Linux – Configure the vi/vim Default Setting

The vi/vim configuration file is located @ $HOME/.exrc. of it does not exist, just create it.


:set number
:set ts=2


Your vi now will have tab size = 2 and line number is shown.

More useful settings

  • :set – all Display all Set options
  • :set autoindent – Indent following lines to the indentation of previous line.
  • :set ts=4 – set tab stop to 4 char
  • :set ignorecase – Ignore case during pattern matching.
  • :set list – Show special characters in the file.
  • :set number – Display line numbers.
  • :set shiftwidth=n – Width for shifting operators << and >>
  • :set showmode – Display when in Insert, Append, or Replace mode.
  • :set wrapmargin=n – Set right margin 80-n for autowrapping lines (inserting newlines). 0 turns it off.

Done =)

Reference: how to change the tab size in vi?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.