christoomey / vim-tmux-runner

Vim and tmux, sittin' in a tree...
MIT License
291 stars 37 forks source link

Not possible to send multiple lines to ipython v.5.0 #65

Open djmarti opened 7 years ago

djmarti commented 7 years ago

With the latest version of ipython (5.0), the command VtrSendLinesToRunner only sends the first of all the statements visually selected. So if the visual selection comprises the two lines

foo = 3
bar = 2

calling VtrSendLinesToRunner will output foo = 3. But if the visual selection is

tmp = function_with_many_arguments(a, b, c, d
                   full_output=True)

the output will include the whole statement, as desired. I didn't have any problems with the former version of ipython, which makes me think this problem may be related with the replacement of readline by the new terminal interface prompt_toolkit. I'm sure there must be some workaround for this, but I have no idea which.

For the record, I am using the settings recommended for python code, to handle whitespaces properly.

christoomey commented 7 years ago

Hi @djmarti, sorry to hear about the trouble. Sounds like ipython's handling of newlines has changed. I don't expect I'll have a ton of time to investigate this, but if you're interested in taking a look, the relevant VTR code is here. You could experiment with different newline variations and see if anything works for you.

djmarti commented 7 years ago

Thanks @christoomey for your quick response. I have found a related problem at https://github.com/jpalardy/vim-slime/issues/109. It seems that's the problem can be fixed by calling the magic function %cpaste, which guarantees error-free pasting (see also https://github.com/jpalardy/vim-slime/tree/master/ftplugin/python).