elihunter173/dirbuf.nvim

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

jeetsukumaran opened this issue · 3 comments

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)?

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

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.

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