nvim: Switch to nvim-lsp
Enabled lsp within nvim and switched completion engine from deoplete to completion-nvim. The completion will be somewhat more barebones for some filetypes until the language servers are set up, but should then (theoretically) carry a lot more features than before. Additionally, we can, over time, add additional code inspection functionality. One change concerns the calling of bibtex cite key completion in pandoc files: Where before the completion would automatically begin after typing an '@', it will now only start on manual completion invocation (c-p/c-n) -- since the completion from my current bibtex file takes a while to load.
This commit is contained in:
parent
28f7f304c1
commit
a79bef6c4d
7 changed files with 114 additions and 67 deletions
|
@ -29,60 +29,58 @@ autocmd VimEnter *
|
|||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
" base
|
||||
Plug 'christoomey/vim-tmux-navigator' " allow seamless navigation between vim buffers and tmux splits
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle' " toggles numbers to absolute for all buffers but the current which is relative
|
||||
Plug 'justinmk/vim-sneak' " jump between letters with improved fFtT quicksearch
|
||||
Plug 'RRethy/vim-illuminate' " highlight other occurences of the word under cursor
|
||||
|
||||
" base
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'justinmk/vim-sneak'
|
||||
Plug 'RRethy/vim-illuminate'
|
||||
" filedrawer
|
||||
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs
|
||||
|
||||
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs
|
||||
" editing
|
||||
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc
|
||||
Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add)
|
||||
Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||
Plug 'jiangmiao/auto-pairs' " Auto close brackets and ''
|
||||
Plug 'junegunn/vim-easy-align' " Align tables and other alignable things
|
||||
Plug 'junegunn/vim-peekaboo' " Show the contents of regiseters on pasting from '', @, <C-R>
|
||||
|
||||
" editing
|
||||
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc
|
||||
Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add)
|
||||
Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||
Plug 'jiangmiao/auto-pairs' " Auto close brackets and ''
|
||||
Plug 'junegunn/vim-easy-align' " Align tables and other alignable things
|
||||
Plug 'junegunn/vim-peekaboo' " Show the contents of regiseters on pasting from '', @, <C-R>
|
||||
|
||||
" Fuzzy matching
|
||||
" Fuzzy matching
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" ultimately the only thing left here should be a
|
||||
Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs
|
||||
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
|
||||
Plug 'deoplete-plugins/deoplete-jedi'
|
||||
Plug 'Shougo/echodoc.vim', {}
|
||||
Plug 'desmap/ale-sensible' | Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
||||
" statusline
|
||||
Plug 'neovim/nvim-lspconfig' " some commong language server configurations
|
||||
Plug 'nvim-lua/completion-nvim' " simple completion engine built specifically for nvim and lsp
|
||||
Plug 'desmap/ale-sensible' | Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
||||
" statusline
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'edkolev/tmuxline.vim'
|
||||
" Colorschemes
|
||||
" Colorschemes
|
||||
Plug 'chriskempson/base16-vim'
|
||||
Plug 'reedes/vim-colors-pencil'
|
||||
|
||||
" RMarkdown & LaTeX workflow
|
||||
" RMarkdown & LaTeX workflow
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
" Notes and Wiki
|
||||
Plug 'dyng/ctrlsf.vim'
|
||||
Plug 'lervag/wiki.vim'
|
||||
Plug 'alok/notational-fzf-vim'
|
||||
" Prose Workflow
|
||||
Plug 'micarmst/vim-spellsync' " personal dict improvements for git sync
|
||||
Plug 'ron89/thesaurus_query.vim' " find thesaurus backed synonyms for word under cursor
|
||||
Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins
|
||||
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
|
||||
" and allows you to jump to the *end* of this <g)> or last <g(> sentence.
|
||||
Plug 'reedes/vim-pencil', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
|
||||
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
|
||||
" Notes and Wiki
|
||||
Plug 'dyng/ctrlsf.vim' " search-and-edit of many wiki files at once
|
||||
Plug 'lervag/wiki.vim' " foundational wiki system, allowing links between plaintext files
|
||||
Plug 'alok/notational-fzf-vim' " quickly search through the wiki
|
||||
" Prose Workflow
|
||||
Plug 'micarmst/vim-spellsync' " personal dict improvements for git sync
|
||||
Plug 'ron89/thesaurus_query.vim' " find thesaurus backed synonyms for word under cursor
|
||||
Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins
|
||||
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
|
||||
" and allows you to jump to the *end* of this <g)> or last <g(> sentence.
|
||||
|
||||
Plug 'reedes/vim-pencil', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
|
||||
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
|
||||
Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
|
||||
" Language Integration
|
||||
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
|
||||
" Language Integration
|
||||
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
|
||||
Plug 'stephpy/vim-yaml'
|
||||
Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'}
|
||||
|
||||
|
|
13
nvim/.config/nvim/lua/pandoc_complete.lua
Normal file
13
nvim/.config/nvim/lua/pandoc_complete.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M.getCompletionItems(prefix)
|
||||
-- define your total completion items
|
||||
local items = vim.api.nvim_call_function('pandoc#completion#Complete',{0, prefix})
|
||||
return items
|
||||
end
|
||||
|
||||
M.complete_item = {
|
||||
item = M.getCompletionItems
|
||||
}
|
||||
|
||||
return M
|
59
nvim/.config/nvim/plugin/completion-nvim.vim
Normal file
59
nvim/.config/nvim/plugin/completion-nvim.vim
Normal file
|
@ -0,0 +1,59 @@
|
|||
" use completion-nvim for all buffers (not just lsp)
|
||||
autocmd BufEnter * lua require'completion'.on_attach()
|
||||
|
||||
"map <c-p> to manually trigger completion
|
||||
imap <silent> <c-p> <Plug>(completion_trigger)
|
||||
imap <silent> <c-n> <Plug>(completion_trigger)
|
||||
|
||||
" Add <Tab> and <S-Tab> to navigate through popup menu
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
|
||||
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
|
||||
" Avoid showing message extra message when using completion
|
||||
set shortmess+=c
|
||||
|
||||
" set loop of strategies in descending order
|
||||
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
|
||||
|
||||
" even when backtracking enable completion
|
||||
let g:completion_trigger_on_delete = 1
|
||||
|
||||
" register new completion engines
|
||||
" (set in rtp/lua/*_complete.lua)
|
||||
"
|
||||
" pandoc citation key completion
|
||||
lua require'completion'.addCompletionSource('bibcite', require'pandoc_complete'.complete_item)
|
||||
|
||||
" only call for specified shortcut, or with completion keys
|
||||
augroup pandocCompletion
|
||||
autocmd!
|
||||
autocmd BufEnter * call SetupPandocCompletion()
|
||||
augroup end
|
||||
fun! SetupPandocCompletion()
|
||||
if &ft =~ 'pandoc'
|
||||
let g:completion_enable_auto_popup = 0
|
||||
let g:completion_trigger_character = ['@\w*']
|
||||
return
|
||||
endif
|
||||
let g:completion_enable_auto_popup = 1
|
||||
let g:completion_trigger_character = ['.']
|
||||
endfun
|
||||
|
||||
" the completion chains for different filetypes
|
||||
" see https://github.com/nvim-lua/completion-nvim/wiki/chain-complete-support
|
||||
let g:completion_chain_complete_list = {
|
||||
\ 'pandoc': [
|
||||
\ {'complete_items': ['bibcite', 'lsp', 'snippet']},
|
||||
\ {'mode': '<c-p>'},
|
||||
\ {'mode': '<c-n>'}
|
||||
\],
|
||||
\ 'default': [
|
||||
\ {'complete_items': ['lsp', 'snippet']},
|
||||
\ {'mode': '<c-p>'},
|
||||
\ {'mode': '<c-n>'}
|
||||
\]
|
||||
\}
|
|
@ -1,20 +0,0 @@
|
|||
" PLUGIN: DEOPLETE
|
||||
" For async completion
|
||||
" enable deoplete at startup
|
||||
let g:deoplete#enable_at_startup =1
|
||||
|
||||
call deoplete#custom#option( {
|
||||
\ 'camel_case': v:true,
|
||||
\ 'smart_case': v:true,
|
||||
\ 'ignore_case': v:true,
|
||||
\ 'refresh_always': v:true,
|
||||
\ 'max_abbr_width': 0,
|
||||
\ 'max_menu_width': 0
|
||||
\} )
|
||||
|
||||
call deoplete#custom#var('omni', 'input_patterns', {
|
||||
\'pandoc': '@\w*',
|
||||
\})
|
||||
call deoplete#custom#var('omni', 'functions', {
|
||||
\'pandoc': 'pandoc#completion#Complete',
|
||||
\})
|
|
@ -1,7 +0,0 @@
|
|||
" PLUGIN: ECHODOC
|
||||
let g:echodoc#type="virtual"
|
||||
let g:echodoc_enable_at_startup=1
|
||||
set splitbelow
|
||||
set completeopt+=menu,menuone,noinsert,noselect
|
||||
set completeopt-=preview
|
||||
autocmd CompleteDone * pclose
|
4
nvim/.config/nvim/plugin/nvim-lspconfig.vim
Normal file
4
nvim/.config/nvim/plugin/nvim-lspconfig.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
" enable python language servers
|
||||
lua require'nvim_lsp'.pyls.setup{}
|
||||
lua require'nvim_lsp'.vimls.setup{}
|
|
@ -1,7 +1,7 @@
|
|||
" PLUGIN: vim-polyglot
|
||||
"
|
||||
" we disable markdown so that every markdown file can be given pandoc type
|
||||
let g:polyglot_disabled = ['markdown']
|
||||
" let g:polyglot_disabled = ['markdown']
|
||||
|
||||
au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn} set ft=pandoc
|
||||
au BufNewFile,BufRead *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set ft=pandoc
|
||||
|
|
Loading…
Reference in a new issue