2 minute read

this is a little vimrc that is just about right for small purposes..

(edit the file ~/.vimrc for user specific changes and /etc/vimrc?? for systemwide configuration)

[code language="bash" padlinenumbers="true"]
syntax on
filetype indent plugin on

set autoindent
set smartindent

set tabstop=4
set expandtab
set shiftwidth=4
set softtabstop=4

set number
set background=light
set smartcase
set cursorline
[/code]


explanation:

  • smartcase searches smart:
    /copyright      " Case insensitive
    /Copyright      " Case sensitive
    /copyright\C    " Case sensitive
    /Copyright\c    " Case insensitive
  • indentation:
    • autoindent: same as line before
    • smartindent: does some thinking (one level deeper for "if else", etc.)
  • cursorline:
    • highlights current line of cursor position
  • The command zc will close a fold (if the cursor is in an open fold), and zo will open a fold (if the cursor is in a closed fold). It's easier to just use za which will toggle the current fold (close it if it was open, or open it if it was closed).The commands zc (close), zo (open), and za (toggle) operate on one level of folding, at the cursor. The commands zC, zO and zA are similar, but operate on all folding levels (for example, the cursor line may be in an open fold, which is inside another open fold; typing zC would close all folds at the cursor).The command zr reduces folding by opening one more level of folds throughout the whole buffer (the cursor position is not relevant). Use zR to open all folds.The command zm gives more folding by closing one more level of folds throughout the whole buffer. Use zM to close all folds.

sources: