[nvim] fix: shorten filenames in unfocused buffers

786d119 shortened the filename for the current buffer, but didn't change
the filename in other buffers
This commit is contained in:
David JULIEN 2023-02-13 09:49:14 +01:00
parent 786d119e5c
commit cdd3b50248
1 changed files with 7 additions and 1 deletions

View File

@ -215,8 +215,14 @@ local function statusline_focused()
end
local function statusline_not_focused()
local bufnr = vim.fn.winbufnr(vim.g.statusline_winid)
local file = vim.fn.expand("#" .. bufnr .. ":p:~")
local winwidth = vim.fn.winwidth(0)
return table.concat {
gen_section("%#StatuslineNF#", { "%f", "%m" }),
gen_section("%#StatuslineNF#", {
shorten_path(file, winwidth / 3),
"%m"
}),
"%=",
gen_section("%#StatuslineNF#", { "%03.p%%" }),
gen_section("%#StatuslineNF#", { "-%03.c-" })