From ebe1de13f1ae081af20ba22d7b62f7477d5062cd Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Fri, 20 Oct 2023 16:33:03 +0200 Subject: Fixed LS integration and nvim init.lua housekeeping --- .gitmodules | 21 ++- after/syntax/cpp.vim | 1 - init.lua | 271 +++++++++++++--------------- pack/all/start/fzf | 1 + pack/all/start/fzf.vim | 2 +- pack/all/start/vim-editorconfig | 2 +- pack/nvim/start/nvim-cmp | 2 +- pack/nvim/start/nvim-cmp-lsp-signature-help | 2 +- pack/nvim/start/nvim-cmp-nvim-lsp | 2 +- pack/nvim/start/nvim-git-blame | 1 + pack/nvim/start/nvim-lsp | 1 + pack/nvim/start/nvim-lspconfig | 2 +- pack/nvim/start/nvim-lua-language-server | 1 + pack/nvim/start/nvim-plenary | 1 + pack/nvim/start/nvim-telescope | 1 + pack/nvim/start/nvim-treesitter | 2 +- pack/nvim/start/nvim-vsnip | 2 +- pack/vim/opt/vim-youcompleteme | 2 +- 18 files changed, 161 insertions(+), 156 deletions(-) delete mode 120000 after/syntax/cpp.vim create mode 160000 pack/all/start/fzf create mode 160000 pack/nvim/start/nvim-git-blame create mode 160000 pack/nvim/start/nvim-lsp create mode 160000 pack/nvim/start/nvim-lua-language-server create mode 160000 pack/nvim/start/nvim-plenary create mode 160000 pack/nvim/start/nvim-telescope diff --git a/.gitmodules b/.gitmodules index 986283d..92552d3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule "pack/submodules/start/nvim-cmp"] path = pack/nvim/start/nvim-cmp url = https://github.com/hrsh7th/nvim-cmp -[submodule "pack/submodules/start/nvim-lspconfig"] - path = pack/nvim/start/nvim-lspconfig - url = https://github.com/neovim/nvim-lspconfig [submodule "pack/submodules/start/nvim-cmp-nvim-lsp"] path = pack/nvim/start/nvim-cmp-nvim-lsp url = https://github.com/hrsh7th/cmp-nvim-lsp @@ -61,3 +58,21 @@ [submodule "pack/all/start/fzf.vim"] path = pack/all/start/fzf.vim url = https://github.com/junegunn/fzf.vim +[submodule "pack/all/start/fzf"] + path = pack/all/start/fzf + url = https://github.com/junegunn/fzf +[submodule "pack/nvim/start/nvim-telescope"] + path = pack/nvim/start/nvim-telescope + url = https://github.com/nvim-telescope/telescope.nvim +[submodule "pack/nvim/start/nvim-plenary"] + path = pack/nvim/start/nvim-plenary + url = https://github.com/nvim-lua/plenary.nvim +[submodule "pack/nvim/start/nvim-lua-language-server"] + path = pack/nvim/start/nvim-lua-language-server + url = https://github.com/LuaLS/lua-language-server +[submodule "pack/nvim/start/nvim-lspconfig"] + path = pack/nvim/start/nvim-lspconfig + url = https://github.com/neovim/nvim-lspconfig +[submodule "pack/nvim/start/nvim-lsp"] + path = pack/nvim/start/nvim-lsp + url = https://github.com/prabirshrestha/vim-lsp diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim deleted file mode 120000 index 64e3fd4..0000000 --- a/after/syntax/cpp.vim +++ /dev/null @@ -1 +0,0 @@ -c.vim \ No newline at end of file diff --git a/init.lua b/init.lua index d58bbba..e69b081 100644 --- a/init.lua +++ b/init.lua @@ -2,57 +2,147 @@ vim.cmd('source ~/.vim/vimrc') vim.o.termguicolors = true vim.o.exrc = true +vim.o.shell = 'cmd.exe' +-- vim.o.shadafile = "/tmp/shada" +vim.opt.rtp:append("C:\\Users\\max\\scoop\\shims") + +-- only on Linux... +-- vim.o.shadafile = (os.getenv("XDG_CACHE_HOME") or +-- os.getenv("HOME") .. "/.cache" +-- ) .. "/vim.shada" +-- vimscript: get(environ(), "XDG_CACHE_HOME", "~/.cache")."/vim.shada" +-- require'man' -vim.o.shadafile = (os.getenv("XDG_CACHE_HOME") or - os.getenv("HOME") .. "/.cache" - ) .. "/vim.shada" +require'colorizer'.setup() --- vimscript: get(environ(), "XDG_CACHE_HOME", "~/.cache")."/vim.shada" +-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. +require('cmp_nvim_lsp').setup{} +local capabilities = require('cmp_nvim_lsp').default_capabilities() -require'man' -require'colorizer'.setup() +local cmp = require('cmp'); +cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item({behavior=cmp.SelectBehavior.Insert}), + [""] = cmp.mapping.select_prev_item({behavior=cmp.SelectBehavior.Insert}), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + -- [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) +}) + +-- Set configuration for specific filetype. +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. + }, { + { name = 'buffer' }, + }) +}) --- language servers: +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + -- mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + -- mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'cmdline' } + }) +}) + + +-- # Language Servers -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md +-- The following example advertise capabilities to `clangd`. -- C/C++ | clang -require'lspconfig'.clangd.setup{} +require('lspconfig')['clangd'].setup{capabilities = capabilities} --- lua -require'lspconfig'.sumneko_lua.setup{ - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } -} +-- bash | bash-language-server +require('lspconfig')['bashls'].setup{capabilities = capabilities} + +-- ccs | vscode-css-languageserver +require('lspconfig')['cssls'].setup{capabilities = capabilities} + +-- rust | rust-analyzer +require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities} + +-- javascript | eslint +require('lspconfig')['eslint'].setup{capabilities = capabilities} + +-- javascript | typescript-language-server +require('lspconfig')['tsserver'].setup{capabilities = capabilities} + +-- vimscript | vim-language-server +require('lspconfig')['vimls'].setup{capabilities = capabilities} + +require('lspconfig')['html'].setup{capabilities = capabilities} + +require('lspconfig')['jsonls'].setup{capabilities = capabilities} + +-- C/C++ | clang +require('lspconfig')['clangd'].setup{capabilities = capabilities} -- bash | bash-language-server -require'lspconfig'.bashls.setup{} +require('lspconfig')['bashls'].setup{capabilities = capabilities} -- ccs | vscode-css-languageserver -require'lspconfig'.cssls.setup{} +require('lspconfig')['cssls'].setup{capabilities = capabilities} -- rust | rust-analyzer -require'lspconfig'.rust_analyzer.setup{} +require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities} -- javascript | eslint -require'lspconfig'.eslint.setup{} +require('lspconfig')['eslint'].setup{capabilities = capabilities} -- javascript | typescript-language-server -require'lspconfig'.tsserver.setup{} +require('lspconfig')['tsserver'].setup{capabilities = capabilities} -- vimscript | vim-language-server -require'lspconfig'.vimls.setup{} +require('lspconfig')['vimls'].setup{capabilities = capabilities} -require'lspconfig'.html.setup{} +require('lspconfig')['html'].setup{capabilities = capabilities} -require'lspconfig'.jsonls.setup{} +require('lspconfig')['jsonls'].setup{capabilities = capabilities} -require'lspconfig'.pylsp.setup{ +require('lspconfig')['pylsp'].setup{ settings = { pylsp = { plugins = { @@ -65,123 +155,16 @@ require'lspconfig'.pylsp.setup{ } } - -require'cmp_nvim_lsp'.setup{} - -require'cmp'.setup { - sources = { - { name = 'nvim_lsp' } - } -} - --- -- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -local capabilities = require('cmp_nvim_lsp').default_capabilities() --- --- -- The following example advertise capabilities to `clangd`. -require'lspconfig'.clangd.setup { -capabilities = capabilities, -} - --- Set up nvim-cmp. -local cmp = require'cmp' - -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - -- [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - }) -}) - --- Set configuration for specific filetype. -cmp.setup.filetype('gitcommit', { -sources = cmp.config.sources({ -{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. -}, { -{ name = 'buffer' }, -}) -}) - --- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { -mapping = cmp.mapping.preset.cmdline(), -sources = { -{ name = 'buffer' } +-- lua +require('lspconfig')['lua_ls'].setup{ + settings = { + Lua = { + diagnostics = { + globals = { 'vim', 'require', 'cmp' } + } + } + } } -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { -mapping = cmp.mapping.preset.cmdline(), -sources = cmp.config.sources({ -{ name = 'path' } -}, { -{ name = 'cmdline' } -}) -}) - --- -- Set up lspconfig. --- local capabilities = require('cmp_nvim_lsp').default_capabilities() --- -- Replace with each lsp server you've enabled. --- -- require('lspconfig')[''].setup { --- -- } --- --- -- C/C++ | clang --- require'lspconfig'.clangd.setup{capabilities = capabilities} --- --- -- bash | bash-language-server --- require'lspconfig'.bashls.setup{capabilities = capabilities} --- --- -- ccs | vscode-css-languageserver --- require'lspconfig'.cssls.setup{capabilities = capabilities} --- --- -- rust | rust-analyzer --- require'lspconfig'.rust_analyzer.setup{capabilities = capabilities} --- --- -- javascript | eslint --- require'lspconfig'.eslint.setup{capabilities = capabilities} --- --- -- javascript | typescript-language-server --- require'lspconfig'.tsserver.setup{capabilities = capabilities} --- --- -- vimscript | vim-language-server --- require'lspconfig'.vimls.setup{capabilities = capabilities} --- --- require'lspconfig'.html.setup{capabilities = capabilities} --- --- require'lspconfig'.jsonls.setup{capabilities = capabilities} --- require'nvim-treesitter.configs'.setup { @@ -212,3 +195,5 @@ require'nvim-treesitter.configs'.setup { additional_vim_regex_highlighting = false, }, } + +-- vim: tabstop=2 shiftwidth=2 softtabstop=2 diff --git a/pack/all/start/fzf b/pack/all/start/fzf new file mode 160000 index 0000000..70c461c --- /dev/null +++ b/pack/all/start/fzf @@ -0,0 +1 @@ +Subproject commit 70c461c60bb1e2165a378e8ba0451b511c29b5cb diff --git a/pack/all/start/fzf.vim b/pack/all/start/fzf.vim index 0f03107..d1016db 160000 --- a/pack/all/start/fzf.vim +++ b/pack/all/start/fzf.vim @@ -1 +1 @@ -Subproject commit 0f03107bc94b31a9c7adcee6da8e5de7492e4b0b +Subproject commit d1016dbd7cec2d2a3bb5863776c84b4034e4b85e diff --git a/pack/all/start/vim-editorconfig b/pack/all/start/vim-editorconfig index 30ddc05..e014708 160000 --- a/pack/all/start/vim-editorconfig +++ b/pack/all/start/vim-editorconfig @@ -1 +1 @@ -Subproject commit 30ddc057f71287c3ac2beca876e7ae6d5abe26a0 +Subproject commit e014708e917b457e8f6c57f357d55dd3826880d4 diff --git a/pack/nvim/start/nvim-cmp b/pack/nvim/start/nvim-cmp index c49ad26..d3a3056 160000 --- a/pack/nvim/start/nvim-cmp +++ b/pack/nvim/start/nvim-cmp @@ -1 +1 @@ -Subproject commit c49ad26e894e137e401b1d294948c46327877eaf +Subproject commit d3a3056204e1a9dbb7c7fe36c114dc43b681768c diff --git a/pack/nvim/start/nvim-cmp-lsp-signature-help b/pack/nvim/start/nvim-cmp-lsp-signature-help index d2768cb..3d8912e 160000 --- a/pack/nvim/start/nvim-cmp-lsp-signature-help +++ b/pack/nvim/start/nvim-cmp-lsp-signature-help @@ -1 +1 @@ -Subproject commit d2768cb1b83de649d57d967085fe73c5e01f8fd7 +Subproject commit 3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1 diff --git a/pack/nvim/start/nvim-cmp-nvim-lsp b/pack/nvim/start/nvim-cmp-nvim-lsp index 5922477..44b16d1 160000 --- a/pack/nvim/start/nvim-cmp-nvim-lsp +++ b/pack/nvim/start/nvim-cmp-nvim-lsp @@ -1 +1 @@ -Subproject commit 59224771f91b86d1de12570b4070fe4ad7cd1eeb +Subproject commit 44b16d11215dce86f253ce0c30949813c0a90765 diff --git a/pack/nvim/start/nvim-git-blame b/pack/nvim/start/nvim-git-blame new file mode 160000 index 0000000..8fcf007 --- /dev/null +++ b/pack/nvim/start/nvim-git-blame @@ -0,0 +1 @@ +Subproject commit 8fcf0077ab0c020a68e9d26d347df7da717ddf11 diff --git a/pack/nvim/start/nvim-lsp b/pack/nvim/start/nvim-lsp new file mode 160000 index 0000000..c58edb9 --- /dev/null +++ b/pack/nvim/start/nvim-lsp @@ -0,0 +1 @@ +Subproject commit c58edb98f09a650612adaaf8c47995c9e2b7ffb1 diff --git a/pack/nvim/start/nvim-lspconfig b/pack/nvim/start/nvim-lspconfig index 6b43ce5..e49b1e9 160000 --- a/pack/nvim/start/nvim-lspconfig +++ b/pack/nvim/start/nvim-lspconfig @@ -1 +1 @@ -Subproject commit 6b43ce561d97412cc512b569db6938e44529293e +Subproject commit e49b1e90c1781ce372013de3fa93a91ea29fc34a diff --git a/pack/nvim/start/nvim-lua-language-server b/pack/nvim/start/nvim-lua-language-server new file mode 160000 index 0000000..ce96479 --- /dev/null +++ b/pack/nvim/start/nvim-lua-language-server @@ -0,0 +1 @@ +Subproject commit ce964793afc6251673238c256a25e06502e487b8 diff --git a/pack/nvim/start/nvim-plenary b/pack/nvim/start/nvim-plenary new file mode 160000 index 0000000..5001291 --- /dev/null +++ b/pack/nvim/start/nvim-plenary @@ -0,0 +1 @@ +Subproject commit 50012918b2fc8357b87cff2a7f7f0446e47da174 diff --git a/pack/nvim/start/nvim-telescope b/pack/nvim/start/nvim-telescope new file mode 160000 index 0000000..74ce793 --- /dev/null +++ b/pack/nvim/start/nvim-telescope @@ -0,0 +1 @@ +Subproject commit 74ce793a60759e3db0d265174f137fb627430355 diff --git a/pack/nvim/start/nvim-treesitter b/pack/nvim/start/nvim-treesitter index 68e8181..eb3faef 160000 --- a/pack/nvim/start/nvim-treesitter +++ b/pack/nvim/start/nvim-treesitter @@ -1 +1 @@ -Subproject commit 68e8181dbcf29330716d380e5669f2cd838eadb5 +Subproject commit eb3faef3a44641e5875581e901b0a8df8da2bde4 diff --git a/pack/nvim/start/nvim-vsnip b/pack/nvim/start/nvim-vsnip index 8dde8c0..be27746 160000 --- a/pack/nvim/start/nvim-vsnip +++ b/pack/nvim/start/nvim-vsnip @@ -1 +1 @@ -Subproject commit 8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e +Subproject commit be277461265f1e5c7db470aa479f30956597ea9e diff --git a/pack/vim/opt/vim-youcompleteme b/pack/vim/opt/vim-youcompleteme index 88efc6f..cc9a3ae 160000 --- a/pack/vim/opt/vim-youcompleteme +++ b/pack/vim/opt/vim-youcompleteme @@ -1 +1 @@ -Subproject commit 88efc6f6035e4c656e8791f3c3a8a4328a1634dc +Subproject commit cc9a3ae3efdcc7d038aab0620ea28882533c236c -- cgit v1.2.3