Code Monkey home page Code Monkey logo

Comments (24)

nigeljyng avatar nigeljyng commented on July 24, 2024 2

Yes. Everything worked on IPython 4.x. I only encountered this problem after upgrading to IPython 5.

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024 1

@rsmith31415: Can you doublecheck your vim config? I just installed nvim and reproduced your error, but it was because I hadn't imported my vim config ... specifically let g:slime_python_ipython = 1.

For example, with slime_python_ipython not set:

image

Above is after I interrogated g:slime_python_ipython to show it's not set.

After I re-enable let g:slime_python_ipython=1 in my config it seems to work fine, with one catch:
image

The very first time text is sent over to tmux/IPython it's not echo'd in my terminal. However, after that everything is. (However, you can see that it worked.)

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

Hi there,

Just to be clear: are you saying everything worked in iPython < 5 and now it doesn't?

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@jpalardy (cc @nigeljyng): I submitted a small PR to fix this issue. It looks like sending %cpaste separately from the code to IPython fixes this issue.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

merged: thanks to @vrivellino .

Let me know if it's still a problem.

from vim-slime.

 avatar commented on July 24, 2024

@jpalardy Are you sure this fixes the issue? I updated with Vundle and verified that the latest PR was included, but I still see the same behavior.

Using neovim 0.1.5-dev, tmux 2.1, Ubuntu 16.04

Including screenshot after <C-c><C-c> and targeting :0.2. Am I missing something?

screenshot from 2016-07-15 15-43-20

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

@vrivellino thoughts?

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@jpalardy I actually use screen locally and didn't think twice that the fix may not work for tmux. I'll install tmux locally and see if I can reproduce.

At the end of the day, something changed on the IPython side and, ultimately, an issue might need to raised there.

For example, I just started up ipython in a terminal (not in tmux or screen), copied the following text in my clipboard ...

%cpaste
print 'hello'
print 'world'
--

... and pasted into the ipython terminal:

image

So the %cpaste magic input handling is behaving differently than in IPython 4.

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@jpalardy @rsmith31415: I just installed tmux locally and I couldn't reproduce - vim-slime was behaving as expected.

However, I'm on a Mac running El Capitan with vim 7.4 and tmux 2.2 installed via homebrew. Perhaps my workaround doesn't work on Linux?

from vim-slime.

 avatar commented on July 24, 2024

@vrivellino I believe this can be an issue on Linux. I was able to reproduce this bug in a fresh installation (EC2) with tmux 2.1 (and 2.2) and vim 7.4.

screenshot from 2016-07-16 17-19-03

from vim-slime.

nigeljyng avatar nigeljyng commented on July 24, 2024

@vrivellino @jpalardy I can confirm the PR fixed the issue for me. Using Ipython 5.0.0, OSX El Capitan, tmux in iTerm2

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

ok, thanks ^

from vim-slime.

 avatar commented on July 24, 2024

@jpalardy Should I open another issue for Linux?

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

We're all here, let's keep this issue for now.

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

FWIW - I just spun up an EC2 instance running Amazon Linux with vim 7.4, tmux 1.8, IPython 5.0.0 works OK.

I'm going to try install neovim real quick to see if that's the issue. May give Ubuntu a go if I get some time.

from vim-slime.

 avatar commented on July 24, 2024

@vrivellino I think that is very likely to be the issue here. I didn't receive the red box you show in the first image though. Interestingly, it used to work in IPython 4, but I will check after including let g:slime_python_ipython = 1 in my configuration file.

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@rsmith31415 The red box was generated by me entering :let g:slime_python_ipython in command mode. I'm pretty certain it needs to be enabled. Also, by enabling it IPython won't attempt auto-indent text that pasted in via vim-slime, so IMO it's a good idea to enable.

@jpalardy: You may want to highlight something in the readme that IPython 5 users may need to have slime_python_ipython enabled.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

From reading the code again, isn't let g:slime_python_ipython = 1 always needed for iPython? Is there something different about v5 I'm not getting?

from vim-slime.

 avatar commented on July 24, 2024

@vrivellino Yes, that definitely works but I was making another mistake. Previously, I was able to send commands to IPython without saving the file. Now, you need to save the file and then it will receive the whole input.

By the way, regarding let g:slime_python_ipython, I didn't use it previously and still worked (with IPython 4), but I don't think it is a problem if that is required.

I noticed a small detail. When you send some code, there is an uneven indentation inside the %cpaste block between the first line and the second line:

In [11]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:import logging
import sys
import os
--
:::

Why is that?

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@jpalardy Yes it is. When I mentioned updating the IPython readme, I should have said "IPython 5 users must have let g:slime_python_ipython = 1." :)

@rsmith31415

Previously, I was able to send commands to IPython without saving the file. Now, you need to save the file and then it will receive the whole input.

Hmm ... I've never experienced that.

I noticed a small detail. When you send some code, there is an uneven indentation inside the %cpaste block between the first line and the second line:

That's a by-product of how IPython is handling pasted input with %cpaste, and I don't think there's a simple way around this. To illustrate this, fire up IPython (doesn't have to be tmux or screen), then enter %cpaste:

image

Copy the following text to your clipboard:

print 'hello'
print 'world'
--

And paste it into IPython:
image

That's the behavior you're seeing.

Now, if you were to enter those lines one-by-one (not copied and pasted):
image

IPython is printing : for each line of the %cpaste prompt. I'd say they should just remove that prompt, there's no need for it you're pasting in code.

from vim-slime.

 avatar commented on July 24, 2024

@vrivellino You're absolutely right. It is a bit annoying, but not a big deal. Thank you for the help.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

I added a note about IPython 5.

Good? Or does it need better wording?

from vim-slime.

vrivellino avatar vrivellino commented on July 24, 2024

@jpalardy 👍 Looks OK to me

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

excellent

from vim-slime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.