I just came across: GitHub - a3lem/replink: A handy CLI for executing code in a REPL in a separate pane and thought it would be cool if we could do the same with iex. I’m often copy pasting stuff, sending it directly from an editor would be awesome.
Ah, I just noticed that this code doesn’t rely on the python cli, but rather on tmux: replink/replink/core.py at 4abd8dbdaf29b916649fcba10296977a5b9ef10d · a3lem/replink · GitHub
So yes, this should be possible with IEx as well if you’re using tmux for example.
I made something like this though only works in Vim (but not nvim). You can highlight text and send it to a :term
and it gets updated as you update the code in the buffer. It’s pretty hacky—it just copies the code from the buffer to a tempfile then import_files
s it in the term window (adding that line to your IEx history). In any event, it’s possible
I would love to be able to connect to a running REPL a-la clojure. It would allow for more flexibility than LSP (though of course back to editor-specific implementations). There’s been discussion about it around here but I don’t think there is much movement around it (I was feeling motivated but then moved on).
EDIT: I forgot I made a screencast about it—it’s my first and only screencast so be nice (lol).
That’s cool! I made a Neovim plugin that does something similar - it sends the character to the term
and adds a line break at the end to execute the command.
Do you use your Vim plugin often? I also have the dream for better interaction with IEx but unfortunately I don’t have much time to build something right now and I end up typing directly in IEx more than I would like to.
I ended up not using it too much since the auto-update for mix projects arrived weeks later. I also use tests a lot to run random stuff. It was largely more of an experiment and just showed in into my plugin But ya, an actual connected iex is the dream.