dotfiles/.config/nvim/init.vim

150 lines
3.6 KiB
VimL
Raw Normal View History

2020-06-18 05:58:10 +00:00
" Shortcuts
map <C-o> :NERDTreeToggle<CR>
2020-08-18 03:12:49 +00:00
nnoremap <silent><nowait> <space>s :TagbarToggle<CR>
2020-06-18 05:58:10 +00:00
2020-08-18 03:12:49 +00:00
" Remove Highlight
nnoremap <esc><esc> :let @/=""<cr>
2020-06-19 02:07:10 +00:00
2020-09-04 05:42:17 +00:00
" Always show the signcolumn
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
2020-06-18 05:58:10 +00:00
2020-08-18 03:12:49 +00:00
" Required for operations modifying multiple buffers like rename.
" Used by coc.nvim
set hidden
2020-06-18 05:58:10 +00:00
2020-08-18 03:12:49 +00:00
" Set more space for displaying messages
" Used by coc.nvim
set cmdheight=2
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" C-Space triggers autocompletion
inoremap <silent><expr> <c-space> coc#refresh()
2020-09-04 05:42:17 +00:00
" coc.nvim quick fix
nmap <leader>qf <Plug>(coc-fix-current)
2020-08-18 03:12:49 +00:00
" Use tab for trigger completion with characters ahead and navigate.
" Used by coc.nvim
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 <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position.
" Used by coc.nvim
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use K to show documentation in preview window.
" Used by coc.nvim
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
" CoC Status in LightLine
" Used by coc.nvim lightline.nvim
let g:lightline = {
\ 'colorscheme': 'molokai',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'cocstatus': 'coc#status'
\ },
\ }
" Use auocmd to force lightline update.
" Used by coc.nvim lightline.nvim
autocmd User CocStatusChange,CocDiagnosticChange call lightline#update()
" Add `:Format` command to format current buffer.
" Used by coc.nvim
command! -nargs=0 Format :call CocAction('format')
" TODO: Pick and Chose the ones I want
" Mappings for CoCList
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>
2020-06-18 05:58:10 +00:00
" Plugged Plugins
call plug#begin(stdpath('data') . '/plugged')
2020-08-29 18:38:14 +00:00
" Activity Tracking
" Plug 'ActivityWatch/aw-watcher-vim'
2020-08-29 18:38:14 +00:00
2020-06-18 05:58:10 +00:00
" One Dark Theme
Plug 'joshdick/onedark.vim'
2020-06-19 02:07:10 +00:00
" Monokai Theme
Plug 'tomasr/molokai'
2020-06-18 05:58:10 +00:00
" Tender Theme
Plug 'jacoborus/tender.vim'
" Powerline Bar at bottom of screen
Plug 'itchyny/lightline.vim'
2020-08-18 03:12:49 +00:00
" Autocomplete
Plug 'neoclide/coc.nvim', {'branch': 'release'}
2020-06-18 05:58:10 +00:00
" Scope Tags
Plug 'majutsushi/tagbar'
" Rust Support
Plug 'rust-lang/rust.vim'
2020-08-18 03:12:49 +00:00
" TOML Support
Plug 'toml-lang/toml'
2020-06-19 02:07:10 +00:00
" Fuzzy Search
Plug 'junegunn/fzf'
2020-06-18 05:58:10 +00:00
" Multiple Cursors
Plug 'terryma/vim-multiple-cursors'
" File Browser
Plug 'preservim/nerdtree'
" NerdTree Icons (Should be last according to docs)
Plug 'ryanoasis/vim-devicons'
2020-06-19 02:07:10 +00:00
" Better Rust Synatax Highlighting
Plug 'arzg/vim-rust-syntax-ext'
2020-09-04 05:42:17 +00:00
" Auto-close brackets
Plug 'jiangmiao/auto-pairs'
2020-06-18 05:58:10 +00:00
call plug#end()
" Autosave with rust-fmt (Rust Only)
let g:rustfmt_autosave = 1
" Configuration
set noshowmode " Not Needed because we have Lightline
2020-06-19 02:07:10 +00:00
colorscheme molokai