2023-08-14 07:44:10 +00:00
|
|
|
" =============== 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
|
2023-09-05 03:24:01 +00:00
|
|
|
Plug 'luochen1990/rainbow'
|
|
|
|
Plug 'navarasu/onedark.nvim'
|
2023-08-14 07:44:10 +00:00
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'} " code completion
|
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" =============== Vannila vim config ================================================
|
2023-09-13 05:55:58 +00:00
|
|
|
let mapleader = "\\"
|
2023-10-05 11:59:43 +00:00
|
|
|
set splitbelow
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
set number relativenumber
|
|
|
|
windo set nowrap
|
|
|
|
set showcmd
|
|
|
|
set mouse=a
|
2024-05-14 18:28:30 +00:00
|
|
|
set cursorline
|
2023-10-05 11:59:43 +00:00
|
|
|
set foldmethod=syntax
|
|
|
|
set updatetime=250
|
|
|
|
set tabstop=4 shiftwidth=4 smarttab
|
|
|
|
highlight Comment ctermfg=Grey
|
2023-09-13 05:55:58 +00:00
|
|
|
nnoremap <silent> <leader>p :split +term <CR>
|
|
|
|
|
|
|
|
|
|
|
|
" =============== NERDTree ================================================
|
|
|
|
" Toggle file browser
|
|
|
|
nnoremap <silent> <leader>e :NERDTreeToggle<CR>
|
|
|
|
|
|
|
|
" =============== Colors ================================================
|
2023-09-05 03:24:01 +00:00
|
|
|
let g:onedark_config = {
|
|
|
|
\ 'style': 'warmer',
|
|
|
|
\}
|
|
|
|
colorscheme onedark
|
2023-10-05 11:59:43 +00:00
|
|
|
hi CocFloating guibg=#151515 guifg=clear
|
|
|
|
hi Pmenu guibg=#151515 guifg=clear
|
|
|
|
hi @parameter guifg=#ed6215
|
|
|
|
hi CursorColumn guibg=#e2c792 guifg=#232326
|
2023-08-14 07:44:10 +00:00
|
|
|
|
|
|
|
" =============== NERDTree Config ================================================
|
2023-10-05 11:59:43 +00:00
|
|
|
let NERDTreeShowHidden=1
|
2023-09-05 03:24:01 +00:00
|
|
|
"
|
|
|
|
" =============== Rainbow Config ================================================
|
2023-10-05 11:59:43 +00:00
|
|
|
let g:rainbow_active = 1
|
2023-08-14 07:44:10 +00:00
|
|
|
|
|
|
|
" =============== COC Config ================================================
|
2023-08-20 12:41:22 +00:00
|
|
|
|
2023-08-14 07:44:10 +00:00
|
|
|
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
|
2023-09-13 05:55:58 +00:00
|
|
|
nnoremap <silent> <leader>r <Plug>(coc-rename)
|
2023-08-14 07:44:10 +00:00
|
|
|
" 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
|
|
|
|
|