0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.0207

This commit is contained in:
Bram Moolenaar
2006-02-25 21:45:02 +00:00
parent 32466aa2e9
commit ba6c05240f
4 changed files with 104 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
*tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 24 *tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 25
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -14,6 +14,7 @@ when used in combination with more than one tab page.
2. Commands |tab-page-commands| 2. Commands |tab-page-commands|
3. Other items |tab-page-other| 3. Other items |tab-page-other|
4. Setting 'tabline' |setting-tabline| 4. Setting 'tabline' |setting-tabline|
5. Setting 'guitablabel' |setting-guitablabel|
{Vi does not have any of these commands} {Vi does not have any of these commands}
{not able to use multiple tab pages when the |+windows| feature was disabled {not able to use multiple tab pages when the |+windows| feature was disabled
@@ -133,7 +134,7 @@ gT Go to the previous tab page. Wraps around from the first one
to the last one. to the last one.
:tabr[ewind] *:tabfir* *:tabfirst* *:tabr* *:tabrewind* :tabr[ewind] *:tabfir* *:tabfirst* *:tabr* *:tabrewind*
:tabl[ast] Go to the first tab page. :tabfir[st] Go to the first tab page.
*:tabl* *:tablast* *:tabl* *:tablast*
:tabl[ast] Go to the last tab page. :tabl[ast] Go to the last tab page.
@@ -205,6 +206,9 @@ When switching to another tab page the order is:
============================================================================== ==============================================================================
4. Setting 'tabline' *setting-tabline* 4. Setting 'tabline' *setting-tabline*
The 'tabline' option specifies what the line with tab pages labels looks like.
It is only used when there is no GUI tab line.
You can use the 'showtabline' option to specify when you want the line with You can use the 'showtabline' option to specify when you want the line with
tab page labels to appear: never, when there is more than one tab page or tab page labels to appear: never, when there is more than one tab page or
always. always.
@@ -269,4 +273,54 @@ trunctating the names. You will want to reduce the width of labels in a
clever way when there is not enough room. Check the 'columns' option for the clever way when there is not enough room. Check the 'columns' option for the
space available. space available.
==============================================================================
5. Setting 'guitablabel' *setting-guitablabel*
When the GUI tab pages line is displayed, 'guitablabel' can be used to
specify the label to display for each tab page. Unlike 'tabline', which
specifies the whole tab pages line at once, 'guitablabel' is used for each
label separately.
See the 'statusline' option for the format of the value.
The "%N" item can be used for the current tab page number. The |v:lnum|
variable is also set to this number.
Note that syntax highlighting is not used for 'guitablabel'. The %T and %X
are also ignored.
A simple example that puts the tab page number and the buffer name in the label: >
:set guitablabel=%N\ %f
An example that resembles the default: Show the number of windows in the tab
page and a '+' if there is a modifed buffer: >
function! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label = '+'
break
endif
endfor
" Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
let label .= wincount
endif
if label != ''
let label .= ' '
endif
" Append the buffer name
return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
endfunction
set guitablabel=%{GuiTabLabel()}
<
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -3197,7 +3197,7 @@ free_titles()
#endif /* FEAT_TITLE */ #endif /* FEAT_TITLE */
#if defined(FEAT_STL_OPT) || defined(PROTO) #if defined(FEAT_STL_OPT) || defined(FEAT_GUI_TABLINE) || defined(PROTO)
/* /*
* Build a string from the status line items in "fmt". * Build a string from the status line items in "fmt".
* Return length of string in screen cells. * Return length of string in screen cells.
@@ -3212,10 +3212,11 @@ free_titles()
* If maxwidth is not zero, the string will be filled at any middle marker * If maxwidth is not zero, the string will be filled at any middle marker
* or truncated if too long, fillchar is used for all whitespace. * or truncated if too long, fillchar is used for all whitespace.
*/ */
/*ARGSUSED*/
int int
build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab) build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab)
win_T *wp; win_T *wp;
char_u *out; /* buffer to write into */ char_u *out; /* buffer to write into != NameBuff */
size_t outlen; /* length of out[] */ size_t outlen; /* length of out[] */
char_u *fmt; char_u *fmt;
int use_sandbox; /* "fmt" was set insecurely, use sandbox */ int use_sandbox; /* "fmt" was set insecurely, use sandbox */
@@ -3632,8 +3633,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
str = tmp; str = tmp;
break; break;
case STL_PAGENUM: case STL_PAGENUM:
#ifdef FEAT_PRINTER #if defined(FEAT_PRINTER) || defined(FEAT_WINDOWS)
num = get_printer_page_num(); num = printer_page_num;
#else #else
num = 0; num = 0;
#endif #endif
@@ -4020,7 +4021,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
} }
#endif /* FEAT_STL_OPT */ #endif /* FEAT_STL_OPT */
#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) || defined(PROTO) #if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) \
|| defined(FEAT_GUI_TABLINE) || defined(PROTO)
/* /*
* Get relative cursor position in window into "str[]", in the form 99%, using * Get relative cursor position in window into "str[]", in the form 99%, using
* "Top", "Bot" or "All" when appropriate. * "Top", "Bot" or "All" when appropriate.

View File

@@ -76,6 +76,7 @@ static void nv_hor_scrollbar __ARGS((cmdarg_T *cap));
#endif #endif
#ifdef FEAT_GUI_TABLINE #ifdef FEAT_GUI_TABLINE
static void nv_tabline __ARGS((cmdarg_T *cap)); static void nv_tabline __ARGS((cmdarg_T *cap));
static void nv_tabmenu __ARGS((cmdarg_T *cap));
#endif #endif
static void nv_exmode __ARGS((cmdarg_T *cap)); static void nv_exmode __ARGS((cmdarg_T *cap));
static void nv_colon __ARGS((cmdarg_T *cap)); static void nv_colon __ARGS((cmdarg_T *cap));
@@ -423,6 +424,7 @@ static const struct nv_cmd
#endif #endif
#ifdef FEAT_GUI_TABLINE #ifdef FEAT_GUI_TABLINE
{K_TABLINE, nv_tabline, 0, 0}, {K_TABLINE, nv_tabline, 0, 0},
{K_TABMENU, nv_tabmenu, 0, 0},
#endif #endif
#ifdef FEAT_FKMAP #ifdef FEAT_FKMAP
{K_F8, farsi_fkey, 0, 0}, {K_F8, farsi_fkey, 0, 0},
@@ -4997,6 +4999,44 @@ nv_tabline(cap)
/* Even if an operator was pending, we still want to jump tabs. */ /* Even if an operator was pending, we still want to jump tabs. */
goto_tabpage(current_tab); goto_tabpage(current_tab);
} }
/*
* Selected item in tab line menu.
*/
static void
nv_tabmenu(cap)
cmdarg_T *cap;
{
if (cap->oap->op_type != OP_NOP)
clearopbeep(cap->oap);
/* Even if an operator was pending, we still want to jump tabs. */
switch (current_tabmenu)
{
case TABLINE_MENU_CLOSE:
if (current_tab == 0)
do_cmdline_cmd((char_u *)"tabclose");
else
{
vim_snprintf((char *)IObuff, IOSIZE, "tabclose %d",
current_tab);
do_cmdline_cmd(IObuff);
}
break;
case TABLINE_MENU_NEW:
if (current_tab > 0)
goto_tabpage(current_tab);
do_cmdline_cmd((char_u *)"tabnew");
break;
case TABLINE_MENU_OPEN:
if (current_tab > 0)
goto_tabpage(current_tab);
do_cmdline_cmd((char_u *)"browse tabnew");
break;
}
}
#endif #endif
/* /*

View File

@@ -3143,7 +3143,7 @@ find_tabpage(n)
/* /*
* Get index of tab page "tp". First one has index 1. * Get index of tab page "tp". First one has index 1.
* When not found returns number of tab pages. * When not found returns number of tab pages plus one.
*/ */
int int
tabpage_index(ftp) tabpage_index(ftp)