-
-
Save jessieay/3835597 to your computer and use it in GitHub Desktop.
VIM vommands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hjkl - move around | |
:#,#d - deletes between two lines, eg: :10,12d deletes lines 10 through 12 | |
x - delete character | |
o - insert on next line | |
O - insert on preceding line | |
a - insert after cursor | |
i - go into insert mode | |
w - move to beginning of next word (also W for whitespace delimited word) | |
e - move to end of word (also E for whitespace delimited words) | |
b - move backward to start of word (also B) | |
$ - move cursor to end of line | |
0 - move to beginning of line | |
p - put (can put yanked or deleted text) | |
f[char] - moves to that char (eg: fh moves to next h on that line - it is case sensitive) | |
#d[char] - moves to that char (eg: 3fl moves to the third l in the line) | |
F - searches like f but to the left | |
% - go to matching parenthesis/bracket | |
:18 - goes to line 18 | |
G - go to end of file | |
gg - go to top of file | |
H - move to top of part of file you see | |
M - move to middle part | |
L - move to last line you can see | |
CTRL G - tells you where you are | |
CTRL D - move screen down | |
CTRL U - move screen up | |
zz - make current cursor position the center of the screen | |
zt - makes current cursor position the top of the screen | |
/string - searches for word string | |
/string + ENTER + n - find next occurrence of string | |
* - when placed over a word, * searches for the next occurrence of that word | |
'' - go back | |
y - yank | |
yy - yank whole line | |
MOTIONS AND STUFF: | |
4x - deletes 4 characters | |
dw - deletes word | |
4w - moves cursor over 4 words | |
d4w - delete 4 words | |
d2e - deletes up to end of 2 next words | |
d$ - deletes through end of line | |
s2l - delete 2 letters | |
4dd - deletes 4 lines | |
D - deletes to end of line (same as d$) | |
y2w - copy 2 words | |
daw - delete entire word (even if you're not at the beginning of the word) | |
di" or di' - delete inside of <delimiter> - eg: di) | |
CHANGE: | |
cw - deletes word and puts you into insert mode | |
C - change to end of line (same as c$) | |
REPLACE: | |
rT - replace current character with T | |
5rx - replaces 5 characters with x (xxxxx) | |
r ENTER - inserts a line break (and deletes one character) | |
R - replace until press ESC | |
. - REPEAT LAST COMMAND (!!!!!) | |
VISUAL MODE: | |
v - enter visual mode | |
V - enter visual mode and highlight entire lines | |
CTRL V - enter visual mode with a block | |
(can perform operations on highlighted text, like delete with d) | |
p - put | |
P - put above cursor | |
:e! - go back to original version of doc | |
CTRL-] - go to documentation of word you are above | |
CTRL-O - go back | |
:help 'number' - tells you what number does in vim | |
:set number - adds number lines to file | |
:set nonumber - removes number lines | |
:set ruler - show cursor position | |
:set hlsearch - highlight all search results when search for a string | |
Navigation article: http://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment