Compare commits

...

2 Commits

Author SHA1 Message Date
Sanchayan Maity cd50d8f956
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.
2024-04-12 11:01:26 +05:30
Sanchayan Maity f27f6629de
nvim: after/ftplugin/c: Do not add include files to buffer list
Hide header files from /usr/include from the buffer list.
2024-04-11 16:07:55 +05:30
2 changed files with 11 additions and 1 deletions

View File

@ -7,3 +7,10 @@ vim.bo.makeprg = 'meson compile -C build'
vim.keymap.set('n', 'gh', ":ClangdSwitchSourceHeader<CR>", { noremap=true, buffer=0 })
vim.keymap.set('n', 'gq', ":!gst-indent %<CR>" , { noremap=true, buffer=0 })
vim.api.nvim_create_autocmd({ "BufReadPre", "BufWinEnter" }, {
pattern = { "*/usr/include/*" },
callback = function()
vim.bo.buflisted = false
end,
})

View File

@ -294,7 +294,10 @@ api.nvim_create_autocmd({"BufWinEnter", "BufFilePost"}, {
return
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,
})
api.nvim_create_autocmd({"TermOpen", "TermEnter"}, {