Nvim の :help ページは、生成されたもので、ソースを tree-sitter-vimdoc パーサーを使って作成されています。
:tabnew " opens tabpage after the current one
:.tabnew " as above
:+tabnew " opens tabpage after the next tab page
" note: it is one further than :tabnew
:-tabnew " opens tabpage before the current
:0tabnew " opens tabpage before the first one
:$tabnew " opens tabpage after the last one:[count]tabe[dit] [++opt] [+cmd] {file} :[count]tabnew [++opt] [+cmd] {file} :edit と同様に、新しいタブページを開き、{file} を編集します。[count] については、上記の :tabnew を参照してください。{file} :tabf :tabfind :find と同様に、新しいタブページを開き、'path' 内の {file} を編集します。[count] については、上記の :tabnew を参照してください。{cmd} :tab{cmd} を実行し、新しいウィンドウを開く場合は、代わりに新しいタブページを開きます。:diffsplit、:diffpatch、:execute、:normal では機能しません。[count] が指定された場合、新しいタブページは [count] 番目のタブページの後に表示されます。それ以外の場合は、現在のタブページの後に表示されます。例:tab split " opens current buffer in new tab page
:tab help gt " opens tab page with help for "gt"
:.tab help gt " as above
:+tab help " opens tab page with help after the next
" tab page
:-tab help " opens tab page with help before the
" current one
:0tab help " opens tab page with help before the
" first one
:$tab help " opens tab page with help after the last
" oneCTRL-W gf 新しいタブページを開き、カーソル下のファイル名を編集します。CTRL-W_gf を参照してください。:tabclose " close the current tab page:{count}tabc[lose][!] :tabc[lose][!]
{count} {count} 番目のタブページを閉じます。上記の :tabclose と同じように失敗します。:-tabclose " close the previous tab page :+tabclose " close the next tab page :1tabclose " close the first tab page :$tabclose " close the last tab page :tabclose -2 " close the 2nd previous tab page :tabclose + " close the next tab page :tabclose 3 " close the third tab page :tabclose $ " close the last tab page :tabclose # " close the last accessed tab pageタブが閉じられると、次のタブページが現在のタブページになります。この動作は、'tabclose' オプションを使用してカスタマイズできます。
:tabonly " close all tab pages except the current one:tabo[nly][!]
{count} {count} 番目のタブページを除くすべてのタブページを閉じます。:.tabonly " as above
:-tabonly " close all tab pages except the previous
" one
:+tabonly " close all tab pages except the next one
:1tabonly " close all tab pages except the first one
:$tabonly " close all tab pages except the last one
:tabonly - " close all tab pages except the previous
" one
:tabonly +2 " close all tab pages except the two next
" one
:tabonly 1 " close all tab pages except the first one
:tabonly $ " close all tab pages except the last one
:tabonly # " close all tab pages except the last
" accessed one別のタブページに切り替える<C-PageDown> CTRL-<PageDown> <C-PageDown> gt i_CTRL-<PageDown> i_<C-PageDown> 次のタブページに移動します。最後のタブページから最初のタブページに折り返します。{count} {count} 番目のタブページに移動します。最初のタブページは番号 1 です。:-tabnext " go to the previous tab page :+tabnext " go to the next tab page :+2tabnext " go to the two next tab page :1tabnext " go to the first tab page :$tabnext " go to the last tab page :tabnext $ " as above :tabnext # " go to the last accessed tab page :tabnext - " go to the previous tab page :tabnext -1 " as above :tabnext + " go to the next tab page :tabnext +1 " as above
{count}<C-PageDown> {count}gt {count} 番目のタブページに移動します。最初のタブページは番号 1 です。<C-PageUp> <C-PageUp> i_CTRL-<PageUp> i_<C-PageUp> gT 前のタブページに移動します。最初のタブページから最後のタブページに折り返します。{count} :tabN[ext] {count} {count}<C-PageUp> {count}gT {count} 個前のタブページに移動します。最初のタブページから最後のタブページに折り返します。{count} の使用方法は、タブページ番号として使用される :tabnext とは異なることに注意してください。:tabmove 1 と :tabmove 2 は効果がありません。N がない場合、タブページは最後に移動します。:.tabmove " do nothing
:-tabmove " move the tab page to the left
:+tabmove " move the tab page to the right
:0tabmove " move the tab page to the first
:tabmove 0 " as above
:tabmove " move the tab page to the last
:$tabmove " as above
:tabmove $ " as above
:tabmove # " move the tab page after the last accessed
" tab page:tabm[ove] +[N] :tabm[ove] -[N] 現在のタブページを右 (+ の場合) または左 (- の場合) に N 個移動します。:tabmove - " move the tab page to the left :tabmove -1 " as above :tabmove + " move the tab page to the right :tabmove +1 " as above:Ntabmove を使用して N 番目のタブの背後にタブを移動できることに注意してください。また、:+Ntabmove を使用して N 個移動することもできます。このコンテキストでの +N の意味については、[range] を参照してください。
{cmd} 各タブページで、または [range] が指定されている場合は、タブページ番号が [range] に含まれるタブページでのみ、{cmd} を実行します。これは、次のように動作します。:tabfirst
:{cmd}
:tabnext
:{cmd}
etc.{cmd} には、複数のコマンドを連結するために '|' を含めることができます。{cmd} は、タブページを開いたり閉じたり、並べ替えたりしてはいけません。また、:windo、:argdo、:bufdo、:cdo、:ldo、:cfdo、:lfdoも参照してください。:set tabline=%!MyTabLine()次に、MyTabLine()関数を定義して、すべてのタブページのラベルをリストします。便利な方法は、2つの部分に分割することです。最初に、すべてのタブページを調べてラベルを定義します。次に、各タブページのラベルを取得します。
function MyTabLine()
let s = ''
for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr()
let s ..= '%#TabLineSel#'
else
let s ..= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s ..= '%' .. (i + 1) .. 'T'
" the label is made by MyTabLabel()
let s ..= ' %{MyTabLabel(' .. (i + 1) .. ')} '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s ..= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s ..= '%=%#TabLine#%999Xclose'
endif
return s
endfunction次に、各タブページのラベルを取得するために、MyTabLabel()関数が呼び出されます。function MyTabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) return bufname(buflist[winnr - 1]) endfunctionこれは、デフォルトに似たタブページラインを作成するだけの単純な例ですが、変更されたバッファに+を追加したり、名前を切り捨てたりすることはありません。十分なスペースがない場合は、ラベルの幅を賢く縮小する必要があります。'columns' オプションで利用可能なスペースを確認してください。
:set guitablabel=%N\ %fデフォルトの 'guitablabel' に似た例: タブページ内のウィンドウ数と、変更されたバッファがある場合は '+' を表示します
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()}関数はオプションを設定する前に定義する必要があることに注意してください。そうしないと、関数が不明であるというエラーメッセージが表示されます。