From 4ace0a7ee4b9249e07bd0be74193fd513b6d4ca0 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sat, 17 Dec 2022 17:55:27 +0300 Subject: feat(nvim): lualine show ff and enc when needed --- .config/nvim/lua/plugin_settings.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to '.config/nvim/lua/plugin_settings.lua') diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index 55a4eae..78b0792 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua @@ -47,6 +47,18 @@ local conditions = { end } +-- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ +-- override 'encoding': don't display if encoding is utf-8. +local encoding = function() + local ret, _ = (vim.bo.fenc).gsub("^utf%-8$", "") + return ret +end + +-- fileformat: don't display if &ff is unix. +local fileformat = function() + local ret, _ = vim.bo.fileformat.gsub("^unix$", "") + return ret +end require'lualine'.setup { options = { @@ -72,16 +84,13 @@ require'lualine'.setup { cond = conditions.spell_on, }}, lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_x = {encoding, fileformat, 'filetype'}, lualine_y = {'progress'}, lualine_z = { 'location', { 'diagnostics', sources = {'nvim_diagnostic'}, sections = {'error', 'warn', 'info', 'hint'}, - diagnostics_color = { - warn = { fg = '#6e6a86' }, - }, symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} } } -- cgit v1.2.3-70-g09d2