web-dev-qa-db-ja.com

Vim:buffers%aと#はどういう意味ですか?

何をしますか%aおよび#VIM:buffersウィンドウの意味?

Vim :buffers window

9
Nemoden

その情報は「:help :buffers」に含まれています。ここで引用します:

Indicators (chars in the same column are mutually exclusive):
u   an unlisted buffer (only displayed when [!] is used)
       |unlisted-buffer|
 %  the buffer in the current window
 #  the alternate buffer for ":e #" and CTRL-^
  a an active buffer: it is loaded and visible
  h a hidden buffer: It is loaded, but currently not
       displayed in a window |hidden-buffer|
   -    a buffer with 'modifiable' off
   =    a readonly buffer
    +   a modified buffer
    x   a buffer with read errors

したがって、特定の質問に答えるために、「%」は、「:buffers」を実行したときにカーソルが置かれているウィンドウ内の現在のバッファーを意味します。 「a」は、現在表示できるバッファを意味します。最後に、「#」は代替バッファーです。これは通常、最後に編集したバッファーを意味します。

10
Heptite

さらに、ファイルの実行時に、リテラルファイル名の代わりに#%が使用されます。たとえば、Pythonファイルを編集するときに、:!python %と入力すると、現在のファイルがPythonファイルとして実行されます。同様に、%#に置き換えると、代替ファイル。非常に便利です。:)

5
varun