tpope / vim-repeat

repeat.vim: enable repeating supported plugin maps with "."
http://www.vim.org/scripts/script.php?script_id=2136
2.59k stars 81 forks source link

Is it possible to have more than one repeat key? #17

Closed skeept closed 11 years ago

skeept commented 11 years ago

Intuitively . should be used in actions that change text. I have a map that jumps to a location based on the text of the current line. It seems to be possible to use your plugin to use . to repeat this action, but I would prefer if I could use another key, say to repeat these special operations.

Would this be possible? If yes could you show an example of how to accomplish this?

Thank you,

Jorge

tpope commented 11 years ago

Repeat.vim doesn't provide any support for this, but it should be pretty easy to roll your own. Just set the last location jumped to in a global variable, and use that variable in your custom map.

skeept commented 11 years ago

Maybe I didn't explain my self well, but what I had in mind was the following:

you plugin enables "." to repeat custom actions. For example using unimpaired I can add a new line with [ and then repeat the procedure using ".". Now I define a function that does some action like the one I described (jump to a specific location based on the current line value) and I add a new map ",n" to call this function. I could use your plugin to make "." repeat this action but my desired behavior is to use to repeat this action but not the actions that are associated with the "." key.

Does this make sense? If your opinion is still that vim cannot do it, or your plugin cannot then please just disregard this message...

Regards, Jorge

tpope commented 11 years ago

You most certainly can accomplish this, but repeat.vim won't be any help.

skeept commented 11 years ago

OK, Thanks.