vim usage: wrapping, spelling, completion, indentation, …

code folding

To fold a number of lines (5 for example) press zf5j.

To fold code within curly brackets use za

The folded lines will be replaced in the buffer with a line that looks like:

+----- 5 lines: }-----

To open the folded text, press zo while the cursor is at the above line.
To close it back, press zc.

Switch case

Use the ~ sign.

Auto indentation

to auto-indent a piece of code, highlight it in visual mode, and press =. To auto-indent the current line, press ==.



Wrapping line

type gqgq : it wraps the current line


In your .vimrc configuration file, type

setlocal spell spelllang=en_us

or within vim itself, type

set spell

then, the commands you need to know are :

  • ]s      move to the next mispelled word
  • [s      move to the previous mispelled word
  • zg      add a word to the dictionary
  • zug   undo the addition of a word to the dictionary
  • z=    view spelling suggestions for a mispelled word


  • x: delete a character
  • 5x: delete 5 characters
  • dw: delete a word
  • dw: delete 5 words
  • dd: delete a line
  • 5dd: delete 5 lines
  • d$ or D: delete all data from the cursor to the end of the line
  •  d0: delete all data from the cursor to the beginning of the line
  • dw and db: delete from cursor to the end or beginnin of the word


  •  u. undo
  •  ~: switch small/big caps
Please follow and like us:
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.