oil.nvim
oil.nvim copied to clipboard
feature request: show somewhere in the buffer what directory I'm currently looking at
Did you check existing requests?
- [X] I have searched the existing issues
Describe the feature
My oil looks like this:
I have no idea what dir that is, having a header that states what directory oil is displaying would be absurdly helpful.
Provide background
No response
What is the significance of this feature?
strongly desired
Additional details
Here's my config:
{
"stevearc/oil.nvim",
opts = {
view_options = {
show_hidden = true,
},
skip_confirm_for_simple_edits = true,
delete_to_trash = true,
columns = {
"permissions",
"size",
"mtime",
"icon",
},
keymaps = {
["q"] = "actions.close",
["^"] = "actions.parent",
["gr"] = "actions.refresh",
},
},
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "Oil",
keys = {
{ "<leader>fd", "<CMD>Oil<CR>", desc = "Open oil on dir of current file" },
{
"<leader>fD",
function()
require("oil").open(vim.fn.getcwd())
end,
desc = "Open oil on git root",
},
},
}
I would love to see a feature like this
You can use winbar for that, since there are path information you can get from api
Winbar is the recommended way to do this. If you're using a statusline plugin they probably have a way to configure the winbar, but with raw Neovim APIs you can do this:
function OilDir() return require("oil").get_current_dir() end
vim.api.nvim_create_autocmd("BufWinEnter", {
callback = function(ev)
if vim.bo[ev.buf].filetype == "oil" and vim.api.nvim_get_current_buf() == ev.buf then
vim.api.nvim_set_option_value("winbar", "%{%v:lua.OilDir()%}", { scope = "local", win = 0 })
end
end,
})
ctrl+g can be useful as well.