Vim Skills Training Tutorial (9) - Buffers and Tabs

Summary: Buffer usage and tab usage

Buffer
In the previous section, we learned window-related commands. In fact, the biggest function of multi-window is to store multiple different buffers.

After the file is loaded into memory, we are actually operating the buffer. The purpose of the :write command is to write the buffer back to the file.

View the buffer in the memory
Through :ls command, you can view the current buffer

: ls
  1 #a + "test.cpp" line 1
  2 = "test.txt" line 7
  8 %a "[No Name]" line 1
where the number of the first column is the number of the buffer.
"%" means the buffer used by the current window
a means the active buffer Switch buffer

in the current window
: bnext switch to the next buffer
: bprev switch to the previous buffer
: bfirst switch to the first buffer
: blast Switch to the last buffer
:buffer N Jump to the Nth buffer
:buffer {keyword} Search the buffer according to the keyword
:sbuffer N Open the window and switch the Nth buffer
All switching commands have a corresponding s Version, used to open in a new window, such as sbnext, sbfirst, etc.

buffer management
:bdelete : delete buffers
:bufdo : execute ex commands on all buffers
:windo: execute ex commands in all windows
Tabs
Tabs are a more modern style and are more suitable for mouse operations.

Tab example

: tabnew filename - create a new tab
: tabclose - close the current tab
: tabonly - keep only the current tab
: tabnext - switch to the next tab
: tabprevious - switch to the previous tab
: tabfirst - switch to the first tab 1 tab
: tablast - switch to the last tab
: tabs - list all tabs

Use Yunqi Community APP, comfortable~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326204122&siteId=291194637