-*windows.txt* For Vim version 9.1. Last change: 2025 Nov 11
+*windows.txt* For Vim version 9.1. Last change: 2025 Dec 03
VIM REFERENCE MANUAL by Bram Moolenaar
*:sta* *:stag*
:sta[g][!] [tagname]
Does ":tag[!] [tagname]" and splits the window for the found
- tag. See also |:tag|.
+ tag. Refer to 'switchbuf' to jump to a tag in a vertically
+ split window or a new tab page. See also |:tag|.
CTRL-W ] *CTRL-W_]* *CTRL-W_CTRL-]*
CTRL-W CTRL-] Split current window in two. Use identifier under cursor as a
tag and jump to it in the new upper window.
In Visual mode uses the Visually selected text as a tag.
- Make new window N high.
+ Make new window N high. Refer to 'switchbuf' to jump to a tag
+ in a vertically split window or a new tab page.
*CTRL-W_g]*
CTRL-W g ] Split current window in two. Use identifier under cursor as a
if (getfile_result == GETFILE_UNUSED
&& (postponed_split || cmdmod.cmod_tab != 0))
{
+ if (swb_flags & SWB_VSPLIT)
+ // If 'switchbuf' contains 'vsplit', then use a new vertically
+ // split window.
+ cmdmod.cmod_split |= WSP_VERT;
+
+ if (swb_flags & SWB_NEWTAB)
+ // If 'switchbuf' contains 'newtab', then use a new tabpage
+ cmdmod.cmod_tab = tabpage_index(curtab) + 1;
+
if (win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags) == FAIL)
{
1tabnext | stag third
call assert_equal(2, tabpagenr('$'))
call assert_equal(3, line('.'))
+ tabonly
+
+ " use a vertically split window
+ enew | only
+ set switchbuf=vsplit
+ stag third
+ call assert_equal(2, winnr('$'))
+ call assert_equal(1, winnr())
+ call assert_equal(3, line('.'))
+ call assert_equal(['row', [['leaf', win_getid(1)], ['leaf', win_getid(2)]]], winlayout())
+
+ " jump to a tag in a new tabpage
+ enew | only
+ set switchbuf=newtab
+ stag second
+ call assert_equal(2, tabpagenr('$'))
+ call assert_equal(2, tabpagenr())
+ call assert_equal(2, line('.'))
tabclose!
enew | only
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1949,
/**/
1948,
/**/