Sunday, June 26, 2016

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

On 26/06/2016 08:19 a.m., Nikolay Aleksandrovich Pavlov wrote:
> 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.

Yes, this :@r is why I meant, and thanks for the detailed explanation.

I use it very often with all kind of commands and functions, and I've
never had a problem with it, except now, with the continuation sign.

Best regards,

--
Cesar

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