nvim: statusline: Make winbar status be relative to current directory
We want file path being shown in winbar to be relative to the current directory or in our case frequently the git root. For whatever reason, only the first opened leftmost split would show the file path relative to current git root while any files opened later would show the full path starting from `HOME`/~ directory. So something around how '%f%m%r' actually works or how it is being used to set winbar has been a problem.
This commit is contained in:
parent
f27f6629de
commit
cd50d8f956
1 changed files with 4 additions and 1 deletions
|
@ -294,7 +294,10 @@ api.nvim_create_autocmd({"BufWinEnter", "BufFilePost"}, {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.opt_local.winbar = string.format(" %s%s", "%#WinbarFile#", '%f%m%r')
|
-- `:.` Reduces file name to be relative to current directory, if possible.
|
||||||
|
local winbar_file = vim.fn.expand('%:.')
|
||||||
|
|
||||||
|
vim.opt_local.winbar = string.format(" %s%s", "%#WinbarFile#", winbar_file)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
api.nvim_create_autocmd({"TermOpen", "TermEnter"}, {
|
api.nvim_create_autocmd({"TermOpen", "TermEnter"}, {
|
||||||
|
|
Loading…
Reference in a new issue