Thursday 31 January 2013

VI Editor shortcut Keys

keys:
:help index - it will show all command
h -left
j -down
k -up
l -right
x -delete a single caractor
u -undo
ctrl-R -redo
ZZ -save and exit
:q! -exit without saving
:wq -save and exit
dd -delete line
yy -copy line
p -paste line
o -open new line
w -moving forword one word
b -moving backword one word
$ -end of line
5$ -end of 5th line
# -put your cursor in word and search that word in all file
^ -begining of line
:set number -numburing turn on
:set nonumber -turn off numburing
ctrl-u -scrolling up
ctrl-d -scrolling down
dw -delete word
d$ -delete till end of line
cw -delete word and insert mode
. -repeats loast delete or changes
J -caps j joins two lines
) -move next sentences
( -move previous sentences
} -move next paragraph
{ -move previous para
gg -1st line of doc
G -shift g end of doc
d) -delete sentenses
d} -delete para
r -replace caractor
~ -change case uppercase to lower case vice versa
:set hlsearch -set highlight search
:set nohlsearch -unset highlight search
:nohlsearch -clear highlights
n -next search
N -previous search
!! -type command and output will be in your file  
:wnext -save cuurunt filr and go to next file
:next! -dont save currunt file and go to next file
:set autowrite -to save automatically
:args -which file am i on
:previous -same as next
:rewind -shift to fist file
:first -shift to first file
:last -shift to last file
ctrl^ -shifting in two files
v -to select lines visual mode - start visual mode
d -delete
y -copy
ctrl-v -to select block
!Gsort -sort the docs by alphabetics
x   :delete character under the cursor (short for "dl")
X   :delete character before the cursor (short for "dh")
D   :delete from cursor to end of line (short for "d$")
dw  :delete from cursor to next start of word
db  :delete from cursor to previous start of word
diw :dearzoo.com
to add start of line
:%s/^/abcd
add abcd every start of line
search www and delete
:%s/www/
find abcd and replace @arzoo.com
:%s/abcd/@arzoo.com/glete word under the cursor (excluding white space)
daw :delete word under the cursor (including white space)
dG  :delete until the end of the file
dgg :delete until the start of the file
If you use "c" instead of "d" they become change commands. And with "y" you
yank the text. And so forth.
To add @arzoo.com to every end of line
:%s/$/@arzoo.com
to add start of line
:%s/^/abcd
add abcd every start of line
search www and delete
:%s/www/
find abcd and replace @arzoo.com
:%s/abcd/@arzoo.com/g

No comments:

Post a Comment