summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-07-13 23:02:50 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-07-13 23:02:50 +0200
commit9eb1d5b1fdd43ece0452601e526af364de5c84d3 (patch)
treeda832bafa16fa8fb1f57c6ecd368087d6906eda4
parent8648d846267178e009da089dd468c6f7982b35a1 (diff)
Add lsp to lualine
-rw-r--r--fnl/config/lualine.fnl15
1 files changed, 13 insertions, 2 deletions
diff --git a/fnl/config/lualine.fnl b/fnl/config/lualine.fnl
index b8c651d..17360cd 100644
--- a/fnl/config/lualine.fnl
+++ b/fnl/config/lualine.fnl
@@ -13,12 +13,21 @@
:TelescopePrompt
""])
+(defn- active-clients [] (let [clients (vim.lsp.buf_get_clients)
+ client_names []]
+ (each [_ client (pairs clients)]
+ (if (not= client.name :null-ls)
+ (table.insert client_names client.name)))
+ (if (> (length client_names) 0)
+ (table.concat client_names ", ")
+ "")))
+
(defn- hide-in-width [] (> (vim.fn.winwidth 0) 80))
(def- diagnostics {1 :diagnostics
:sources [:nvim_diagnostic]
:sections [:error :warn]
- :symbols {:error " " :warn " "}
+ ;; :symbols {:error "x " :warn "! "}
:colored false
:update_in_insert false
:always_visible true})
@@ -32,6 +41,8 @@
(def- filetype {1 :filetype :cond hide_in_width :color {}})
+(def- language-server {1 active-clients :padding 0 :cond hide_in_width})
+
(let [lualine (util.load-plugin :lualine)]
(lualine.setup {:options {:icons_enabled true
:theme :auto
@@ -42,7 +53,7 @@
:sections {:lualine_a [:mode]
:lualine_b [branch diff :filename]
:lualine_c {}
- :lualine_x [diagnostics filetype]
+ :lualine_x [filetype language-server diagnostics]
:lualine_y {}
:lualine_z [:location :progress :encoding]}
:inactive_sections {:lualine_a [:mode]