zhuang@linux:~/reading/practical-vim/06-manage-multiple-files/$ less

Practical Vim / chapter 06

Manage Multiple Files

$ grep tags 06-manage-multiple-files.md

This post extracts some knowledge from Chapter 6 – Manage Multiple Files.

traverse the buffer list:

vim
:bn
:bp
:bf
:bl
:b N
:b bufname

delete buffer(just close buffer not real delete associated file):

vim
:bdelete N1 N2 N3
:N,M bdelete
vim
:next
:prev
:first
:last
:args **/*.js **/*.css
:argdo
CommandEffect
<C-w>sSplit the current window horizontally, reusing the current buffer in the new window
<C-w>vSplit the current window vertically, reusing the current buffer in the new window
:sp[lit] {file}Split the current window horizontally, loading {file} into the new window
:vsp[lit] {file}Split the current window vertically, loading {file} into the new window

Changing the Focus Between Windows

CommandEffect
<C-w>wCycle between open windows
<C-w>hFocus the window to the left
<C-w>jFocus the window below
<C-w>kFocus the window above
<C-w>lFocus the window to the right

Closing Windows

Ex CommandNormal CommandEffect
:clo[se]<C-w>cClose the active window
:on[ly]<C-w>oKeep only the active window, closing all others

Resizing and Rearranging Windows

KeystrokesEffect
<C-w>=Equalize width and height of all windows
<C-w>_Maximize height of the active window
<C-w>|Maximize width of the active window
[N]<C-w>_Set active window height to [N] rows
[N]<C-w>|Set active window width to [N] columns

more details

CommandEffect
:tabe[dit] {filename}Open {filename} in a new tab
<C-w>TMove the current window into its own tab
:tabc[lose]Close the current tab page and all of its windows
:tabo[nly]Keep the active tab page, closing all others

Switching Between Tabs

Ex CommandNormal CommandEffect
:tabn[ext] {N}{N}gtSwitch to tab page number {N}
:tabn[ext]gtSwitch to the next tab page
:tabp[revious]gTSwitch to the previous tab page

Rearranging Tabs We can use the :tabmove [N] Ex command to rearrange tab pages. When [N] is 0, the current tab page is moved to the beginning, and if we omit [N], the current tab page is moved to the end.

zhuang@linux:~/reading/practical-vim/06-manage-multiple-files/$ comments