Vi Editor Series III

Below commands must be used in visual mode (ctrl+v)

  • Type  dw  to delete a word.
  • Type  d$   to delete to the end of the line.
  • Press  a  to append text.
  • Type  %  to find a matching ),], or } .
  • Type  :s/vlsispace_old/vlsispcae_new/g  to substitute ‘vlsispace_new‘ for ‘vlsispace_old‘ in the line
  • Type   :%s/vlsispace_old/vlsispcae_new/g  to change every occurrence in the whole file.
  • Type  :!     followed by an external command to execute that command.
  • CTRL+R a few times  to redo the commands.
  • Type CTRL+g to show your location in the file and the file status.
  • Type  CTRL+G  to move to a line in the file.
  • Press  G  to move you to the bottom of the file.
  • Type  gg  to move you to the start of the file.
  • Type  a  to insert text AFTER the cursor.
  • Type  A  to insert text after the end of the line.
  • Type a capital  R  to replace more than one character.
  • yw  yanks one word.
  • y  operator to copy text and  p  to paste it 
  • Type  o  to open a line BELOW the cursor and start Insert mode.    Type  O  to open a line ABOVE the cursor.
  • The  command moves to the end of a word.
  • Typing “:set xxx” sets the option “xxx”.  Some options are:
    • ic‘ ‘ignorecase’       ignore upper/lower case when searching
    • is‘ ‘incsearch’        show partial matches for a search phrase
    • hls‘ ‘hlsearch’        highlight all matching phrases
    •  You can either use the long or the short option name.
  • Prep-end “no” to switch an option off:   :set noic
  •  Vim has a comprehensive on-line help system.  To get started, try one of  these three:
    • press the <HELP> key (if you have one)
    • press the <F1> key (if you have one)
    • type   :help <ENTER>
  •  You can find help on just about any subject, by giving an argument to the  “:help” command.
    • :help w
    • :help c_CTRL-D 
    • :help insert-index 
    • :help user-manual 
    • :help vimrc-intro
  • There is a variable in VIM runtime..
    • $VIMRUNTIME/  ==> we can refer to this if want to know any vim  versions etc..
  • Command line completion with CTRL-D and <TAB>

Comments