tags:

views:

71

answers:

1

I lost my latest version of my .vimrc and I have no snapshots of it anywhere but I do have a vim still open that has the new functions and mappings. I was hoping that maybe someone would know how to "export" that running vim's maps and functions out to a file so I could recreate the .vimrc?

+6  A: 

Use :mkvimrc (or :mksession if you also want to save any buffer-local state too).

Piet Delport
Thanks, but this will not work as it does not save the functions.
stephenmm
There's no built-in convenience for saving functions that i know of, but you can list the defined functions and their bodies with [`:function`](http://vimdoc.sourceforge.net/htmldoc/eval.html#:function). This should allow you to manually save the ones you want.
Piet Delport
Thanks again but no. From the help: ":fu[nction] List all functions and their arguments." It does not list the body of the function as you claim. I am not trying to be rude but I do not want people to think this issue is resolved. As it stands now I am still unaware of any way to see the body of the function.
stephenmm
@stephen -- No, Piet D. is right. You should get entire body if you enter just the function name with no parens, e.g., ':function MyFunction'. This will list body to screen, you can use a version of the :redirect command to save to variable or file, so it's fully possible to automate the process. (Maybe there's more direct way than using :redirect but offhand I don't see it.)
Herbert Sitz
Well I'll be damned, ":function {name}" does work. I must be dense. My sincerest apologies to Piet and greatest thanks to Piet and Herbert. This is really great news and will save me a ton of time.
stephenmm