tpope / vim-unimpaired

unimpaired.vim: Pairs of handy bracket mappings
https://www.vim.org/scripts/script.php?script_id=1590
3.31k stars 205 forks source link

Use count to toggle options in other windows #192

Closed odnoletkov closed 4 years ago

odnoletkov commented 4 years ago

So 2yod would toggle 'diff' in the second window.

Handy with mergetool or Gdiffsplit!. Excluding local or remote version from the diff temporary helps to understand and resolve many conflicts.

tpope commented 4 years ago

My first reaction is I like it. But then I think about how it will complicate the implementation, and I can't come up with any use cases other than the one you cite. So maybe start by making it od only, but even that's a little bit weird because now 1yod targets the same window as Fugitive's d2o map, and the built-in 1do targets the first buffer, not the first window. Three different semantics, what a mess!

odnoletkov commented 4 years ago

I also don't see any real use cases other than for 'diff'.

It is a mess indeed. But I don't think this change would add too much to it. These three different semantics are already there – conflicting and causing confusion.

Also the git mergetool use case don't have this problem with different semantics at all. So it will only benefit from the change.

Another argument is yod is not very useful on its own in practice. Almost always I want to toggle diff in some other window – not in the current window.

tpope commented 4 years ago

If the implementation isn't too onerous I don't see much downside. Feel free to submit a PR for review. Stick to the diff family unless it's trivial to extend it to the rest of the maps.