共享一个NOI用过的vimrc [rc][vimrc]
1 set nocp 2 set nu 3 set ru 4 set noet 5 set bs=2 6 set ts=8 7 set ss=8 8 set sw=8 9 set ai 10 set cin 11 set mouse =a 12 13 set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi 14 15 syn on 16 colo default 17 18 let cc =80 19 let g:qf=0 20 let g:hls=0 21 inoremap <S-Tab> <C-n> 22 23 func! Q() 24 if g:qf 25 let g:qf=0 26 cclose 27 else 28 let g:qf=1 29 copen 30 end 31 endfunc 32 33 func! H() 34 if g:hls 35 let g:hls=0 36 set nohls 37 else 38 let g:hls=1 39 set hls 40 end 41 endfunc 42 43 map <F1> <ESC>gT 44 map <F2> <ESC>gt 45 map <F3> <ESC>:call H()<CR> 46 map <F4> <ESC>:call Q()<CR> 47 map <F5> <ESC>:set ts=4 ss=4 sw=4<CR> 48 map <F6> <ESC>:set ts=8 ss=8 sw=8<CR> 49 map <F7> <ESC>:!gdb ./%<<CR> 50 map <F8> <ESC>:!python<CR> 51 map <F9> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> 52 map <F10> <ESC>:!./%<<CR> 53 map <F11> <ESC>:set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi<CR> 54 map <F12> <ESC>:set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++11<CR> 55 56 inoremap <F1> <ESC><ESC>gTa 57 inoremap <F2> <ESC><ESC>gta 58 inoremap <F3> <ESC><ESC>:call H()<CR>a 59 inoremap <F4> <ESC><ESC>:call Q()<CR>a 60 inoremap <F5> <ESC><ESC>:set ts=4 ss=4 sw=4<CR>a 61 inoremap <F6> <ESC><ESC>:set ts=8 ss=8 sw=8<CR>a 62 inoremap <F7> <ESC><ESC>:!gdb ./%<<CR>a 63 inoremap <F8> <ESC><ESC>:!python<CR>a 64 inoremap <F9> <ESC><ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k>a 65 inoremap <F10> <ESC><ESC>:!./%<<CR>a 66 inoremap <F11> <ESC><ESC>:set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi<CR>a 67 inoremap <F12> <ESC><ESC>:set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++11<CR>a
本rc快捷键介绍:
Ex模式下:
F1: 上一个标签页
F2: 下一个标签页
F3: 打开/关闭高亮查找
F4: 打开/关闭编译信息
F5: 调整为4格缩进
F6: 调整为8格缩进
F7: gdb调试
F8: 打开python
F9: 编译
F10: 运行
F11: 关闭-std=c++11编译选项
F12: 打开-std=c++11编译选项
插入模式:
Shift+Tab: 自动补全
Win更新版本20180120
set nocp nu ru noet bs=2 ts=8 ss=8 sw=8 ai cin mouse =a set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++11 syn on set gfn=Courier\ New:h12 colo desert let cc =80 let g:qf=0 let g:hls=0 let g:intd=0 let g:o2=0 inoremap <S-Tab> <C-n> func! Q() if g:qf let g:qf=0 cclose else let g:qf=1 copen end endfunc func! H() if g:hls let g:hls=0 set nohls else let g:hls=1 set hls end endfunc func! I() if g:intd let g:intd=0 set ts=8 ss=8 sw=8 else let g:intd=1 set ts=4 ss=4 sw=4 end endfunc func! O() if g:o2 let g:o2=0 set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++11 else let g:o2=1 set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++11\ -O2 end endfunc map <F1> <ESC>gT map <F2> <ESC>gt map <F3> <ESC>:call H()<CR> map <F4> <ESC>:call Q()<CR> map <F5> <ESC>:call I()<CR> map <F6> <ESC>:call O()<CR> map <F7> <ESC>:!start gdb ./%<<CR> map <F8> <ESC>:!start python<CR> map <F9> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> map <F10> <ESC>:!%<<CR> inoremap <F1> <ESC><ESC>gTa inoremap <F2> <ESC><ESC>gta inoremap <F3> <ESC><ESC>:call H()<CR>a inoremap <F4> <ESC><ESC>:call Q()<CR>a inoremap <F5> <ESC><ESC>:call I()<CR>a inoremap <F6> <ESC><ESC>:call O()<CR>a inoremap <F7> <ESC><ESC>:!start gdb ./%<<CR>a inoremap <F8> <ESC><ESC>:!start python<CR>a inoremap <F9> <ESC><ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k>a inoremap <F10> <ESC><ESC>:!%<<CR>a
Win更新版(带插件)20200202
" ==============Head================ let $LANG='en' set langmenu=en set enc=UTF8 source $VIMRUNTIME/defaults.vim " ==============Init Plugins================ let &pythonthreedll = 'D:\Builder\Python36-32\python36.dll' call plug#begin('~/vimfiles/plugged') Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'junegunn/limelight.vim' Plug 'justinmk/vim-sneak' Plug 'tpope/vim-commentary' Plug 'vim-scripts/taglist.vim' Plug 'danilo-augusto/vim-afterglow' Plug 'tpope/vim-fugitive' Plug 'Chiel92/vim-autoformat' Plug 'kien/rainbow_parentheses.vim' Plug 'scrooloose/nerdtree' Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'scrooloose/syntastic' Plug 'airblade/vim-gitgutter' Plug 'mbbill/fencview' Plug 'nathanaelkane/vim-indent-guides' Plug 'junegunn/fzf' Plug 'kien/ctrlp.vim' Plug 'skwp/greplace.vim' call plug#end() " ==============Plugin Config================ set rtp+='D:\\Builder\\fzf' " ================ConfigFiles============= source C:\\Users\\Nathaniel\\vimfiles\\cocrc.vim source C:\\Users\\Nathaniel\\vimfiles\\airlinerc.vim source C:\\Users\\Nathaniel\\vimfiles\\nerdgitrc.vim source C:\\Users\\Nathaniel\\vimfiles\\fzfrc.vim " ==================AirLine=================== autocmd VimResized * :AirlineRefres let g:airline#extensions#tabline#enabled = 1 " ===============AutoFormat================ let g:autoformat_retab = 1 let g:autoformat_autoindent = 1 let g:autoformat_remove_trailing_spaces = 1 " =================Rainbow================= au VimEnter * RainbowParenthesesToggle au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces au Syntax * RainbowParenthesesLoadChevrons " ===================Syntatic===================== let g:syntastic_always_populate_loc_list = 1 let g:syntastic_check_on_wq = 0 let g:syntastic_java_javac_args = "-J-Duser.language=en" au FileType python let b:syntastic_mode="passive" " ===================Syntatic===================== let g:indent_guides_enable_on_vim_startup = 1 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guifg=#444444 guibg=#202020 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guifg=#444444 guibg=#101010 " ==============CtrlP=============== let g:ctrlp_map = '<c-p>' let g:ctrlp_cmd = 'CtrlP' " ==============Customed Config================ autocmd FileType cpp setlocal commentstring=//\ %s set nocp set noet set nu set ru set noet set bs=2 set ts=4 set ss=4 set sw=4 set ai set mouse=a set lbr set wmnu set foldcolumn=4 set fdm=marker "set selectmode+=mouse filetype plugin on filetype plugin indent on set list set listchars=tab:>-,trail:~,space:. set nois "set nows set ic set smartcase "set undofile setlocal cm=blowfish2 let $LANG='en' set langmenu=en set enc=UTF8 set vb t_vb= au GuiEnter * set t_vb= set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++17 syn on set gfn=Powerline\ Consolas:h11 " set gfn=Source_Code_Pro_for_Powerline:h10 " set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h10 set t_Co=256 colo jellybeans let g:airline_theme='cool' set go-=T set go-=r set go-=L set lines=35 columns=120 set cc =80 hi ColorColumn cterm=reverse guibg=Grey30 let g:qf=0 let g:qf1=0 let g:hls=0 let g:intd=0 let g:o2=0 " ==============Func================ func! Q() if g:qf let g:qf=0 cclose else let g:qf=1 copen end endfunc func! Q1() if g:qf1 let g:qf1=0 lclose else let g:qf1=1 lopen end endfunc func! H() if g:hls let g:hls=0 set nohls else let g:hls=1 set hls end endfunc func! I() if g:intd let g:intd=0 set ts=4 ss=4 sw=4 %retab! else let g:intd=1 set ts=8 ss=8 sw=8 %retab! end endfunc func! O() if g:o2 let g:o2=0 set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++17 else let g:o2=1 set mp=g++\ %\ -o\ %<\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -O2\ -std=c++17 end endfunc " ==============Key Maps================ map <C-j> <ESC><C-w>- map <C-k> <ESC><C-w>+ map <C-h> <ESC><C-w>< map <C-l> <ESC><C-w>> map <F1> <ESC>gt map <F2> <ESC>:bn<CR> map <F3> <ESC>:call H()<CR> map <F4> <ESC>:call Q()<CR> map <C-F4> <ESC>:call Q1()<CR> map <F5> <ESC>:call I()<CR> map <F6> <ESC>:call O()<CR> au FileType c,cpp map <F7> <ESC>:!start gdb %<<CR> au FileType python map <F7> <ESC>Opdb.set_trace();<ESC>j map <F8> <ESC>:!ctags %<CR> map <F9> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> au FileType c,cpp map <F10> <ESC>:!%<<CR> au FileType python map <F10> <ESC>:!python %<CR> map <F11> <ESC>:TlistToggle<CR> map <C-F11> <ESC>:NERDTreeToggle<CR> map <F12> <ESC>:GundoToggle<CR> map <C-S-B> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> inoremap <F1> <ESC><ESC>gta inoremap <F2> <ESC><ESC>:bn<CR>a inoremap <F3> <ESC><ESC>:call H()<CR>a inoremap <F4> <ESC><ESC>:call Q()<CR>a inoremap <C-F4> <ESC><ESC>:call Q1()<CR>a inoremap <F5> <ESC><ESC>:call I()<CR>a inoremap <F6> <ESC><ESC>:call O()<CR>a au FileType c,cpp inoremap <F7> <ESC><ESC>:!start gdb %<<CR>a au FileType python inoremap <F7> <ESC><ESC>Opdb.set_trace();<ESC>jA inoremap <F8> <ESC><ESC>:!ctags %<CR> inoremap <F9> <ESC><ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k>a au FileType c,cpp inoremap <F10> <ESC><ESC>:!%<<CR>a au FileType python inoremap <F10> <ESC><ESC>:!python %<CR>a inoremap <F11> <ESC><ESC>:TlistToggle<CR> inoremap <C-F11> <ESC><ESC>:NERDTreeToggle<CR> inoremap <F12> <ESC><ESC>:GundoToggle<CR> inoremap <C-S-B> <ESC><ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k>a inoremap <S-Tab> <C-n> inoremap <C-f> <C-x><C-f> inoremap <C-l> <C-x><C-l> map gb <ESC>:bn<CR> map gB <ESC>:bN<CR> "nnoremap <C-]> "tyaw:ts <C-R>t<CR>
更新20220719
" ==============Head================ let $LANG='en' set langmenu=en set enc=UTF8 source $VIMRUNTIME/defaults.vim set rtp+=C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\ set pythonthreedll=C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\python38.dll " ==============Init Plugins================ call plug#begin('~/vimfiles/plugged') Plug 'neoclide/coc.nvim', {'branch': 'release'} "补全 Plug 'vim-airline/vim-airline' "装逼 Plug 'vim-airline/vim-airline-themes' "装逼辅助 Plug 'junegunn/limelight.vim' "装逼进阶 Plug 'justinmk/vim-sneak' "快速跳转(两个字母的f/F命令) Plug 'tpope/vim-commentary' "一键注释 Plug 'vim-scripts/taglist.vim' "函数列表 Plug 'tpope/vim-fugitive' "git 插件 Plug 'Chiel92/vim-autoformat' "代码格式化 Plug 'kien/rainbow_parentheses.vim' "彩色括号 Plug 'scrooloose/nerdtree' "目录树 Plug 'Xuyuanp/nerdtree-git-plugin' "目录树git标记 "Plug 'scrooloose/syntastic' "自动语法检查 "Plug 'dense-analysis/ale', {'branch': 'v2.6.x'} "自动语法检查 Plug 'airblade/vim-gitgutter' "git 插件 Plug 'mbbill/fencview' "自动编码 Plug 'nathanaelkane/vim-indent-guides' "交替缩进颜色 "Plug 'junegunn/fzf' "快速查找文件 Plug 'kien/ctrlp.vim' "快速查找文件+1 "Plug 'skwp/greplace.vim' "全局替换 Plug 'kshenoy/vim-signature' "书签标记 Plug 'godlygeek/tabular' "对齐 "Plug 'ycm-core/YouCompleteMe', {'branch': 'master'} "YCM补全 Plug 'adelarsq/vim-matchit' " 进阶% Plug 'octol/vim-cpp-enhanced-highlight' " C++ hl "Plug 'lervag/vimtex' " Latex支持 "Plug 'SirVer/ultisnips' " Snippet "Plug 'honza/vim-snippets' " 预置 snippet Plug 'dunstontc/vim-vscode-theme' " VS Code 主题 Plug 'altercation/vim-colors-solarized' " solarized 配色 Plug 'tacahiroy/ctrlp-funky' " 函数Ctrl-P Plug 'easymotion/vim-easymotion' " 快速移动 Plug 'sjl/gundo.vim' "撤销树 Plug 'tpope/vim-abolish' " 大小写无关替换 Plug 'tpope/vim-surround' Plug 'xolox/vim-lua-ftplugin' Plug 'xolox/vim-misc' call plug#end() " ==============Plugin Config================ "set rtp+='D:\\Builder\\fzf' " ==================airline=================== autocmd vimresized * :airlinerefres let g:airline#extensions#tabline#enabled = 1 " ===============autoformat================ let g:autoformat_retab = 1 let g:autoformat_autoindent = 1 let g:autoformat_remove_trailing_spaces = 1 " =================rainbow================= au VimEnter * RainbowParenthesesToggle au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces au Syntax * RainbowParenthesesLoadChevrons " ===================Syntatic===================== let g:syntastic_always_populate_loc_list = 1 let g:syntastic_check_on_wq = 0 let g:syntastic_java_javac_args = "-J-Duser.language=en" au FileType python let b:syntastic_mode="passive" let g:syntastic_tex_checkers = ["xelatex"] " ===================IndentGuides===================== "let g:indent_guides_enable_on_vim_startup = 1 "autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guifg=#444444 guibg=#171717 "autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guifg=#444444 guibg=#191919 " ==============CtrlP=============== let g:ctrlp_map = '<c-p>' let g:ctrlp_cmd = 'CtrlP' " ==============CtrlPFunky=============== let mapleader = " " nnoremap <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 " ==============Tlist=============== let tlist_go_settings = 'go;f:function;v:var;t:type' " ==============Ultisnip=============== let g:UltiSnipsExpandTrigger="<s-tab>" let g:UltiSnipsListSnippets="<c-tab>" let g:UltiSnipsJumpForwardTrigger="<c-j>" let g:UltiSnipsJumpBackwardTrigger="<c-k>" let g:UltiSnipsSnippetDirectories=["C:\\Users\\Admin\\vimfiles\\ultsnippets"] " ================ConfigFiles============= source C:\\Users\\Admin\\vimfiles\\nerdgitrc.vim source C:\\Users\\Admin\\vimfiles\\vimtexrc.vim source C:\\Users\\Admin\\vimfiles\\cocrc.vim source C:\\Users\\Admin\\vimfiles\\airlinerc.vim " ==============Customed Config================ autocmd FileType cpp setlocal commentstring=//\ %s set nocp set noet set nu set ru set noet set bs=2 set ts=4 set ss=4 set sw=4 set ai set mouse=a set lbr set wmnu "set rnu set foldcolumn=4 "set fdm=marker set fdm=manual "set selectmode+=mouse filetype plugin on filetype plugin indent on "set list "set listchars=tab:>-,trail:~,space:. set nois "set nows set ic set smartcase "set undofile setlocal cm=blowfish2 let $LANG='en' set langmenu=en set enc=UTF8 set vb t_vb= au GuiEnter * set t_vb= set mp=g++\ %\ -o\ %<.exe\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++17 syn on set gfn=Consolas\ NF:h11 " set gfn=Source_Code_Pro_for_Powerline:h10 " set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h10 set t_Co=256 "colo jellybeans colo dark_plus let g:airline_theme='solarized' set go-=T set go-=r set go-=L set lines=35 columns=120 set cc =80 hi ColorColumn cterm=reverse guibg=Grey30 let g:qf=0 let g:qf1=0 let g:hls=0 let g:intd=0 let g:o2=0 " ==============Func================ func! Q() if g:qf let g:qf=0 cclose else let g:qf=1 copen end endfunc func! Q1() if g:qf1 let g:qf1=0 lclose else let g:qf1=1 lopen end endfunc func! H() if g:hls let g:hls=0 set nohls else let g:hls=1 set hls end endfunc func! I() if g:intd let g:intd=0 set ts=4 ss=4 sw=4 %retab! else let g:intd=1 set ts=8 ss=8 sw=8 %retab! end endfunc func! O() if g:o2 let g:o2=0 set mp=g++\ %\ -o\ %<.exe\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -std=c++17 else let g:o2=1 set mp=g++\ %\ -o\ %<.exe\ -g\ -Wall\ -Wshadow\ -Wuninitialized\ -Winline\ -ansi\ -O2\ -std=c++17 end endfunc " ==============Key Maps================ "map <C-j> <ESC><C-w>- "map <C-k> <ESC><C-w>+ map <C-h> <ESC><C-w>< map <C-l> <ESC><C-w>> map <F1> <ESC>:bN<CR> map <F2> <ESC>:bn<CR> map <F3> <ESC>:call H()<CR> map <F4> <ESC>:call Q()<CR> map <C-F4> <ESC>:call Q1()<CR> map <F5> <ESC>:call I()<CR> map <C-F5> <ESC>:set rnu!<CR> map <F6> <ESC>:call O()<CR> au FileType c,cpp map <F7> <ESC>:!start gdb %<<CR> au FileType python map <F7> <ESC>Opdb.set_trace();<ESC>j map <F8> <ESC>:!ctags %<CR> au FileType c,cpp map <F9> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> au FileType tex map <F9> <ESC>:w<CR>:let g:qf=0<CR>:VimtexStopAll<CR>:VimtexCompile<CR>:call Q()<CR><C-w><C-k> au FileType tex map <C-F9> <ESC>:w<CR>:let g:qf=1<CR>:VimtexStopAll<CR>:call Q()<CR><C-w><C-k> au FileType java map <F9> <ESC>:!javac %<CR> au FileType c,cpp map <F10> <ESC>:!%<<CR> au FileType java map <F10> <ESC>:!java %<<CR> au FileType python map <F10> <ESC>:!python3 %<CR> au FileType tex map <F10> <ESC>:VimtexView<CR> au FileType lua map <F10> <ESC>:!lua %<CR> map <F11> <ESC>:TlistToggle<CR> au FileType tex map <F11> <ESC>:VimtexTocToggle<CR> map <C-F11> <ESC>:NERDTreeToggle<CR> map <F12> <ESC>:GundoToggle<CR> map <C-S-B> <ESC>:w<CR>:let g:qf=0<CR>:make<CR>:call Q()<CR><C-w><C-k> inoremap <C-f> <C-x><C-f> inoremap <C-l> <C-x><C-l> vnoremap <C-f> y/<C-r>0<CR> map gb <ESC>:bn<CR> map gB <ESC>:bN<CR> "nnoremap <C-]> "tyaw:ts <C-R>t<CR> "