pratiktest
7/5/2016 - 5:36 AM

vim commands

vim commands

##Visual

back select visual mode

shift + v or v and then b

Scroll

scroll down

ctrl + e

scroll up

ctrl + y

Open file

open a new file from within vim

:vert new filename.ext

open 2 files parallel vertically

vim -O a.txt b.txt

line number

set line number

:set nu

go to line number 123

123G 123gg

substitution

:%s/foo/bar/g

get confirmation before

:%s/foo/bar/gc

only apply to current line

:s/foo/bar/gc

replace all the spaces and tabs to end of words(note the $) with nothing

:%s/\s\+$//

redo undo

undo

u

redo

ctrl + r