A one-line vim REPL

Here is a quick way to send a line of text from vim into your favorite REPL. Normal mode only.

Note: I know very little vim; I got this far reading a lot of useless posts and monkeying around.

This recipe requires a named tmux session with the target running, accepting text from stdin. In my case the session is called 'octo'.

Add the following binding to .vimrc:

nnoremap  :silent! .w !xargs -0 tmux send-keys -t octo:0.0j:call search('^\s*\S.*', 'W')

.w ! sends the current line to tmux, via xargs. As a bonus, I advance the cursor to the next non-blank line.

Funny how often I don't need a clunky plugin to do a simple thing.

=> index | home

Proxy Information
Original URL
gemini://gemini.ctrl-c.club/~stack/gemlog/2022-10-24.vim.repl.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
426.986583 milliseconds
Gemini-to-HTML Time
0.292147 milliseconds

This content has been proxied by September (3851b).