Join us at FACEBOOK
COMMAND EFFECT
:.= find
out the current line number
:1 go to line 1
Ctrl-d page
down
Ctrl-u page
up
Shift-g go to end of file
i insert text at current
position
Shift-a append
text after end of current line
Shift-I insert text before start of
current line
Esc get
out of edit mode, back into normal vi command mode
dd delete
current line
10dd delete
10 lines from current line on down
d shift-g delete all lines from
current line and below
d 1 shift-g delete all lines from
current line and above
. repeat
previous command
shift-y yank (copy) current line
p paste
that copy into line below
/data search
forward for occurencies of string "data"
/ search
forward for next occurrence of remembered search string
? search
backward for next occurrence of remembered search string
:set ic make
searches case insensitive
:1,$s/data/index/g replace
all occurrencies of "data" with "index"
:1,$s/"//g remove
all " characters
:1,$s/$/ ;/ append
" ;" to the end of every line
:1,$s/^/rem / insert
"rem " to the start of every line
:w write
(save) file
:q quit
out of vi
:q! quit
out of vi without saving changes
:wq write
(save) file and quit out of vi
shift-z shift-z
same as above ":wq" except
does not write (change file modification
times) if you have not made any changes.
:n next
file (when vi'ing a series of files, e.g. with using "vi *" at the
command
prompt)
u undo
last command
shift-j Join
next line onto end of current line
VI Quick
Reference Guide
---------------------------------
BASIC commands
$ vi filename - normal mode
$ vedit filename - user
friendly edit
$ esc -
return to command mode
INSERTING
o - insert a line after cursor
O - insert a line before cursor
i - insert text at cursor
a - insert text after cursor
I - insert text at start of line
A or $a - insert text at eol
SAVING AND QUITING
ZZ - save and
exit
:w - save without exiting
:w! - save write
protected file
:q - quit editor
:q! - quit without
saving
DELETING
dd - delete current
line
x - delete char at
cursor
X - delete char
before cursor
dw - delete word
D or d$ - delete from cursor to
eol
CURSOR MOVEMENT
k
^
h < > l
v
j
REPLACING / CHANGING
R - replace till eol
r - replace one character
C - change all text after cursor
cw - change a word
c$ - change from cursor to EOL
cG - change from cursor to EOF
MOVING ABOUT
f - page forward
b - page back
d - 1/2 page forward
u - 1/2 page back
w - next word
b - previous word
^B - Goes one page UP
^ - start of line (shift 6)
G - go to end of file
1G - go to beginning of file
g - show position in file
^D - Goes half page down
^U - Goes half page up
^F - Goes one page DOWN
$ - end of line
nG - go to nth line
MOVING TEXT
To move n lines of text from A to B
1. move cursor to A
2. ndd - delete n lines
3. move cursor to B
4. P - pull text in
after cursor
p - pull text in before cursor
(,( next, previous sentence
},{ next, previous paragraph
]],[[ next, previous section
% goto matching parenthesis () {} []
YANK OPERATOR TO BUFFER
yw - yank word
y$ - yank from cursor to EOL
yG - yank from cursor to EOF
yy - yank complete current line
p - paste from buffer after cursor
P - paste from buffer before cursor
USEFUL COMMANDS
. - repeat last command
u - undo last command
U - undo changes made to current line
J - join the next line to the current line
^G - Show the current filename and status
! - Ejecuta uan linea del shell
:1,$s/old/new/g - global search and replace old with new *
:.,$d - delete from current line to eof
:r filename - read filename into this vi buffer
:n,mw filename - write lines n through m to filename
SEARCHING
/abc - search for string "abc"
N - find previous occurrence
n - find next occurrence
COPYING TEXT
To copy n lines of text from A to B
1. move cursor to A
2. nyy - yank n lines
3. move cursor to B
4. P - pull text in after cursor
p - pull text in before cursor
your website is great to view it sir thank you for your valluable information regards Oracle R12 Financials Training in Ameerpet
ReplyDelete