On 15/09/09 19:38, Patrick Gen-Paul wrote:
> Tony Mechelynck wrote:
>
> Thanks!
>
> [..]
>
>> I'm not using that plugin, but I'm using a text-style tabline in both
>> Console Vim and gvim.
>
> I really needed the tab number, because I function mostly with a single
> vim session that opens when I start X, and by the time I get to garbage
> collection time, it can easily have some ten tabs open or more.. So I
> had to count the tabs so as to be able to issue {count}gt's or else
> issue a ":tabs" :-(

see :help tabpagenr()

>
> Since the author of the plugin would not stand up and be counted, I
> actually proceeded to write my own last night :-)
>
>> One example of how to set it can be found under ":help setting-tabline".
>> What I use is slightly different, as follows (uncomment the maps at the
>> bottom if you like them):
>
> [..]
>
> I tried it and it's quite similar to the one I wrote, although yours is
> structured differently - and uses programming syntax I didn't even know
> existed in the vim scripting language such as "a ? b : c" as a shorthand
> for "if-then-else".
>
> I blindly followed the :h setting-tabline example, basically testing
> every statement from the command line and with the online help in front
> of me till I could get it to do what I wanted. :-(
>
> Interestingly, both our versions have similar (minor) bugs:
>
> 1. In your version, there should be a space between the last tab and
> this mysterious "X" to the far right of the tab line. Otherwise the X
> looks like it's part of the file name. I have a similar problem that I
> had failed to notice where I have three spaces instead of one - thus
> wasting space.

I never have enough tabs to fill the line, and since the X is at far 
right, I usually have quite some empty space between it and the 
rightmost tab.

>
> 2. When opening more tabs than the width of the display can accommodate,
> if you issue a "1"+"gt" you do move back the focus to tab #1, but the
> beginning of the tab line is not displayed, which means that you may be
> displaying part of tab #4 etc. and you are not able to see which tab you
> are on, since the tab that should be highlighted is not visible. All you
> see is a "<" in column one that indicates that there are more tabs to
> the left but I haven't found the way to display them. Maybe something to
> do with that right-justified final "X" - I'm curious what that "X" is
> for.. I don't use a mouse, so maybe that's why it does nothing that I
> can see. Maybe the "<" is clickable?

click X (with the mouse) to close the current tab IIRC.

>
> On the other hand, we both fixed another minor bug with vim's default
> tab line, where the space immediately following the file name is
> highlighted, which doesn't look right.
>
> I'm still debating the usefulness of having the&modified flag
> materialize in my version. Kinda of clutters the display and I'm not
> really sure I need that, so I may remove it - or possibly remove the
> number of windows in a tab - made the coding more fun but I don't think
> I really care if a tab has three windows open rather than four.

there may be several windows in a tab, with modified buffers in some and 
unmodified ones in others.

>
> I'm curious as to why the tab line was implemented this way rather than
> something like the status line. I'm not complaining, mind you, writing a
> simple function was definitely a fun and useful experience - vim is an
> editor for programmers, not a word processor, right ;-) - but I'm not
> sure why it was not done the same way for the terminal as for the gui -
> cf. :h set guitablabel..?

it _was_ done like the status line i.e. for the whole width. You can 
display what you want in it, even just the number of the current tab...

I think there were a few Vim 7.0aa (alpha) snapshots which had the 
'tabline' option available but not 'guitablabel'. The latter has to mesh 
with tabs built by whatever GUI subsystem it was compiled with, so it 
has to build only one tab label at a time. The former is part of the Vim 
text display and to the OS it is just plain monospaced text just like 
the rest of the Vim display.

>
> What would be possible then is that since users normally display the
> same data in all their tabs, provided they had been implemented, you
> could simply refer to a list of items similar to the ones defined in ":h
> 'statusline'".
>
> To clarify, the help file could look a bit like:
>
> 'tablabel'
>
> ...
>
> item  meaning
>
> N     tab number
> n     number of windows in tab
> F     full name of file in current window
> f     base name of file in current window
> m     tab has unsaved buffers - cf.&modified
>
> etc.
>
> Anyway, attaching what I came up with, if you care to take a peek..
>
> Hopefully it's I'm not violating the list's policy.
>
> It's fenc=utf8&  tw=80 so I'm not sure I could paste it in this message.

tw=80 shouldn't be a problem, and you wouldn't be the first to post in 
UTF-8, though UTF-8, ISO-8859-1 and US-ASCII represent identically 
everything until U+007F / 0x7F / 127, so if you have only text 
representable in 7-bit ASCII it can be read even by those braindead 
mailers which don't obey the Content-Type header (and read any mail as 
if it were encoded in Latin1), even if you send in UTF-8. SeaMonkey 
1.1.6 (which you seem to be using) ought to set the mail headers 
correctly according to how it sends the mail if you paste the text 
inline. If you send it as attachment SeaMonkey doesn't necessarily know 
the file's encoding, but regardless of whether or not there are "high 
codepoints" in the text, UTF-8 with BOM, i.e. ":setlocal fenc=utf-8 
bomb", should be readable by any modern editor including Vim (if 
compiled with +multi_byte and set up with 'enc' set to utf8 and 'fencs' 
starting with ucs-bom).

The only reason not to attach the file (or part of file) itself would be 
if it were very long, and even then you could upload it somewhere (if 
there is "somewhere" you can upload to) and post a link to it.

>
> It has lots of useless comments that I had to put in there for my own
> sake, just to keep track of what I was doing. :-)

If they are really useless you can remove them, but if they are only 
useful to rank newbies they are not useless and in that case you can 
leave them in. :-)

>
> Oh, one other thing.. I often toggle between two tabs say, that may not
> be adjacent.. Does vim keep track of the previous tab you were on so
> that I could switch back and forth between tab-x and tab-y..?

I think that if it existed it would be mentioned under "SWITCHING TO 
ANOTHER TAB PAGE" in the help section starting with ":tabnext". I don't 
ese it there so I suppose there's nothing built-in. I suppose you can 
make autocommands to remember the previously-used tab, and a mapping or 
user-command to go back to it.

>
> I didn't see anything in the manual.
>
> Thanks,
>
> Gen-Paul.

Best regards,
Tony.
-- 
You can't judge a book by the way it wears its hair.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to