Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 15: | Line 15: | ||
The following script will set up a tab label containing a "modified" indicator, the tab number, the name of the currently active buffer in the tab, and the number of windows in the tab. Drop it into your [[vimrc]] or its own file in your plugin directory. |
The following script will set up a tab label containing a "modified" indicator, the tab number, the name of the currently active buffer in the tab, and the number of windows in the tab. Drop it into your [[vimrc]] or its own file in your plugin directory. |
||
− | Getting the tab number is easy, it's just the "let label.=v:lnum" portion of the script, if you don't want to use the entire thing. We could have also used the tabpagenr() function, which may be required if using {{help|prefix=no|'tabline'}} instead. Note that we CANNOT simply use < |
+ | Getting the tab number is easy, it's just the "let label.=v:lnum" portion of the script, if you don't want to use the entire thing. We could have also used the tabpagenr() function, which may be required if using {{help|prefix=no|'tabline'}} instead. Note that we CANNOT simply use <tt>%N</tt> as stated in {{help|setting-guitablabel}}, because we are returning text from a function that is called using <tt>%{...}</tt> syntax. |
Note, this script only works in GUI Vim, because it uses the (marginally easier) {{help|prefix=no|'guitablabel'}} option instead of {{help|prefix=no|'tabline'}}, which would work in terminal Vim. |
Note, this script only works in GUI Vim, because it uses the (marginally easier) {{help|prefix=no|'guitablabel'}} option instead of {{help|prefix=no|'tabline'}}, which would work in terminal Vim. |
||
Line 100: | Line 100: | ||
Should probably start with a simple version, something like following. |
Should probably start with a simple version, something like following. |
||
− | Set tab label to show tab number, filename, if modified ('< |
+ | Set tab label to show tab number, filename, if modified ('<tt>+</tt>' is shown if the ''current'' window in the tab has been modified): |
<pre> |
<pre> |
||
:set guitablabel=%N/\ %t\ %M |
:set guitablabel=%N/\ %t\ %M |
||
</pre> |
</pre> |
||
− | Then mention how the script shows '< |
+ | Then mention how the script shows '<tt>+</tt>' if ''any'' window in the tab has been modified. [[User:JohnBeckett|JohnBeckett]] 07:27, May 19, 2010 (UTC) |
---- |
---- |
||
Line 116: | Line 116: | ||
--[[User:Fritzophrenic|Fritzophrenic]] 17:24, May 19, 2010 (UTC) |
--[[User:Fritzophrenic|Fritzophrenic]] 17:24, May 19, 2010 (UTC) |
||
---- |
---- |
||
− | Here's a text-style tabline for both Console and GUI modes; it displays before each filename something like '''< |
+ | Here's a text-style tabline for both Console and GUI modes; it displays before each filename something like '''<tt>3:4/8</tt>''', meaning "Tab 3, window 4 of 8". These numbers are in "User1" highlight, or "User2" for the current tab, while the TabLine, TabLineSel and TabLineFill highlight groups have their usual meanings, see {{help|setting-tabline}}. You may want to set the colours in a colorscheme, possibly an owncoded one, but that is not the topic of this tip. |
<pre> |
<pre> |
||
if has('gui') |
if has('gui') |
||
Line 325: | Line 325: | ||
--[[User:BobFavazzi|BobFavazzi]] 16:22, October 10, 2011 (UTC) |
--[[User:BobFavazzi|BobFavazzi]] 16:22, October 10, 2011 (UTC) |
||
:No, this will display the buffer number, not the tab number. You could easily end up with something like: |
:No, this will display the buffer number, not the tab number. You could easily end up with something like: |
||
− | :< |
+ | :<tt><nowiki>| 4) file4.txt | 1) file1.txt | 1) file1.txt | 2)file2.txt |</nowiki></tt> |
:--[[User:Fritzophrenic|Fritzophrenic]] 17:16, October 10, 2011 (UTC) |
:--[[User:Fritzophrenic|Fritzophrenic]] 17:16, October 10, 2011 (UTC) |
||
Line 364: | Line 364: | ||
::--[[User:BobFavazzi|BobFavazzi]] 11:10, October 13, 2011 (UTC) |
::--[[User:BobFavazzi|BobFavazzi]] 11:10, October 13, 2011 (UTC) |
||
---- |
---- |
||
+ | Screenshot please. |