Cheatography
https://cheatography.com
Working with Files
:e [filename] |
Open file |
:w [filename] |
Save changes to file |
:x |
:wq |
Manage Multiple Files
[Ctrl+w] s |
Split current window horizontally |
[Ctrl+w] v |
Split current window vertically |
:sp {file} |
Load file into another horizontal window |
:vsp {file} |
Load file into another vertical window |
[Ctrl+w] h / j / k / l |
Navigate between windows |
[Ctrl+w] c |
Close active window |
[Ctrl+w] o |
Close other windows except active one |
[Ctrl+w] = |
Equalize width & height of all windows |
:tabe {filename} |
Load file in opening tab |
:tabc |
Close active tab |
:tabo |
Close other tabs |
{N}gt |
Switch to tab page number {N} |
:tabmove [N] |
Move current tab to Nth position |
:find {filename} |
Opening file with relative path |
:e. |
Open file explorer for current working dir: |
zz |
Center screen at cursor |
|
|
Navigate inside file
e |
End of next word |
E |
w |
Begin of next word |
W |
b |
Begin of previous word |
B |
0 |
Begin of line |
^ |
$ |
End of line |
H |
Begin screen line |
M |
Middle screen line |
L |
End screen line |
Inside Visual Mode
V |
Select entire line |
bvw |
Select a word under cursor |
byw |
Yank a word |
Y |
Yank entire line |
p |
Paste after cursor |
P |
Paste before cursor |
V[#lines]G |
Select a code block |
Search & Replace
/{pattern} |
n / N |
?{pattern} |
n / N |
:noh |
Removes highlights |
:%s/{old}/{new}/g |
Replace {old} by {new} globally |
/f{char} |
; / , |
/F{char} |
; / , |
NERDTree
o |
Open file |
go |
Open file (cursor in NERDTree) |
t |
Open file in new tab |
O |
Open recursively directory |
X |
Close recursively directory |
x |
Close current nodes' parent |
s |
Open selected file in a new vsplit |
gs |
Same as s (cursor in NERDTree) |
C |
Change the tree root to the selected dir |
R |
Recursively refresh the current root |
|
|
Modifying file
I |
Insert at begin word of line |
A |
Insert at end of line |
o |
Insert one line below |
O |
Insert one line above |
C |
Remove rest line, insert mode |
s |
Remove 1 char, insert mode |
S |
Remove 1 line, insert mode |
dd |
Remove a line |
D |
Remove rest of line |
x |
Remove 1 char after |
X |
Remove 1 char before |
Ctrl+r |
Redo |
ciw |
Remove and insert under cursor word |
c[#]aw |
Remove next # number of words, insert mode |
d[#]aw |
Remove # number of words |
[#]Ctrl+a |
Add # to the next number occurence |
[#]Ctrl+x |
Subtract # from the next number occurence |
~ |
Change case of selected text |
g~iw |
Change case of word |
ci" |
Delete inside double quotes (insert mode) |
Search text in files
:vimgrep /{pattern}/[g][j] {file/dir} |
"g" including multiple matches on same line |
|
"j" turning off auto-goto first match feature |
|
"**" means all sub-directories |
:cw |
Show list of searched files & locations |
|
Created By
Metadata
Favourited By
Comments
knd, 09:43 12 Oct 15
Yeah!
knd, 09:30 13 Oct 15
Yeah!
Unknown 09:25 30 Oct 15
Oh yeah!!!!!!
Add a Comment