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

Error when opening a new split window in tmux #14

Closed
AreUGroot opened this issue Jul 10, 2022 · 12 comments
Closed

Error when opening a new split window in tmux #14

AreUGroot opened this issue Jul 10, 2022 · 12 comments
Labels
bug Something isn't working

Comments

@AreUGroot
Copy link

Laptop information:

  • OS: macOS 12.3
  • iTerm version: 13.4.5
  • tmux version: 3.2a

The following error message appeared when I typed os or call jukit#splits#output()

Error detected while processing function jukit#splits#output[8]..jukit#tmux#splits#│ output[2]..jukit#tmux#cmd#launch[2]..<SNR>149_system:
line 5:
E714: List required

Is there anything wrong with my settings? Thank you!

@luk400
Copy link
Owner

luk400 commented Jul 10, 2022

Hi, thanks for making me aware of this. It should be fixed now, please reinstall the plugin and try again.

@AreUGroot
Copy link
Author

Thanks! It works and I am able to open the ipython panel in tmux, though there are some other issues. The split layout is different from the expected layout, the even vertical layout. The ipython pane zooms in more than half of the space.

By the way, there are two more issues. The cursor goes to the ipython pane, not the vim pane at the beginning. After moving the cursor to the vim pane, I have to press q to reveal the file in vim. The screenshot is posted below.

Figure1

@luk400
Copy link
Owner

luk400 commented Jul 11, 2022

Interesting, I will try to reproduce your issue today in the evening, meanwhile could you make sure you have the right iterm2 build? I'm not sure what version 13.4.5 is or if that's just a typo, but I only tested it on build 3.4.15.

@AreUGroot
Copy link
Author

Interesting, I will try to reproduce your issue today in the evening, meanwhile could you make sure you have the right iterm2 build? I'm not sure what version 13.4.5 is or if that's just a typo, but I only tested it on build 3.4.15.

Sorry for the typo. My iterm2 was downloaded from the official website and it has been working well. Btw I'm using zsh as default shell.

@luk400
Copy link
Owner

luk400 commented Jul 12, 2022

Everything works as expected for me with iterm2 build 3.4.15 and tmux 3.2a, but that's on a fresh install of Big Sur. I'll have to see if I can get a MacOS Monterey VM running to further debug this

@luk400
Copy link
Owner

luk400 commented Jul 12, 2022

Also in case you're running the new vim version 9, you can try downgrading to vim 8.2 since this plugin has not been tested with the new vim release yet.

@luk400 luk400 added the bug Something isn't working label Jul 12, 2022
@luk400
Copy link
Owner

luk400 commented Jul 12, 2022

alright so I was able to reproduce the issue with a fresh install of macOS Monterey. It occurs using both Vim 8.2 and Vim 9. I'll have time to look into it further by the end of the week.

@luk400
Copy link
Owner

luk400 commented Jul 13, 2022

Update: Your described problem actually only occured for me when using the wrong tmux version. Please uninstall tmux using brew uninstall tmux and install the version with the exact commit hash I just tested on using the following commands:

wget https://raw.githubusercontent.com/Homebrew/homebrew-core/e44425df5a8b3c8c24073486fa7e355f3ac19657/Formula/tmux.rb
brew install ./tmux.rb
tmux -V # make sure it says tmux 3.2a
brew pin tmux # prevent unintentional upgrade in the future

Exit and restart your tmux session in case you executed the above commands from within tmux and afterwards everything (including the plots) should work as expected.

@AreUGroot
Copy link
Author

Thank you! The split layout works as expected now, while the inline figure shows in a wrong place. It appears on the left pane covering the codes. Could you please have a look on this issue?

Figure1

.

@AreUGroot AreUGroot reopened this Jul 13, 2022
@luk400
Copy link
Owner

luk400 commented Jul 13, 2022

Interesting, I can't reproduce this, but I have an idea where it's coming from. The image is rendered wherever the cursor currently is. Which is why in the matplotlib backend (i.e. in vim-jukit/helpers/imgcat/imgcat.py) right before the plot is displayed the focus is switched to the output pane via os.system('tmux select-pane -t <the-id-of-the-output-pane>') and after rendering the plot the focus is switched back to the file-content-pane.
So for whatever reason it looks like this python command to switch panes in the matplotlib backend is either not executed or fails in your case. Please try the following:

  1. First find out the pane id of your file-content-pane, by running :echo system('tmux run "echo #{pane_id}"') in vim - in my case the output was %0
  2. Switch focus to the pane where the ipython shell is running
  3. Then in the ipython shell execute the following command (replace "%0" with your pane id if you got a different one in step 1.): import os; os.system('tmux select-pane -t %0')

It should switch your focus back to the file-content-pane. Is that working for you?

If this works, then execute the following command in your ipython shell:

print(plt.show.__annotations__["tmux_panes"])

It should print a list, where the first entry in the list should represent the pane id of the file-content-pane and the second one that of the output-pane. Check if those pane ids are correct (output of :echo g:jukit_output_title in vim should be identical to the second entry in the list and :echo system('tmux run "echo #{pane_id}"') should be identical to the first entry in the list) and if you can switch to each of them by executing os.system('tmux select-pane -t <first-or-second-id>') in your ipython shell.

@luk400
Copy link
Owner

luk400 commented Aug 26, 2022

closing due to inactivity

@luk400 luk400 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2022
@nikisix
Copy link
Contributor

nikisix commented Oct 26, 2023

I'm having the same issue as @AreUGroot. I checked the panes, and the output pane is correct (even though current_pane is blank) (more info here: #101).

That's good to know about how imgcat.py is working. I'll have to check that next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants