VIM Cheat Sheet

A Software › Vim cheat sheet in English by Tomcat
3,966 views 1,249 downloads 19 Sep 2019 History
3.7 avg · 0 ratings

Mode

Control
esc
Insert
i
Append
a
Visual
v

View

show line numbers
:set nu
hide line numbers
:set nonu
show status
ctrl + g

Moving

start of file
gg
end of file
G
jump to next word
w
jump to line 12
:12
start of line
^
end of line
$

Edit

delete
x
copy line
yy
delete line
dd
new line
o
paste
p
copy selection ( frrom visual mode)
y
indent right
>
indent left
<

General

undo
u
redo
ctrl + r

Search & Replace

search
/pattern
forward occurence
n
backward occurence
N
find & replace
:%s/ol­d/new/g
find & replace (need confirm)
:%s/ol­d/n­ew/gc

Exit

no write & quit
:q!
write & quit
:wq
save as file.txt
:w file.txt
open file2.txt (from file1.txt)
:e file1.txt

Shell

executing ls
:!ls -alt
pasting output ls
:r !ls -alt
count word
:!wc -c %
run python to current file
:!python %
open shell
:shell
set shell
:set shell=­/bi­n/bash

.vimrc

set clipbo­ard­=un­nam­edplus
use system­'s clipboard
set expandtab
convert tab to space
set shiftw­idth=4
shift = 4 spaces
set tabstop=4
tab = 4 spaces
set hlsearch
highlight search
set ignorecase
search ignore case
set smartcase
search sensit­ively

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.