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

Re: put a carriage return

Expand Messages
  • Benji Fisher
    ... So one solution is ... HTH --Benji Fisher
    Message 1 of 9 , Jan 29, 2001
    • 0 Attachment
      c928400@... wrote:
      >
      > Thus wrote Alan G. Isaac (aisaac@...) on [010129]:
      > > On Mon, 29 Jan 2001 c928400@... wrote:
      > > > :put=\"foo\nbar\"
      > > > Note that you cannot use literal string hee (as \n would not be translated).
      >
      > [edited quote]
      >
      > > function! Test()
      > > put=\"top1\ntop2\ntop3\n\"
      > > put='middle'
      > > endfunction
      >
      > > When called it produces as output:
      > > top1
      > > middle
      > > top2
      > > top3
      >
      > > Can you please explain why I'm not allowed to put
      > > both strings and literal strings in a function?
      > > (In case it matters, I use gvim 5.7 on Win95.)
      >
      > It is not a matter of strings vs. literal strings (try replacing the
      > 's with \" and see).
      >
      > The problem is that the cursor will be placed on the first line of the
      > :put'ed text (as with a regular put of several lines with p/P) and
      > then the next :put will place the text after the first line of the
      > previous lines.
      >
      > Peppe

      So one solution is

      :put=\"several\nlines\"
      :'] put='another line'

      :help ']
      :help :range

      HTH --Benji Fisher
    • Alan G. Isaac
      ... Thanks to Peppe and Benji for their useful explanations and suggestions. Alan
      Message 2 of 9 , Jan 29, 2001
      • 0 Attachment
        On Mon, 29 Jan 2001, Peppe wrote:
        >> The problem is that the cursor will be placed on the first line of the
        >> :put'ed text (as with a regular put of several lines with p/P) and
        >> then the next :put will place the text after the first line of the
        >> previous lines.


        On Mon, 29 Jan 2001, Benji Fisher wrote:
        > So one solution is
        > :put=\"several\nlines\"
        > :'] put='another line'
        > :help ']
        > :help :range

        Thanks to Peppe and Benji for their useful
        explanations and suggestions.
        Alan
      Your message has been successfully submitted and would be delivered to recipients shortly.