Vim basic commands

Navigation

Ctrl+d — move down half a page
Ctrl+u — move up half a page
w — move cursor to next word
b — move cursor to previous word
gg — move cursor at beginning of page
G — move cursor to last line first char of page
} — go forward by paragraph (the next blank line)
{ — go backward by paragraph (the next blank line)
: [line_number] [enter] — Go to that line in the document

Edit

i — start insert mode at cursor
a — append after the cursor
r — replace char at cursor
d — delete left/right char (by moving cursor left right)
dd — delete whole line
shift+v,d -delete multiple lines
u — undo
select multi line and tab: shift+v then >

Copy-Pase

yy — yank (copy) a line
p — put (paste) the clipboard after cursor
P — put (paste) before cursor
shift+v ,y -copy multiple lines (then press p at cursor to paste)

Exit

:w — write (save) the file, but don’t exit
:wq — write (save) and quit
:q — quit (fails if anything has changed)
:q! — quit and throw away changes

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LORY

LORY

1.2K Followers

A Senior Software Developer/Body builder . to help others enjoy coding and stay healthy