1 Star 2 Fork 0

Eplankton/easyVim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
.vimrc 4.75 KB
一键复制 编辑 原始数据 按行查看 历史
Eplankton 提交于 2022-06-13 17:52 . zhao
" 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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Eplankton/easy-vim.git
git@gitee.com:Eplankton/easy-vim.git
Eplankton
easy-vim
easyVim
master

搜索帮助