7

I'm trying to integrate ipython and vim through a single tmux session using the popular vim plugin "vim-slime." The problem is that while I can get it to work fine provided that vim is opened in a separate tmux window (or using gvim), if I try to send lines of code to a different pane in the same window, at best I wind up sending it to the vim session I'm currently using.

Really what I want in my setup is vim on the right-hand side of the screen, ipython on the upper-left, and a regular command-line on the bottom left. I don't really want to be opening and managing multiple sessions and windows.

Is there a simple way to do this that I just don't know about because of my relative inexperience?

5

Okay, so I was having exactly the same problem, which is what brought me to this question. I have a split session, vim code on the left and a scheme prompt on the right.

My problem was, I thought the session name was the socket name, but they are two different things. I had named the session '0', for the 0-th window, but in fact, the SOCKET is named 'default' despite the session name I specified.

To get a list of the tmux sockets run: lsof -U | grep "^tmux"
I found that from this answer:
https://stackoverflow.com/questions/11333291/is-it-possible-to-find-tmux-sockets-currently-in-use

The above was helpful to see the actual names of the sockets.

That is what you put in the first prompt. I was putting '0', which was the name of my session, but it was not working. 'default' is what is needed there despite the fact I had named the session.

Then, at the second prompt, I entered (index-0 window, index-1 pane):
:0.1

Voila! Finally! It was working. Brilliant, now side-by-side editing!

  • 1
    This solved it! – Ram Apr 4 '16 at 16:49
0

You need to change the target pane with <c-c>v or :SlimeConfig. The default is :, which is "current window, current pane." See :help slime-tmux.

Instead, navigate to the Tmux pane you want to send the text to (the one with iPython running), and from the shell run echo $TMUX_PANE or tmux run "echo #{pane_id}" to find the correct pane ID.

  • Does not work for me. <C-c>v just brings up VISUAL mode. Plus I believe the $TMUX_PANE is not the information sought. Pressing <C-b>x (command to kill a pane) brings up a confirmation request that includes the n° of the pane. This number differs from $TMUX_PANE and appears to be the correct information to answer the OP's requirement – Titou May 9 '17 at 11:07
0
  1. Launch tmux.
  2. Ctrl-b % to split vertically.
  3. Ctrl-b [left arrow] to move to left hand pane
  4. Ctrl-b " to split left hand pane horizontally. You'll now have 3 command lines.
  5. Ctrl-b [up arrow] to move to upper left hand pane, followed by ipython.
  6. Ctrl-b [right arrow] to move to right hand pane.
  7. Launch vim on your Python code.
  8. Send a line using Ctrl-C Ctrl-C, accept socket name as default, and enter :0.0 to select the IPython pane.

default and 0:0 are the socket name and pane id respectively.

  • 1
    This does not address the issue described in my OP. – Ram Sep 14 '15 at 15:29
  • @Ram Yes it did : following the steps that Simon gave, I obtain exactly the configuration the OP asked for. – Titou May 9 '17 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.