diff options
author | Yigit Sever | 2022-12-17 17:55:27 +0300 |
---|---|---|
committer | Yigit Sever | 2022-12-17 17:55:27 +0300 |
commit | 4ace0a7ee4b9249e07bd0be74193fd513b6d4ca0 (patch) | |
tree | 09d8570dd5244cd3421e692959e8ddfe7f0f83ef /.config/nvim/lua/plugin_settings.lua | |
parent | 86ef795ec0e33739c62d2e4a7aea706f6a96a24d (diff) | |
download | dotfiles-4ace0a7ee4b9249e07bd0be74193fd513b6d4ca0.tar.gz dotfiles-4ace0a7ee4b9249e07bd0be74193fd513b6d4ca0.tar.bz2 dotfiles-4ace0a7ee4b9249e07bd0be74193fd513b6d4ca0.zip |
feat(nvim): lualine show ff and enc when needed
Diffstat (limited to '.config/nvim/lua/plugin_settings.lua')
-rw-r--r-- | .config/nvim/lua/plugin_settings.lua | 17 |
1 files changed, 13 insertions, 4 deletions
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 = { | |||
47 | end | 47 | end |
48 | } | 48 | } |
49 | 49 | ||
50 | -- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ | ||
51 | -- override 'encoding': don't display if encoding is utf-8. | ||
52 | local encoding = function() | ||
53 | local ret, _ = (vim.bo.fenc).gsub("^utf%-8$", "") | ||
54 | return ret | ||
55 | end | ||
56 | |||
57 | -- fileformat: don't display if &ff is unix. | ||
58 | local fileformat = function() | ||
59 | local ret, _ = vim.bo.fileformat.gsub("^unix$", "") | ||
60 | return ret | ||
61 | end | ||
50 | 62 | ||
51 | require'lualine'.setup { | 63 | require'lualine'.setup { |
52 | options = { | 64 | options = { |
@@ -72,16 +84,13 @@ require'lualine'.setup { | |||
72 | cond = conditions.spell_on, | 84 | cond = conditions.spell_on, |
73 | }}, | 85 | }}, |
74 | lualine_c = {'filename'}, | 86 | lualine_c = {'filename'}, |
75 | lualine_x = {'encoding', 'fileformat', 'filetype'}, | 87 | lualine_x = {encoding, fileformat, 'filetype'}, |
76 | lualine_y = {'progress'}, | 88 | lualine_y = {'progress'}, |
77 | lualine_z = { | 89 | lualine_z = { |
78 | 'location', { | 90 | 'location', { |
79 | 'diagnostics', | 91 | 'diagnostics', |
80 | sources = {'nvim_diagnostic'}, | 92 | sources = {'nvim_diagnostic'}, |
81 | sections = {'error', 'warn', 'info', 'hint'}, | 93 | sections = {'error', 'warn', 'info', 'hint'}, |
82 | diagnostics_color = { | ||
83 | warn = { fg = '#6e6a86' }, | ||
84 | }, | ||
85 | symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} | 94 | symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} |
86 | } | 95 | } |
87 | } | 96 | } |