From 96863418b86051ec2b00901ecaeda04bda663d74 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Fri, 12 Jul 2024 23:01:42 +0200 Subject: [PATCH] plugins: Switch to LSP and Mason Remove old language-specific packages like javacomplete2, vim-clang, but also generic packages like gutentags. Instead add Mason and friends. --- keymaps.vim | 15 --- plugins-full.vim.example | 217 ++++++++++++++++++++++----------------- plugins-midi.vim.example | 23 +---- plugins-mini.vim | 2 +- 4 files changed, 125 insertions(+), 132 deletions(-) diff --git a/keymaps.vim b/keymaps.vim index 4310e79..f7d029e 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -61,26 +61,11 @@ au Filetype c,cpp,objc map :FSHere au Filetype markdown map :call RunMarkdown() au Filetype asciidoc,asciidoctor map :call RunAsciidoc() -" See https://github.com/artur-shaik/vim-Javacomplete2 -" ji ji -au FileType java nmap (JavaComplete-Imports-AddSmart) -au FileType java imap (JavaComplete-Imports-AddSmart) -" ii jii -au FileType java nmap (JavaComplete-Imports-Add) -au FileType java imap (JavaComplete-Imports-Add) -" I jI -au FileType java nmap (JavaComplete-Imports-AddMissing) -au FileType java imap (JavaComplete-Imports-AddMissing) -" R jR -au FileType java nmap (JavaComplete-Imports-RemoveUnused) -au FileType java imap (JavaComplete-Imports-RemoveUnused) - """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Some plugin-specific settings - if filereadable($HOME . '/.vim/keymaps-local.vim') source ~/.vim/keymaps-local.vim endif diff --git a/plugins-full.vim.example b/plugins-full.vim.example index 841d262..f1ba0d5 100644 --- a/plugins-full.vim.example +++ b/plugins-full.vim.example @@ -1,40 +1,36 @@ -" java extension to deoplete -Plug 'artur-shaik/vim-javacomplete2', {'for': 'java'} +" neovim-0.4 has troubles with nvim-treesitter +if has('nvim-0.5') + " neovim-0.7 works until v0.8.0 + if has('nvim-0.9') + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + else + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate', 'tag': 'v0.8.0'} + endif -Plug 'neomake/neomake' -Plug 'puremourning/vimspector' + Plug 'nvim-treesitter/nvim-treesitter-refactor', {'do': ':TSUpdate'} +endif + +if has('nvim-0.7') + Plug 'williamboman/mason.nvim' + Plug 'neovim/nvim-lspconfig' + Plug 'williamboman/mason-lspconfig.nvim' + Plug 'mfussenegger/nvim-lint' + Plug 'mhartington/formatter.nvim' +endif -Plug 'kana/vim-operator-user' -Plug 'rhysd/vim-clang-format' -Plug 'justmao945/vim-clang', {'for': ['c', 'cpp', 'objc']} " Prevent slow foling update, e.g., for vimtex Plug 'Konfekt/FastFold' -Plug 'lervag/vimtex' - -Plug 'shuber2/vim-syntax-easychair2' Plug 'gko/vim-coloresque' -Plug 'vimwiki/vimwiki' -Plug 'jceb/vim-orgmode', {'for': ['org']} - -Plug 'cakebaker/scss-syntax.vim', {'for': 'scss'} -Plug 'hail2u/vim-css3-syntax', {'for': ['scss', 'css']} +Plug 'puremourning/vimspector' -Plug 'https://gitlab.com/dbeniamine/vim-mail' Plug 'Konfekt/vim-DetectSpellLang', {'do': 'spell'} -Plug 'dpelle/vim-LanguageTool' -" Disable devicons on linux terminal -if $TERM == 'linux' - let g:enable_plugin_devicons=0 - " Enable loading of devicons on all others -else - let g:enable_plugin_devicons=1 -endif +Plug 'dpelle/vim-LanguageTool' -Plug 'ryanoasis/vim-devicons', Cond(g:enable_plugin_devicons) +Plug 'ryanoasis/vim-devicons', Cond($TERM != 'linux') Plug 'joom/latex-unicoder.vim' Plug 'chrisbra/unicode.vim' @@ -46,76 +42,119 @@ Plug 'dbeniamine/cheat.sh-vim', {'on': 'Cheat'} Plug 'sheerun/vim-polyglot' -" neovim-0.4 has troubles with nvim-treesitter -if has('nvim-0.5') - " neovim-0.7 works until v0.8.0 - if has('nvim-0.9') - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - else - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate', 'tag': 'v0.8.0'} - endif +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" FileType specific plugins - Plug 'nvim-treesitter/nvim-treesitter-refactor', {'do': ':TSUpdate'} -endif +" Java IDE: +" https://sookocheff.com/post/vim/neovim-java-ide/ -function PluginsConfigFull() - let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck'] - let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck'] - let g:clang_compilation_database = '.' +Plug 'lervag/vimtex' - " Taken from neomake - if OnBattery() - call neomake#configure#automake('w') - else - call neomake#configure#automake('nw', 1000) - endif +Plug 'shuber2/vim-syntax-easychair2' + +Plug 'vimwiki/vimwiki' + +Plug 'jceb/vim-orgmode', {'for': ['org']} + +Plug 'https://gitlab.com/dbeniamine/vim-mail' + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +function PluginsConfigFull() if has('nvim-0.5') set foldexpr=nvim_treesitter#foldexpr() - lua < gK :lua vim.lsp.buf.hover() + + endif + let g:fastfold_minlines = 0 let g:detectspelllang_langs = {} @@ -147,11 +186,6 @@ EOF \ 'template_ext': '.html'}] let g:vimwiki_global_ext = 0 - - " Java completion - au FileType java setlocal omnifunc=javacomplete#Complete - au FileType java JCEnable - let g:vimtex_fold_enabled = 1 let g:vimtex_fold_levelmarker = '➜' let g:vimtex_view_general_viewer = 'okular' @@ -191,15 +225,6 @@ EOF xmap de VimspectorBalloonEval au BufNewFile .vimspector.json read ~/.vim/vimspector-config/vimspector.json - - " Do not show diagnostic window of vim-clang - let g:clang_diagsopt = '' - - augroup ClangFormatSettings - au! - au FileType c,cpp,objc,javascript,java,typescript,protobuf,cuda,vala - \ vmap cf (operator-clang-format) - au FileType c,cpp,objc,javascript,java,typescript,protobuf,cuda,vala - \ nmap cf :ClangFormat - augroup END endfunction + +" vim:ft=vim diff --git a/plugins-midi.vim.example b/plugins-midi.vim.example index a024726..7b120b9 100644 --- a/plugins-midi.vim.example +++ b/plugins-midi.vim.example @@ -2,21 +2,15 @@ Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'} Plug 'jamessan/vim-gnupg' -" Conditional loading does not work, see github issue #823 -Plug 'ludovicchabant/vim-gutentags' - Plug 'editorconfig/editorconfig-vim' Plug 'embear/vim-localvimrc' Plug 'airblade/vim-rooter' -Plug 'plasticboy/vim-markdown', {'for': 'markdown'} +Plug 'preservim/vim-markdown', {'for': 'markdown'} Plug 'lvht/tagbar-markdown', {'for': 'markdown'} Plug 'habamax/vim-asciidoctor', {'for': 'asciidoc'} -Plug 'PProvost/vim-markdown-jekyll', {'for': 'markdown'} -Plug 'tpope/vim-liquid', {'for': ['liquid', 'html', 'xml', 'markdown']} - Plug 'tpope/vim-ragtag' Plug 'Shougo/neosnippet.vim' @@ -46,21 +40,10 @@ function PluginsConfigMidi() au FileType markdown call RagtagInit() - " Generally disable gutentags, but enable for some filetypes - let g:gutentags_enabled = 0 - au FileType c,cpp,objc,tex let g:gutentags_enabled = 1 - " Make manually created tags files also root markers - let g:gutentags_project_root = ['tags'] - let g:gutentags_cache_dir = expand('~/.cache/vim/ctags/') - " Do not automatically generate on browsing - let g:gutentags_generate_on_missing = 0 - let g:gutentags_ctags_exclude_wildignore = 1 - let g:gutentags_ctags_exclude = [ - \'node_modules', '_build', 'build*', 'CMakeFiles', '.*cache*', 'venv', - \'*.md', '*.css', '*.html', '*.json', '*.xml', '*.xmls', '*.ui'] - " Allow for reflow of bullet paragraphs let g:vim_markdown_auto_insert_bullets = 0 let g:calendar_monday = 1 endfunction + +" vim:ft=vim diff --git a/plugins-mini.vim b/plugins-mini.vim index 4ad7420..dad7247 100644 --- a/plugins-mini.vim +++ b/plugins-mini.vim @@ -105,7 +105,7 @@ function PluginsConfigMini() require('mini.bracketed').setup() require('mini.bufremove').setup() require('mini.comment').setup() - require('mini.completion').setup({delay = {completion = 500}}) + require('mini.completion').setup() require('mini.cursorword').setup() require('mini.diff').setup() require('mini.files').setup() -- 2.39.5