vimrc 配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | "============Vundle Setting Start============ set shell= /bin/bash set t_Co=256 set nocompatible " be iMproved, required set hidden set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 set termencoding=utf-8 set encoding=utf-8 filetype off " required set rtp+=~/.vim /bundle/vundle/ call vundle #begin() " let Vundle manage Vundle, required Plugin 'gmarik/Vundle.vim' " plugin from http: //vim-scripts .org /vim/scripts .html Plugin 'L9' Plugin 'taglist.vim' Plugin 'vim-airline' " plugin on GitHub repo " julia part Plugin 'JuliaEditorSupport/julia-vim' " go part Plugin 'fatih/vim-go' " normal part Plugin 'ervandew/supertab' Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdcommenter' Plugin 'scrooloose/syntastic' Plugin 'Shougo/neocomplcache' Plugin 'mhinz/vim-startify' Plugin 'kien/ctrlp.vim' Plugin 'godlygeek/tabular' Plugin 'tomtom/tcomment_vim' Plugin 'Lokaltog/vim-easymotion' Plugin 'tpope/vim-surround' Plugin 'tpope/vim-repeat' Plugin 'Valloric/YouCompleteMe' Plugin 'majutsushi/tagbar' Plugin 'edkolev/tmuxline.vim' Plugin 'powerline/powerline' Plugin 'puremourning/vimspector' "Plugin 'Lokaltog/vim-powerline' Bundle 'vim-ctrlspace/vim-ctrlspace' "Bundle 'luochen1990/rainbow' "Plugin 'kien/rainbow_parentheses.vim' "Plugin 'SirVer/ultisnips' " Snippets are separated from the engine. Add this if you want them: Plugin 'honza/vim-snippets' Plugin 'altercation/vim-colors-solarized' "solarize主题 Plugin 'drmingdrmer/xptemplate' Plugin '2072/PHP-Indenting-for-VIm' "PHP缩进 "Bundle 'yonchu/accelerated-smooth-scroll' "Bundle 'tacahiroy/ctrlp-funky' "Bundle 'Raimondi/delimitMate' Plugin 'CodeFalling/fcitx-vim-osx' Plugin 'MarcWeber/vim-addon-mw-utils' "Plugin 'tomtom/tlib_vim' Plugin 'garbas/vim-snipmate' " python part "Plugin 'isnowfy/python-vim-instant-markdown' "Plugin 'jtratner/vim-flavored-markdown' "Plugin 'suan/vim-instant-markdown' "Plugin 'nelstrom/vim-markdown-preview' "python sytax checker "Plugin 'vim-scripts/Pydiction' "Plugin 'hdima/python-syntax' "Plugin 'w0rp/ale' "Plugin 'google/yapf' "Plugin 'fisadev/vim-isort' " weiluo part Plugin 'tell-k/vim-autopep8' " markdown part" Plugin 'shougo/neocomplete' Plugin 'ferrine/md-img-paste.vim' "add javascript vim Plugin 'pangloss/vim-javascript' "下面是 vundle的一些命令等会尔会用到 " " " Brief help " :BundleList - list configured bundles " :BundleInstall(!) - install (update) bundles " :BundleSearch(!) foo - search(or refresh cache first) for foo " :BundleClean(!) - confirm(or auto-approve) removal of unused " bundles " " see :h vundle for more details or wiki for FAQ " NOTE: comments after Bundle command are not allowed. " git repos on your local machine (i.e. when working on your own plugin) "Plugin 'file:///home/gmarik/path/to/plugin' call vundle #end() " required "============Vundle Setting End============ filetype plugin indent on "允许插件 filetype on " enables filetype detection filetype plugin on " enables filetype specific plugins set laststatus=2 let g:Powerline_symbols= 'unicode' map <F3> :NERDTreeMirror<CR> map <F3> :NERDTreeToggle<CR> if v :lang =~ "utf8$" || v :lang =~ "UTF-8$" set fileencodings=utf-8,latin1 endif set nocompatible " Use Vim defaults (much better!) set bs=indent,eol,start " allow backspacing over everything in insert mode "set ai " always set autoindenting on "set backup " keep a backup file set viminfo= '20,\"50 " read/write a .viminfo file, don' t store more " than 50 lines of registers set history =50 " keep 50 lines of command line history set ruler " show the cursor position all the time set nu " Only do this part when compiled with support for autocommands if has( "autocmd" ) augroup redhat " In text files, always limit the width of text to 78 characters autocmd BufRead *.txt set tw=78 " When editing a file , always jump to the last cursor position autocmd BufReadPost * \ if line( "'\"" ) > 0 && line ( "'\"" ) <= line( "$" ) | \ exe "normal! g'\"" | \ endif augroup END endif if has( "cscope" ) && filereadable( "/usr/bin/cscope" ) set csprg= /usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable( "cscope.out" ) cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has( "gui_running" ) syntax on set hlsearch endif " let g:syntastic_php_checkers = [ 'php' , 'phpcs' , 'phpmd' ] "if &term==" xterm" " set t_Co=8 " set t_Sb=m " set t_Sf=m "endif hi Comment ctermfg=darkgreen " set fileencodings=utf-8,gb2312,gbk set fileformats=unix " set encoding=prc set mouse=a " set ttymouse=xterm2 "behave xterm " set selectmode=mouse set termencoding=utf-8 set encoding=utf-8 "设置gvim内部编码 set fileencoding=utf-8 "设置当前文件编码 set fileencodings=ucs-bom,utf-8,gbk,cp936,latin-1 "设置支持打开的文件编码 " 文件格式,默认 ffs=dos,uni " set fileformat=unix " 设置新文件的<EOL>格式 " set fileformats=unix,dos,mac " 给出文件的<EOL>格式类 " snippets " Trigger configuration. Do not use <tab> if you use " https: //github .com /Valloric/YouCompleteMe . let g:UltiSnipsExpandTrigger= "<c-j>" let g:UltiSnipsJumpForwardTrigger= "<c-b>" let g:UltiSnipsJumpBackwardTrigger= "<c-z>" " If you want :UltiSnipsEdit to split your window. let g:UltiSnipsEditSplit= "vertical" let g:snips_author= 'Orpheus' let g:author= 'Orpheus' let g:snips_email= '1024245303@qq.com' let g:snipMate = { 'snippet_version' : 1 } " powerline set guifont=Source\ Code\ Pro\ for \ Powerline:h14 set nocompatible set laststatus=2 let g:Powerline_symbols = 'fancy' let Powerline_symbols= 'compatible' let g:airline_enabled = 1 let g:airline_powerline_fonts = 1 " 关闭状态显示空白符号计数,这个对我用处不大" let g:airline #extensions#whitespace#enabled = 0 let g:airline #extensions#whitespace#symbol = '!' let g:tmuxline_preset = { \ 'a' : '#S' , \ 'b' : '#W' , \ 'c' : '#H' , \ 'win' : '#I #W' , \ 'cwin' : '#I #W' , \ 'x' : '%a' , \ 'y' : '#W %R' , \ 'z' : '#H' } ":inoremap ( ()<ESC>i<SPACE><SPACE><BACKSPACE><BACKSPACE> ":inoremap [ []<ESC>i ":inoremap { {}<ESC>i ":inoremap " "" <ESC>i ":inoremap ' ' '<ESC>i "" "" "" "" " if $TMUX == '' " set clipboard+=unnamed "endif set clipboard=unnamed "将系统剪贴板指定到匿名寄存器中 使vim共享数据 "" "" "" "" let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 let g:miniBufExplMoreThanOne = 0 " MiniBufExpl Colors hi MBENormal guifg= #808080 guibg=fg hi MBEChanged guifg= #CD5907 guibg=fg hi MBEVisibleNormal guifg= #5DC2D6 guibg=fg hi MBEVisibleChanged guifg= #F1266F guibg=fg hi MBEVisibleActiveNormal guifg= #A6DB29 guibg=fg hi MBEVisibleActiveChanged guifg= #F1266F guibg=fg "" "" "" "" "" "" "" "" "" filetype plugin indent on "启用缩进 set smartindent "启用智能对齐方式 set expandtab "将Tab键转换为空格 set tabstop=4 "设置Tab键的宽度 set shiftwidth=4 "换行时自动缩进4个空格 set smarttab "指定按一次backspace就删除shiftwidth宽度的空格 "set foldenable " 启用折叠 "set foldmethod=indent " indent 折叠方式 set autochdir "" "" "" "" "< TagList 插件配置 > "----------------------------------------------------------------------------- " 高效地浏览源码, 其功能就像vc中的workpace " 那里面列出了当前文件中的所有宏,全局变量, 函数名等 " 常规模式下输入 tl 调用插件,如果有打开 Tagbar 窗口则先将其关闭 set tags=. /tags ,tags;$HOME nmap tl :TagbarClose<CR>:Tlist<CR> let Tlist_Show_One_File=1 "只显示当前文件的tags " let Tlist_Enable_Fold_Column=0 " 使taglist插件不显示左边的折叠行 let Tlist_Exit_OnlyWindow=1 "如果Taglist窗口是最后一个窗口则退出Vim let Tlist_File_Fold_Auto_Close=1 "自动折叠 let Tlist_WinWidth=30 "设置窗口宽度 let Tlist_Use_Right_Window=1 "在右侧窗口中显示 let mapleader= ',' if exists( ":Tabularize" ) nmap <Leader>a= :Tabularize /=<CR> vmap <Leader>a= :Tabularize /=<CR> nmap <Leader>a: :Tabularize /:\zs<CR> vmap <Leader>a: :Tabularize /:\zs<CR> endif "ctrlp config " let g:ctrlp_working_path_mode = 'ra' let g:ctrlp_map = '<c-p>' let g:ctrlp_cmd = 'CtrlP' map <leader>f :CtrlPMRU<CR> let g:ctrlp_user_command = 'find %s -type f' let g:ctrlp_working_path_mode = 0 let g:ctrlp_match_window_reversed=0 set wildignore+=* /tmp/ *,* /node_modules/ *,*.so,*.swp,*.zip let g:ctrlp_custom_ignore = { 'dir' : '\v[\/]\.(git|hg|svn)$' , 'file' : '\v\.(exe|so|dll)$' } noremap <C-a> :CtrlP ~<CR> "tagbar config nmap <F9> :TagbarToggle<CR> " 启动时自动focus let g:tagbar_autofocus = 1 " for php, delete if you do not need let g:tagbar_type_ps1 = { \ 'ctagstype' : 'powershell' , \ 'kinds' : [ \ 'f:function' , \ 'i:filter' , \ 'a:alias' \ ] \ } "YouCompleteMe " Enable debugging let g:ycm_keep_logfiles = 1 let g:ycm_log_level = 'debug' " If the base settings don't repro, paste your existing config for YCM only, " here: " let g:ycm_.... " Load YCM (only) let &rtp .= ',' . expand ( '<sfile>:p:h' ) filetype plugin indent on "funcy config noremap <Leader>fu :CtrlPFunky<Cr> " narrow the list down with a word under cursor nnoremap <Leader>fU :execute 'CtrlPFunky ' . expand ( '<cword>' )<Cr> let g:ctrlp_funky_syntax_highlight = 1 let g:ctrlp_extensions = [ 'funky' ] "dalimitMate config " 自动补全单引号,双引号等 " for python docstring " , 特别有用 au FileType python let b:delimitMate_nesting_quotes = [ '"' ] " 关闭某些类型文件的自动补全 "au FileType mail let b:delimitMate_autoclose = 0 " let g:ycm_server_python_interpreter= '/Users/wangzenan/miniconda3/bin/python' let g:ycm_global_ycm_extra_conf= '~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py' "nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR> "" "" "" "" "" "" "" "" "" "" "" "Quickly Run "" "" "" "" "" "" "" "" "" "" "" map <F5> :call CompileRunGcc()<CR> func! CompileRunGcc() exec "w" if &filetype == 'c' exec "!g++ % -o %<" exec "!time ./%<" elseif &filetype == 'cpp' exec "!g++ % -o %<" exec "!time ./%<" elseif &filetype == 'java' exec "!javac %" exec "!time java %<" elseif &filetype == 'sh' :! time bash % elseif &filetype == 'python' exec "!time python3.6 %" elseif &filetype == 'html' exec "!firefox % &" elseif &filetype == 'go' " exec " !go build %<" exec "!time go run %" elseif &filetype == 'mkd' exec "!~/.vim/markdown.pl % > %.html &" exec "!firefox %.html &" endif endfunc let g:ycm_global_ycm_extra_conf= '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py' |
成功没有捷径
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具