diff options
author | Adam <56338480+adastx@users.noreply.github.com> | 2022-06-02 21:14:15 +0200 |
---|---|---|
committer | Adam <56338480+adastx@users.noreply.github.com> | 2022-06-02 21:44:36 +0200 |
commit | c8fc2e2d1b7c9ccc2856bd01d240ef36d3dc2ec9 (patch) | |
tree | 43a869fb835aeccc29b32ada1876dbd4201f6ec9 /.config/nvim/lua/setup | |
parent | fb8d5eed2cf90c97be763d01f224d14e8854a1b7 (diff) |
nvim: lualine show active lsp status
Diffstat (limited to '.config/nvim/lua/setup')
-rw-r--r-- | .config/nvim/lua/setup/lualine.lua | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/.config/nvim/lua/setup/lualine.lua b/.config/nvim/lua/setup/lualine.lua index 2a792b7..36517b0 100644 --- a/.config/nvim/lua/setup/lualine.lua +++ b/.config/nvim/lua/setup/lualine.lua @@ -1,4 +1,6 @@ -require 'lualine'.setup { +local lualine = require 'lualine' + +local config = { options = { icons_enabled = true, theme = 'onedark', @@ -26,3 +28,33 @@ require 'lualine'.setup { tabline = {}, extensions = {}, } + +-- local function ins_left(component) +-- table.insert(config.sections.lualine_c, component) +-- end + +local function ins_right(component) + table.insert(config.sections.lualine_x, 1, component) +end + +ins_right { + -- Lsp server name . + function() + local msg = '' + 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 = ' ', +} + +lualine.setup(config) |