Mar 112012
 

Made some refactoring of my VIM settings the other day.

The current plugins used are:

  • colorsamplepack
  • cscope_maps
  • highlight_current_line
  • matchit
  • NERD_tree
  • SearchComplete
  • taglist

This is the current settings file, or .vimrc as it's called.

" Joakim Wesslen
"
" The inspiration for the below setup was found at these places
" http://www.derekwyatt.org/vim/
" http://www.swaroopch.com/notes/Vim_en:Programmers_Editor
" http://spf13.com/post/perfect-vimrc-vim-config-file
" http://www.catonmat.net/blog/vim-plugins-surround-vim/
" among others...
"
set nocompatible " not compatible with original vi
let mapleader="," " set mapleader to , instead of \
nmap <silent> <leader>ev :e $MYVIMRC<CR> " edit .vimrc
nmap <silent> <leader>sv :so $MYVIMRC<CR> " source .vimrc
" Status bar --------------------------------------------------------------
set ch=2 " Make command line two lines high
set showmode " show current mode in status bar
set stl=%f\ %m\ %r\ Line:\ %l/%L[%p%%]\ Col:\ %c\ Buf:\ #%n\ [%b][0x%B] " Set the status line the way I like it
set laststatus=2 " Show statusline in single window
" Color, layout etc  ------------------------------------------------------
set background=dark " background color
colorscheme darkgreen " color scheme
syntax on " Enable syntax highlightning
set tw=120 " text width
set cc=+1 " highlight column after textwidth
set nowrap " wrap text
"set smarttab " tab/backspace are smart
"set expandtab " insert spaces as tabs
set tabstop=8 " Tab length, nbr spaces
set cindent " indent according to tabstop
set smartindent " help me with indenting
set autoindent " autoindent
set sw=2 " scrollbar width
set number " show line numbers
set autoread " watch for file changes
set undolevels=1000 " nbr undo levels
set history=1000 " command history levels
set list " Show trailing spaces and tabs
set listchars=trail:+,tab:>- " Show trailing spaces and tabs
set foldminlines=5 " Folding lines shown
set foldnestmax=3 " Folding level
" Search ------------------------------------------------------------------
set ignorecase " ignore case in pattern
set smartcase " override ignorecase
set incsearch " show pattern in text as it is written
set hlsearch " highlight all matches
set wrapscan " Set the search scan to wrap around the file
set path+=** " search directories
" Copy --------------------------------------------------------------------
set cpoptions+=$ " add a $ at end of 'copy/change'
" Buffer ------------------------------------------------------------------
set hidden " change buffer without saving
noremap <C-Left> :bfirst<cr> " Switch to first buffer
noremap <C-Down> :bnext<cr> " Switch to next buffer
noremap <C-Up> :bprevious<cr> " Switch to previous buffer
noremap <C-Right> :blast<cr> " Switch to last buffer
" Windows -----------------------------------------------------------------
noremap <silent> <C-h> :wincmd h<cr> " Move the cursor to the window left of the current one
noremap <silent> <C-j> :wincmd j<cr> " Move the cursor to the window below the current one
noremap <silent> <C-k> :wincmd k<cr> " Move the cursor to the window above the current one
noremap <silent> <C-l> :wincmd l<cr> " Move the cursor to the window right of the current one
" Specials ----------------------------------------------------------------
map <C-s> :w<CR> " 'Ctrl s' to save file in command mode.
imap <C-s> <Esc>:w<CR>i " 'Ctrl s' to save file in insert mode.
" Plugins -----------------------------------------------------------------
:filetype plugin on "
" Function keys -----------------------------------------------------------------
map <F2> :TlistToggle<cr> " Taglist, need ctags
map <F3> :NERDTreeToggle<cr> " NERDtree
"map <F4> <cr> " Buflist (buflist.vim defines F4 as toggle window
map <F5> :b#<cr> " switch buffer
" file type detection
:filetype on "
autocmd FileType make set noexpandtab set sw=4
autocmd FileType c set tw=80
autocmd FileType h set tw=80
autocmd FileType patch set tw=80

 

Sorry, the comment form is closed at this time.