Skip to content

Commit 65a71b2

Browse files
committed
Move lualine config to file
1 parent 3e5ced2 commit 65a71b2

2 files changed

Lines changed: 193 additions & 191 deletions

File tree

lua/plugins/lualine.lua

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
---@type LazySpec
2+
return {
3+
{
4+
"nvim-lualine/lualine.nvim",
5+
lazy = false,
6+
opts = {
7+
options = {
8+
theme = "auto",
9+
component_separators = { left = "", right = "" },
10+
section_separators = { left = "", right = "" },
11+
disabled_filetypes = {
12+
statusline = {},
13+
winbar = { "neo-tree", "snacks_dashboard", "qf", "noice", "trouble", "help" },
14+
},
15+
always_divide_middle = true,
16+
always_show_tabline = false,
17+
},
18+
sections = {
19+
lualine_a = {},
20+
lualine_b = {
21+
{
22+
-- Separator to set the left edge
23+
function() return "" end,
24+
draw_empty = true,
25+
separator = { left = "" },
26+
},
27+
{ "project", format = "short", no_project = "N/A" },
28+
{ "branch", on_click = function() Snacks.lazygit() end },
29+
"filetype",
30+
},
31+
lualine_c = {
32+
{
33+
-- harpoon
34+
function(fmt)
35+
local current_file = vim.fn.expand("%:p")
36+
return vim
37+
.iter(ipairs(require("harpoon"):list().items))
38+
:map(function(index, item)
39+
local file_path = vim.fn.fnamemodify(item.value, ":p")
40+
local icon, hl = require("mini.icons").get("file", file_path)
41+
local new_hl = require("nikero.lualine"):statusline_icon_hl(hl, fmt.default_hl)
42+
local icon_str = "%#" .. new_hl .. "#" .. icon .. "%*" .. fmt.default_hl
43+
44+
local value = string.format("%s %d", icon_str, index)
45+
46+
if file_path == current_file then
47+
value = string.format("(%s)", value)
48+
else
49+
value = string.format(" %s ", value)
50+
end
51+
52+
return value
53+
end)
54+
:join("")
55+
end,
56+
},
57+
{
58+
"diff",
59+
padding = { left = 2 },
60+
symbols = {
61+
added = require("icons").git.add .. " ",
62+
modified = require("icons").git.modified .. " ",
63+
removed = require("icons").git.removed .. " ",
64+
},
65+
separator = "",
66+
},
67+
{ "%=", separator = "" },
68+
{
69+
function()
70+
local reg = vim.fn.reg_recording()
71+
if reg == "" then return "" end
72+
return require("icons").tools.macro_recording .. " " .. reg
73+
end,
74+
cond = function() return vim.fn.reg_recording() ~= "" end,
75+
},
76+
},
77+
lualine_x = {
78+
{ function() return require("wtf").get_status() end },
79+
{
80+
function()
81+
local linters = require("lint").get_running()
82+
if #linters == 0 then return require("icons").status.active .. " " end
83+
return require("icons").status.working .. " " .. table.concat(linters, ", ")
84+
end,
85+
color = function()
86+
local linters = require("lint").get_running()
87+
return { fg = #linters == 0 and "#33aa88" or nil }
88+
end,
89+
},
90+
{
91+
"diagnostics",
92+
padding = 2,
93+
symbols = {
94+
error = require("icons").diagnostics.error .. " ",
95+
warn = require("icons").diagnostics.warn .. " ",
96+
info = require("icons").diagnostics.info .. " ",
97+
hint = require("icons").diagnostics.hint .. " ",
98+
},
99+
},
100+
},
101+
lualine_y = {
102+
{ "progress", padding = { left = 1, right = 2 } },
103+
{ "location", separator = { right = "" } },
104+
},
105+
lualine_z = {},
106+
},
107+
tabline = {
108+
lualine_a = {},
109+
lualine_b = {},
110+
lualine_c = {
111+
{
112+
"tabs",
113+
mode = 2,
114+
section_separators = { left = "", right = "" },
115+
show_modified_status = false,
116+
tabs_color = {
117+
active = "lualine_a_normal",
118+
inactive = "lualine_c_inactive",
119+
},
120+
},
121+
},
122+
lualine_x = {},
123+
lualine_y = {},
124+
lualine_z = {},
125+
},
126+
winbar = {
127+
lualine_a = {},
128+
lualine_b = {
129+
{
130+
"filetype",
131+
separator = { left = "" },
132+
padding = { left = 1, right = 0 },
133+
icon_only = true,
134+
},
135+
{
136+
"filename",
137+
padding = { left = 0, right = 1 },
138+
file_status = true,
139+
newfile_status = true,
140+
path = 1,
141+
symbols = {
142+
modified = require("icons").files.modified,
143+
readonly = require("icons").files.read_only,
144+
unnamed = require("icons").files.new,
145+
newfile = require("icons").files.new,
146+
},
147+
},
148+
},
149+
lualine_c = {
150+
{ "navic", color_correction = "static", draw_empty = true },
151+
},
152+
lualine_x = {},
153+
lualine_y = {},
154+
lualine_z = {},
155+
},
156+
inactive_winbar = {
157+
lualine_a = {},
158+
lualine_b = {
159+
{
160+
"filetype",
161+
separator = "",
162+
padding = { left = 2, right = 0 },
163+
colored = false,
164+
icon_only = true,
165+
},
166+
{
167+
"filename",
168+
padding = { left = 0, right = 1 },
169+
file_status = true,
170+
newfile_status = true,
171+
path = 1,
172+
symbols = {
173+
modified = require("icons").files.modified,
174+
readonly = require("icons").files.read_only,
175+
unnamed = require("icons").files.new,
176+
newfile = require("icons").files.new,
177+
},
178+
},
179+
},
180+
lualine_c = {},
181+
lualine_x = {},
182+
lualine_y = {},
183+
lualine_z = {},
184+
},
185+
extensions = { "lazy", "man", "mason", "trouble" },
186+
},
187+
config = function(_, opts)
188+
local lualine_require = require("lualine_require")
189+
lualine_require.require = require
190+
require("lualine").setup(opts)
191+
end,
192+
},
193+
}

lua/plugins/ui.lua

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -271,195 +271,4 @@ return {
271271
safe_output = true,
272272
},
273273
},
274-
{
275-
"nvim-lualine/lualine.nvim",
276-
lazy = false,
277-
opts = {
278-
options = {
279-
theme = "auto",
280-
component_separators = { left = "", right = "" },
281-
section_separators = { left = "", right = "" },
282-
disabled_filetypes = {
283-
statusline = {},
284-
winbar = { "neo-tree", "snacks_dashboard", "qf", "noice", "trouble", "help" },
285-
},
286-
always_divide_middle = true,
287-
always_show_tabline = false,
288-
},
289-
sections = {
290-
lualine_a = {},
291-
lualine_b = {
292-
{
293-
-- Separator to set the left edge
294-
function() return "" end,
295-
draw_empty = true,
296-
separator = { left = "" },
297-
},
298-
{ "project", format = "short", no_project = "N/A" },
299-
{ "branch", on_click = function() Snacks.lazygit() end },
300-
"filetype",
301-
},
302-
lualine_c = {
303-
{
304-
-- harpoon
305-
function(fmt)
306-
local current_file = vim.fn.expand("%:p")
307-
return vim
308-
.iter(ipairs(require("harpoon"):list().items))
309-
:map(function(index, item)
310-
local file_path = vim.fn.fnamemodify(item.value, ":p")
311-
local icon, hl = require("mini.icons").get("file", file_path)
312-
local new_hl = require("nikero.lualine"):statusline_icon_hl(hl, fmt.default_hl)
313-
local icon_str = "%#" .. new_hl .. "#" .. icon .. "%*" .. fmt.default_hl
314-
315-
local value = string.format("%s %d", icon_str, index)
316-
317-
if file_path == current_file then
318-
value = string.format("(%s)", value)
319-
else
320-
value = string.format(" %s ", value)
321-
end
322-
323-
return value
324-
end)
325-
:join("")
326-
end,
327-
},
328-
{
329-
"diff",
330-
padding = { left = 2 },
331-
symbols = {
332-
added = require("icons").git.add .. " ",
333-
modified = require("icons").git.modified .. " ",
334-
removed = require("icons").git.removed .. " ",
335-
},
336-
separator = "",
337-
},
338-
{ "%=", separator = "" },
339-
{
340-
function()
341-
local reg = vim.fn.reg_recording()
342-
if reg == "" then return "" end
343-
return require("icons").tools.macro_recording .. " " .. reg
344-
end,
345-
cond = function() return vim.fn.reg_recording() ~= "" end,
346-
color = "SpecialChar",
347-
},
348-
},
349-
lualine_x = {
350-
{ function() return require("wtf").get_status() end },
351-
{
352-
function()
353-
local linters = require("lint").get_running()
354-
if #linters == 0 then return require("icons").status.active .. " " end
355-
return require("icons").status.working .. " " .. table.concat(linters, ", ")
356-
end,
357-
color = function()
358-
local linters = require("lint").get_running()
359-
return { fg = #linters == 0 and "#33aa88" or nil }
360-
end,
361-
},
362-
{
363-
"diagnostics",
364-
padding = 2,
365-
symbols = {
366-
error = require("icons").diagnostics.error .. " ",
367-
warn = require("icons").diagnostics.warn .. " ",
368-
info = require("icons").diagnostics.info .. " ",
369-
hint = require("icons").diagnostics.hint .. " ",
370-
},
371-
},
372-
},
373-
lualine_y = {
374-
{ "progress", padding = { left = 1, right = 2 } },
375-
{ "location", separator = { right = "" } },
376-
},
377-
lualine_z = {},
378-
},
379-
tabline = {
380-
lualine_a = {},
381-
lualine_b = {},
382-
lualine_c = {
383-
{
384-
"tabs",
385-
mode = 2,
386-
section_separators = { left = "", right = "" },
387-
show_modified_status = false,
388-
tabs_color = {
389-
active = "lualine_a_normal",
390-
inactive = "lualine_c_inactive",
391-
},
392-
},
393-
},
394-
lualine_x = {},
395-
lualine_y = {},
396-
lualine_z = {},
397-
},
398-
winbar = {
399-
lualine_a = {},
400-
lualine_b = {
401-
{
402-
"filetype",
403-
separator = { left = "" },
404-
padding = { left = 1, right = 0 },
405-
icon_only = true,
406-
},
407-
{
408-
"filename",
409-
padding = { left = 0, right = 1 },
410-
file_status = true,
411-
newfile_status = true,
412-
path = 1,
413-
symbols = {
414-
modified = require("icons").files.modified,
415-
readonly = require("icons").files.read_only,
416-
unnamed = require("icons").files.new,
417-
newfile = require("icons").files.new,
418-
},
419-
},
420-
},
421-
lualine_c = {
422-
{ "navic", color_correction = "static", draw_empty = true },
423-
},
424-
lualine_x = {},
425-
lualine_y = {},
426-
lualine_z = {},
427-
},
428-
inactive_winbar = {
429-
lualine_a = {},
430-
lualine_b = {
431-
{
432-
"filetype",
433-
separator = "",
434-
padding = { left = 2, right = 0 },
435-
colored = false,
436-
icon_only = true,
437-
},
438-
{
439-
"filename",
440-
padding = { left = 0, right = 1 },
441-
file_status = true,
442-
newfile_status = true,
443-
path = 1,
444-
symbols = {
445-
modified = require("icons").files.modified,
446-
readonly = require("icons").files.read_only,
447-
unnamed = require("icons").files.new,
448-
newfile = require("icons").files.new,
449-
},
450-
},
451-
},
452-
lualine_c = {},
453-
lualine_x = {},
454-
lualine_y = {},
455-
lualine_z = {},
456-
},
457-
extensions = { "lazy", "man", "mason", "trouble" },
458-
},
459-
config = function(_, opts)
460-
local lualine_require = require("lualine_require")
461-
lualine_require.require = require
462-
require("lualine").setup(opts)
463-
end,
464-
},
465274
}

0 commit comments

Comments
 (0)