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

130103RE: Write register contents to file

Expand Messages
  • John Beckett
    Apr 1, 2012
    • 0 Attachment
      howard Schwartz wrote:
      > I would like to write the contents of a register to a file.
      > Easy enough to grab the contents with let variable =
      > getreg('a'). It would then be easy if :echo variable > file
      > worked like unix echo, but it doesnt. Any simple way to get
      > contents of some register a into a file of my choosing? There is a
      > writelist() function, but I do not know how to get the
      > context of a register into a list.

      The following writes the default yank register to file x.tmp.

      :call writefile(split(@@, "\n", 1), 'x.tmp')


      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 5 messages in this topic