Send lines to REPL in Tmux

I’d like to share one way to get the evaluate line behavior of Juno/VSCode in Tmux.

Just a bit of context on why I’m trying to do that: today I found myself with three weeks to go without my laptop and very limited internet connection, but equipped with an Android tablet and a bluetooth keyboard, and I really don’t want to give up playing with Julia.

I normally use VSCode with its convenient evaluate cell shortcut and its Remte SSH extension that allows me to work directly on a remote server.
To reproduce a bit such setting, I installed Termux on the tablet, with which I can connect via ssh on the server. I can then attach to a Tmux session, where I have a splitted window: Neovim on the left to edit Julia files, and the Julia REPL on the right (see pic).

By adding the lines bind j pasteb -t right in my .tmux.conf and set clipboard+=unnamedplus in my init.vim (.vimrc for Vim), I can now copy some code in the Neovim pane on the left and send it to the REPL on the right by typing C+b and j.

2 Likes

Cool! There is also vim-slime.

I updated the last paragraph of the original post, since I misunderstood why my solution was working.

Also, I modified a bit my setting, since I was experiencing a very annoying delay when typing and editing files directly on the server. Now I open tmux locally, with neovim on the left pane to edit files in my local repository, while on the right pane I nest another tmux instance which run julia on the server.