From 2cbf53d48109cf45e27249db6f31d8d02078b555 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 12 Oct 2021 19:33:12 +0200 Subject: [PATCH 01/10] feat: upgrade sumneko_lua --- .local/share/nvim/lsp/sumneko_lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/share/nvim/lsp/sumneko_lua b/.local/share/nvim/lsp/sumneko_lua index db51575..0bb7a2f 160000 --- a/.local/share/nvim/lsp/sumneko_lua +++ b/.local/share/nvim/lsp/sumneko_lua @@ -1 +1 @@ -Subproject commit db515753ac0c9811199453d3e4ce72a1c72f5e2e +Subproject commit 0bb7a2f2255e6d1a02c0e56296e8a8f89a22eeb4 From 0c69940ad956fa127cf74414d5c78b015ce95af3 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 14 Oct 2021 11:54:17 +0200 Subject: [PATCH 02/10] feat: upgrade sumneko --- .local/share/nvim/lsp/sumneko_lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/share/nvim/lsp/sumneko_lua b/.local/share/nvim/lsp/sumneko_lua index 0bb7a2f..c876e0d 160000 --- a/.local/share/nvim/lsp/sumneko_lua +++ b/.local/share/nvim/lsp/sumneko_lua @@ -1 +1 @@ -Subproject commit 0bb7a2f2255e6d1a02c0e56296e8a8f89a22eeb4 +Subproject commit c876e0da1c0c2d01db9cb0c6f2914659318e0460 From 2bf23cc38f2b43ad39dfec2a86039e67402c44d3 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 14 Oct 2021 11:54:37 +0200 Subject: [PATCH 03/10] feat: show cursorline in neovim --- .config/nvim/lua/settings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 0740eae..03ab9cd 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -25,6 +25,7 @@ opt.splitbelow = true opt.scrolloff = 4 opt.termguicolors = true opt.background = "dark" +opt.cursorline = true opt.shortmess = opt.shortmess:append { c = true } opt.number = true opt.relativenumber = true From ca8106210509542abf6f256d02b41631f436e75a Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 12:44:44 +0200 Subject: [PATCH 04/10] [nvim] feat: use nvim_lsp_installer manage lsp servers through nvim's plugin !!! BREAKING: requires npm check https://github.com/williamboman/nvim-lsp-installer.git --- .config/nvim/lua/plugin/lsp_installer.lua | 29 +++++++++++++++++++++++ .config/nvim/lua/plugins.lua | 9 +++++++ 2 files changed, 38 insertions(+) create mode 100644 .config/nvim/lua/plugin/lsp_installer.lua diff --git a/.config/nvim/lua/plugin/lsp_installer.lua b/.config/nvim/lua/plugin/lsp_installer.lua new file mode 100644 index 0000000..fa6fc46 --- /dev/null +++ b/.config/nvim/lua/plugin/lsp_installer.lua @@ -0,0 +1,29 @@ +-- Author : swytch +-- Created : Saturday Sept. 11, 2021 22:12:33 CET +-- License : GPLv3 +-- Description : nvim-lsp-installer plugin config file + +local lsp_installer = require("nvim-lsp-installer") + +lsp_installer.settings { + ui = { + icons = { + server_installed = "✓", + server_pending = "➜", + server_uninstalled = "✗" + } + } +} + +lsp_installer.on_server_ready(function(server) + local opts = {} + + -- (optional) Customize the options passed to the server + -- if server.name == "tsserver" then + -- opts.root_dir = function() ... end + -- end + + -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) + server:setup(opts) + vim.cmd [[ do User LspAttachBuffers ]] +end) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index dffc26d..5ce4328 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -48,6 +48,15 @@ return require("packer").startup(function() } -- LSP + use { + "williamboman/nvim-lsp-installer", + cmd = { + "LspInstall", + "LspInstallInfo" + }, + config = function() require("plugin.lsp_installer").setup() end + } + use { "neovim/nvim-lspconfig", ft = { "c", "cpp", "lua", "python", "tex"}, From 17f7b0943198cbab26a7f11854633ff9757ea332 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 12:46:32 +0200 Subject: [PATCH 05/10] [nvim] feat: remove sumneko_lsp submodule !!! BREAKING: install sumneko_lua through nvim --- .config/nvim/lua/lsp/lua.lua | 6 ++++-- .local/share/nvim/lsp/sumneko_lua | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 160000 .local/share/nvim/lsp/sumneko_lua diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua.lua index 892afc2..7e55549 100644 --- a/.config/nvim/lua/lsp/lua.lua +++ b/.config/nvim/lua/lsp/lua.lua @@ -6,8 +6,10 @@ local system_name = "Linux" -- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use -local sumneko_root_path = globals.lsp_path .. "/sumneko_lua" -local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server" +local sumneko_root_path = vim.fn.stdpath("data") .. + "/lsp_servers/sumneko_lua/extension/server" +local sumneko_binary = sumneko_root_path .. "/bin/" .. system_name .. + "/lua-language-server" require'lspconfig'.sumneko_lua.setup { cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; diff --git a/.local/share/nvim/lsp/sumneko_lua b/.local/share/nvim/lsp/sumneko_lua deleted file mode 160000 index c876e0d..0000000 --- a/.local/share/nvim/lsp/sumneko_lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c876e0da1c0c2d01db9cb0c6f2914659318e0460 From 6bd3c20f7d2df141934b53de7c3c25d4e4b76387 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 12:49:55 +0200 Subject: [PATCH 06/10] [nvim] feat: auto install lsp servers python, lua, bash, tex --- .config/nvim/lua/plugin/lsp_installer.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.config/nvim/lua/plugin/lsp_installer.lua b/.config/nvim/lua/plugin/lsp_installer.lua index fa6fc46..70e929f 100644 --- a/.config/nvim/lua/plugin/lsp_installer.lua +++ b/.config/nvim/lua/plugin/lsp_installer.lua @@ -15,6 +15,24 @@ lsp_installer.settings { } } +local servers = { + "bashls", + "jedi_language_server", + "texlab", + "sumneko_lua", +} + +for _, name in pairs(servers) do + local ok, server = lsp_installer.get_server(name) + -- Check that the server is supported in nvim-lsp-installer + if ok then + if not server:is_installed() then + print("Installing " .. name) + server:install() + end + end +end + lsp_installer.on_server_ready(function(server) local opts = {} From 1634cc16792154910917de841f72b9b16b1c1dbf Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 14:41:33 +0200 Subject: [PATCH 07/10] [nvim] feat: Comment plugin keymaps --- .config/nvim/lua/plugin/comment.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/plugin/comment.lua b/.config/nvim/lua/plugin/comment.lua index 6cb9912..c226f13 100644 --- a/.config/nvim/lua/plugin/comment.lua +++ b/.config/nvim/lua/plugin/comment.lua @@ -20,27 +20,30 @@ require("Comment").setup { ---operator-pending mapping ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}` basic = true, + ---extra mapping + ---Includes `gco`, `gcO`, `gcA` + extra = true, ---extended mapping ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}` - extra = false, + extended = false, }, ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode ---@type table toggler = { ---line-comment toggle - line = 'gcc', + line = "", ---block-comment toggle - block = 'gbc', + block = "bb", }, ---LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode ---@type table opleader = { ---line-comment opfunc mapping - line = 'gc', + line = "c", ---block-comment opfunc mapping - block = 'gb', + block = "b", }, ---Pre-hook, called before commenting the line From 1552146cd7d0e502597a48b7a1046a2de6c261be Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sun, 17 Oct 2021 14:58:15 +0200 Subject: [PATCH 08/10] [nvim] cleanup: plugin setup inside plugins.lua move `require("") to nvim/lua/plugins.lua --- .config/nvim/init.lua | 9 --------- .config/nvim/lua/plugins.lua | 11 ++++++++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 4c60c50..6036136 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -11,12 +11,3 @@ require("maps") -- ./lua/maps.lua require("statusline") -- ./lua/statusline.lua require("polyjuice") -- ~/.local/src/polyjuice/lua/polyjuice.lua - --- auto complete -require("plugin.cmp") -- ./lua/plugin/cmp.lua - --- treesitter -require("plugin.treesitter") -- ./lua/plugin/treesitter.lua - --- commenting, done right -require("plugin.comment") -- ./lua/plugin/comment.lua diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 5ce4328..eaa407b 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -27,7 +27,8 @@ return require("packer").startup(function() -- tree-sitter use { "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate" + run = ":TSUpdate", + config = function() require("plugin.treesitter") end } -- fuzzy finder @@ -75,11 +76,15 @@ return require("packer").startup(function() "hrsh7th/cmp-calc", "ray-x/cmp-treesitter", "f3fora/cmp-spell" - } + }, + config = function() require("plugin.cmp") end } -- commenting, simplified - use "numToStr/Comment.nvim" + use { + "numToStr/Comment.nvim", + config = function() require("plugin.comment") end + } -- display colors directly in editor use { From ecc15d8798fe62b150da1fd8be94ef7f8e11288e Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Mon, 18 Oct 2021 22:48:42 +0200 Subject: [PATCH 09/10] [nvim] fix: texlab command for lsp specified the path to lsp server --- .config/nvim/lua/lsp/tex.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/nvim/lua/lsp/tex.lua b/.config/nvim/lua/lsp/tex.lua index d61cd01..a715ed9 100644 --- a/.config/nvim/lua/lsp/tex.lua +++ b/.config/nvim/lua/lsp/tex.lua @@ -4,6 +4,7 @@ -- Description : LaTeX config file for lsp require("lspconfig").texlab.setup { + cmd = { vim.fn.stdpath("data") .. "/lsp_servers/latex/texlab" }, settings = { build = { executable = "pdflatex" From f5faaa5a90c3dfc09fb22c6ff33d2b0617d02899 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Mon, 18 Oct 2021 23:52:03 +0200 Subject: [PATCH 10/10] [nvim] cleanup: remove sumneko_lua --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index dfbd1ba..adcdc69 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,6 +16,3 @@ [submodule ".local/src/slock"] path = .local/src/slock url = git@github.com:swy7ch/slock.git -[submodule ".local/share/nvim/lsp/sumneko_lua"] - path = .local/share/nvim/lsp/sumneko_lua - url = git@github.com:sumneko/lua-language-server.git