feat(lualine): highlight file encoding & format when not "unix utf-8"
This commit is contained in:
parent
71af65996a
commit
10e898aa81
@ -39,13 +39,15 @@ return {
|
|||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local icons = require("lazyvim.config").icons
|
local icons = require("lazyvim.config").icons
|
||||||
|
local warning_col = { fg = "#bf7b00" }
|
||||||
|
|
||||||
opts.options.theme = "horizon"
|
opts.options.theme = "horizon"
|
||||||
|
|
||||||
opts.sections = {
|
opts.sections = {
|
||||||
lualine_a = { "mode" },
|
lualine_a = { "mode" },
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
Util.lualine.root_dir({ color = { fg = "#bf7b00" } }),
|
-- Show "root dir" of current file when different from CWD
|
||||||
|
Util.lualine.root_dir({ color = warning_col }),
|
||||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||||
{ Util.lualine.pretty_path() },
|
{ Util.lualine.pretty_path() },
|
||||||
},
|
},
|
||||||
@ -63,8 +65,22 @@ return {
|
|||||||
lualine_x = opts.sections.lualine_x,
|
lualine_x = opts.sections.lualine_x,
|
||||||
lualine_z = opts.sections.lualine_y,
|
lualine_z = opts.sections.lualine_y,
|
||||||
lualine_y = {
|
lualine_y = {
|
||||||
{ "fileformat", separator = "", padding = { left = 1, right = 0 } },
|
{
|
||||||
"encoding",
|
"fileformat",
|
||||||
|
color = function()
|
||||||
|
return (vim.bo.fileformat ~= "unix") and warning_col or nil
|
||||||
|
end,
|
||||||
|
separator = "",
|
||||||
|
padding = { left = 1, right = 0 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
function()
|
||||||
|
return vim.o.fileencoding
|
||||||
|
end,
|
||||||
|
color = function()
|
||||||
|
return (vim.o.fileencoding ~= "utf-8") and warning_col or nil
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user