yegappan / mru

Most Recently Used (MRU) Vim Plugin
Other
259 stars 48 forks source link

Keep alternate file when using current window #50

Closed mmrwoods closed 2 years ago

mmrwoods commented 2 years ago

Update commands to use keepalt when MRU set to use the current window, such that after opening and selecting a file from the MRU window, the alternate file is the last edited file rather than the MRU files buffer.

The MRU files buffer is empty when loaded as the alternate file, so it doesn't seem necessary to add a new configuration variable for this.

mmrwoods commented 2 years ago

This does not work when MRU is loaded immediately after opening vim, but that could be addressed as an edge case later

yegappan commented 2 years ago

Thanks for reporting this issue and the patch. With this change, when opening a file from the MRU window (without MRU_Use_Current_Window set to 1), the alternate file is not modified.

I have pushed a change 9e85b70943d7da5c5843035394526b37b1a669ed to handle this correctly and added tests for this.

mmrwoods commented 2 years ago

Great, thanks!

Since adding the original PR, I've updated my fork to also avoid setting the MRU files buffer as the alternate file when MRU is set to use the current window. This addresses the edge case of MRU being loaded immediately after opening vim (i.e. it is the first buffer).

Seems to work nicely, see https://github.com/mmrwoods/mru/commit/0e04bcf2d84e7797965ec0b4ddebff88b8bf9522

mmrwoods commented 2 years ago

Seems to work nicely, see mmrwoods@0e04bcf

I've added a separate PR for this and a fix for the MRUToggle command when using the current window: https://github.com/yegappan/mru/pull/51