]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/nvim/lua/plugins/lualine.lua
neovim: configure, using ghostty and tmux
[julm/julm-nix.git] / home-manager / profiles / nvim / lua / plugins / lualine.lua
1 -- A blazing fast and easy to configure neovim statusline plugin written in pure lua.
2 -- https://github.com/nvim-lualine/lualine.nvim
3 return {
4 "lualine.nvim",
5 lazy = false,
6 after = function()
7 require("lualine").setup({
8 extensions = {
9 "neo-tree",
10 {
11 filetypes = { "snacks_picker_list", "snacks_picker_input" },
12 sections = {
13 lualine_a = {
14 function()
15 return vim.fn.fnamemodify(vim.fn.getcwd(), ":~")
16 end,
17 },
18 },
19 },
20 },
21 inactive_sections = {
22 lualine_a = {},
23 lualine_b = {},
24 lualine_c = { "filename" },
25 lualine_x = { "location" },
26 lualine_y = {},
27 lualine_z = {},
28 },
29 options = {
30 always_divide_middle = true,
31 component_separators = { left = "", right = "" },
32 globalstatus = true,
33 icons_enabled = true,
34 refresh = { statusline = 200, tabline = 1000, winbar = 1000 },
35 section_separators = { left = "", right = "" },
36 theme = "ayu",
37 },
38 sections = {
39 lualine_a = {
40 {
41 "mode",
42 icons_enabled = true,
43 separator = {
44 left = "▎",
45 right = "",
46 },
47 },
48 {
49 "",
50 draw_empty = true,
51 separator = { left = "", right = "" },
52 },
53 },
54 lualine_b = {
55 {
56 "filetype",
57 colored = true,
58 icon_only = true,
59 icon = { align = "left" },
60 },
61 {
62 "filename",
63 path = 1, -- relative path from the cwd
64 symbols = { modified = " ", readonly = " " },
65 separator = { right = "" },
66 },
67 {
68 "",
69 draw_empty = true,
70 separator = { left = "", right = "" },
71 },
72 },
73 lualine_c = {
74 {
75 "diff",
76 colored = false,
77 diff_color = {
78 -- Same color values as the general color option can be used here.
79 added = "DiffAdd", -- Changes the diff's added color
80 modified = "DiffChange", -- Changes the diff's modified color
81 removed = "DiffDelete", -- Changes the diff's removed color you
82 },
83 symbols = { added = "+", modified = "~", removed = "-" }, -- Changes the diff symbols
84 separator = { right = "" },
85 },
86 },
87 lualine_x = {
88 {
89 -- Lsp server name
90 function()
91 local buf_ft = vim.bo.filetype
92 local excluded_buf_ft =
93 { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
94
95 if excluded_buf_ft[buf_ft] then
96 return ""
97 end
98
99 local bufnr = vim.api.nvim_get_current_buf()
100 local clients = vim.lsp.get_clients({ bufnr = bufnr })
101
102 if vim.tbl_isempty(clients) then
103 return "No Active LSP"
104 end
105
106 local active_clients = {}
107 for _, client in ipairs(clients) do
108 table.insert(active_clients, client.name)
109 end
110
111 return table.concat(active_clients, ", ")
112 end,
113 icon = " ",
114 separator = { left = "" },
115 },
116 {
117 "diagnostics",
118 sources = { "nvim_lsp", "nvim_diagnostic", "nvim_diagnostic", "vim_lsp", "coc" },
119 symbols = { error = "󰅙 ", warn = " ", info = " ", hint = "󰌵 " },
120 colored = true,
121 update_in_insert = false,
122 always_visible = false,
123 diagnostics_color = {
124 color_error = { fg = "red" },
125 color_warn = { fg = "yellow" },
126 color_info = { fg = "cyan" },
127 },
128 },
129 },
130 lualine_y = {
131 {
132 "",
133 draw_empty = true,
134 separator = { left = "", right = "" },
135 },
136 {
137 "searchcount",
138 maxcount = 999,
139 timeout = 120,
140 separator = { left = "" },
141 },
142 --{
143 -- "branch",
144 -- icon = " •",
145 -- separator = { left = "" },
146 --},
147 },
148 lualine_z = {
149 {
150 "",
151 draw_empty = true,
152 separator = { left = "", right = "" },
153 },
154 {
155 "progress",
156 separator = { left = "" },
157 },
158 { "location" },
159 --{
160 -- "fileformat",
161 -- color = { fg = "black" },
162 -- symbols = {
163 -- unix = "", -- e712
164 -- dos = "", -- e70f
165 -- mac = "", -- e711
166 -- },
167 --},
168 },
169 },
170 winbar = { lualine_c = { { "navic", draw_empty = true } } },
171 })
172 end,
173 }