From e65eeea36a88fc903d0a2f181c976a09e0415078 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 13 Jun 2024 14:24:44 -0500 Subject: [PATCH] refactor(nvim): improve heirline usage --- .../.config/nvim/lua/plugins/configs/heirline.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua b/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua index 462fde7c..2b5b2c41 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/heirline.lua @@ -15,9 +15,6 @@ return { local utils = require("heirline.utils") local conditions = require("heirline.conditions") - local lsp_attached = function() - return next(vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() })) ~= nil - end local pad = function(num) return string.rep(" ", num) @@ -555,7 +552,7 @@ return { { { condition = function() - return lsp_attached() or conditions.has_diagnostics() + return conditions.lsp_attached() or conditions.has_diagnostics() end, { provider = seps.full.left, @@ -578,7 +575,7 @@ return { provider = seps.full.right, hl = function() local bg = colors.oniViolet2 - if conditions.has_diagnostics() and not lsp_attached() then + if conditions.has_diagnostics() and not conditions.lsp_attached() then bg = colors.sumiInk2 end @@ -587,13 +584,13 @@ return { }, }, { - condition = lsp_attached, + condition = utils.lsp_attached, { - update = { "LspAttach", "LspDetach" }, - provider = function() local names = {} - for _, server in ipairs(vim.lsp.get_clients({ bufnr = 0 })) do + for _, server in + ipairs(vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() })) + do table.insert(names, server.name) end return " " .. table.concat(names, ", ")