stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.84k stars 110 forks source link

Add current directory to the oil buffer #301

Closed dmtrKovalenko closed 7 months ago

dmtrKovalenko commented 8 months ago

Did you check existing requests?

Describe the feature

I would be happy if there would be any way to display the current directory inside oil without additional hacks like virtual text and being able to edit the current directory just like you can edit any other file.

Provide background

I am working on my little idea project of having oild as a sidebar and it looks very good except for one little thing — it does not display the current directory selected at the top which makes it look raw.

image

What is the significance of this feature?

cannot use this plugin without it

Additional details

No response

stevearc commented 7 months ago

The recommended way to do this would be by using the winbar (see :help winbar). You can set that to a custom function that displays the output of oil.get_current_dir(), or you could show the raw buffer name. Editing the name of the directory that oil is currently displaying is probably not going to happen. It's more complex than you think, and the benefit is small.

Gelio commented 6 months ago

For anyone wondering how to set the winbar to display the path, I used

    win_options = {
        winbar = "%{v:lua.require('oil').get_current_dir()}",
    },

https://github.com/Gelio/ubuntu-dotfiles/blob/eee2e9914df726d63870cf1174b80f08f938abc4/universal/neovim/config/nvim/lua/plugins/file-tree.lua#L13