From 70301470abcc1a96a7c164dbf8901aa6f1e52c12 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 20 Oct 2021 08:48:21 +0200 Subject: Update to colorscheme, ftplugin --- .config/nvim/lua/lsp/config.lua | 2 +- .config/nvim/lua/lsp/init.lua | 29 +++++++++++++++++++++----- .config/nvim/lua/lsp/null-ls/init.lua | 5 +++++ .config/nvim/lua/lsp/providers/sumneko_lua.lua | 4 ++-- 4 files changed, 32 insertions(+), 8 deletions(-) (limited to '.config/nvim/lua/lsp') diff --git a/.config/nvim/lua/lsp/config.lua b/.config/nvim/lua/lsp/config.lua index f13d965..9c25249 100644 --- a/.config/nvim/lua/lsp/config.lua +++ b/.config/nvim/lua/lsp/config.lua @@ -1,5 +1,5 @@ return { - templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"), + templates_dir = join_paths(get_config_dir(), "ftplugin"), diagnostics = { signs = { active = true, diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index f421d99..42c2536 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -54,13 +54,22 @@ local function add_lsp_buffer_keybindings(bufnr) return end for mode_name, mode_char in pairs(mappings) do - wk.register(options.lsp.buffer_mappings[mode_name], { mode = mode_char, buffer = bufnr }) + wk.register( + options.lsp.buffer_mappings[mode_name], + { mode = mode_char, buffer = bufnr } + ) end else -- Remap using nvim api for mode_name, mode_char in pairs(mappings) do for key, remap in pairs(options.lsp.buffer_mappings[mode_name]) do - vim.api.nvim_buf_set_keymap(bufnr, mode_char, key, remap[1], { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap( + bufnr, + mode_char, + key, + remap[1], + { noremap = true, silent = true } + ) end end end @@ -94,8 +103,13 @@ local function select_default_formater(client) Log:debug("Checking for formatter overriding for " .. client.name) local client_filetypes = client.config.filetypes or {} for _, filetype in ipairs(client_filetypes) do - if options.lang[filetype] and #vim.tbl_keys(options.lang[filetype].formatters) > 0 then - Log:debug("Formatter overriding detected. Disabling formatting capabilities for " .. client.name) + if + options.lang[filetype] and #vim.tbl_keys(options.lang[filetype].formatters) > 0 + then + Log:debug( + "Formatter overriding detected. Disabling formatting capabilities for " + .. client.name + ) client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_range_formatting = false end @@ -146,7 +160,10 @@ function M.setup() end for _, sign in ipairs(options.lsp.diagnostics.signs.values) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) + vim.fn.sign_define( + sign.name, + { texthl = sign.name, text = sign.text, numhl = sign.name } + ) end require("lsp.handlers").setup() @@ -154,6 +171,8 @@ function M.setup() require("lsp.templates").generate_templates() end + Log:info(string.format("%s", options.lsp.templates_dir)) + bootstrap_nlsp { config_home = utils.join_paths(get_config_dir(), "lsp-settings") } require("lsp.null-ls").setup() diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua index fde9fed..a18209b 100644 --- a/.config/nvim/lua/lsp/null-ls/init.lua +++ b/.config/nvim/lua/lsp/null-ls/init.lua @@ -12,6 +12,11 @@ function M:setup() end null_ls.config() + local default_opts = require("lsp").get_common_opts() + + if vim.tbl_isempty(options.lsp.null_ls.setup or {}) then + options.lsp.null_ls.setup = default_opts + end require("lspconfig")["null-ls"].setup(options.lsp.null_ls.setup) for filetype, config in pairs(options.lang) do if not vim.tbl_isempty(config.formatters) then diff --git a/.config/nvim/lua/lsp/providers/sumneko_lua.lua b/.config/nvim/lua/lsp/providers/sumneko_lua.lua index 4fee1fd..25693a9 100644 --- a/.config/nvim/lua/lsp/providers/sumneko_lua.lua +++ b/.config/nvim/lua/lsp/providers/sumneko_lua.lua @@ -2,11 +2,11 @@ local opts = { settings = { Lua = { diagnostics = { - globals = { "vim", "lvim" }, + globals = { "vim", "nvim" }, }, workspace = { library = { - [require("utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true, + [require("utils").join_paths(get_runtime_dir(), "lua")] = true, [vim.fn.expand "$VIMRUNTIME/lua"] = true, [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, }, -- cgit v1.2.3-70-g09d2