From 932e3ffc422e6c0eaec93ec0f3b47aba9034468a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 12 Apr 2020 18:18:54 +0530 Subject: [PATCH] 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 --- nvim/.config/nvim/after/ftplugin/c.vim | 15 + nvim/.config/nvim/after/ftplugin/cpp.vim | 6 + .../.config/nvim/after/ftplugin/gitcommit.vim | 1 + nvim/.config/nvim/after/ftplugin/haskell.vim | 82 +++++ nvim/.config/nvim/after/ftplugin/markdown.vim | 1 + .../nvim/after/ftplugin/purescript.vim | 12 + nvim/.config/nvim/after/ftplugin/python.vim | 22 ++ nvim/.config/nvim/after/ftplugin/qf.vim | 2 + nvim/.config/nvim/after/ftplugin/rust.vim | 19 + nvim/.config/nvim/after/ftplugin/text.vim | 1 + nvim/.config/nvim/after/ftplugin/vim.vim | 4 + nvim/.config/nvim/init.vim | 344 +++--------------- 12 files changed, 212 insertions(+), 297 deletions(-) create mode 100644 nvim/.config/nvim/after/ftplugin/c.vim create mode 100644 nvim/.config/nvim/after/ftplugin/cpp.vim create mode 100644 nvim/.config/nvim/after/ftplugin/gitcommit.vim create mode 100644 nvim/.config/nvim/after/ftplugin/haskell.vim create mode 100644 nvim/.config/nvim/after/ftplugin/markdown.vim create mode 100644 nvim/.config/nvim/after/ftplugin/purescript.vim create mode 100644 nvim/.config/nvim/after/ftplugin/python.vim create mode 100644 nvim/.config/nvim/after/ftplugin/qf.vim create mode 100644 nvim/.config/nvim/after/ftplugin/rust.vim create mode 100644 nvim/.config/nvim/after/ftplugin/text.vim create mode 100644 nvim/.config/nvim/after/ftplugin/vim.vim diff --git a/nvim/.config/nvim/after/ftplugin/c.vim b/nvim/.config/nvim/after/ftplugin/c.vim new file mode 100644 index 0000000..6188a5f --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/c.vim @@ -0,0 +1,15 @@ +nmap ct :NeomakeSh ctags -R . +nmap cu :NeomakeSh cscope -bqR +nmap cr :cs reset + +nmap s (quickr_cscope_symbols) +nmap g (quickr_cscope_global) +nmap h (quickr_cscope_global_split) +nmap v (quickr_cscope_global_vert_split) +nmap d (quickr_cscope_functions) +nmap c (quickr_cscope_callers) +nmap t (quickr_cscope_text) +nmap e (quickr_cscope_egrep) +nmap f (quickr_cscope_files) +nmap i (quickr_cscope_includes) +nmap a (quickr_cscope_assignments) diff --git a/nvim/.config/nvim/after/ftplugin/cpp.vim b/nvim/.config/nvim/after/ftplugin/cpp.vim new file mode 100644 index 0000000..98f95b9 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/cpp.vim @@ -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 + diff --git a/nvim/.config/nvim/after/ftplugin/gitcommit.vim b/nvim/.config/nvim/after/ftplugin/gitcommit.vim new file mode 100644 index 0000000..2b757a6 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/gitcommit.vim @@ -0,0 +1 @@ +setlocal spell textwidth=72 diff --git a/nvim/.config/nvim/after/ftplugin/haskell.vim b/nvim/.config/nvim/after/ftplugin/haskell.vim new file mode 100644 index 0000000..ca73c22 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/haskell.vim @@ -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 b :Neomake! +nmap t :NeomakeSh stack exec -- hasktags -x -c . +nmap td :NeomakeSh stack exec -- haskdogs +nmap g :Ghcid +nmap k :GhcidKill +nmap c :HoogleClose +nmap o :exe ':Hoogle ' . expand('') +nmap i :exe ':HoogleInfo ' . expand('') + +" Tabular helpers +vnoremap = :Tabularize /= +vnoremap - :Tabularize /-> +vnoremap < :Tabularize /<- +vnoremap , :Tabularize /, +vnoremap # :Tabularize /#-} +vnoremap : :Tabularize /:: +vnoremap [ :Tabularize /[ + +nmap ]] :call JumpHaskellFunction(0) +nmap [[ :call JumpHaskellFunction(1) +imap ;; :call MakeArrow(1) +imap ;: :call MakeArrow(0) + +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 diff --git a/nvim/.config/nvim/after/ftplugin/markdown.vim b/nvim/.config/nvim/after/ftplugin/markdown.vim new file mode 100644 index 0000000..bcda2dd --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/markdown.vim @@ -0,0 +1 @@ +setlocal spell diff --git a/nvim/.config/nvim/after/ftplugin/purescript.vim b/nvim/.config/nvim/after/ftplugin/purescript.vim new file mode 100644 index 0000000..771132d --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/purescript.vim @@ -0,0 +1,12 @@ +nmap L :Plist +nmap l :Pload +nmap r :Prebuild +nmap f :PaddClause +nmap T :PaddType +nmap a :Papply +nmap c :Pcase +nmap i :Pimport +nmap q :PaddImportQualifications +nmap g :Pgoto +nmap p :Pursuit +nmap t :Ptype diff --git a/nvim/.config/nvim/after/ftplugin/python.vim b/nvim/.config/nvim/after/ftplugin/python.vim new file mode 100644 index 0000000..b78650c --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/python.vim @@ -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 = "" +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 + + diff --git a/nvim/.config/nvim/after/ftplugin/qf.vim b/nvim/.config/nvim/after/ftplugin/qf.vim new file mode 100644 index 0000000..cef3cb1 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/qf.vim @@ -0,0 +1,2 @@ +noremap p :call quickui#tools#preview_quickfix() + diff --git a/nvim/.config/nvim/after/ftplugin/rust.vim b/nvim/.config/nvim/after/ftplugin/rust.vim new file mode 100644 index 0000000..e328459 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/rust.vim @@ -0,0 +1,19 @@ +nmap gd DeopleteRustGoToDefinitionDefault +nmap K DeopleteRustShowDocumentation +nmap gv DeopleteRustGoToDefinitionVSplit +nmap gh DeopleteRustGoToDefinitionSplit +nmap gt 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 + diff --git a/nvim/.config/nvim/after/ftplugin/text.vim b/nvim/.config/nvim/after/ftplugin/text.vim new file mode 100644 index 0000000..bcda2dd --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/text.vim @@ -0,0 +1 @@ +setlocal spell diff --git a/nvim/.config/nvim/after/ftplugin/vim.vim b/nvim/.config/nvim/after/ftplugin/vim.vim new file mode 100644 index 0000000..0db3a8d --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/vim.vim @@ -0,0 +1,4 @@ +nmap pg :PlugUpgrade +nmap pd :PlugUpdate +nmap pw :PlugClean +nmap pr :so % diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index f33da62..e86e717 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -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 fH :History/ nnoremap fm :Commands nnoremap fo :Locate nnoremap fk :Maps -nnoremap fr :FZFMru nnoremap f/ :Rg nnoremap fs :exe ':Rg ' . expand('') imap (fzf-complete-word) @@ -308,7 +303,6 @@ nnoremap ]Q :clast nnoremap qs :Grepper -nojump -query nnoremap q* :Grepper -nojump -cword nnoremap qt :call ToggleQuickfixList() -nnoremap qf :Quickfix nnoremap Lo :lopen nnoremap Lc :lclose nnoremap [l :lprevious @@ -317,7 +311,6 @@ nnoremap [L :lfirst nnoremap ]L :llast nnoremap Ls :Grepper -nojump -noquickfix -query nnoremap L* :Grepper -nojump -noquickfix -cword -nnoremap Lf :Quickfix! nnoremap Lt :call ToggleLocationList() " Preview tags nnoremap pt :ptag @@ -378,15 +371,6 @@ noremap g/ incsearch#go(incsearch_config({'is_stay': 1})) nnoremap :vsp :exec("tag ".expand("")) nnoremap :sp :exec("tag ".expand("")) -" Tabular helpers -vnoremap = :Tabularize /= -vnoremap - :Tabularize /-> -vnoremap < :Tabularize /<- -vnoremap , :Tabularize /, -vnoremap # :Tabularize /#-} -vnoremap : :Tabularize /:: -vnoremap [ :Tabularize /[ - " Any jump nnoremap aj :AnyJump nnoremap ab :AnyJumpBack @@ -403,86 +387,11 @@ command! -bang -nargs=* GGrep \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) " --------------------------- Autocmd groups --------------------------------- - -augroup QuickfixPreview - au! - au FileType qf noremap p :call quickui#tools#preview_quickfix() -augroup END - -augroup vimplug_maps - au! - au FileType vim nmap pg :PlugUpgrade - au FileType vim nmap pd :PlugUpdate - au FileType vim nmap pc :PlugClean - au FileType vim nmap pr :so % -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 b :Neomake! - au FileType haskell nmap t :NeomakeSh stack exec -- hasktags -x -c . - au FileType haskell nmap td :NeomakeSh stack exec -- haskdogs - au FileType haskell nmap g :Ghcid - au FileType haskell nmap k :GhcidKill - au FileType haskell nmap c :HoogleClose - au FileType haskell nmap o :exe ':Hoogle ' . expand('') - au FileType haskell nmap i :exe ':HoogleInfo ' . expand('') - - au FileType haskell nnoremap ]] :call JumpHaskellFunction(0) - au FileType haskell nnoremap [[ :call JumpHaskellFunction(1) - au FileType haskell inoremap ;; :call MakeArrow(1) - au FileType haskell inoremap ;: :call MakeArrow(0) -augroup END - -augroup c_maps - au! - au FileType c nmap ct :NeomakeSh ctags -R . - au FileType c nmap cu :NeomakeSh cscope -bqR - au FileType c nmap cr :cs reset - - au FileType c nmap s (quickr_cscope_symbols) - au FileType c nmap g (quickr_cscope_global) - au FileType c nmap h (quickr_cscope_global_split) - au FileType c nmap v (quickr_cscope_global_vert_split) - au FileType c nmap d (quickr_cscope_functions) - au FileType c nmap c (quickr_cscope_callers) - au FileType c nmap t (quickr_cscope_text) - au FileType c nmap e (quickr_cscope_egrep) - au FileType c nmap f (quickr_cscope_files) - au FileType c nmap i (quickr_cscope_includes) - au FileType c nmap a (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 le :call lsp#enable() - nnoremap ld :call lsp#disable() - nnoremap lh :LspStopServer() - nnoremap ls :LspStatus - 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 = "\" 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 @@ -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 gd :LspDefinition - nmap gpd :LspPeekDefinition - nmap gk :LspHover - - " May or may not be available depending on language server - nmap gx :LspReferences - nmap gr :LspRename - nmap ca :LspCodeAction - nmap dd :LspDocumentDiagnostics - nmap df :LspDocumentFormat - nmap rf :LspDocumentRangeFormat - nmap ds :LspDocumentSymbol - nmap di :LspImplementation - nmap nd :LspNextDiagnostic - nmap pd :LspPreviousDiagnostic - nmap ne :LspNextError - nmap pe :LspPreviousError - nmap nr :LspNextReference - nmap pr :LspPreviousReference - nmap nw :LspNextWarning - nmap pw :LspPreviousWarning - nmap dt :LspTypeDefinition - nmap td :LspPeekTypeDefinition - nmap pi :LspPeekImplementation -endfunction