About Me.

My self Adinarayana working as Implementation Application DBA with advanced technologies like RAC/PCP,OID/SSO,DMZ,Exadata and Fusion Middleware i.e Demantra,Application Server,SOA,FMW,BPEL and UPK. Created this blog to share the useful information related to DBA and Application DBA Your comments and suggestions are most welcome. Disclaimer: Please note all the views and opinions expressed in this site are my own. It's not recommend to use the fixes/suggestions provided in this site directly in production instance, please test them before implementing.

Tuesday, July 9, 2013

List Of vi Commands

Editing Commands
Command Action
 
Insert
i, a   Insert text before, after cursor
I, A   Insert text before beginning, after end of line
o, O   Open new line for text below, above cursor


Change  
r   Replace character
cw   Change word
cc   Change current line
cmotion   Change text between the cursor and the target of motion
C   Change to end of line
R   Type over (overwrite) characters
s   Substitute: delete character and insert new text
S   Substitute: delete current line and insert new text



Delete, move  
x   Delete character under cursor
X   Delete character before cursor
dw   Delete word
dd   Delete current line
dmotion   Delete text between the cursor and the target of motion
D   Delete to end of line
p, P   Put deleted text after, before cursor
"np   Put text from delete buffer number n after cursor (for last nine deletions)


Exit Commands
Command Meaning
ZZ   Write (save) and quit file
:x   Write (save) and quit file
:wq   Write (save) and quit file
:w   Write (save) file
:w!   Write (save) file, overriding protection
:30,60w newfile   Write from line 30 through line 60 as newfile
:30,60w>> file   Write from line 30 through line 60 and append to file
:w %.new   Write current buffer named file as file.new
:q   Quit file
:q!   Quit file, overriding protection
Q   Quit vi and invoke ex
:e file2   Edit file2 without leaving vi
:n   Edit next file
:e!   Return to version of current file at time of last write (save)
:e #   Edit alternate file
:vi   Invoke vi from ex
:   Invoke one ex command from vi editor
%   Current filename (substitutes into ex command line)
#   Alternate filename (substitutes into ex command line)





RETURN   First nonblank character of next line
0, $   First, last position of current line
^   First nonblank character of current line
+, -   First nonblank character of next, previous line
n|   Column n of current line
H   Top line of screen
M   Middle line of screen
L   Last line of screen
nH   n (number) of lines after top line
nL   n (number) of lines before last line
 
Scrolling
CTRL-F, CTRL-B   Scroll forward, backward one screen
CTRL-D, CTRL-U   Scroll down, up one-half screen
CTRL-E, CTRL-Y   Show one more line at bottom, top of window
zRETURN   Reposition line with cursor to top of screen
z.   Reposition line with cursor to middle of screen
z-   Reposition line with cursor to bottom of screen
CTRL-L   Redraw screen (without scrolling)
 
Searches
/pattern   Search forward for pattern
?pattern   Search backward for pattern
n, N   Repeat last search in the same, opposite direction
/, ?   Repeat previous search forward, backward
fx   Search forward for character x in current line
Fx   Search backward for character x in current line
tx   Search forward to character before x in current line
Tx   Search backward to character after x in current line
;   Repeat previous current line search
,   Repeat previous current line search in opposite direction
 
Line Number
CTRL-G Display current line number
nG   Move to line number n
G   Move to last line in file
:n   Move to line n in file
 
Marking position
mx   Mark current position as x
``x   Move cursor to mark x
``   Return to previous mark or context
'x   Move to the beginning of line containing mark x
''   Return to beginning of line containing previous mark

No comments:

Post a Comment