On Sunday, August 19, 2012 11:28:10 PM UTC+4, roland puntaier wrote:
> On 8/18/2012 3:05 AM, Maxim Philippov
>       wrote:
> 
>     
>     
>       О©╫О©╫О©╫О©╫О©╫О©╫О©╫, 18 О©╫О©╫О©╫О©╫О©╫О©╫О©╫ 2012О©╫О©╫., 0:51:46 
> UTC+4 О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫ Vlad Irnov О©╫О©╫О©╫О©╫О©╫О©╫О©╫:
> 
>       
>         There are plugins that implement REPL-like behavior:
> 
> http://www.vim.org/scripts/script.php?script_id=3484
> 
> http://www.vim.org/scripts/script.php?script_id=3327
> 
> http://www.vim.org/scripts/script.php?script_id=3231
> 
> and probably other.
> 
> 
> It makes no sense for :python commands to behave differently from
> 
> other commands. That is, we currently need to type
> 
> :echo 2+2
> 
> to see the result, why :python should be different?
> 
> 
>       
>       Though this scripts are useful, I think typing ":py 2+2" is more fluent 
> (and maybe more lightweight) than ":PyInteractiveEval 2+2" or running full 
> REPL session.
> 
> We need to type ":echo 2+2" because of the vim's script syntax, ":4" by 
> itself is a command, there is no need for this in python. 
> 
> Often I forget to call "print" because as a python user I expect expression 
> result to be printed automatically. It is difficult to switch from python 
> REPL to vim's current implementation, so why not have the best from both 
> worlds? =)
> 
> 
>     
>     
> 
>     A macro like
> 
>     py3<<EOL
> 
>       def python_with_print(*args):
> 
>       О©╫ global py_res
> 
>       О©╫ py_res=None
> 
>       О©╫ try:
> 
>       О©╫О©╫О©╫О©╫О©╫ eval(compile('py_res='+'
>       '.join(args),'<string>','exec'),globals())
> 
>       О©╫ except:
> 
>       О©╫О©╫О©╫О©╫О©╫ eval(compile('
>       '.join(args),'<string>','exec'),globals())
> 
>       О©╫ print(py_res)
> 
>       EOL
> 
>       command! -narg=* Py py3 python_with_print(<f-args>)
> 
>     
>     in $MYVIMRC
> 
>     would allow you to write
> 
>     
> 
>     :Py from math import *
> 
>       :Py sin(30*pi/180)
> 
>     
>     an you would get results or None on the command line.
> 
>     
> 
>     Regards, 
> 
>     Roland

It's a nice hack, but, in my opinion, in C it looks more natural (or even 
simpler).

If it makes sense for Py macro, it should make sense for py command. As far as 
I see, it doesn't break anything (am I missing something?), it's just more user 
friendly. Why not make it work out of a box?

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui