From de19c7bc39e0ea504d042455460d2128b3a94c89 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Tue, 10 Jan 2023 09:19:58 +1030 Subject: [PATCH] more updates? --- .config/nvim/lua/lazyvim/plugins/lsp/init.lua | 1 + .config/nvim/lua/lazyvim/plugins/lsp/misc.lua | 33 +++++++++++++++++++ .config/nvim/lua/lazyvim/plugins/lualine.lua | 4 --- .../nvim/lua/lazyvim/plugins/treesitter.lua | 22 ++++++------- 4 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 .config/nvim/lua/lazyvim/plugins/lsp/misc.lua diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index 899adee..ed9eb97 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -36,6 +36,7 @@ return { require("lazyvim.functions").on_attach(function(client, buffer) require("lazyvim.plugins.lsp.format").on_attach(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) + require("lazyvim.plugins.lsp.misc").on_attach(client, buffer) end) -- diagnostics diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua new file mode 100644 index 0000000..72cabe5 --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua @@ -0,0 +1,33 @@ +local M = {} + +function M.disable_deno_formatting(client) + if client.name == "denols" then + require("null-ls").disable({ "prettier" }) + end +end + +function M.resolve_tsserver_deno(client) + local active_clients = vim.lsp.get_active_clients() + if client.name == "denols" then + for _, client_ in pairs(active_clients) do + -- stop tsserver if denols is already active + if client_.name == "tsserver" then + client_.stop() + end + end + elseif client.name == "tsserver" then + for _, client_ in pairs(active_clients) do + -- prevent tsserver from starting if denols is already active + if client_.name == "denols" then + client.stop() + end + end + end +end + +function M.on_attach(client, bufnr) + M.disable_deno_formatting(client) + M.resolve_tsserver_deno(client) +end + +return M diff --git a/.config/nvim/lua/lazyvim/plugins/lualine.lua b/.config/nvim/lua/lazyvim/plugins/lualine.lua index 1c48052..71ebcdc 100644 --- a/.config/nvim/lua/lazyvim/plugins/lualine.lua +++ b/.config/nvim/lua/lazyvim/plugins/lualine.lua @@ -110,10 +110,6 @@ return { lualine_y = { "filetype " }, lualine_z = { "%l:%c", "%p%%/%L" }, }), - inactive_sections = { - lualine_c = { "%f %y %m" }, - lualine_x = {}, - }, } end, } diff --git a/.config/nvim/lua/lazyvim/plugins/treesitter.lua b/.config/nvim/lua/lazyvim/plugins/treesitter.lua index 2ba44c3..85bdf05 100644 --- a/.config/nvim/lua/lazyvim/plugins/treesitter.lua +++ b/.config/nvim/lua/lazyvim/plugins/treesitter.lua @@ -3,17 +3,17 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", event = "BufReadPost", - ensure_installed = "all", - config = function(plugin) - require("nvim-treesitter.configs").setup({ - sync_install = false, - ensure_installed = plugin.ensure_installed, - matchup = { enable = true }, - highlight = { enable = true }, - autopairs = { enable = true }, - indent = { enable = true }, - context_commentstring = { enable = true, enable_autocmd = false }, - }) + opts = { + sync_install = false, + matchup = { enable = true }, + highlight = { enable = true }, + autopairs = { enable = true }, + indent = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, + ensure_installed = "all", + }, + config = function(plugin, opts) + require("nvim-treesitter.configs").setup(opts) end, }, }