共享一个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:BuilderPython36-32python36.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>
View Code
原文地址:https://www.cnblogs.com/Gster/p/6879674.html