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

RE: convert vim variable contents into a file

Expand Messages
  • Zdenek Sekera
    ... Clever! Thanks! Slight obvious correction: redir /tmp/myfile | echo g:list | redir end
    Message 1 of 3 , May 19, 2005
      > -----Original Message-----
      > From: Keith Roberts [mailto:kroberts@...]
      > Sent: 19 May 2005 17:31
      > To: Zdenek Sekera; vim-dev@...
      > Subject: RE: convert vim variable contents into a file
      >
      > >-----Original Message-----
      > >From: Zdenek Sekera [mailto:Zdenek.Sekera@...]
      > >Sent: Thursday, May 19, 2005 5:40 AM
      > >To: vim-dev@...
      > >Subject: convert vim variable contents into a file
      > >
      > >Hi,
      > >
      > >I have a variable
      > >g:list="a\nb\nc\nd\n"
      > >
      > >so :echo g:list displays
      > >
      > >a
      > >b
      > >c
      > >d
      > >
      > >I'd like to turn it into a file, something like:
      > >
      > > :echo g:list > /tmp/myfile
      > > (of course this is schematics)
      > >
      > >so I could later use grep on it, something like:
      > >
      > > let a=system(echo g:list | grep regexp)
      > >
      > >or
      > >
      > > let a=system(echo /tmp/myfile | grep regexp)
      > >
      > >I can't figure out how to do it.
      > >Am I overlooking anything obvious?
      > >
      > >Thanks and cheers,
      > >
      > >---Zdenek
      >
      > How about:
      >
      > redir /tmp/myfile | echo g:list | redir end

      Clever! Thanks! Slight obvious correction:

      redir > /tmp/myfile | echo g:list | redir end

      ---Zdenek
    Your message has been successfully submitted and would be delivered to recipients shortly.