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