Showing if a file has a BOM. #928
madelaney
started this conversation in
Configuration
Replies: 1 comment
-
I was able to get this done by creating a local function: local function ext_encoding()
local bufnr = vim.api.nvim_get_current_buf()
if vim.bo[bufnr].bomb then
return string.format("%s (bom)", vim.bo[bufnr].fileencoding)
else
return vim.bo[bufnr].fileencoding
end
end Then adding the function require('lualine').setup({
options = {
icons_enabled = true,
theme = theme,
section_separators = { left = '', right = '' },
disabled_filetypes = { 'TelescopePrompt' },
globalstatus = true,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'filename' },
lualine_c = { 'branch', 'diff', 'diagnostics' },
lualine_x = { ext_encoding },
lualine_y = { line_info_component },
lualine_z = {
lsp_ready_component,
{
err_diagnostic_component,
cond = is_err_diagnostic,
separator = { left = '' },
color = { fg = colors.text_softlight, bg = colors.error }
},
{
warn_diagnostic_component,
cond = is_warn_diagnostic,
separator = { left = '' },
color = { fg = colors.text_softdark, bg = colors.warn }
},
},
},
inactive_sections = {
lualine_a = { 'mode' },
lualine_b = { 'filename' },
lualine_c = {},
lualine_x = { ext_encoding },
lualine_y = { line_info_component },
lualine_z = { 'encoding' },
},
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to add the suffix
bom
to any file that has a BOM. I looked at how to do this in the VIM status line (https://vim.fandom.com/wiki/Show_fileencoding_and_bomb_in_the_status_line) but I couldn't figure out why the lualine wanted that formated.Beta Was this translation helpful? Give feedback.
All reactions