Loading ...
Sorry, an error occurred while loading the content.
 

Re: How to save a macro for later use?

Expand Messages
  • Mathias Michaelis
    Hello Li ... Put in your .vimrc file (if not already done) save global variables that consists of upper case letters set viminfo+=! save 50 lines of each
    Message 1 of 2 , Feb 28, 2005
      Hello Li

      > I recorded a macro. I hope I can use it anytime I open Vim again. Right
      > now, if I quit Vim, the recorded macro is gone. How can I save it for
      > later use?
      >
      Put in your .vimrc file (if not already done)

      " save global variables that consists of upper case letters
      "
      set viminfo+=!

      " save 50 lines of each register
      "
      set viminfo+=<50

      Then your macros should be saved and restored in the register you
      recorded them, e.g. in register @a if you recorded it by entering

      qa.......q

      You can now save your macro in a global variable (consisting of
      upper case letters, digits and '_' only). Let the macro reside in
      register @a and MY_MACRO be the name of the global variable, then type:

      :let MY_MACRO=@a

      HTH
      Mathias
    Your message has been successfully submitted and would be delivered to recipients shortly.