diff options
-rw-r--r-- | after/plugin/statusline.lua | 2 | ||||
-rw-r--r-- | lua/core/statusbar/components.lua | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/after/plugin/statusline.lua b/after/plugin/statusline.lua index eff407c..e1a27de 100644 --- a/after/plugin/statusline.lua +++ b/after/plugin/statusline.lua @@ -52,7 +52,7 @@ el.setup { { { " " }, c.mode { modes = modes, hl_icon_only = false } }, { sections.split, required = true }, { sections.collapse_builtin { { builtin.filetype }, { " " } } }, - { sections.maximum_width(builtin.tail_file, 0.50), required = true }, + { sections.maximum_width(c.fn_tail, 0.50), required = true }, { sections.collapse_builtin { { " " }, { builtin.modified_flag } } }, { sections.split, required = true }, { c.lsp_srvname }, diff --git a/lua/core/statusbar/components.lua b/lua/core/statusbar/components.lua index f731688..0233e1b 100644 --- a/lua/core/statusbar/components.lua +++ b/lua/core/statusbar/components.lua @@ -308,4 +308,18 @@ function M.line(opts) end) end +function M.fn_tail(opts) + opts = opts or {} + local fmt = opts.fmt or "%s" + local hl_exec = opts.hl_exec or "Character" + + local fn = vim.fn.expand("%:t") + if vim.fn.getftype(fn) == "file" then + if string.match(vim.fn.getfperm(fn), 'x', 3) then + return (fmt):format(set_hl(hl_exec, fn)) + end + end + return (fmt):format(fn) +end + return M |