junegunn / vim-peekaboo

:eyes: " / @ / CTRL-R
1.12k stars 38 forks source link

Add key map prefix customization #41

Closed tweekmonster closed 8 years ago

tweekmonster commented 8 years ago

This would allow users to optionally toggle peekaboo with a custom prefix when they feel they need it. I think it would also be an acceptable alternative way to use the plugin for people having problems with macros and recursive normal commands (as noted in a comment on SE).

I originally wanted to have a single setting for the prefix with <c-x> as a suggestion in the README, but that would override the default <c-x> in normal/visual mode and using anything but a ctrl prefix in insert mode is just weird.

I think the FAQ and Known Issues would need to be updated, but I didn't want to change the tone of your README.

junegunn commented 8 years ago

Thanks, I'd really like to properly fix the problems but it's not likely to happen soon, and this is a reasonable workaround. Can you also update unmaps in peekaboo#off() accordingly?

tweekmonster commented 8 years ago

Oh wow, totally forgot that. Will update in a sec.

I'd really like to properly fix the problems but it's not likely to happen soon

Something I thought about doing was temporarily unmapping the keys before running feedkeys(), but I didn't spend that much time studying the source to see what the drawbacks of that would be. It would only work if peekaboo was the starting point, though. : could be mapped to unmap peekaboo, but that'll probably lead to confusion and unexpected behavior. 😑

junegunn commented 8 years ago

Merged, thanks! It seems like feedkeys() is inherently not very compatible with macros/ex commands, and I almost gave up trying to make it work smoothly in all scenarios.

justinmk commented 7 years ago

@junegunn With the recently added "x" and "i" flags for feedkeys, it might be possible to avoid past problems.