Kit
Kit

Reputation: 31543

Send and run multiple lines of Python to a visible running python/bpython/ipython interpreter process

I am running a full-screen tmux, split into two panes. The left pane runs vim, where I edit Python files. The right pane runs a Python interpreter.

I would like to be able to highlight multiple lines in vim (Shift+V), then using some shortcut key, send these lines to the running Python interpreter on the other pane.

Is there some vim plugin that does this?

This functionality is similar to that in Spyder, where you can highlight multiple lines, right-click, then send those lines to the active interpreter within Spyder. I hesitate moving to Spyder because my muscle memory is already heavily invested in vim and tmux (keeping hands on the keyboard and all that).

Upvotes: 0

Views: 258

Answers (2)

ChatterOne
ChatterOne

Reputation: 3541

You probaly want vimux : https://github.com/benmills/vimux

From the documentation:

" If text is selected, save it in the v buffer and send that buffer it to tmux:

vmap <LocalLeader>vs "vy :call VimuxSlime()<CR>

Upvotes: 0

user11274868
user11274868

Reputation:

I don't use vim so I can't help you with that part of it, but if you can figure out how to make vim pipe its selection to a command, you can pipe it to something like:

tmux loadb -bvim_copy - \; pasteb -bvim_copy -t'{right}' \; deleteb -bvim_copy'

Upvotes: 0

Related Questions