Open multiple files
Open multiple files on the horizontal direction:
Switch edit file:
Close all opened files without saving operation:
Multiple fails in the vertical direction:
Add a number
vim -o file1 file2 file3 ...
.Switch edit file:
ctrl + ww
.Close all opened files without saving operation:
qa
.Multiple fails in the vertical direction:
vim -O file1 file2 file3 ...
.Add a number
n
after -o
, we can open multiple files in multiple split windows).Split window
Add a new split window on the horizontal direction:
Add a new split window on the vertical direction:
split
.Add a new split window on the vertical direction:
vsplit
Move the cursor between multiple windows
ctrl + w +
We can know that
Direction key
: Direction key
contains h
, t
, k
, and l
, they refer to left, under, upper, and right directions respectively.We can know that
set mouse=a
would make the window where the cursor on becomes editable status after we read vim’s help content. Save multiple files and exist
Bash
vim -O file1,file2,file3,...
# equal to
# vim -O `echo file{1,2,3,...}`
:wqall
Move the current window towards one special direction.
- Ctrl + w
- Shift +
Direction key
For example,
ctrl + w + K
Can help us to put the current window on the top area.Edit in multiple tags
Create a new tab:
Close tab:
Retain only current tab:
abnew filename
.Close tab:
tabclose filename
.Retain only current tab:
tabonly