Wednesday, December 12, 2012

VIM shorcut

I love VIM...!!!  For me, this is the best text editor ever. No matter what OS i use now (Linux, Mac even windows) must have this app.

A lot of reason of why i love this app. Simplicity is main reason. A lot of 'hidden' shortcut make you geek-alike. Hehe...

Here's most useful VIM shortcut. Yeah, i know sometimes is little bit difficult to remember it all. My advice is just remember what most you need and use frequently.  ;)


source: http://www.keyxl.com/aaa8263/290/VIM-keyboard-shortcuts.htm

ShortcutCommandHow useful(?)
Cursor movement

VIM

hmove left+       –
jmove down+       –
kmove up+       –
lmove right+       –
wjump by start of words (punctuation considered words)+       –
Wjump by words (spaces separate words)+       –
ejump to end of words (punctuation considered words)+       –
Ejump to end of words (no punctuation)+       –
bjump backward by words (punctuation considered words)+       –
Bjump backward by words (no punctuation)+       –
0(zero) start of line+       –
^first non-blank character of line+       –
$end of line+       –
GGo To command (prefix with number+       –
Note:Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.+       –
Insert ModeInserting/Appending text+       –
istart insert mode at cursor+       –
Iinsert at the beginning of the line+       –
aappend after the cursor+       –
Aappend at the end of the line+       –
oopen (append) blank line below current line (no need to press return)+       –
Oopen blank line above current line+       –
eaappend at end of word+       –
Escexit insert mode+       –
Editing

VIM

rreplace a single character (does not use insert mode)+       –
Jjoin line below to the current one+       –
ccchange (replace) an entire line+       –
cwchange (replace) to the end of word+       –
c$change (replace) to the end of line+       –
sdelete character at cursor and subsitute text+       –
Sdelete line at cursor and substitute text (same as cc)+       –
xptranspose two letters (delete and paste, technically)+       –
uundo+       –
.repeat last command+       –
Marking text (visual mode)

VIM

vstart visual mode, mark lines, then do command (such as y-yank)+       –
Vstart Linewise visual mode+       –
omove to other end of marked area+       –
Ctrl+vstart visual block mode+       –
Omove to Other corner of block+       –
awmark a word+       –
aba () block (with braces)+       –
aBa {} block (with brackets)+       –
ibinner () block+       –
iBinner {} block+       –
Escexit visual mode+       –
Visual commands

VIM

>shift right+       –
<shift left+       –
yyank (copy) marked text+       –
ddelete marked text+       –
~switch case+       –
Cut and Paste

VIM

yyyank (copy) a line+       –
2yyyank 2 lines+       –
ywyank word+       –
y$yank to end of line+       –
pput (paste) the clipboard after cursor+       –
Pput (paste) before cursor+       –
dddelete (cut) a line+       –
dwdelete (cut) the current word+       –
xdelete (cut) current character+       –
Exiting

VIM

:wwrite (save) the file, but don't exit+       –
:wqwrite (save) and quit+       –
:qquit (fails if anything has changed)+       –
:q!quit and throw away changes+       –
Search/Replace

VIM

/patternsearch for pattern+       –
?patternsearch backward for pattern+       –
nrepeat search in same direction+       –
Nrepeat search in opposite direction+       –
:%s/old/new/greplace all old with new throughout file+       –
:%s/old/new/gcreplace all old with new throughout file with confirmations+       –
Working with multiple files

VIM

:e filenameEdit a file in a new buffer+       –
:bnext (or :bn)go to next buffer+       –
:bprev (of :bp)go to previous buffer+       –
:bddelete a buffer (close a file)+       –
:sp filenameOpen a file in a new buffer and split window+       –
ctrl+wsSplit windows+       –
ctrl+wwswitch between windows+       –
ctrl+wqQuit a window+       –
ctrl+wvSplit windows vertically+       –

No comments:

Post a Comment