Skip to content

Instantly share code, notes, and snippets.

@BastianHofmann
BastianHofmann / mad_vim_skills_1.md
Last active August 2, 2020 12:13
Mad VIM Skills #1

Easy Split Navigation

Use :sp to split the current window in two (:vs for vertical split).

Add the following mapping commands to your .vimrc for easier split navigation.

"easy split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap  
@BastianHofmann
BastianHofmann / mad_vim_skills_2.md
Last active June 5, 2018 08:20
Mad VIM Skills #2

Page Scrolling

Use [count] ctrl+e to scroll the window downwards [count] lines. [count] ctrl+y to scroll upwards.

Really usefull is ctrl+d to scroll the half page down and ctrl+u to scroll half the page up. As a side note: "half the page" is only the default. You can use set scroll=[count] to define this behaviour.

@BastianHofmann
BastianHofmann / mad_vim_skills_3.md
Last active June 5, 2018 08:20
Mad VIM Skills #3

Undo and Redo

Use u in command mode to undo the last action and ctrl+r to redo the action. You can also use [count]u and [count]ctrl+r to undo and redo multiple times. You can also use U to revert all the changes in the last modfied line.

@BastianHofmann
BastianHofmann / mad_vim_skills_4.md
Last active June 5, 2018 08:20
Mad VIM Skills #4

Write and Quit

You can use :x or ZZ to write and quit instead of :wq.

@BastianHofmann
BastianHofmann / mad_vim_skills_5.md
Last active June 5, 2018 08:20
Mad VIM Skills #5

Search for Word under Cursor

Press * in command mode to search for the word under the cursor in the open buffer.

Screen Jumping

Use H to the top of the screen, L to the bottom of the screen and M to jump to the middle of the screen.

NERDTreeFind

To reveal the current buffer in NERDTree use the :NERDTreeFind command. This will also open NERDTree if it's closed. You can map the command to a shortcut if you want to.

@BastianHofmann
BastianHofmann / mad_vim_skills_9.md
Created May 24, 2018 09:38
Mad VIM Skills #9

CtrlP Open in New Split

Use ctrl+v to open the highlighted result in CtrlP in a new split.

Swap Files Location

You can tell VIM to store your swap files in a fixed directory, instead of mixed in with your other files, by setting for example set directory^=~/.vim/tmp/swap//.