annotate vim/.vimrc @ 9:d3c383a0a5e8

New settings inspired from recent blog posts on the net.
author Brian Neal <bgneal1@rockwellcollins.com>
date Wed, 19 Sep 2012 15:07:55 -0500
parents ff60fbc930de
children b113527fa5d1
rev   line source
bgneal@0 1 set nocompatible
bgneal@0 2 "source $VIMRUNTIME/vimrc_example.vim
bgneal@0 3 "source $VIMRUNTIME/mswin.vim
bgneal@0 4 "behave mswin
bgneal@0 5
bgneal@0 6 set nobackup
bgneal@0 7 set tabstop=3
bgneal@0 8 set shiftwidth=3
bgneal@0 9 set backspace=indent,eol,start
bgneal@0 10 set expandtab
bgneal1@9 11 set textwidth=79
bgneal@0 12 set number
bgneal@0 13 set ruler
bgneal@0 14 set history=1000
bgneal@0 15 set encoding=utf-8
bgneal@4 16 set showcmd
bgneal@0 17
bgneal@0 18 " CtrlP related settings
bgneal1@9 19 " set wildignore+=.git\*,.hg\*,.svn\*,*.d,*.dbo,*.o,*.ti,*.ii,*.swp,*.pyc
bgneal@4 20 set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
bgneal@4 21 let g:ctrlp_working_path_mode = 2
bgneal@0 22
bgneal@0 23 " This allows % to toggle on if/elsif/else/end, XML tags, & more
bgneal@0 24 runtime macros/matchit.vim
bgneal@0 25
bgneal@0 26 " These two options make /-style searching case-sensitive only if there
bgneal@0 27 " is a capital letter in the search expression.
bgneal@0 28 set ignorecase
bgneal@0 29 set smartcase
bgneal@0 30
bgneal@0 31 " Sets the terminal title when run in an xterm
bgneal@0 32 set title
bgneal@0 33
bgneal@0 34 " This puts more context around the cursor when scrolling
bgneal@0 35 set scrolloff=3
bgneal@0 36
bgneal1@9 37 let g:netrw_sort_sequence = "[\/]$,*,\.bak$,\.o$,\.info$,\.swp$,\.obj$"
bgneal@0 38
bgneal@0 39 syntax on
bgneal@0 40 filetype on
bgneal@0 41 filetype plugin on
bgneal@0 42 filetype indent on
bgneal@0 43 set hlsearch
bgneal@0 44 set incsearch
bgneal@0 45
bgneal@0 46 " highlight trailing spaces
bgneal@0 47 let c_space_errors = 1
bgneal1@9 48 let python_space_error_highlight = 1
bgneal@0 49
bgneal@2 50 set background=dark
bgneal@2 51 colorscheme peaksea2
bgneal@2 52 " colorscheme Dark
bgneal@0 53
bgneal@0 54 " shortcut for word completion in insert mode
bgneal@0 55 imap <S-Tab> <C-n>
bgneal@0 56
bgneal@0 57 " buffer next and previous commands
bgneal@0 58 nnoremap <Tab> :bnext<CR>
bgneal@0 59 nnoremap <S-Tab> :bprevious<CR>
bgneal@0 60
bgneal@0 61 " Remove extra trailing spaces
bgneal@0 62 nnoremap <F2> :%s/\s\+$//<CR>
bgneal@0 63
bgneal@4 64 " setlocal spell spelllang=en_us
bgneal@0 65
bgneal@0 66 let mapleader=","
bgneal@0 67
bgneal@0 68 " NERD tree plugin
bgneal@0 69 " nmap ,n :NERDTreeToggle<CR>
bgneal@0 70 " let g:NERDTreeQuitOnOpen=1
bgneal@6 71
bgneal1@9 72 " ctags support
bgneal1@9 73
bgneal1@9 74 function BgnCtags()
bgneal1@9 75 let d = fnamemodify(findfile("root.dir", ";"), ":p:h")
bgneal1@9 76 let tags = d . "\\tags"
bgneal1@9 77 let s = "ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --exclude=Coe_prune --exclude=Opnet --languages=-all --languages=+c,c++,python -f " . tags . " " . d
bgneal1@9 78 echo s
bgneal1@9 79 call system(s)
bgneal1@9 80 endfunction
bgneal1@9 81
bgneal1@9 82 nnoremap <F8> :call BgnCtags()<CR>
bgneal1@9 83 nnoremap <F9> :tn<CR>
bgneal1@9 84 nnoremap <F10> :tp<CR>
bgneal1@9 85 nnoremap <F11> :tj<CR>
bgneal1@9 86 set tags=tags;/
bgneal1@9 87
bgneal1@9 88 " Trial settings
bgneal1@9 89 set wildmenu
bgneal1@9 90 set wildmode=list:longest
bgneal1@9 91 set laststatus=2
bgneal1@9 92 set gdefault
bgneal1@9 93 set showmatch
bgneal1@9 94 set formatoptions=qrn1
bgneal1@9 95 nnoremap ,/ :noh<CR>
bgneal1@9 96 " nnoremap / /\v
bgneal1@9 97 " vnoremap / /\v
bgneal1@9 98
bgneal1@9 99 " Splitting windows and moving around between them:
bgneal1@9 100 nnoremap ,v <C-w>v<C-w>l
bgneal1@9 101 nnoremap <C-h> <C-w>h
bgneal1@9 102 nnoremap <C-j> <C-w>j
bgneal1@9 103 nnoremap <C-k> <C-w>k
bgneal1@9 104 nnoremap <C-l> <C-w>l
bgneal1@9 105
bgneal1@9 106 " Absolute vs relative line numbers:
bgneal1@9 107 nnoremap ,na :set norelativenumber<CR>:set number<CR>
bgneal1@9 108 nnoremap ,nr :set relativenumber<CR>
bgneal1@9 109
bgneal1@9 110 " Format paragraph
bgneal1@9 111 nnoremap ,p gqip
bgneal1@9 112
bgneal@6 113 " Pathogen support
bgneal@6 114 call pathogen#infect()