nvim: LSP cleanup and refactor
LSP does not work all the time. Either client breaks, server breaks or it does not work because of the project structure. Removing LSP for the umpteenth time. asyncomplete does not seem to work at all for tags. For example, in the gst-build directory the generated tags file can be 200MB+ in size. Even with the file size limit set to unlimited it does not seem to give any tag suggestions at all. Same is the case for Haskell. Mucomplete can be slow in such cases where tag file is very large or search space is extensively large and being synchronous this is to be expected. To alleviate this, it is necessary to have a minimum prefix length of 2 and perhaps trigger completion only when required. However, this was still not good enough. We are back to deoplete with custom source configuration. It is pretty clear vimscript solutions are not up to the mark. Enable python provider and also reintroduce language specific solutions like racer and jedi. Refactor out language/file type specific settings. init.vim should only have global keybindings, plugins and plugin settings. Also some other minor cleanups, additions and rearrangements. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
68c61a7a1c
commit
932e3ffc42
12 changed files with 212 additions and 297 deletions
15
nvim/.config/nvim/after/ftplugin/c.vim
Normal file
15
nvim/.config/nvim/after/ftplugin/c.vim
Normal file
|
@ -0,0 +1,15 @@
|
|||
nmap <LocalLeader>ct :NeomakeSh ctags -R .<CR>
|
||||
nmap <LocalLeader>cu :NeomakeSh cscope -bqR<CR>
|
||||
nmap <LocalLeader>cr :cs reset<CR>
|
||||
|
||||
nmap <silent> <LocalLeader>s <Plug>(quickr_cscope_symbols)
|
||||
nmap <silent> <LocalLeader>g <Plug>(quickr_cscope_global)
|
||||
nmap <silent> <LocalLeader>h <Plug>(quickr_cscope_global_split)
|
||||
nmap <silent> <LocalLeader>v <Plug>(quickr_cscope_global_vert_split)
|
||||
nmap <silent> <LocalLeader>d <Plug>(quickr_cscope_functions)
|
||||
nmap <silent> <LocalLeader>c <Plug>(quickr_cscope_callers)
|
||||
nmap <silent> <LocalLeader>t <Plug>(quickr_cscope_text)
|
||||
nmap <silent> <LocalLeader>e <Plug>(quickr_cscope_egrep)
|
||||
nmap <silent> <LocalLeader>f <Plug>(quickr_cscope_files)
|
||||
nmap <silent> <LocalLeader>i <Plug>(quickr_cscope_includes)
|
||||
nmap <silent> <LocalLeader>a <Plug>(quickr_cscope_assignments)
|
6
nvim/.config/nvim/after/ftplugin/cpp.vim
Normal file
6
nvim/.config/nvim/after/ftplugin/cpp.vim
Normal file
|
@ -0,0 +1,6 @@
|
|||
let g:cpp_class_scope_highlight = 1
|
||||
let g:cpp_member_variable_highlight = 1
|
||||
let g:cpp_class_decl_highlight = 1
|
||||
let g:cpp_posix_standard = 1
|
||||
let g:cpp_concepts_highlight = 1
|
||||
|
1
nvim/.config/nvim/after/ftplugin/gitcommit.vim
Normal file
1
nvim/.config/nvim/after/ftplugin/gitcommit.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal spell textwidth=72
|
82
nvim/.config/nvim/after/ftplugin/haskell.vim
Normal file
82
nvim/.config/nvim/after/ftplugin/haskell.vim
Normal file
|
@ -0,0 +1,82 @@
|
|||
" https://www.reddit.com/r/neovim/comments/es8wn7/haskell_makeprg_for_stack_build/
|
||||
" https://github.com/maxigit/vimrc/tree/2020/compiler
|
||||
compiler stack
|
||||
setlocal makeprg=stack\ build
|
||||
setlocal keywordprg=:Hoogle
|
||||
nmap <LocalLeader>b :Neomake!<CR>
|
||||
nmap <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
|
||||
nmap <LocalLeader>td :NeomakeSh stack exec -- haskdogs<CR>
|
||||
nmap <LocalLeader>g :Ghcid<CR>
|
||||
nmap <LocalLeader>k :GhcidKill<CR>
|
||||
nmap <LocalLeader>c :HoogleClose<CR>
|
||||
nmap <LocalLeader>o :exe ':Hoogle ' . expand('<cword>')<CR>
|
||||
nmap <LocalLeader>i :exe ':HoogleInfo ' . expand('<cword>')<CR>
|
||||
|
||||
" Tabular helpers
|
||||
vnoremap <Leader>= :Tabularize /=<CR>
|
||||
vnoremap <Leader>- :Tabularize /-><CR>
|
||||
vnoremap <Leader>< :Tabularize /<-<CR>
|
||||
vnoremap <Leader>, :Tabularize /,<CR>
|
||||
vnoremap <Leader># :Tabularize /#-}<CR>
|
||||
vnoremap <Leader>: :Tabularize /::<CR>
|
||||
vnoremap <Leader>[ :Tabularize /[<CR>
|
||||
|
||||
nmap <buffer><silent> ]] :call JumpHaskellFunction(0)<CR>
|
||||
nmap <buffer><silent> [[ :call JumpHaskellFunction(1)<CR>
|
||||
imap <buffer> ;; <ESC>:call MakeArrow(1)<CR>
|
||||
imap <buffer> ;: <ESC>:call MakeArrow(0)<CR>
|
||||
|
||||
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
|
||||
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
|
||||
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
|
||||
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
|
||||
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
|
||||
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
|
||||
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
|
||||
|
||||
let g:haskell_classic_highlighting = 0
|
||||
let g:haskell_indent_if = 3
|
||||
let g:haskell_indent_case = 2
|
||||
let g:haskell_indent_let = 4
|
||||
let g:haskell_indent_where = 6
|
||||
let g:haskell_indent_before_where = 2
|
||||
let g:haskell_indent_after_bare_where = 2
|
||||
let g:haskell_indent_do = 3
|
||||
let g:haskell_indent_in = 1
|
||||
let g:haskell_indent_guard = 2
|
||||
let g:haskell_indent_case_alternative = 1
|
||||
let g:cabal_indent_section = 2
|
||||
" Either check empty($IN_NIX_SHELL) for nix specific or executable('ghcid')
|
||||
if executable('ghcid')
|
||||
let g:ghcid_command = 'ghcid'
|
||||
else
|
||||
let g:ghcid_command = 'stack exec -- ghcid'
|
||||
endif
|
||||
if executable('hoogle')
|
||||
let g:hoogle_search_bin = 'hoogle'
|
||||
else
|
||||
let g:hoogle_search_bin = 'stack exec -- hoogle'
|
||||
endif
|
||||
let g:hoogle_search_count = 30
|
||||
|
||||
function! JumpHaskellFunction(reverse)
|
||||
call search('\C[[:alnum:]]*\s*::', a:reverse ? 'bW' : 'W')
|
||||
endfunction
|
||||
|
||||
function! MakeArrow(type)
|
||||
if a:type
|
||||
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
|
||||
exe "norm! a-> "
|
||||
else
|
||||
exe "norm! a -> "
|
||||
endif
|
||||
exe "startreplace"
|
||||
else
|
||||
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
|
||||
exe "norm! a=> "
|
||||
else
|
||||
exe "norm! a => "
|
||||
endif
|
||||
exe "startreplace"
|
||||
endif
|
||||
endfunction
|
1
nvim/.config/nvim/after/ftplugin/markdown.vim
Normal file
1
nvim/.config/nvim/after/ftplugin/markdown.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal spell
|
12
nvim/.config/nvim/after/ftplugin/purescript.vim
Normal file
12
nvim/.config/nvim/after/ftplugin/purescript.vim
Normal file
|
@ -0,0 +1,12 @@
|
|||
nmap <buffer> <silent> <LocalLeader>L :Plist<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>l :Pload<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>r :Prebuild<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>f :PaddClause<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>T :PaddType<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>a :Papply<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>c :Pcase<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>i :Pimport<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>q :PaddImportQualifications<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>g :Pgoto<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>p :Pursuit<CR>
|
||||
nmap <buffer> <silent> <LocalLeader>t :Ptype<CR>
|
22
nvim/.config/nvim/after/ftplugin/python.vim
Normal file
22
nvim/.config/nvim/after/ftplugin/python.vim
Normal file
|
@ -0,0 +1,22 @@
|
|||
" Python Jedi
|
||||
let g:jedi#goto_command = "gt"
|
||||
let g:jedi#goto_assignments_command = "ga"
|
||||
let g:jedi#goto_definitions_command = "gd"
|
||||
let g:jedi#documentation_command = "K"
|
||||
let g:jedi#usages_command = "gx"
|
||||
let g:jedi#completions_command = "<Tab>"
|
||||
let g:jedi#rename_command = "gr"
|
||||
|
||||
let g:jedi#auto_initialization = 1
|
||||
let g:jedi#auto_vim_configuration = 0
|
||||
let g:jedi#use_tabs_not_buffers = 1
|
||||
let g:jedi#popup_on_dot = 1
|
||||
let g:jedi#popup_select_first = 0
|
||||
let g:jedi#smart_auto_mappings = 0
|
||||
let g:jedi#show_call_signatures = "2"
|
||||
let g:jedi#show_call_signatures_delay = 0
|
||||
let g:jedi#show_call_signatures_modes = 'i'
|
||||
let g:jedi#enable_speed_debugging = 0
|
||||
let g:jedi#completions_enabled = 0
|
||||
|
||||
|
2
nvim/.config/nvim/after/ftplugin/qf.vim
Normal file
2
nvim/.config/nvim/after/ftplugin/qf.vim
Normal file
|
@ -0,0 +1,2 @@
|
|||
noremap <silent><buffer> p :call quickui#tools#preview_quickfix()<CR>
|
||||
|
19
nvim/.config/nvim/after/ftplugin/rust.vim
Normal file
19
nvim/.config/nvim/after/ftplugin/rust.vim
Normal file
|
@ -0,0 +1,19 @@
|
|||
nmap <buffer> gd <Plug>DeopleteRustGoToDefinitionDefault
|
||||
nmap <buffer> K <Plug>DeopleteRustShowDocumentation
|
||||
nmap <buffer> gv <Plug>DeopleteRustGoToDefinitionVSplit
|
||||
nmap <buffer> gh <Plug>DeopleteRustGoToDefinitionSplit
|
||||
nmap <buffer> gt <Plug>DeopleteRustGoToDefinitionTab
|
||||
|
||||
augroup rust_maps
|
||||
au!
|
||||
" Taken from http://seenaburns.com/vim-setup-for-rust/
|
||||
" Neomake
|
||||
" Gross hack to stop Neomake running when exitting because it creates a zombie cargo check process
|
||||
" which holds the lock and never exits. But then, if you only have QuitPre, closing one pane will
|
||||
" disable neomake, so BufEnter reenables when you enter another buffer.
|
||||
let s:quitting = 0
|
||||
au FileType rust au QuitPre let s:quitting = 1
|
||||
au FileType rust au BufEnter let s:quitting = 0
|
||||
au FileType rust au BufWritePost if ! s:quitting | Neomake | else | echom "Neomake disabled" | endif
|
||||
augroup END
|
||||
|
1
nvim/.config/nvim/after/ftplugin/text.vim
Normal file
1
nvim/.config/nvim/after/ftplugin/text.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal spell
|
4
nvim/.config/nvim/after/ftplugin/vim.vim
Normal file
4
nvim/.config/nvim/after/ftplugin/vim.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
nmap pg :PlugUpgrade<CR>
|
||||
nmap pd :PlugUpdate<CR>
|
||||
nmap pw :PlugClean<CR>
|
||||
nmap pr :so %<CR>
|
|
@ -10,8 +10,6 @@ Plug 'haya14busa/incsearch.vim'
|
|||
Plug 'haya14busa/incsearch-easymotion.vim'
|
||||
" Fuzzy search
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'pbogut/fzf-mru.vim'
|
||||
Plug 'fszymanski/fzf-quickfix', {'on': 'Quickfix'}
|
||||
" Remove extraneous whitespace when edit mode is exited
|
||||
Plug 'axelf4/vim-strip-trailing-whitespace'
|
||||
" Status bar mods
|
||||
|
@ -41,31 +39,37 @@ Plug 'rbong/vim-flog'
|
|||
Plug 'samoshkin/vim-mergetool'
|
||||
" Git diffs in quickfix list
|
||||
Plug 'oguzbilgic/vim-gdiff'
|
||||
" For tmux yank
|
||||
" Boost vim command line mode
|
||||
Plug 'vim-utils/vim-husk'
|
||||
" GDB
|
||||
Plug 'sakhnik/nvim-gdb', { 'do': ':UpdateRemotePlugins' }
|
||||
" Lisp
|
||||
Plug 'guns/vim-sexp', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'tpope/vim-sexp-mappings-for-regular-people', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'junegunn/rainbow_parentheses.vim', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'kovisoft/slimv', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
" Haskell
|
||||
Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' }
|
||||
Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
|
||||
Plug 'hspec/hspec.vim'
|
||||
Plug 'pbrisbin/vim-syntax-shakespeare'
|
||||
Plug 'zenzike/vim-haskell-unicode', { 'for': 'haskell' }
|
||||
Plug 'godlygeek/tabular'
|
||||
" For autocompletion
|
||||
Plug 'prabirshrestha/asyncomplete.vim'
|
||||
Plug 'prabirshrestha/asyncomplete-buffer.vim'
|
||||
Plug 'prabirshrestha/asyncomplete-file.vim'
|
||||
Plug 'prabirshrestha/asyncomplete-tags.vim'
|
||||
Plug 'godlygeek/tabular', { 'for': 'haskell' }
|
||||
Plug 'Twinside/vim-haskellFold'
|
||||
" Purescript
|
||||
Plug 'frigoeu/psc-ide-vim', { 'for': 'purescript' }
|
||||
" Erlang Support
|
||||
Plug 'vim-erlang/vim-erlang-tags', { 'for': 'erlang' }
|
||||
Plug 'vim-erlang/vim-erlang-omnicomplete', { 'for': 'erlang' }
|
||||
Plug 'vim-erlang/vim-erlang-compiler', { 'for': 'erlang' }
|
||||
" Lisp
|
||||
Plug 'guns/vim-sexp', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'tpope/vim-sexp-mappings-for-regular-people', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'junegunn/rainbow_parentheses.vim', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
Plug 'kovisoft/slimv', { 'for': [ 'scheme', 'lisp', 'clojure' ] }
|
||||
" Python
|
||||
Plug 'davidhalter/jedi-vim', { 'for': 'python' }
|
||||
" For autocompletion
|
||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
Plug 'deoplete-plugins/deoplete-jedi', { 'for': 'python' }
|
||||
Plug 'sebastianmarkow/deoplete-rust', { 'for': 'rust' }
|
||||
Plug 'Shougo/neco-syntax'
|
||||
Plug 'deoplete-plugins/deoplete-tag'
|
||||
" Neo/Async stuff
|
||||
Plug 'sbdchd/neoformat'
|
||||
Plug 'neomake/neomake'
|
||||
|
@ -93,13 +97,6 @@ Plug 'tpope/vim-eunuch'
|
|||
Plug 'tpope/vim-sleuth'
|
||||
Plug 'tpope/vim-vinegar'
|
||||
Plug 'Yggdroot/indentLine'
|
||||
" LSP related
|
||||
Plug 'liuchengxu/vista.vim'
|
||||
Plug 'prabirshrestha/async.vim'
|
||||
Plug 'prabirshrestha/vim-lsp'
|
||||
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
||||
" Search and Replace
|
||||
Plug 'brooth/far.vim'
|
||||
" Floating terminal
|
||||
Plug 'voldikss/vim-floaterm'
|
||||
" Language agnostic
|
||||
|
@ -114,8 +111,6 @@ Plug 'wsdjeg/vim-fetch'
|
|||
" Miscellaneous
|
||||
Plug 'junegunn/vim-slash'
|
||||
Plug 'andymass/vim-matchup'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'igankevich/mesonic'
|
||||
Plug 'liuchengxu/vim-which-key'
|
||||
Plug 'farmergreg/vim-lastplace'
|
||||
|
||||
|
@ -154,7 +149,7 @@ set noswapfile " no swap files
|
|||
set foldmethod=syntax " Create folds based on files syntax
|
||||
set nofoldenable " Open folds by default
|
||||
set undofile " Enable undo persistence across sessions
|
||||
set hidden " Required by LC
|
||||
set hidden
|
||||
set noautochdir
|
||||
|
||||
" Wild menu
|
||||
|
@ -193,6 +188,7 @@ set completeopt=menu,noselect,preview,noinsert
|
|||
" Required for vim-workspace
|
||||
" See https://github.com/thaerkh/vim-workspace/issues/11
|
||||
set sessionoptions-=blank
|
||||
set grepprg=rg\ --vimgrep
|
||||
|
||||
" Theme
|
||||
let g:sonokai_style = 'atlantis'
|
||||
|
@ -227,7 +223,6 @@ nnoremap <Leader>fH :History/<CR>
|
|||
nnoremap <Leader>fm :Commands<CR>
|
||||
nnoremap <Leader>fo :Locate<SPACE>
|
||||
nnoremap <Leader>fk :Maps<CR>
|
||||
nnoremap <Leader>fr :FZFMru<CR>
|
||||
nnoremap <Leader>f/ :Rg<CR>
|
||||
nnoremap <Leader>fs :exe ':Rg ' . expand('<cword>')<CR>
|
||||
imap <C-x><C-w> <plug>(fzf-complete-word)
|
||||
|
@ -308,7 +303,6 @@ nnoremap ]Q :clast<CR>
|
|||
nnoremap qs :Grepper -nojump -query<SPACE>
|
||||
nnoremap q* :Grepper -nojump -cword<CR>
|
||||
nnoremap qt :call ToggleQuickfixList()<CR>
|
||||
nnoremap qf :Quickfix<CR>
|
||||
nnoremap Lo :lopen<CR>
|
||||
nnoremap Lc :lclose<CR>
|
||||
nnoremap [l :lprevious<CR>
|
||||
|
@ -317,7 +311,6 @@ nnoremap [L :lfirst<CR>
|
|||
nnoremap ]L :llast<CR>
|
||||
nnoremap Ls :Grepper -nojump -noquickfix -query<SPACE>
|
||||
nnoremap L* :Grepper -nojump -noquickfix -cword<CR>
|
||||
nnoremap Lf :Quickfix!<CR>
|
||||
nnoremap Lt :call ToggleLocationList()<CR>
|
||||
" Preview tags
|
||||
nnoremap pt :ptag <C-R><C-W><CR>
|
||||
|
@ -378,15 +371,6 @@ noremap <silent><expr> g/ incsearch#go(<SID>incsearch_config({'is_stay': 1}))
|
|||
nnoremap <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
|
||||
nnoremap <A-]> :sp <CR>:exec("tag ".expand("<cword>"))<CR>
|
||||
|
||||
" Tabular helpers
|
||||
vnoremap <Leader>= :Tabularize /=<CR>
|
||||
vnoremap <Leader>- :Tabularize /-><CR>
|
||||
vnoremap <Leader>< :Tabularize /<-<CR>
|
||||
vnoremap <Leader>, :Tabularize /,<CR>
|
||||
vnoremap <Leader># :Tabularize /#-}<CR>
|
||||
vnoremap <Leader>: :Tabularize /::<CR>
|
||||
vnoremap <Leader>[ :Tabularize /[<CR>
|
||||
|
||||
" Any jump
|
||||
nnoremap <Leader>aj :AnyJump<CR>
|
||||
nnoremap <Leader>ab :AnyJumpBack<CR>
|
||||
|
@ -403,86 +387,11 @@ command! -bang -nargs=* GGrep
|
|||
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
|
||||
|
||||
" --------------------------- Autocmd groups ---------------------------------
|
||||
|
||||
augroup QuickfixPreview
|
||||
au!
|
||||
au FileType qf noremap <silent><buffer> p :call quickui#tools#preview_quickfix()<CR>
|
||||
augroup END
|
||||
|
||||
augroup vimplug_maps
|
||||
au!
|
||||
au FileType vim nmap pg :PlugUpgrade<CR>
|
||||
au FileType vim nmap pd :PlugUpdate<CR>
|
||||
au FileType vim nmap pc :PlugClean<CR>
|
||||
au FileType vim nmap pr :so %<CR>
|
||||
augroup END
|
||||
|
||||
augroup haskell_maps
|
||||
au!
|
||||
" https://www.reddit.com/r/neovim/comments/es8wn7/haskell_makeprg_for_stack_build/
|
||||
" https://github.com/maxigit/vimrc/tree/2020/compiler
|
||||
au FileType haskell compiler stack
|
||||
au FileType haskell setlocal makeprg=stack\ build
|
||||
au FileType haskell setlocal keywordprg=:Hoogle
|
||||
au FileType haskell nmap <LocalLeader>b :Neomake!<CR>
|
||||
au FileType haskell nmap <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
|
||||
au FileType haskell nmap <LocalLeader>td :NeomakeSh stack exec -- haskdogs<CR>
|
||||
au FileType haskell nmap <LocalLeader>g :Ghcid<CR>
|
||||
au FileType haskell nmap <LocalLeader>k :GhcidKill<CR>
|
||||
au FileType haskell nmap <LocalLeader>c :HoogleClose<CR>
|
||||
au FileType haskell nmap <LocalLeader>o :exe ':Hoogle ' . expand('<cword>')<CR>
|
||||
au FileType haskell nmap <LocalLeader>i :exe ':HoogleInfo ' . expand('<cword>')<CR>
|
||||
|
||||
au FileType haskell nnoremap <buffer><silent> ]] :call JumpHaskellFunction(0)<CR>
|
||||
au FileType haskell nnoremap <buffer><silent> [[ :call JumpHaskellFunction(1)<CR>
|
||||
au FileType haskell inoremap <buffer> ;; <ESC>:call MakeArrow(1)<CR>
|
||||
au FileType haskell inoremap <buffer> ;: <ESC>:call MakeArrow(0)<CR>
|
||||
augroup END
|
||||
|
||||
augroup c_maps
|
||||
au!
|
||||
au FileType c nmap <LocalLeader>ct :NeomakeSh ctags -R .<CR>
|
||||
au FileType c nmap <LocalLeader>cu :NeomakeSh cscope -bqR<CR>
|
||||
au FileType c nmap <LocalLeader>cr :cs reset<CR>
|
||||
|
||||
au FileType c nmap <silent> <LocalLeader>s <Plug>(quickr_cscope_symbols)
|
||||
au FileType c nmap <silent> <LocalLeader>g <Plug>(quickr_cscope_global)
|
||||
au FileType c nmap <silent> <LocalLeader>h <Plug>(quickr_cscope_global_split)
|
||||
au FileType c nmap <silent> <LocalLeader>v <Plug>(quickr_cscope_global_vert_split)
|
||||
au FileType c nmap <silent> <LocalLeader>d <Plug>(quickr_cscope_functions)
|
||||
au FileType c nmap <silent> <LocalLeader>c <Plug>(quickr_cscope_callers)
|
||||
au FileType c nmap <silent> <LocalLeader>t <Plug>(quickr_cscope_text)
|
||||
au FileType c nmap <silent> <LocalLeader>e <Plug>(quickr_cscope_egrep)
|
||||
au FileType c nmap <silent> <LocalLeader>f <Plug>(quickr_cscope_files)
|
||||
au FileType c nmap <silent> <LocalLeader>i <Plug>(quickr_cscope_includes)
|
||||
au FileType c nmap <silent> <LocalLeader>a <Plug>(quickr_cscope_assignments)
|
||||
augroup END
|
||||
|
||||
augroup rust_maps
|
||||
au!
|
||||
" Taken from http://seenaburns.com/vim-setup-for-rust/
|
||||
" Neomake
|
||||
" Gross hack to stop Neomake running when exitting because it creates a zombie cargo check process
|
||||
" which holds the lock and never exits. But then, if you only have QuitPre, closing one pane will
|
||||
" disable neomake, so BufEnter reenables when you enter another buffer.
|
||||
let s:quitting = 0
|
||||
au FileType rust au QuitPre let s:quitting = 1
|
||||
au FileType rust au BufEnter let s:quitting = 0
|
||||
au FileType rust au BufWritePost if ! s:quitting | Neomake | else | echom "Neomake disabled" | endif
|
||||
augroup END
|
||||
|
||||
augroup rainbow_lisp
|
||||
autocmd!
|
||||
autocmd FileType lisp,clojure,scheme RainbowParentheses
|
||||
augroup END
|
||||
|
||||
" Toggles search highlighting off/on according to current mode. Source: http://blog.sanctum.geek.nz/vim-search-highlighting/
|
||||
augroup toggle_search
|
||||
autocmd!
|
||||
autocmd InsertEnter * setlocal nohlsearch
|
||||
autocmd InsertLeave * setlocal hlsearch
|
||||
augroup END
|
||||
|
||||
augroup quickfix
|
||||
au!
|
||||
" Close QF window if it is last window
|
||||
|
@ -499,116 +408,12 @@ augroup terminal_job
|
|||
au TermOpen * setlocal listchars= nonumber norelativenumber
|
||||
augroup END
|
||||
|
||||
augroup spell_check
|
||||
au!
|
||||
autocmd FileType gitcommit setlocal spell textwidth=72
|
||||
autocmd BufRead,BufNewFile *.md,*.txt setlocal spell
|
||||
augroup END
|
||||
|
||||
augroup ResizeWindowsProportionally
|
||||
au!
|
||||
autocmd VimResized * :wincmd =
|
||||
augroup END
|
||||
|
||||
augroup LSP
|
||||
au!
|
||||
nnoremap <LocalLeader>le :call lsp#enable()<CR>
|
||||
nnoremap <LocalLeader>ld :call lsp#disable()<CR>
|
||||
nnoremap <LocalLeader>lh :LspStopServer()<CR>
|
||||
nnoremap <LocalLeader>ls :LspStatus<CR>
|
||||
au User lsp_server_init call s:on_lsp_server_init()
|
||||
augroup END
|
||||
|
||||
augroup VimLspSettings
|
||||
au!
|
||||
if executable('pyls')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'pyls',
|
||||
\ 'cmd': {server_info->['pyls']},
|
||||
\ 'whitelist': ['python'],
|
||||
\ })
|
||||
endif
|
||||
if executable('ra_lsp_server')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'ra_lsp_server',
|
||||
\ 'cmd': {server_info->['ra_lsp_server']},
|
||||
\ 'whitelist': ['rust'],
|
||||
\ })
|
||||
endif
|
||||
if executable('purescript-language-server')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'purescript-language-server',
|
||||
\ 'cmd': {server_info->['purescript-language-server', '--stdio']},
|
||||
\ 'whitelist': ['purescript'],
|
||||
\ })
|
||||
endif
|
||||
if executable('ghcide')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'ghcide',
|
||||
\ 'cmd': {server_info->['ghcide', '--lsp']},
|
||||
\ 'whitelist': ['haskell'],
|
||||
\ })
|
||||
endif
|
||||
augroup END
|
||||
|
||||
augroup AsyncCompleteSetup
|
||||
au!
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#tags#get_source_options({
|
||||
\ 'name': 'tags',
|
||||
\ 'whitelist': ['c', 'haskell'],
|
||||
\ 'completor': function('asyncomplete#sources#tags#completor'),
|
||||
\ }))
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
|
||||
\ 'name': 'buffer',
|
||||
\ 'whitelist': ['*'],
|
||||
\ 'blacklist': ['go'],
|
||||
\ 'completor': function('asyncomplete#sources#buffer#completor'),
|
||||
\ 'config': {
|
||||
\ 'max_buffer_size': 5000000,
|
||||
\ },
|
||||
\ }))
|
||||
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
|
||||
\ 'name': 'file',
|
||||
\ 'whitelist': ['*'],
|
||||
\ 'priority': 10,
|
||||
\ 'completor': function('asyncomplete#sources#file#completor')
|
||||
\ }))
|
||||
augroup END
|
||||
|
||||
" --------------------------- Plugin settings --------------------------------
|
||||
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
|
||||
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
|
||||
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
|
||||
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
|
||||
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
|
||||
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
|
||||
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
|
||||
|
||||
let g:haskell_classic_highlighting = 0
|
||||
let g:haskell_indent_if = 3
|
||||
let g:haskell_indent_case = 2
|
||||
let g:haskell_indent_let = 4
|
||||
let g:haskell_indent_where = 6
|
||||
let g:haskell_indent_before_where = 2
|
||||
let g:haskell_indent_after_bare_where = 2
|
||||
let g:haskell_indent_do = 3
|
||||
let g:haskell_indent_in = 1
|
||||
let g:haskell_indent_guard = 2
|
||||
let g:haskell_indent_case_alternative = 1
|
||||
let g:cabal_indent_section = 2
|
||||
" Either check empty($IN_NIX_SHELL) for nix specific or executable('ghcid')
|
||||
if executable('ghcid')
|
||||
let g:ghcid_command = 'ghcid'
|
||||
else
|
||||
let g:ghcid_command = 'stack exec -- ghcid'
|
||||
endif
|
||||
if executable('hoogle')
|
||||
let g:hoogle_search_bin = 'hoogle'
|
||||
else
|
||||
let g:hoogle_search_bin = 'stack exec -- hoogle'
|
||||
endif
|
||||
let g:hoogle_search_count = 30
|
||||
|
||||
" Use airline
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||
|
@ -674,12 +479,6 @@ let g:mapleader = "\<Space>"
|
|||
let g:maplocalleader = ','
|
||||
let g:which_key_use_floating_win = 1
|
||||
|
||||
let g:cpp_class_scope_highlight = 1
|
||||
let g:cpp_member_variable_highlight = 1
|
||||
let g:cpp_class_decl_highlight = 1
|
||||
let g:cpp_posix_standard = 1
|
||||
let g:cpp_concepts_highlight = 1
|
||||
|
||||
" For SLIMV
|
||||
let g:lisp_rainbow=1
|
||||
|
||||
|
@ -688,37 +487,15 @@ let g:fzf_mru_no_sort = 1
|
|||
let $FZF_DEFAULT_OPTS='--layout=reverse'
|
||||
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.6 } }
|
||||
|
||||
" Quickr
|
||||
let g:quickr_cscope_keymaps = 0
|
||||
|
||||
" LSP
|
||||
let g:lsp_diagnostics_enabled = 1
|
||||
let g:lsp_signs_enabled = 1
|
||||
let g:lsp_diagnostics_echo_cursor = 1
|
||||
let g:lsp_highlight_references_enabled = 1
|
||||
let g:lsp_auto_enable = 0
|
||||
|
||||
" Vista
|
||||
let g:vista_executive_for = {
|
||||
\ 'c': 'ctags',
|
||||
\ 'haskell': 'vim_lsp',
|
||||
\ 'rust': 'vim_lsp',
|
||||
\ 'purescript': 'vim_lsp',
|
||||
\ 'python': 'vim_lsp',
|
||||
\ }
|
||||
let g:vista_ctags_cmd = {
|
||||
\ 'haskell': 'stack exec -- hasktags -x -o - -c .',
|
||||
\ }
|
||||
|
||||
" Allow nightfly theme to set indentline colors
|
||||
let g:indentLine_setColors = 0
|
||||
|
||||
" Disable providers we do not give a shit about
|
||||
let g:loaded_python_provider = 0
|
||||
let g:loaded_python3_provider = 0
|
||||
let g:loaded_ruby_provider = 0
|
||||
let g:loaded_perl_provider = 0
|
||||
let g:loaded_node_provider = 0
|
||||
let g:python3_host_prog = '/usr/bin/python3'
|
||||
|
||||
" Mergetool
|
||||
let g:mergetool_layout = 'mr'
|
||||
|
@ -746,6 +523,32 @@ let g:grepper.switch = 0
|
|||
let g:grepper.append = 0
|
||||
let g:grepper.prompt = 0
|
||||
|
||||
" Deoplete
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
let g:deoplete#sources#rust#disable_keymap = 1
|
||||
let g:deoplete#sources#rust#racer_binary=expand('$HOME/.cargo/bin/racer')
|
||||
let g:deoplete#sources#rust#rust_source_path=expand('$HOME/GitSources/rust/src')
|
||||
let g:deoplete#sources = {}
|
||||
call deoplete#custom#source('_', 'disabled_syntaxes', ['Comment', 'String'])
|
||||
call deoplete#custom#option('sources', {
|
||||
\ '_' : ['buffer', 'omni', 'around', 'file', 'member'],
|
||||
\ 'haskell': ['tag', 'buffer', 'omni'],
|
||||
\ 'c': ['tag', 'buffer'],
|
||||
\ 'purescript': ['buffer', 'omni'],
|
||||
\ 'rust': ['racer', 'buffer'],
|
||||
\})
|
||||
call deoplete#custom#source('omni', 'functions', {
|
||||
\ 'purescript': 'PSCIDEComplete',
|
||||
\})
|
||||
call deoplete#custom#var('omni', 'input_patterns', {
|
||||
\ 'purescript': '\w*',
|
||||
\})
|
||||
call deoplete#custom#option({
|
||||
\ 'auto_complete_delay': 200,
|
||||
\ 'auto_complete': v:true,
|
||||
\ 'smart_case': v:true,
|
||||
\ })
|
||||
|
||||
" ----------------------------- Functions ------------------------------------
|
||||
function! NvimGdbNoTKeymaps()
|
||||
tnoremap <silent> <buffer> <Esc> <C-\><C-n>
|
||||
|
@ -760,56 +563,3 @@ function! s:incsearch_config(...) abort
|
|||
\ 'is_expr': 0
|
||||
\ }), get(a:, 1, {}))
|
||||
endfunction
|
||||
|
||||
function! JumpHaskellFunction(reverse)
|
||||
call search('\C[[:alnum:]]*\s*::', a:reverse ? 'bW' : 'W')
|
||||
endfunction
|
||||
|
||||
function! MakeArrow(type)
|
||||
if a:type
|
||||
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
|
||||
exe "norm! a-> "
|
||||
else
|
||||
exe "norm! a -> "
|
||||
endif
|
||||
exe "startreplace"
|
||||
else
|
||||
if (matchstr(getline('.'), '\%' . col('.') . 'c.') ==? ' ')
|
||||
exe "norm! a=> "
|
||||
else
|
||||
exe "norm! a => "
|
||||
endif
|
||||
exe "startreplace"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:on_lsp_server_init() abort
|
||||
setlocal omnifunc=lsp#complete
|
||||
setlocal signcolumn=yes
|
||||
|
||||
" Always expected to work
|
||||
nmap <buffer> gd :LspDefinition<CR>
|
||||
nmap <buffer> gpd :LspPeekDefinition<CR>
|
||||
nmap <buffer> gk :LspHover<CR>
|
||||
|
||||
" May or may not be available depending on language server
|
||||
nmap <buffer> gx :LspReferences<CR>
|
||||
nmap <buffer> gr :LspRename<CR>
|
||||
nmap <buffer> <LocalLeader>ca :LspCodeAction<CR>
|
||||
nmap <buffer> <LocalLeader>dd :LspDocumentDiagnostics<CR>
|
||||
nmap <buffer> <LocalLeader>df :LspDocumentFormat<CR>
|
||||
nmap <buffer> <LocalLeader>rf :LspDocumentRangeFormat<CR>
|
||||
nmap <buffer> <LocalLeader>ds :LspDocumentSymbol<CR>
|
||||
nmap <buffer> <LocalLeader>di :LspImplementation<CR>
|
||||
nmap <buffer> <LocalLeader>nd :LspNextDiagnostic<CR>
|
||||
nmap <buffer> <LocalLeader>pd :LspPreviousDiagnostic<CR>
|
||||
nmap <buffer> <LocalLeader>ne :LspNextError<CR>
|
||||
nmap <buffer> <LocalLeader>pe :LspPreviousError<CR>
|
||||
nmap <buffer> <LocalLeader>nr :LspNextReference<CR>
|
||||
nmap <buffer> <LocalLeader>pr :LspPreviousReference<CR>
|
||||
nmap <buffer> <LocalLeader>nw :LspNextWarning<CR>
|
||||
nmap <buffer> <LocalLeader>pw :LspPreviousWarning<CR>
|
||||
nmap <buffer> <LocalLeader>dt :LspTypeDefinition<CR>
|
||||
nmap <buffer> <LocalLeader>td :LspPeekTypeDefinition<CR>
|
||||
nmap <buffer> <LocalLeader>pi :LspPeekImplementation<CR>
|
||||
endfunction
|
||||
|
|
Loading…
Reference in a new issue