Skip to content

Instantly share code, notes, and snippets.

@iamkristian
Created August 10, 2012 08:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamkristian/3312533 to your computer and use it in GitHub Desktop.
Save iamkristian/3312533 to your computer and use it in GitHub Desktop.
A list of shortcuts I use a lot in vim.
# c == ctrl
# Note capital letters marks the use of shift.
# ! will force your command.
# Navigation
h Moves left.
j Moves down.
k Moves up.
l Moves right.
H Moves the cursor to the top of the screen.
M Moves the cursor to the middle of the screen.
L Moves the cursor to the bottom of the screen.
G Moves to the end of the file.
% Jumps to corresponding item.
# Saving
:w Saves current buffer.
:wall For saving all.
# Session
mksession Saves your current setup of tabs, windows and buffers, so you can reopen it later.
# Ctrl-p
c-p Opens the ctrl-p window.
c-t Once you have selected your file, you can open it in a new tab.
enter Will open the file in the current buffer.
F5 Will force the plugin to empty the file cache.
c-z To mark multiple files.
# Ruby Test
<leader>-t For running test under the cursor.
<leader>-T For running all tests in file.
<leader>-t For rerunning last test.
# Tabs
gt Will switch to the next tab.
gT Will switch to the previous tab.
<number>gt Will skip <number> tabs forward.
<number>gT Will skip <number> tabs backward.
:tabs List all tabs and their files.
:tabm <number> Move tab to position.
# Windows
:split Will split the window horizontally.
:vsplit Will split the window vertically.
# Fugitive
:Gwrite Will write the file and add it for git staging.
:Gread Will perform a git checkout on the file.
:Gcommit Will open a window and let you commit the files you've staged.
:Gmove <path> Will move the file to a new path.
:Gbrowse Will open the current file on github.
# Selection
v Opens visual selection.
V Selects the current line.
c-v Selects in column mode.
I To insert text infront of the block, press esc when you are done.
A To append text after the block, press esc when you are done.
$ If you want to insert after block rows, press esc when you are done.
# Quit
:q Closes the current buffer, quits if only one buffer exists.
:qall Closes all buffers and quits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment