add vim
This commit is contained in:
parent
b99f91af13
commit
f47cd29f54
161
vim/.vimrc
Normal file
161
vim/.vimrc
Normal file
@ -0,0 +1,161 @@
|
||||
" Plugins
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" Themes, visual elements
|
||||
Plug 'dracula/vim', { 'as': 'dracula' }
|
||||
Plug 'itchyny/lightline.vim'
|
||||
|
||||
" Symlink
|
||||
Plug 'aymericbeaumet/vim-symlink'
|
||||
|
||||
" Code completion
|
||||
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
|
||||
Plug 'phpactor/phpactor', {'for': 'php', 'branch': 'master', 'do': 'composer install --no-dev -o'}
|
||||
|
||||
" Debugging
|
||||
Plug 'puremourning/vimspector'
|
||||
|
||||
" Git
|
||||
Plug 'tpope/vim-fugitive', { 'tag': 'v3.2' }
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
|
||||
" NERDTree
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
|
||||
call plug#end()
|
||||
|
||||
syntax on
|
||||
|
||||
colorscheme dracula
|
||||
|
||||
" Indentation
|
||||
filetype plugin indent on
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set autoindent
|
||||
set smartindent
|
||||
|
||||
" Lightline
|
||||
set laststatus=2
|
||||
set cmdheight=2
|
||||
|
||||
" Line numbers
|
||||
set number
|
||||
set relativenumber
|
||||
|
||||
" Undo
|
||||
set undofile
|
||||
set undodir=~/.vim/undo
|
||||
set undolevels=1024
|
||||
|
||||
" Backup
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" updatetime
|
||||
set updatetime=450
|
||||
|
||||
" NERDTree
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
|
||||
map <C-n> :NERDTreeToggle<CR>
|
||||
|
||||
" Code completion
|
||||
set hidden
|
||||
set shortmess+=c
|
||||
set signcolumn=yes
|
||||
|
||||
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
|
||||
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
else
|
||||
inoremap <silent><expr> <c-@> coc#refresh()
|
||||
endif
|
||||
|
||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
elseif (coc#rpc#ready())
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
execute '!' . &keywordprg . " " . expand('<cword>')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
xmap ic <Plug>(coc-classobj-i)
|
||||
omap ic <Plug>(coc-classobj-i)
|
||||
xmap ac <Plug>(coc-classobj-a)
|
||||
omap ac <Plug>(coc-classobj-a)
|
||||
|
||||
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
endif
|
||||
|
||||
if has('nvim')
|
||||
vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
|
||||
vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
|
||||
endif
|
||||
|
||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
Loading…
x
Reference in New Issue
Block a user