diff options
Diffstat (limited to '.config/nvim/lua/plugins/lualine.lua')
-rw-r--r-- | .config/nvim/lua/plugins/lualine.lua | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..c528b69 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua | |||
@@ -0,0 +1,84 @@ | |||
1 | return { | ||
2 | "nvim-lualine/lualine.nvim", | ||
3 | dependencies = { | ||
4 | "nvim-tree/nvim-web-devicons" | ||
5 | }, | ||
6 | config = function() | ||
7 | local function lualine_spell() | ||
8 | if vim.wo.spell then | ||
9 | return "spell" | ||
10 | else | ||
11 | return | ||
12 | end | ||
13 | end | ||
14 | |||
15 | local conditions = { | ||
16 | spell_on = function () | ||
17 | return vim.wo.spell | ||
18 | end, | ||
19 | filetype_is_tex = function() | ||
20 | return vim.bo.filetype == "tex" | ||
21 | end | ||
22 | } | ||
23 | |||
24 | -- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ | ||
25 | -- override 'encoding': don't display if encoding is utf-8. | ||
26 | local encoding = function() | ||
27 | local ret, _ = vim.bo.fenc:gsub("^utf%-8$", "") | ||
28 | return ret | ||
29 | end | ||
30 | |||
31 | -- fileformat: don't display if &ff is unix. | ||
32 | local fileformat = function() | ||
33 | local ret, _ = vim.bo.fileformat:gsub("^unix$", "") | ||
34 | return ret | ||
35 | end | ||
36 | |||
37 | require("lualine").setup({ | ||
38 | options = { | ||
39 | icons_enabled = true, | ||
40 | theme = "catppuccin", | ||
41 | section_separators = { left = '', right = '' }, | ||
42 | component_separators = { left = '', right = '' }, | ||
43 | }, | ||
44 | sections = { | ||
45 | lualine_a = {{'mode', fmt = string.lower}}, | ||
46 | lualine_b = {'branch', | ||
47 | { | ||
48 | 'diff', | ||
49 | diff_color= { | ||
50 | added = { fg = 'LightGreen' }, | ||
51 | modified = { fg = 'LightBlue' }, | ||
52 | removed = { fg = 'LightRed' }, | ||
53 | } | ||
54 | }, | ||
55 | { | ||
56 | lualine_spell, | ||
57 | cond = conditions.spell_on, | ||
58 | }}, | ||
59 | lualine_c = {'filename'}, | ||
60 | lualine_x = {encoding, fileformat, 'filetype'}, | ||
61 | lualine_y = {'progress'}, | ||
62 | lualine_z = { | ||
63 | 'location', { | ||
64 | 'diagnostics', | ||
65 | sources = {'nvim_diagnostic'}, | ||
66 | sections = {'error', 'warn', 'info', 'hint'}, | ||
67 | symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} | ||
68 | } | ||
69 | } | ||
70 | }, | ||
71 | inactive_sections = { | ||
72 | lualine_a = {}, | ||
73 | lualine_b = {}, | ||
74 | lualine_c = {'filename'}, | ||
75 | lualine_x = {}, | ||
76 | lualine_y = {}, | ||
77 | lualine_z = {} | ||
78 | }, | ||
79 | tabline = {}, | ||
80 | extensions = {} | ||
81 | |||
82 | }) | ||
83 | end, | ||
84 | } | ||