Friday, March 25, 2011

Settings for Vim on Linux or Mac

set nocompatible        " use vim defaults
set tabstop=8           " numbers of spaces of tab character
set shiftwidth=4        " numbers of spaces to (auto)indent
set showcmd             " display incomplete commands
set nobackup            " do not keep a backup file
set number              " show line numbers
set ignorecase          " ignore case when searching
set autoindent          " always set autoindenting on
set sm                  " show matching braces
syn on                  " syntax highlighing
set syn=auto            " syntax auto
set bkc=no

if has("autocmd")
         " Restore cursor position
         au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe(    "norm '\"")|else|exe "norm $"|endif|endif
endif

" Show line numbers
set number

" Make text wrap automatically at 70 columns
" when you type long lines
set textwidth=70

" Automatic indenting
set autoindent
set shiftwidth=4

" Buffer switching using Alt-Left/Right
" (or Command-Left/Right in Mac OS X)
:nnoremap <D-Right> :bnext<CR>
:nnoremap <M-Right> :bnext<CR>
:nnoremap <D-Left> :bprevious<CR>
:nnoremap <M-Left> :bprevious<CR>

No comments: