Skip to content

Latest commit

 

History

History
48 lines (42 loc) · 1.62 KB

Readme.md

File metadata and controls

48 lines (42 loc) · 1.62 KB

Vim Tricks

Shortcuts

Action Combination
Toggle tree Ctrl + n
Next tab gt
Previous tab gT
Go to beginning of line 0
Go to end $
Move forward one word w
Move backward one word b
Move to end of file G
Move to top of file gg
Begin a new line above the cursor O
Begin a new line below the cursor o
Go to function definition Ctrl + ]
Jump back from definition Ctrl + T
Open the definition in a horizontal split Ctrl+W Ctrl+]
delete character at cursor x
delete a word dw
delete to the beginning of a line d0
delete to end of the line d$
Cut a line dd
Copy a visual selection y
Paste a line p
Select and cut multiple lines v + d
Move a line to n number :m2
Turn off highlighting :noh
move current line to the middle of the screen z z
Moves screen up one line ctrl + y
Moves screen down one line ctrl + e
Moves cursor & screen up 1/2 page Ctrl-u
Moves cursor & screen down 1/2 page Ctrl-d
Move to end of the matching brace %

  • Replace
:%s/foo/bar/g # Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.

:2,5s/foo/bar/g # Change each 'foo' to 'bar' for all lines from line 2 to line 5 inclusive.