Jan Bundesmann wrote:
> I'm currently playing around with the new channel support and came
> across something I do not fully understand. Playing around with the
> demoserver.py I tried to send a command to my vim-instance via
> feedkeys. The original command was:
> 
> :call feedkeys("ggOHello, world!\e")
> 
> >From within vim this works. I tried to enter it in the server stdin as:
> 
> ["ex", "..."]
> 
> and had to fight with the nested quotes. The special character "\e" is only accepted within double-quotes. So I tried to include the whole call-command in single quotes which is not accepted by the default handler leaving me with
> 
> ["ex", 'call feedkeys("ggOHello, world!\e")']                                      
> > Decoding failed - discarding input
> 
> in the ch_log. A working version is
> 
> ["ex", "call feedkeys(\"ggOHello, world!\\e\")"]                                 
> 
> with a lot of escapes. I do not understand why the first solution does
> not work.
Keep in mind this is in Python.  And in Python a backslash inside a
single quoted string has a special meaning, unlike Vim.
I think this should also work:
 ["ex", 'call feedkeys("ggOHello, world!\\e")']
The text inside single quotes is a Python string, where the actual
resulting text is:
 call feedkeys("ggOHello, world!\e")
And then Vim will interpret the \e in double quotes as an escape.
-- 
Bad fashion can discourage normal people from interacting with the engineer
and talking about the cute things their children do.
				(Scott Adams - The Dilbert principle)
 /// 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.
Tuesday, May 24, 2016
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment