From 0c01fbc12150ea487dbeabc0b3c6dd4b3e61fd60 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 7 Jun 2023 02:36:02 +0300 Subject: [PATCH] feat: display LSP source on statusline --- modules/statusline/lualine/config.nix | 5 +++-- modules/statusline/lualine/lualine.nix | 20 +++++++++++++++++++- modules/ui/modes/config.nix | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index 7d4d879..385e139 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -12,13 +12,14 @@ in { ]; vim.luaConfigRC.lualine = nvim.dag.entryAnywhere '' - require('lualine').setup { + local lualine = require('lualine') + lualine.setup { options = { icons_enabled = ${boolToString cfg.icons.enable}, theme = "${cfg.theme}", component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"}, section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"}, - disabled_filetypes = { 'alpha' }, -- 'NvimTree' + disabled_filetypes = { 'alpha' }, always_divide_middle = true, globalstatus = ${boolToString cfg.globalStatus}, ignore_focus = {'NvimTree'}, diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index 3409194..f9e3473 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -183,6 +183,25 @@ in { description = "active config for: | A | B | C (X) | Y | Z |"; default = '' { + { + -- Lsp server name . + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + 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 = ' ', + }, { "diagnostics", sources = {'nvim_lsp', 'nvim_diagnostic', 'coc'}, @@ -227,7 +246,6 @@ in { separator = { left = '', }, - }, { "location", diff --git a/modules/ui/modes/config.nix b/modules/ui/modes/config.nix index 2e9ac04..827eca5 100644 --- a/modules/ui/modes/config.nix +++ b/modules/ui/modes/config.nix @@ -15,6 +15,9 @@ in { vim.luaConfigRC.modes-nvim = nvim.dag.entryAnywhere '' require('modes').setup({ set_cursorline = ${boolToString cfg.setCursorline}, + line_opacity = { + visual = 0, + }, colors = { copy = "${toString cfg.colors.copy}", delete = "${toString cfg.colors.delete}",