luk400 / vim-jukit

Jupyter-Notebook inspired Neovim/Vim Plugin
MIT License
587 stars 23 forks source link

tmux3.3 upgrade -- inline plotting #101

Open nikisix opened 1 year ago

nikisix commented 1 year ago

I'm on (iterm2) tmux3.3 not 3.2a, so this is for folks that want to help get this amazing plugin up to speed with the new tmux version.

The Issue: inline image is displayed in the editor window instead of the output (or history) windows:

jukit-tmux-plots

The Culprit: tmux panes. The current and target panes are specified on the line: vim-jukit/autoload/jukit/splits.vim +227

                \. 'plt.show.__annotations__["tmux_panes"] = ["'
                \. current_pane . '", "' . target_pane . '"];'

And as you can see from the variable at runtime the current_pane is getting fumbled:

╭───────── In ─────────•••
│ plt.show.__annotations__
╰──────────────────────•••
Out[9]: {'tmux_panes': ['', '%60'], 'save_dpi': 150}

The Question: Even after specifying the correct current_pane at runtime like: plt.show.__annotations__['tmux_panes']=['%59','%60'] It still doesn't move the plot to the output split, but rather continues displaying in the editor.

An Idea: Once we answer the question above, perhaps we should name the output and history panes for more stable references like: select-pane -T <pane_name>

Just a thought, but curious to know what others think.

nikisix commented 1 year ago

After reading #14 I just realized I may have gotten around the needing to downgrade tmux thing by:

  1. pip install imgcat
  2. adding set-option -g allow-passthrough on to my .tmux.conf (as mentioned in the imgcat README).

Still getting the plot showing up in the current_pane as opposed to target_pane, as mentioned in #14, but I think that can be fixed by:

  1. getting current_pane to actually set
  2. figure out why the panes argument is coming up none in vim-jukit/helpers/imgcat/imgcat.py by figuring out what calls it.
nikisix commented 12 months ago

Looked into this a bit more and I'm pretty sure the check that's failing is:

helpers/imgcat/imgcat.py +232

    if panes is not None and is_tmux:
        os.system(f'tmux select-pane -t {panes[1]}')

I tried setting a breakpoint in here as a way to start editing the codebase, but my code changes didn't appear to have any behavioral effects. Is there something I need to do to trigger a rebuild? Basically, what's your dev-workflow look like?