137 lines
3.3 KiB
VimL
137 lines
3.3 KiB
VimL
" Shortcuts
|
|
map <C-o> :NERDTreeToggle<CR>
|
|
nnoremap <silent><nowait> <space>s :TagbarToggle<CR>
|
|
|
|
" Remove Highlight
|
|
nnoremap <esc><esc> :let @/=""<cr>
|
|
|
|
|
|
" Required for operations modifying multiple buffers like rename.
|
|
" Used by coc.nvim
|
|
set hidden
|
|
|
|
" 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()
|
|
|
|
" 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>
|
|
|
|
|
|
" Plugged Plugins
|
|
call plug#begin(stdpath('data') . '/plugged')
|
|
" Activity Tracking
|
|
Plug 'ActivityWatch/aw-watcher-vim'
|
|
|
|
" One Dark Theme
|
|
Plug 'joshdick/onedark.vim'
|
|
|
|
" Monokai Theme
|
|
Plug 'tomasr/molokai'
|
|
|
|
" Tender Theme
|
|
Plug 'jacoborus/tender.vim'
|
|
|
|
" Powerline Bar at bottom of screen
|
|
Plug 'itchyny/lightline.vim'
|
|
|
|
" Autocomplete
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
" Scope Tags
|
|
Plug 'majutsushi/tagbar'
|
|
|
|
" Rust Support
|
|
Plug 'rust-lang/rust.vim'
|
|
|
|
" TOML Support
|
|
Plug 'toml-lang/toml'
|
|
|
|
" Fuzzy Search
|
|
Plug 'junegunn/fzf'
|
|
|
|
" Multiple Cursors
|
|
Plug 'terryma/vim-multiple-cursors'
|
|
|
|
" File Browser
|
|
Plug 'preservim/nerdtree'
|
|
|
|
" NerdTree Icons (Should be last according to docs)
|
|
Plug 'ryanoasis/vim-devicons'
|
|
|
|
" Better Rust Synatax Highlighting
|
|
Plug 'arzg/vim-rust-syntax-ext'
|
|
|
|
call plug#end()
|
|
|
|
" Autosave with rust-fmt (Rust Only)
|
|
let g:rustfmt_autosave = 1
|
|
|
|
" Configuration
|
|
set noshowmode " Not Needed because we have Lightline
|
|
colorscheme molokai
|