Touch with us for Information Technology Solutions. Email us for your Query on Technical.gaurav@gmail.com.
Propellerads

01/10/2012

Vim Installation & Commands

Basics VIM ( VI-EDITOR) Feature's :-

The vi Editor had three modes Command mode , Insert mode & Command line mode .
  • Command mode :- Commands are case sensitive . The ESC key can end a command .
  • Text is inserted   :-The ESC key ends insert mode and returns you to command mode. One can enter insert mode with the "i" (insert), "a" (insert after), "A" (insert at end of line), "o" (open new line after current line) or "O" (Open line above current line) commands.
  • Command line mode :- One enters this mode by typing ":" which puts the command line entry at the foot of the screen.


Partial list of interactive commands:

KeystrokesAction
h/j/k/lMove cursor left/down/up/right
spacebarMove cursor right one space
-/+Move cursor down/up in first column
ctrl-dScroll down one half of a page
ctrl-uScroll up one half of a page
ctrl-fScroll forward one page
ctrl-bScroll back one page
M (shift-h)Move cursor to middle of page
HMove cursor to top of page
LMove cursor to bottom of page
W
w
5w
Move cursor a word at a time
Move cursor ahead 5 words
B
b
5b
Move cursor back a word at a time
Move cursor back a word at a time
Move cursor back 5 words
e
5e
Move cursor to end of word
Move cursor ahead to the end of the 5th word
0 (zero)Move cursor to beginning of line
$Move cursor to end of line
)Move cursor to beginning of next sentence
(Move cursor to beginning of current sentence
GMove cursor to end of file
%Move cursor to the matching bracket.
Place cursor on {}[]() and type "%".
Use the matchit or xmledit plug-in to extend this capability to XML/XHTML tags.
'.Move cursor to previously modified line.
'aMove cursor to line mark "a" generated by marking with keystroke "ma"
'AMove cursor to line mark "a" (global between buffers) generated by marking with keystroke "mA"
]'Move cursor to next lower case mark.
['Move cursor to previous lower case mark.

Editing Commands:

KeystrokesAction
iInsert at cursor
aAppend after cursor
AAppend at end of line
ESCTerminate insert mode
uUndo last change
UUndo all changes to entire line
oOpen a new line
dd
3dd
Delete line
Delete 3 lines.
DDelete contents of line after cursor
CDelete contents of line after cursor and insert new text. Press esc key to end insertion.
dw
4dw
Delete word
Delete 4 words
cwChange word
xDelete character at cursor
rReplace character
ROverwrite characters from cursor onward
sSubstitute one character under cursor continue to insert
SSubstitute entire line and begin to insert at beginning of line
~Change case of individual character
ctrl-a
ctrl-x
Increment number under the cursor.
Decrement number under the cursor.
/search_string{CR}Search for search_string
?search_string{CR}Search backwards (up in file) for search_string
/\<search_string\>{CR}Search for search_word
Ex: /\<s\>
Search for variable "s" but ignore declaration "string" or words containing "s". This will find "string s;", "s = fn(x);", "x = fn(s);", etc
nFind next occurrence of search_word
NFind previous occurrence of search_word
.repeat last command action.

Terminate session:

Use Command :- ZZ 
Save changes and quit.

Use command line: ":wq"
Save (write) changes and quit.

Use command line: ":w"
Save (write) changes without quitting.

Use command line: ":q!"
Ignore changes and quit. 
No changes from last write will be saved.

Use command line: ":qa"
Quit all files opened.


Red Hat Enterprises 6 Linux Menu


  1. OS Installation. 
  2. Basics.
  3. How to install samba in Red Hat 6
  4. Virtualization.
  5. Security's
  6. Trouble Shooting.