AndrewRadev/switch.vim

Reverse switching

Closed this issue · 3 comments

maxfl commented

Is there a possibility to iterate the list in reverse so it could be mapped to a key?

Btw, thank you for the plugin and wiki, I will upload my latex configuration after some cleaning.

Sorry for taking a while to respond.

For some kinds of setup, this would be impossible -- if it's a hash, it's unordered, so I don't think there would be a way to determine how to move "backwards". I guess it might be possible for lists, but I'm not sure if I'll be able to fit it in with the existing way the definitions are processed... I'll see what I can do.

I will upload my latex configuration after some cleaning.

I would appreciate that :). As you can see, the wiki is a bit empty right now :)

I've pushed a commit that implements this functionality. I added a command called :SwitchReverse which reverses list-based switch definitions (and only those -- no way of reversing dictionaries). There's also a mapping, which is unset by default, set from g:switch_reverse_mapping. Please try it out and let me know if it works for you.

maxfl commented

Works awesome, thank you!