dotfiles/.config/nvim/init.vim

85 lines
2.7 KiB
VimL

" =============== 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 'luochen1990/rainbow'
Plug 'navarasu/onedark.nvim'
" 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 ================================================
let mapleader = "\\"
:set splitbelow
:set clipboard=unnamedplus
:set number relativenumber
:windo set nowrap
:set showcmd
:set mouse=a
" :set cursorline
:set foldmethod=syntax
:set updatetime=250
:set tabstop=4 shiftwidth=4 smarttab
:highlight Comment ctermfg=Grey
nnoremap <silent> <leader>p :split +term <CR>
" =============== NERDTree ================================================
" Toggle file browser
nnoremap <silent> <leader>e :NERDTreeToggle<CR>
" =============== Colors ================================================
let g:onedark_config = {
\ 'style': 'warmer',
\}
colorscheme onedark
:hi CocFloating guibg=#151515 guifg=clear
:hi Pmenu guibg=#151515 guifg=clear
:hi @parameter guifg=#ed6215
:hi CursorColumn guibg=#e2c792 guifg=#232326
" =============== NERDTree Config ================================================
:let NERDTreeShowHidden=1
"
" =============== Rainbow Config ================================================
:let g:rainbow_active = 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> <leader>r <Plug>(coc-rename)
" 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