代码拉取完成,页面将自动刷新
" init the plugins
" (<--- left pannel) wait for 'PlugInstall' command
" please quit vim after 'PlugInstall' command
" autocmd VimEnter * :PlugInstall
map <F3> :NERDTreeMirror<CR>
map <F3> :NERDTreeToggle<CR>
map <F5> :term<CR>
set previewwindow
set number
set ruler
set showcmd
set notimeout
set mouse=a
set clipboard=unnamed
set cursorline
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set cindent
set smartindent
set showmatch
set matchtime=5
" ==== plugin manager ====
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
Plug 'luochen1990/rainbow'
Plug 'mhinz/vim-startify'
Plug 'preservim/nerdcommenter'
Plug 'liuchengxu/space-vim-theme'
Plug 'morhetz/gruvbox'
" lsp
Plug 'neoclide/coc.nvim'
call plug#end()
" ==== preservim/nerdcommenter ====
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDDefaultAlign = 'left'
let g:NERDToogleCheckAllLines = 1
" ==== preservim/nerdtree ====
nnoremap <LEADER>e :NERDTreeToggle<CR>
" 当NERDTree为剩下的唯一窗口时自动关闭
" autocmd vimenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q |endif
" ==== itchyny/lightline.vim ====
set laststatus=2
if !has('gui_running')
set t_Co=256
endif
" -- INSERT -- is unnecessary anymore because the mode infomation is displayed
" in the statusline.
set noshowmode
" ==== luochen1990/rainbow ====
let g:rainbow_active = 0
" ==== neoclide/coc.nvim ====
" coc extensions
let g:coc_global_extensions = [
\ 'coc-json',
\ 'coc-tsserver',
\ 'coc-css',
\ 'coc-html',
\ 'coc-vimlsp',
\ 'coc-clangd',
\ 'coc-highlight',
\ 'coc-pyright',
\ 'coc-pairs',
\ 'coc-markdownlint'
\ ]
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" <CR> to comfirm selected candidate
" only when there's selected complete item
if exists('*complete_info')
inoremap <silent><expr> <CR> complete_info(['selected'])['selected'] != -1 ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gD :tab sp<CR><Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
function! s:generate_compile_commands()
if empty(glob('CMakeLists.txt'))
echo "Can't find CMakeLists.txt"
return
endif
if empty(glob('.vscode'))
execute 'silent !mkdir .vscode'
endif
execute '!cmake -DCMAKE_BUILD_TYPE=debug
\ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -S . -B .vscode'
endfunction
command! -nargs=0 Gcmake :call s:generate_compile_commands()
" ==== puremourning/vimspector ====
let g:vimspector_enable_mappings = 'HUMAN'
function! s:generate_vimspector_conf()
if empty(glob( '.vimspector.json' ))
if &filetype == 'c' || 'cpp'
!cp ~/.config/nvim/vimspector_conf/c.json ./.vimspector.json
elseif &filetype == 'python'
!cp ~/.config/nvim/vimspector_conf/python.json ./.vimspector.json
endif
endif
e .vimspector.json
endfunction
" C and C++ compiler:
"autocmd FileType c nnoremap <buffer> <C-i> :w <RETURN> :!gcc % -o main -g && ./main <RETURN>
"autocmd FileType cpp nnoremap <buffer> <C-i> :w <RETURN> :!g++ % -o main -g && ./main <RETURN>
" Python runner:
autocmd FileType python nnoremap <buffer> <C-i> :w <RETURN> :!python % <RETURN>
filetype plugin on
set completeopt=longest,menu
colorscheme gruvbox
set background=dark
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。