From ff5555e3c854e762ed392f3d3bf13f0da744608d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 11:34:29 +0300 Subject: [PATCH 1/2] statusline/lualine: disable LSP status inside toggleterm buffer --- modules/statusline/lualine/lualine.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index ab4d05a..abfd048 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -185,19 +185,29 @@ in { { { -- Lsp server name . + function() - local msg = 'No Active Lsp' local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + + -- Check if the current buffer type is "toggleterm" + if buf_ft == "toggleterm" then + return "" + end + + local msg = 'No Active Lsp' local clients = vim.lsp.get_active_clients() + if next(clients) == nil then return msg end + for _, client in ipairs(clients) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end end + return msg end, icon = ' ', From 7b2e7cb6a831724db70e593752a34733e71c242f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 12:50:51 +0300 Subject: [PATCH 2/2] statusline/lualine: use `nvim_get_option_value()` instead of `nvim_buf_get_option()` Co-authored-by: Frothy <76622149+FrothyMarrow@users.noreply.github.com> --- modules/statusline/lualine/lualine.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index abfd048..f0aff79 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -187,7 +187,7 @@ in { -- Lsp server name . function() - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local buf_ft = vim.api.nvim_get_option_value('filetype', {}) -- Check if the current buffer type is "toggleterm" if buf_ft == "toggleterm" then