Vimスクリプト(:tabonly)

:tabonly使ってみます。
ヘルプを確認。

                                                        *:tabo* *:tabonly*
:tabo[nly][!]   Close all other tab pages.
                When the 'hidden' option is set, all buffers in closed windows
                become hidden.
                When 'hidden' is not set, and the 'autowrite' option is set,
                modified buffers are written.  Otherwise, windows that have
                buffers that are modified are not removed, unless the [!] is
                given, then they become hidden.  But modified buffers are
                never abandoned, so changes cannot get lost.
                    :tabonly        " close all tab pages except the current
                                    " one

複数ファイルを開きます。

/tmp $ for i in {1..5};do echo HELLO$i>test_$i.txt;done
/tmp $ vim test_*.txt
:bufdo tabnew

カレントタブは、No Nameです。ここで:tabonlyを実行してみます。

:tabonly

タブが全て消えました。
buffer-listを確認。

:ls


カレントバッファは、No Nameのままですね。

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA