现在公司服务器上用的vimrc. 脚本最后几个插件几乎没怎么用到, 实际上熟读Practical Vim Edit Text at the Speed of Thought后除了ctags和cscope基本不需要其它插件. 将don't repeat yourself贯彻始终才是关键.
1 "vim set 2 "colorscheme elflord 3 colorscheme evening 4 "colorscheme molokai 5 "let g:molokai_original=1 6 "let g:rehash256=1 7 set guifont=Monospace\ 12 8 "file type 9 filetype on 10 filetype plugin on 11 "editing set 12 set nu 13 set ruler 14 set showcmd 15 "search 16 set incsearch 17 set hlsearch 18 set wrapscan 19 "syntax 20 syntax enable 21 syntax on 22 "indent 23 filetype indent on 24 set tabstop=4 25 "set expandtab 26 set shiftwidth=4 27 set formatoptions=tcrqn 28 set autoindent 29 set cindent 30 "encoding set 31 set encoding=utf-8 32 set fileencodings=ucs-bom,utf-8,cp936 33 set fileencoding=gb2312 34 set termencoding=utf-8 35 "if use ; as mapleader move with ; in normal mode will be much slower 36 "37 "let mapleader="\" 38 "map * / # 39 xnoremap * : call VSetSearch() / =@/ 40 xnoremap # : call VSetSearch() ? =@/ 41 function! s:VSetSearch() 42 let temp = @s 43 norm! gv"sy 44 let @/ = '\V' . substitute(escape(@s, '/\'), '\n', '\\n', 'g') 45 let @s = temp 46 endfunction 47 "add cmd :Qargs 48 command! -nargs=0 -bar Qargs execute 'args' QuickfixFilenames() 49 function! QuickfixFilenames() 50 let buffer_numbers = {} 51 for quickfix_item in getqflist() 52 let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr']) 53 endfor 54 return join(map(values(buffer_numbers), 'fnameescape(v:val)')) 55 endfunction 56 "remap curosr move key in insert mode 57 imap 58 imap 59 cnoremap 60 cnoremap 61 cnoremap %% getcmdtype() == ':' expand('%:h').'/' : '%%' 62 "cscope 63 map a :cs add ./cscope.out ./ 64 nmap c :cs find c =expand(" ") 65 nmap d :cs find g =expand(" ") 66 nmap i :cs find i =expand(" ") 67 nmap f :cs find f =expand(" ") 68 nmap s :cs find s =expand(" ") 69 "minibufexplorer 70 let g:miniBufExplMapCTabSwitchBufs = 1 71 "damn secureCRT block so remap another key here 72 nmap 73 nmap 74 "other option not use for now 75 "let g:miniBufExplMapWindowNavVim = 1 76 "let g:miniBufExplMapWindowNavArrows = 1 77 "let g:miniBufExplModSelTarget = 1 78 "grep.vim 79 let Grep_Default_Options = '-rin' 80 let Grep_Default_Filelist = './' 81 let Grep_Skip_Files = '*.o *.dep' 82 "pathogen 83 call pathogen#infect() 84 call pathogen#helptags() 85 "A.vim 86 nmap q :A! 87 nmap w :AV! 88 nmap e :AS! 89 "NERDTree 90 nmap 1 :NERDTreeToggle 91 let g:NERDTreeWinPos="left" 92 let g:NERDTreeWinSize=30 93 let g:NERDTreeShowLineNumber=1 94 let g:neocomplcache_enable_at_startup=1 95 "Syntastic 96 "set statusline+=%#warningmsg# 97 "set statusline+=%{SyntasticStatuslineFlag()} 98 "set statusline+=%* 99 "let g:syntastic_always_populate_loc_list = 1 100 "let g:syntastic_auto_loc_list = 1 101 "let g:syntastic_check_on_open = 1 102 "let g:syntastic_check_on_wq = 0 103