lsp added to statusbar

This commit is contained in:
Kulvir Singh
2025-05-07 20:11:36 +05:30
parent bbbe31edef
commit 52d123e6cf
5 changed files with 30 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ return {
go = { "gofumpt", "goimports_reviser" }, go = { "gofumpt", "goimports_reviser" },
html = { "prettier" }, html = { "prettier" },
lua = { "stylua" }, lua = { "stylua" },
python = { "autopep8" },
typescript = { "prettier" }, typescript = { "prettier" },
typescriptreact = { "prettier" }, typescriptreact = { "prettier" },
}, },

View File

@@ -6,6 +6,7 @@ return {
lint.linters_by_ft = { lint.linters_by_ft = {
json = { "jsonlint" }, json = { "jsonlint" },
python = { "mypy" },
-- typescript = { "eslint" }, -- typescript = { "eslint" },
-- typescriptreact = { "eslint" }, -- typescriptreact = { "eslint" },
} }

View File

@@ -185,6 +185,9 @@ return {
}, },
}, },
}, },
pyright = {},
ts_ls = {}, ts_ls = {},
tailwindcss = { tailwindcss = {
@@ -198,6 +201,8 @@ return {
"goimports-reviser", "goimports-reviser",
"jsonlint", "jsonlint",
"prettier", "prettier",
"mypy",
"autopep8",
"stylua", "stylua",
}) })

View File

@@ -1,6 +1,5 @@
return { return {
"davidmh/mdx.nvim", "davidmh/mdx.nvim",
config = true, config = true,
ft = "mdx",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },
} }

View File

@@ -5,21 +5,40 @@ return {
local statusline = require "mini.statusline" local statusline = require "mini.statusline"
statusline.setup { use_icons = vim.g.have_nerd_font } statusline.setup { use_icons = vim.g.have_nerd_font }
local function get_lsp_clients()
local clients = vim.lsp.get_clients()
if #clients == 0 then
return ""
end
local names = {}
for _, client in ipairs(clients) do
table.insert(names, client.name)
end
local lsp_string = table.concat(names, "|")
return "" .. lsp_string
end
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
statusline.active = function() statusline.active = function()
local mode, mode_hl = statusline.section_mode { trunc_width = 120 } local mode, mode_hl = statusline.section_mode { trunc_width = 120 }
local diff = statusline.section_diff { trunc_width = 75 }
local git = statusline.section_git() local git = statusline.section_git()
local diagnostics = statusline.section_diagnostics() local diagnostics = statusline.section_diagnostics()
local filename = statusline.section_filename { trunc_width = 140 } local fileinfo = MiniStatusline.section_fileinfo { trunc_width = 120 }
local location = statusline.section_location() local location = statusline.section_location()
local lsp = get_lsp_clients()
return statusline.combine_groups { return statusline.combine_groups {
{ hl = mode_hl, strings = { mode } }, { hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { diagnostics } }, { hl = "MiniStatuslineDevinfo", strings = { git, diff } },
"%<", "%<",
{ hl = "MiniStatuslineFilename", strings = { filename } }, { hl = "MiniStatuslineFilename", strings = { fileinfo } },
"%=", "%=",
{ hl = "MiniStatuslineDevinfo", strings = { git } }, { hl = "MiniStatuslineFilename", strings = { lsp } },
{ hl = "MiniStatuslineDevinfo", strings = { diagnostics } },
{ hl = mode_hl, strings = { location } }, { hl = mode_hl, strings = { location } },
} }
end end