summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
authorAdam <adam@adast.xyz>2022-06-02 21:14:15 +0200
committerAdam <adam@adast.xyz>2022-06-04 11:25:52 +0200
commite97b5e38b06d2021de72d56f527e70e9bf50a75c (patch)
treed7b965fe6164956dce7a08eee369f407996c4d54 /.config/nvim/lua
parentcdc0fdd9c3733378d1488a007e5dac3fd89a0cc7 (diff)
nvim: lualine show active lsp status
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/plugins.lua2
-rw-r--r--.config/nvim/lua/setup/lualine.lua34
2 files changed, 34 insertions, 2 deletions
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index e5aacb7..b0fc928 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -21,7 +21,7 @@ local plugins = {
},
{
- "adast9/onedark.nvim",
+ "adastx/onedark.nvim",
after = "packer.nvim",
config = function()
require('onedark').load()
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)