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/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/.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" 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 diff --git a/.config/nvim/lua/plugin/lsp_installer.lua b/.config/nvim/lua/plugin/lsp_installer.lua new file mode 100644 index 0000000..70e929f --- /dev/null +++ b/.config/nvim/lua/plugin/lsp_installer.lua @@ -0,0 +1,47 @@ +-- 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 = "✗" + } + } +} + +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 = {} + + -- (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..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 @@ -48,6 +49,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"}, @@ -66,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 { 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 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 diff --git a/.local/share/nvim/lsp/sumneko_lua b/.local/share/nvim/lsp/sumneko_lua deleted file mode 160000 index db51575..0000000 --- a/.local/share/nvim/lsp/sumneko_lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit db515753ac0c9811199453d3e4ce72a1c72f5e2e