Re: How to turn a q recording into a map?
[EMAIL PROTECTED] wrote: Somehow it never occured to me that I could view and edit the contents of a recording. Of course, it's just a register, so I pasted the register; edited the contents; then yanked the lines back into the register... and naturally this worked fine. This is going to be immensely useful! Thanks for the heads up I was thinking that there should be a way to take the register lines and automatically turn them into an noremap (including adding the @ to start register playback). Has anyone perfected this? Like this? :map {key} {C-R register} For example if you want to save register q as F2: :map F2 {C-R q} where you actually type C-R q at the prompt. If you like your new mapping and want to make it permanent: - open your ~/.vimrc in a new window/tab/buffer - bring up the commandline window (q:) - find the map comand you used - yank it (yy) - close the commandline window (C-C C-C) - paste it Tobia
Re: How to turn a q recording into a map?
Somehow it never occured to me that I could view and edit the contents of a recording. Of course, it's just a register, so I pasted the register; edited the contents; then yanked the lines back into the register... and naturally this worked fine. This is going to be immensely useful! Thanks for the heads up In addition, sometimes it's difficult to pull the exact (modified) contents of the register back into the register so it maintains the desired effect. I find this the case when the macro has multiple line-breaks in it. However, I've found that I can tweak them by doing things like :let @a=substitute(@a, 'foo', 'bar', '') if I want to correct foo to bar in my macro. It also helps when you're using a macro to do one thing that you know you'll be doing the exact-same recorded process, but using some other piece of text. It's a little more difficult to change control-sequences, but for simple text-replacements, I find that it is more predictable and still fairly easy to do. Just another oddball tip for abusing vim. :) -tim
How to turn a q recording into a map?
Somehow it never occured to me that I could view and edit the contents of a recording. Of course, it's just a register, so I pasted the register; edited the contents; then yanked the lines back into the register... and naturally this worked fine. I was thinking that there should be a way to take the register lines and automatically turn them into an noremap (including adding the @ to start register playback). Has anyone perfected this? Yours, Noah
Re: How to turn a q recording into a map?
* [EMAIL PROTECTED] [2007.03.23 19:45]: I was thinking that there should be a way to take the register lines and automatically turn them into an noremap (including adding the @ to start register playback). Has anyone perfected this? If you want your mapping to follow the (possibly changing) content of q: map F2 @q If you want your mapping to stay fixed even if register q changes: :exe map F2 . expand(@q) and then you can map that... map F3 :exe map F2 . expand(@q)CR HTH, -- JR