(親記事はコチラ Vimコマンド&Script入門)
タブを閉じる:tabcloseを使ってみます。
ヘルプを確認。
*:tabc* *:tabclose*
:tabc[lose][!] Close current tab page.
This command fails when:
- There is only one tab page on the screen. *E784*
- When 'hidden' is not set, [!] is not used, a buffer has
changes, and there is no other window on this buffer.
Changes to the buffer are not written and won't get lost, so
this is a "safe" command.
:tabclose " close the current tab page
カレントタブを消すだけですね。
ファイルを複数起動して:tabcloseを使ってみます。
/tmp $ for i in {1..5};do echo HELLO$i>test_$i.txt;done
/tmp $ vim test_*.txt
全バッファをタブで開きます。
:bufdo tabnew

カレントタブはNo Nameです。このタブで、tabclose使ってみます。
:tabclose

No Nameのタブは消えて、test_5.txtのタブが、カレントタブになりました。
:ls

次は、:tabcloseではなく、:quitで閉じてみます。
:quit

test_5.txtのタブは消えて、test_4.txtのタブが、カレントタブになりました。
buffer-listを確認。
:ls

:quitで同じことができるなら、:quitでいい気がします。



コメント