tags:

views:

237

answers:

1

I know there is a way to list mappings via :map (or :imap, :cmap etc.), but I can't find a way to list macros I have stored in my vimrc file (as in let @a = 'blahblah').

Is there a way to do this without having to manually looking inside it (via :split [myvimrcfile] or whatever way)?

Also, if it is possible, is there a way to attach some sort of documentation that would display with the macro to explain what it is for? I have a handful that I use quite a bit, but about 6 weeks apart. It would be nice to just quickly list them along with a comment that tells me what the macro does (or even just a name so I make sure I use the right one).

Thanks

+3  A: 

In vim, the macros are just stored in registers. You can recall the content of any register and execute it as a macro (which is what the @ does). To see a list of what is in your registers, use :reg.

jheddings
Unfortunately it doesn't list the macro in the register unless I recall it first. I'd want to know what the macro I've mapped to that register is before I run it (so I know which one to run).
Jason Down
Really? For things I have in my `.vimrc` (as `let @a=blah`), I am able to see them when I first start up (gVim 7.2). Do you have a function or script that you have to execute to set your macros?
jheddings
I am also using gVim7.2. I just typed my macros directly into my vimrc file... although it is in c:\program files\vim\vimfiles\vimrc_Jay.vim which is loaded in my _vimrc file via source $VIM/vimfiles/vimrc_Jay.vim. Do you think that's the issue?
Jason Down
I just tried moving them into my _vimrc file instead of my other vimrc_Jay file, but it didn't seem to make a difference.
Jason Down
They seem to be working now (after switching everything back to my original setup). I'm not sure what changed and I didn't run all of them, so I know it's not from recalling that register first. Oh well. Your answer DOES work. Thanks.
Jason Down
Glad it's working for you... Be sure to post if you figure out why it wasn't working at first or if you find any issues with it.
jheddings
Will do, thanks.
Jason Down