Continuation line doesn't work when executing from register

32 views
Skip to first unread message

Cesar Romani

unread,
Jun 25, 2016, 5:33:28 p.m.2016-06-25
to vim...@googlegroups.com
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.

Many thanks in advance,

--
Cesar

Bram Moolenaar

unread,
Jun 26, 2016, 8:38:31 a.m.2016-06-26
to Cesar Romani, vim...@googlegroups.com
The ":source" command executes Ex commands, the @r command executes
Normal mode commands. That's quite different.

--
"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 -- Br...@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 ///

Nikolay Aleksandrovich Pavlov

unread,
Jun 26, 2016, 9:19:50 a.m.2016-06-26
to vim...@googlegroups.com, Cesar Romani
2016-06-26 15:38 GMT+03:00 Bram Moolenaar <Br...@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 -- Br...@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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Cesar Romani

unread,
Jun 26, 2016, 11:22:45 a.m.2016-06-26
to vim...@googlegroups.com, Nikolay Aleksandrovich Pavlov
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
Reply all
Reply to author
Forward
0 new messages