Comments (24)
Yes. Everything worked on IPython 4.x. I only encountered this problem after upgrading to IPython 5.
from vim-slime.
@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:
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:
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.
Hi there,
Just to be clear: are you saying everything worked in iPython < 5 and now it doesn't?
from vim-slime.
@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.
merged: thanks to @vrivellino .
Let me know if it's still a problem.
from vim-slime.
@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?
from vim-slime.
@vrivellino thoughts?
from vim-slime.
@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:
So the %cpaste
magic input handling is behaving differently than in IPython 4.
from vim-slime.
@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.
@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.
from vim-slime.
@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.
ok, thanks ^
from vim-slime.
@jpalardy Should I open another issue for Linux?
from vim-slime.
We're all here, let's keep this issue for now.
from vim-slime.
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.
@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.
@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.
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.
@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.
@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
:
Copy the following text to your clipboard:
print 'hello'
print 'world'
--
That's the behavior you're seeing.
Now, if you were to enter those lines one-by-one (not copied and pasted):
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.
@vrivellino You're absolutely right. It is a bit annoying, but not a big deal. Thank you for the help.
from vim-slime.
I added a note about IPython 5.
Good? Or does it need better wording?
from vim-slime.
@jpalardy 👍 Looks OK to me
from vim-slime.
excellent
from vim-slime.
Related Issues (20)
- Cursor returns to the beginning of a selection when sending code from a script in one tmux pane to the terminal in the other terminal pane. HOT 8
- send to multiple panes HOT 2
- How to send <Ctrl-C> via tmux? HOT 2
- <C-c><Text object> HOT 2
- Option to change bracket paste delimiters HOT 4
- neovim tmux in msys2 in windows HOT 4
- Run vimscript commands interactively HOT 5
- Issue #23 returns HOT 1
- Can SlimeConfig apply to all vim buffers HOT 10
- slime_no_mappings works only if declaredbefore plugin is loaded HOT 1
- Naming convention inconsistency HOT 1
- kitty slime broken in kitty v0.32 HOT 5
- WezTerm Pane Direction ID has trailing whitespace
- Proposal for Changes to `autoload/slime.vim` HOT 6
- Additional 'return' required when sending indented, commented code to ipython HOT 3
- neovim target TermOpen autocmd interactions with other terminal buffers HOT 3
- working with ConqueTerm HOT 1
- Error raised after trigger send if there is no neovim terminal opened HOT 6
- Issue to send multiple lines with recent versions of vim-slime HOT 7
- "Undefined variable: g:slime_config_defaults" on opening Python files HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-slime.