init
This commit is contained in:
62
.config/nvim/init.vim
Normal file
62
.config/nvim/init.vim
Normal file
@@ -0,0 +1,62 @@
|
||||
" =============== Plugins ================================================
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
|
||||
Plug 'https://github.com/vim-airline/vim-airline' " status bset mouse=aar on the bottom
|
||||
Plug 'https://github.com/preservim/nerdtree' " file tree
|
||||
Plug 'https://github.com/airblade/vim-gitgutter' " git diff
|
||||
" Plug 'https://github.com/weilbith/nvim-code-action-menu' " fix my shit helper window :)
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'} " code completion
|
||||
|
||||
call plug#end()
|
||||
|
||||
" =============== Vannila vim config ================================================
|
||||
:set clipboard=unnamedplus
|
||||
:set relativenumber
|
||||
:windo set nowrap
|
||||
:set showcmd
|
||||
:set mouse=a
|
||||
" :set cursorline
|
||||
:set foldmethod=syntax
|
||||
:set updatetime=250
|
||||
:set tabstop=4 shiftwidth=4 smarttab
|
||||
|
||||
" =============== NERDTree Config ================================================
|
||||
:let NERDTreeShowHidden=1
|
||||
|
||||
" =============== COC Config ================================================
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Highlight the variable on hold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" coc rename
|
||||
nnoremap <silent> rr <Plug>(coc-rename)
|
||||
" Toggle file browser
|
||||
nnoremap <C-e> :NERDTreeToggle<CR>
|
||||
|
||||
" Jump between references and definiton
|
||||
nnoremap <silent> <C-k> :call CocActionAsync('jumpReferences')<CR>
|
||||
nnoremap <silent> K :call CocActionAsync('jumpDefinition')<CR>
|
||||
" show help menu
|
||||
nnoremap <C-u> :call CocActionAsync('codeAction', 'cursor')<CR>
|
||||
|
||||
|
||||
" Show Documentation
|
||||
nnoremap <silent> J :call ShowDocumentation()<CR>
|
||||
function! ShowDocumentation() " Show hover when provider exists, fallback to vim's builtin behavior.
|
||||
if CocAction('hasProvider', 'hover')
|
||||
call CocActionAsync('definitionHover')
|
||||
else
|
||||
call feedkeys('K', 'in')
|
||||
endif
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user