WebSphere Issues

08/11/2010

vi basic commands

Filed under: Linux — Ishtiaque @ 8:06 am
  • vimtutor -> Basic tutorial
  • vi -r myfile -> Start vi and edit myfile in recovery mode from a system crash
  • :wq -> Save and Exit
  • :q! -> Exit without save
  • :%s/txt1/txt2/g -> Replace all occurances of txt1 with txt2
  • u -> Undo
  • i or Insert key-> Insert
  • I -> Insert at the begning of current line
  • a -> Append at the cursor
  • A -> Append at the end of the line
  • o -> Insert new line below current line
  • O -> Insert new line above current line
  • x -> Delete character
  • dw -> Delete word
  • D -> Delete the rest of the line
  • dd -> Delete current line
  • Esc -> Exit insert mode and switch to command mode
  • : Switch from line to command mode
  • H -> Move cursor at the first line
  • G -> Move the cursor at the last line
  • yy -> Copy current line
  • 3yy -> Copies 3 lines
  • p -> Paste the copied line below the current line
  • /pattern -> Search a pattern or word or string
  • ?pattern -> Search pattern backward
  • n-> Move to the next pattern
  • N-> Move to the previous pattern
  • j -> Down; k-> Up; h-> Left; l-> Right
  • w -> Move cursor to the next word
  • b -> Move cursor to the previous word
  • 0 -> Goto the beggning of the current line
  • $ -> Goto the end of the current line
  • :! wc % -> Counts lines, word and characters
  • :color desert -> set color
  • ~\.vimrc
    • set number
    • synax on
    • set tabstop=4
    • set autoindent
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: