不定期更新這篇,因為查詢到好用的設定或者插件就會更新自己的設定。
1 "set nocompatible 2 let $LANG=‘zh_TW.UTF-8‘ 3 set langmenu=zh_tw.utf-8 4 set encoding=utf-8 5 source $VIMRUNTIME/vimrc_example.vim 6 source $VIMRUNTIME/mswin.vim 7 behave mswin 8 9 set diffexpr=MyDiff() 10 function MyDiff() 11 let opt = ‘-a --binary ‘ 12 if &diffopt =~ ‘icase‘ | let opt = opt . ‘-i ‘ | endif 13 if &diffopt =~ ‘iwhite‘ | let opt = opt . ‘-b ‘ | endif 14 let arg1 = v:fname_in 15 if arg1 =~ ‘ ‘ | let arg1 = ‘"‘ . arg1 . ‘"‘ | endif 16 let arg2 = v:fname_new 17 if arg2 =~ ‘ ‘ | let arg2 = ‘"‘ . arg2 . ‘"‘ | endif 18 let arg3 = v:fname_out 19 if arg3 =~ ‘ ‘ | let arg3 = ‘"‘ . arg3 . ‘"‘ | endif 20 let eq = ‘‘ 21 if $VIMRUNTIME =~ ‘ ‘ 22 if &sh =~ ‘\<cmd‘ 23 let cmd = ‘""‘ . $VIMRUNTIME . ‘\diff"‘ 24 let eq = ‘"‘ 25 else 26 let cmd = substitute($VIMRUNTIME, ‘ ‘, ‘" ‘, ‘‘) . ‘\diff"‘ 27 endif 28 else 29 let cmd = $VIMRUNTIME . ‘\diff‘ 30 endif 31 silent execute ‘!‘ . cmd . ‘ ‘ . opt . arg1 . ‘ ‘ . arg2 . ‘ > ‘ . arg3 . eq 32 endfunction 33 34 35 "------------------------------------------- 36 " < Vundle > 37 "------------------------------------------- 38 filetype off 39 set rtp+=$VIM/vimfiles/bundle/Vundle.vim 40 call vundle#begin(‘$VIM/vimfiles/bundle/‘) 41 Plugin ‘gmarik/Vundle.vim‘ 42 Plugin ‘L9‘ 43 Plugin ‘scrooloose/nerdtree‘ 44 Bundle ‘Valloric/YouCompleteMe‘ 45 Bundle ‘scrooloose/nerdcommenter‘ 46 Bundle ‘majutsushi/tagbar‘ 47 Bundle ‘ctrlpvim/ctrlp.vim‘ 48 Bundle ‘chazy/cscope_maps‘ 49 Bundle ‘vim-airline/vim-airline‘ 50 Bundle ‘tomasr/molokai‘ 51 52 call vundle#end() 53 filetype plugin indent on 54 55 "------------------------------------------- 56 " < Cscope 配置 > 57 "------------------------------------------- 58 nnoremap <F6> :!cscope -Rbk <CR> 59 nnoremap <F7> :cs add cscope.out 60 set cscopetag 61 62 "------------------------------------------- 63 " < YouCompleteMe 配置 > 64 "------------------------------------------- 65 let g:ycm_global_ycm_extra_conf =‘D:\Program Files\Vim\vimfiles\bundle\YouCompleteMe\third_party\ycmd\cpp\ycm\.ycm_extra_conf.py‘ 66 let g:ycm_complete_in_comments=1 67 let g:ycm_seed_identifiers_with_syntax=1 68 69 nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR> 70 nnoremap <leader>gf :YcmCompleter GoToDefinition<CR> 71 nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR> 72 nmap <F4> :YcmDiags<CR> 73 set completeopt=longest,menu 74 75 let g:ycm_filetype_blacklist = { 76 \ ‘tagbar‘ : 1, 77 \ ‘qf‘ : 1, 78 \ ‘notes‘ : 1, 79 \ ‘markdown‘ : 1, 80 \ ‘unite‘ : 1, 81 \ ‘text‘ : 1, 82 \ ‘vimwiki‘ : 1, 83 \ ‘pandoc‘ : 1, 84 \ ‘infolog‘ : 1, 85 \ ‘mail‘ : 1, 86 \ ‘mundo‘: 1, 87 \ ‘fzf‘: 1, 88 \ ‘ctrlp‘ : 1 89 \} 90 91 92 "------------------------------------------- 93 " < airline > 94 "------------------------------------------- 95 "let g:airline#extensions#tabline#enabled = 1 96 97 "------------------------------------------- 98 " < ctag > 99 "------------------------------------------- 100 nnoremap <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR> 101 "nnoremap <F5> :!ctags --tag-relative=yes -f D:\Program Files\Vim --c++-kinds=+p --fields=+iaS --extra=+q -R *<CR> 102 103 "D:\Program Files\Vim\vimfiles\bundle\ctags 104 "nnoremap <F5> :!ctags -R -f D:\Program Files\Vim\tags\tags_self -R *<CR> 105 set autochdir 106 set tags=tags; 107 "set tags=./tags;../tags;../../tags;../../../tags;../../../../tags;../../../../../tags;../../../../../tags; 108 "set tags=./tags,tags; 109 "set tags=$Vim\tags\tags_self; 110 111 "------------------------------------------- 112 " < cscope > 113 "------------------------------------------- 114 nmap fa :cs find a <C-R>=expand("<cword>")<CR><CR> 115 nmap fc :cs find c <C-R>=expand("<cword>")<CR><CR> 116 nmap fd :cs find d <C-R>=expand("<cword>")<CR><CR> 117 nmap fe :cs find e <C-R>=expand("<cword>")<CR><CR> 118 nmap fg :cs find g <C-R>=expand("<cword>")<CR><CR> 119 nmap fi :cs find i <C-R>=expand("<cfile>")<CR><CR> 120 nmap fs :cs find s <C-R>=expand("<cword>")<CR><CR> 121 nmap ft :cs find t <C-R>=expand("<cword>")<CR><CR> 122 nmap ff :cs find f <C-R>=expand("<cfile>")<CR><CR> 123 124 "------------------------------------------- 125 " < CTRLP 配置 > 126 "------------------------------------------- 127 let g:ctrlp_map = ‘<c-p>‘ 128 let g:ctrlp_cmd = ‘CtrlP‘ 129 let g:ctrlp_working_path_mode = 1 130 131 "------------------------------------------- 132 " < NERDTree 配置 > 133 "------------------------------------------- 134 nmap <F2> :NERDTreeToggle <CR> 135 autocmd VimEnter * NERDTree 136 137 138 "------------------------------------------- 139 " < TagBar 配置 > 140 "------------------------------------------- 141 map <F9> :TagbarToggle<CR> "TagBar toggle 142 autocmd VimEnter * Tagbar 143 let g:tagbar_ctags_bin = ‘D:\Program Files\ctags58\ctags.exe‘ 144 145 "------------------------------------------- 146 " < 不備份檔案設定 > 147 "------------------------------------------- 148 set nobackup 149 set noundofile 150 set noswapfile 151 152 153 "------------------------------------------- 154 " < 介面設定 > 155 "------------------------------------------- 156 set guifont=Consolas "設定自型 157 set t_Co=256 158 set nu "設定行號 159 set incsearch "搜尋關鍵字高亮度 160 set ai 161 set cursorline "顯示cursorline 162 set tabstop=4 163 set shiftwidth=4 164 set ignorecase "搜尋時忽略大小寫 165 syntax on "語法高亮度 166 "set bg=light 167 "colorscheme koehler 168 "colorscheme gruvbox 169 colorscheme molokai "Git download 170 set laststatus=2 "set status line 171 set columns=180 172 set lines=50 173 174 "------------------------------------------- 175 " < 自定義快捷鍵 > 176 "------------------------------------------- 177 :nmap ,s :e $VIM/_vimrc 178 :imap ( ()<ESC>i 179 :imap { {<CR>}<ESC>O 180 :imap [ []<ESC>i 181 :imap aa <C-N> 182 ":imap jk <esc> 183 :nmap qw <C-Q> 184 :nmap jp <C-W> 185 186 187 ":map --> (normal/visual/operator pending) 188 ":nmap --> (normal) 189 ":vmap --> (visual) 190 ":omap --> (operator pending) 191 ":imap --> (insert) 192 ":cmap --> (command line) 193 "Ctrl --> <C-xxx> 194 "Alt --> <M-xxx>
时间: 2024-11-06 03:36:01