Get hand over VI / VIM editor


Movements
b   previous word
w next word
e end of word
0/^ begining of line
$ end of line
G end of file
1G/gg begining of file
/pattern search next
?pattern search previous
n repeat search forword ( i.e next occurence )
N repeat search backword
:line goto line specified

*****Modes****
i insert mode
r replace mode
s delete character under cursor and eneter insert mode

*****Delete******
x delete character under cursor
dd delete current line
line dd delete number of lines specified

****copy********
yy copy current line
pp print copied contents
line yy copy number of lines specified

*******visual******

v enter visual mode
aw highlight word
as highlight sentence
ap highlight paragraph
ab highlight block

******undo/redo******
u undo
cntrl+r redo

******autocomplete****
cntrl+x enter completion mode
cntrl+p display autocomplete options

******uppercase/lowercase*****
guu lowercase line
gUU uppercase line

*******Regx replace****

range s/foo/bar/arg - replace foo with bar in ‘range’ with

Values of 'range':
% whole file
number that particular line
none apply to current line only

values of 'arg':
none apply to first occurrence
g global (all occurrences)

Select/Macros
qchar start recording macro storing it in register ‘char’
q end recording
@char replay the macro stored in ‘char’
:1,10 norm! @char run the macro stored in ‘char’ over the 1-10 line range

Advertisements

About sandipransing

Web Developer #ruby #rails #JS
This entry was posted in General and tagged , . Bookmark the permalink.

One Response to Get hand over VI / VIM editor

  1. Remove blank lines in vim:g/^ *$/d

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s