🪴 my neovim config:)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lylla: use sections

robin 318aad91 252fcc78

+37 -28
+37 -28
config/config/lylla.lua
··· 16 16 return fmtstr 17 17 end 18 18 19 - local function rev_hl(hl_name) 20 - local hl = vim.api.nvim_get_hl(0, { name = hl_name }) 21 - if vim.tbl_isempty(hl) or (not hl.fg and not hl.bg and not hl.link) then 22 - return {} 23 - end 24 - if hl.link then 25 - return rev_hl(hl.link) 26 - end 27 - local rev = vim.deepcopy(hl) 28 - rev.fg = hl.bg 29 - rev.bg = hl.fg 30 - return rev 19 + local prefix = vim.env.TERM ~= "linux" and "▐" or "|" 20 + local tl_left_sep = "" 21 + local tl_right_sep = "" 22 + if vim.env.TERM == "linux" then 23 + tl_left_sep = "" 24 + tl_right_sep = "" 31 25 end 32 26 33 - local prefix = vim.env.TERM ~= "linux" and "▐" or "|" 34 - local left_sep = "" 35 - local right_sep = "" 27 + local utils = require("lylla.utils") 28 + 29 + local sl_left_sep = "" 30 + local sl_right_sep = "" 36 31 if vim.env.TERM == "linux" then 37 - left_sep = "" 38 - right_sep = "" 32 + sl_left_sep = "" 33 + sl_right_sep = "" 39 34 end 35 + 40 36 local hls = {} 41 37 vim.once.ColorScheme(function() 42 38 hls.tab = "TabLine" 43 39 ---@type table 44 - hls.tab_rev = rev_hl(hls.tab) 40 + hls.tab_rev = utils.reverse_hl(hls.tab) 45 41 hls.tab_rev.bg = "NONE" 46 42 hls.cur = "TabLineSel" 47 43 ---@type table 48 - hls.cur_rev = rev_hl(hls.cur) 44 + hls.cur_rev = utils.reverse_hl(hls.cur) 49 45 hls.cur_rev.bg = "NONE" 50 46 hls.fil = "TabLineFill" 51 47 end) 52 48 49 + local sections = {} 50 + vim.once.ColorScheme(function() 51 + sections.b = "CursorLine" 52 + sections.b_rev = utils.create_hl(utils.reverse_hl(sections.b)) 53 + end) 54 + 53 55 local H = require("lylla.tabline") 54 56 local lylla = require("lylla") 55 - local utils = require("lylla.utils") 56 57 57 58 lylla.setup({ 58 59 hls = { ··· 63 64 }, 64 65 modules = { 65 66 lylla.component(function() 66 - local modehl = utils.get_modehl() 67 + local modehl, revmodehl = utils.get_modehl() 67 68 return { 68 - { prefix, modehl }, 69 - { "[" .. vim.api.nvim_get_mode().mode .. "]", modehl }, 69 + { section = revmodehl }, 70 + " ", 71 + { vim.api.nvim_get_mode().mode, { fg = 0 } }, 72 + " ", 73 + { section = false }, 74 + { sl_right_sep, modehl }, 70 75 } 71 76 end, { 72 77 events = { "ModeChanged", "CmdlineEnter" }, 73 78 }), 74 - { " " }, 75 79 lylla.component(function() 76 80 return { 81 + { sl_left_sep, sections.b_rev }, 82 + { section = sections.b }, 83 + { " " }, 77 84 utils.getfilepath(), 78 85 utils.getfilename(), 79 86 { " " }, 80 87 "%h%w%m%r", 88 + { section = false }, 89 + { sl_right_sep, sections.b_rev }, 81 90 } 82 91 end, { 83 92 events = { ··· 164 173 local tabhl_rev = t_iscurrent and hls.cur_rev or hls.tab_rev 165 174 local t_win = { 166 175 { string.format("%%%dT", tabidx) }, 167 - { left_sep, tabhl_rev }, 176 + { tl_left_sep, tabhl_rev }, 168 177 { string.format(" %d ", tabidx), tabhl }, 169 - { right_sep, tabhl_rev }, 178 + { tl_right_sep, tabhl_rev }, 170 179 } 171 180 172 181 table.insert( ··· 177 186 local name = vim.fn.bufname(buf) 178 187 local winstr = string.sub(name, 1, 1) == "/" and vim.fs.basename(name) or name 179 188 return { 180 - { left_sep, winhl_rev }, 189 + { tl_left_sep, winhl_rev }, 181 190 { string.format(" %s ", winstr), winhl }, 182 - { right_sep, winhl_rev }, 191 + { tl_right_sep, winhl_rev }, 183 192 } 184 193 end) 185 194 )