tpope / vim-rsi

rsi.vim: Readline style insertion
http://www.vim.org/scripts/script.php?script_id=4359
590 stars 36 forks source link

Don't map Insert mode meta chords during macro #30

Open djjcast opened 8 years ago

djjcast commented 8 years ago

Here's a potential fix for issue #13. To test the fix, edit a file with the following contents:

foo
foo
foo
foo
foo
foo
foo

Then search/foo<CR>, record a macro ggqqciwbar<Esc>nq, and execute the macro a few times 4@q. The important part of the macro that's being tested is the <Esc>n sequence, which vim-rsi remaps.

tpope commented 8 years ago

I think anything this dicey should probably just be made into a separate, general purpose plugin, no? RSI continues to provide <M-b> and the like but drops the escape code shenanigans, and the new plugin delegates all 26 letters or so.

djjcast commented 8 years ago

Sure, I can see this being a separate plugin. Feel free to use and refactor the code however you think is best.

Yeah, it's a dicey hack but seems to work consistently. I'm not sure why we have to use cnoremap <buffer><nowait> <Esc> <C-c> instead of cnoremap <buffer><nowait> <Esc> <Esc>; the latter mapping causes <Esc> to always behave like the x flag is set in cpoptions for some reason.