Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slimux broken in IPython 5 #63

Open
ghost opened this issue Jul 13, 2016 · 8 comments
Open

Slimux broken in IPython 5 #63

ghost opened this issue Jul 13, 2016 · 8 comments

Comments

@ghost
Copy link

ghost commented Jul 13, 2016

When the user sends a visual selection to a pane with IPython 5, slimux only sends the first line. Here is a screenshot the show the result after visual selection (selecting both lines) and <C-c><C-c>:

screenshot from 2016-07-12 22-40-24

By the way, excellent plugin.

@apirogov
Copy link

I've got the same issue!

@bechampion
Copy link

same here ... bpython works tho

@theparadoxofparadox
Copy link

theparadoxofparadox commented Sep 29, 2016

I have this problem too! My only fault for an AWESOME plugin.

I did find though that exiting out of IPython to just a normal bash prompt, SlimuxREPLSendSelection DOES indeed send the selection only, however, after left clicking in the bash prompt pane (and hearing n -1 terminal beeps when copying over n lines). Just interesting...it DOES work, just not in the new IPython.

@shawnwanderson
Copy link

Same issue. Anyone find a workaround?

@cgoldammer
Copy link

I found a workaround, but note that I haven't yet checked all corner cases. Here's a line that makes the visual selection mode work with Slimux in Ipython 5 for me, binding the command to <C-c><C-c> (of course, you can bind it to any other shortcut):

vnoremap <C-c><C-c> :<C-w>SlimuxShellRun %cpaste<CR>:'<,'>SlimuxREPLSendSelection<CR>:SlimuxShellRun --<CR>

In short, the idea is to use the %cpaste magic to enter text. This has the added advantage that it probably works better with heavily indented code, although I haven't fully checked.

Here's what it does:

  1. Delete the '<,'> that vim automatically adds to command lines in visual selection mode
  2. Send over %cpaste
  3. Send over the selection, which needs to be preceeded by '<,'>
  4. Send over -- to end the %cpaste magic

@karadaharu
Copy link
Contributor

I just created a PR for adding an option to use %cpaste

@lotabout
Copy link
Contributor

One concern about %cpaste is it will not be saved in ipython's history. Checkout ipython/ipython#1384

After some investigation, I found that

  1. Ipython >= 5 will support multiple paste (via Ctrl-V or Command-V). That means it will recognize the pasted content and handle the indentation well(basically keep the indentation).
  2. The pasted content is recognized utilizing a technique called bracketed paste mode
  3. tmux's paste-buffer support bracketed paste mode via -p option.

I've created a PR accordingly: #75.
The main advantage of the paste way is that the pasted content will be stored in ipython's history.

@elmerehbi
Copy link

I have this on my work station but on my laptop it works just fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants