executing buffers and registers

You have commands in a buffer, such as to manipulate the syntax and folding of a type of file, but it is a work in progress that will be constantly changed. You could set this up as an “after” file that loads for a particular type, or you could execute the contents directly, without ever creating a file until you are sure you have what you want.

(see folding for example source text and folding code)

To execute the contents of buffer A as a command in buffer B, do this:

  1. switch to buffer A
  2. visually select all text in buffer A, and yank it to a buffer (default “)
  3. switch to buffer B
  4. type this:
    :@"<enter>

You can also map this to another key:

:map <F12> ggVGy<C-w><C-w>:@"<CR>