Sunday, June 26, 2016

Re: Continuation line doesn't work when executing from register

2016-06-26 15:38 GMT+03:00 Bram Moolenaar <Bram@moolenaar.net>:
>
> Cesar Romani wrote:
>
>> I'm using vim 7.4.1952 on Windows 7.
>> Suppose I have two files on the same folder: test1.txt and test2.txt.
>> I have 'set nocp' in both of them.
>>
>> test1.txt contains the following code, and I visually select it and copy
>> it to the clipboard with '<,'>y+:
>>
>> nn <silent> <Plug>RDF :'{,'}s/-\n//ge
>> \ :call repeat#set("\<Plug>RDF")<cr>
>> map ,b <Plug>RDF
>>
>> then I go to test2.txt and do @+
>> then I get an error:
>>
>> E10: \ should be followed by /, ? or &
>>
>> But if, on test1.txt, I do 'source test2.txt' or 'runtime test2.txt,' it
>> works.
>
> The ":source" command executes Ex commands, the @r command executes
> Normal mode commands. That's quite different.

I guess he simply meant :@r (:h :@, do not confuse this with :h @).
And this is general problem with any :execute-like functionality:

:execute
:@
-c
--cmd
py vim.command

: you cannot use continuation anywhere here because all these commands
mostly execute *one* line *always* (and even if they do something else
like ex_at does, used fgetline function still does not support
continuation). And `\n` is being treated just like `|` is.

Though I would say that fixing this anywhere, but in :@ is definitely
going to break backward compatibility: because of "execute one line"
functionality is used to do things like `execute 'normal a' .
multiline_text` to append multiline text or `:execute 'python'
constructed_multiline_script`. :@ is separate because it the only
thing which actually does execute multiple lines, so making
`getexline` used from ex_at (this is essential, ex_at is not the only
place where it is used) support line continuation will simply get rid
of E10 errors.

>
> --
> "Microsoft is like Coke. It's a secret formula, all the money is from
> distribution, and their goal is to get Coke everywhere. Open source is like
> selling water. There are water companies like Perrier and Poland Spring, but
> you're competing with something that's free." -- Carl Howe
>
>
> /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment