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

38386Re: Putting text in the command line

Expand Messages
  • Antony Scriven
    Dec 31, 2004
    • 0 Attachment
      Jens Paulus wrote:

      > Hi Bram,
      >
      > On Thu, Dec 30, 2004 at 16:44:08 +0100, Bram Moolenaar wrote:
      > > > 9. Putting text in the command line
      > > > When writng a function in a buffer and trying to source the yanked lines
      > > > with :<C-R>" or :<C-R><C-R>" what I see is that it does not work because
      > > > the linebreaks are not correctly understood.
      > >
      > > Right, you are editing a line, not a script. It's too dangerous to
      > > execute each line-break separated line without hitting Enter.
      > > Especially if you accidentally use the wrong register.
      > >
      > > You need to use another way to enter multiple lines. I mostly use a
      > > separate buffer, so that you can edit the lines comfortably. You do
      > > need to write the lines into a file to be able to source them though.
      > > Perhaps we can allow a range to the ":execute" command to execute lines
      > > from a buffer.
      >
      > a workaround is to do the following thing.
      > If no function is written but only a list of commands like
      >
      > commandline1
      > commandline2
      > commandline3
      > commandline4
      >
      > put the cursor on the beginning of the first command line and do
      > qay$:<C-R>0<CR>jq3@a and these lines are executed.

      Right. Yank some lines then :@" those lines is perhaps
      better.

      As Bram has suggested the best way is to save a range as a
      temp file and then :source the file. I have a script that
      does that if you are interested. If you write to a file
      first then leading tabs and other subtleties can cause
      problems. I think that allowing :execute to take a range
      would be both a nice and a natural enhancement.

      Antony
    • Show all 72 messages in this topic