Vim Advanced - Day 1
P paste before the cursor
Comment: We usually use p to paste yanked content but barely use P. The p and P pair is common in Vim. There are other pairs whose behaviors are similar to it too, such as x (delete the character under the cursor), X (delete the character before the cursor, which equals to backspace); o (create a new line below the current one), O (create a new line above the current one); f (find a character forward), F (find a character backward); t (jump forward until find a character), T (jump backward until find a character)...
- C-w+s Split the window horizontally. Help You Remember: the
sis the first letter of the word
split, and Vim will split the window horizontally by default. (We can the command
:splitto do same the work too, but personally I think using shortcuts is more efficient.)
- C-w+v Split the window vertically. Help You Remember: the
vis the first letter of the word
vspit, which is the abbreviation of the phrase
vertically split. Note: +some situations, we prefer using command form to the shortcuts. For example, if we need to create a new file somewhere and want to edit it in a new pane. Here we can use
:vsp ../definition/IModalCreation.tsto create a file
IModalCreation.tsunder the folder
definitionand to edit it in a vertically split pane (typically the right pane).
- C-w+> Increase the width of the current pane.
- C-w+< Decrease the width of the current pane.
- C-w++ Increase the height of the current pane.
- C-w+- Decrease the height of the current pane. Note: +can resize only 1 unit of width or height one time, so feel free to add a
NumberC-w to resize faster (for instance, 50 C-w >).
- Besides,+ can the command
:vnewto create a new pane with empty content horizontally or vertically.
- C-w+h Switch to pane to the left.
- C-w+l Switch to pane to the right.
- C-w+j Switch to pane to the above.
- C-w+k Switch to pane to the below.
- C-w+w/C-w Switch to panel clockwise.
- C-w+_ Maximize current pane vertically
- C-w+| Maximize current pane horizontally
- C-w+= Make all panes equal size
:closeClose current pane (For VSCodeVim, I use my own shortcut to close it that is much faster)
- Tue Mar 3 22:08:47 CST 2020 (Add C-w+_, C-w+| and C-w+=)