My vi/vim cheatsheet
Vim documentation: windows
| Open two windows | |
|---|---|
| $ vim -o file1.txt resume.txt | Start vim as follows to open two windows,split horizontally |
| $ vim -O /etc/passwd /etc/hosts | The -O option allows to open two windows, split vertically |
| ^W-s | Split current window in two horizontally |
| ^W-v | Split current window in two vertically |
| ^W-n | Open new empty window horizontally |
| :new | Open new empty window horizontally |
| :sp | Open new empty window horizontally |
| :vsp | Open new empty window vertically |
| :new /etc/hosts.deny | Open exiting file in a new windows horizontally |
| :sp /etc/hosts.deny | Open exiting file in a new windows horizontally |
| :vsp /etc/hosts.deny | Open exiting file in a new windows vertically |
| Switch from Horizontal split to Vertical split | |
| ^W-L | Switch from horizontal to vertical split, putting the current buffer on the right side of the vertical split. |
| ^W-H | Put it on the left |
| ^W-J | bottom |
| ^W-K | top |
| Moving between windows | |
| Key combination | Action |
| ^W-h | move to the window on the left |
| ^W-j | move to the window below |
| ^W-k | move to the window above |
| ^W-l | move to the window on the right |
| ^W-t | move to the TOP window |
| ^W-b | move to the BOTTOM window |
| Close windows | |
| ^W-^Q | Close the current windows |
| [ESC]-:q | Quit current window |
| Resize Window | |
| [ESC] - 5 - ^W - + | Increase windows size by 5 |
| [ESC] - 5 - W - - | Decrease windows size by 5 |
| Save and quit all windows | |
| :wqall | Save all changes in all windows and quite |
| :qall! | Quits Vim and throws away all changes |
0 件のコメント:
コメントを投稿