elihunter173 / dirbuf.nvim

A file manager for Neovim which lets you edit your filesystem like you edit text
GNU Affero General Public License v3.0
423 stars 7 forks source link

Update open buffers if file or directory (or parent directories!) renamed #18

Closed jeetsukumaran closed 2 years ago

jeetsukumaran commented 2 years ago

Would it be possible for dirbuf to check to see if a rename operation would impact any open buffers and update accordingly after the operation (i.e.,internally and automatically :bw! the old path and :edit the new one)?

elihunter173 commented 2 years ago

I like this idea a lot! I've made mistakes with buffers not automatically being renamed before. It's a bit weird when you're doing a copy + move (i.e. a -> b, c) but I'm fine picking one arbitrarily as the one to rename buffers to then.

vim-eunch's :Move command might have some prior art for this. I'm also looking to see if any other Lua/libuv file managers have this feature

Edit: nvim-tree.lua does this by default on it's rename, although it doesn't handle files in directories which dirbuf.nvim should definitely be able to do. Here's the relevant bits

elihunter173 commented 2 years ago

This feature has been implemented! Copy + move operations are resolved arbitrarily like I mentioned. Thank you for the suggestion. This was way easier than I expected and the results feel quite nice.

jeetsukumaran commented 2 years ago

That's awesome! Thanks -- I know this will be very useful to many :)