vim multi-window usage skills

vim multi-window usage skills

1.
Open multiple windows The commands to open multiple windows are as follows:
Horizontally split window
: new + window name (the file name after saving)
: split + window name, which can also be abbreviated as: sp + window name
Vertical Window name
: vsplit+window name, can also be abbreviated as: vsp+window name
2. To close multiple windows,
you can use: q!, you can also use: close, the last window cannot be closed with close. Using close only temporarily closes the window, and its content is still in the cache. Only use q!, w! or x to really exit. : tabc
closes the current window : tabo
closes all windows Switch windows. 4. Window size adjustment Vertical adjustment : ctrl+w + vertical expansion (increase the number of lines) :ctrl+w - vertical reduction (the number of lines decreases) :res(ize) num For example: :res 5, the number of displayed lines is adjusted to 5 lines :res(ize)+num Increase the height of the current window by num lines :res(ize)-num Decrease the height of the current window by num lines Horizontal adjustment : vertical res(ize) num Specify the current window as num columns











:vertical res(ize)+num Add num columns to the current window
:vertical res(ize)-num Reduce the current window to num columns
5, rename the window
: f file
6, vi open multiple files
vi abc
:n Skip to the next A file, you can also directly specify the file to be jumped, such as: nc, you can directly jump to the c file
: e# Return to the file you just edited
7. File browsing
: Ex Open the directory browser, you can browse all the files in the current directory, And you can choose
: Sex to split the current window horizontally and open the directory browser in one window
: ls to display the current buffer situation
8. Switch between vi and shell
: shell can switch to the shell command line without closing vi
: exit from the shell back to vi

Guess you like

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