Coffee Space


Listen:

Vim Configuration

Preview Image

After reading this article written by Sven Guckes (who unfortunately died recently), I thought I would share my .vimrc file.

It remains fairly well commented because I visit it only once every few years:

0001 " .vimrc
0002 "
0003 " A configuration file allowing the system to look much better and do
0004 " pre-compiling of code.
0005 "
0006 " B[]
0007 
0008 " Always force to IMproved version
0009 set nocompatible
0010 " Turn syntax on
0011 syntax on
0012 " Set good colour scheme
0013 colorscheme ron
0014 " Set spell checking
0015 set spell spelllang=en_gb
0016 setlocal spell spelllang=en_gb
0017 " Spell settings
0018 highlight clear SpellBad
0019 highlight SpellBad term=NONE term=underline cterm=NONE ctermbg=NONE ctermfg=red cterm=underline gui=NONE guibg=NONE guifg=red gui=underline
0020 highlight clear SpellCap
0021 highlight SpellCap term=NONE term=underline cterm=NONE ctermbg=NONE ctermfg=blue cterm=underline gui=NONE guibg=NONE guifg=blue gui=underline
0022 highlight clear SpellRare
0023 highlight SpellRare term=NONE term=underline cterm=NONE ctermbg=NONE ctermfg=red cterm=underline gui=NONE guibg=NONE guifg=red gui=underline
0024 highlight clear SpellLocal
0025 highlight SpellLocal term=NONE term=underline cterm=NONE ctermbg=NONE ctermfg=red cterm=underline gui=NONE guibg=NONE guifg=red gui=underline
0026 " Remove automatic preview box
0027 set completeopt-=preview
0028 " Auto-indent should be 2 spaces
0029 set expandtab
0030 set tabstop=8
0031 set shiftwidth=2
0032 " Automatic indent
0033 set autoindent
0034 set smartindent
0035 " Show lines numbers
0036 set number
0037 " Show a ruler for current cursor location
0038 set ruler
0039 " Don't create new line at end of the file
0040 set noeol
0041 
0042 " Bind mappings
0043 
0044 " Auto-wrap lines
0045 map Q gqq
0046 " Move up and down by visual lines
0047 map <Up> gk
0048 map <Down> gj

Interesting points of note:

  1. Turn on spelling - See the comment starting with " Set spell checking.
  2. Spell check colour - Overriding the spell checking colours to make them more usable across multiple systems - see " Spell settings.
  3. Auto-wrap lines - See the comment " Auto-wrap lines - this one saves me maybe 30 minutes every day!
  4. Arrow keys - See comment " Move up and down by visual lines - this one is insanely useful for moving around really long lines (which happens a lot).