{ "@context":[ "https://www.w3.org/ns/activitystreams", {"Hashtag":"as:Hashtag"} ], "published":"2023-09-10T20:04:10.298Z", "attributedTo":"https://social.jayvii.de/actors/jayvii", "inReplyTo":"https://hachyderm.io/users/adamhsparks/statuses/111028129122252698", "to":["https://www.w3.org/ns/activitystreams#Public","https://hachyderm.io/users/adamhsparks"], "cc":["https://social.jayvii.de/actors/jayvii/followers"], "content":"
@adamhsparks well, it might have been a bit of cheating, but besides the lines of config:[keys.normal]
C-c = { C-c = [\"goto_prev_paragraph\", \"collapse_selection\", \"goto_next_paragraph\", \":pipe-to ~/.local/bin/send-to-tmux\", \"collapse_selection\"], c = [\"toggle_comments\"] }
[keys.select]
C-c = { C-c = [\":pipe-to ~/.local/bin/send-to-tmux\"], c = [\"toggle_comments\"] }
There are actually two bash scripts involved as well:
~/.local/bin/send-to-tmux.sh#!/usr/bin/env bash
while IFS= read line; do
tmux send-keys -t \"helix_term\" \"$line\" \"Enter\"
done
~/.local/bin/helixterm.sh#!/usr/bin/env bash
# unset $TMUX variable to enforce spawn
export TMUX=\"\"
# Grab command
if [[ -z \"$1\" ]]; then
CMD=\"$SHELL\"
else
CMD=\"$1\"
fi
# Create new tmux session
tmux -2 new-session -s \"helix_term\" -d \"$CMD\"
# Attach to tmux session
tmux -2 attach-session -t \"helix_term\"
I now can simply start my #rstats session with helixterm.sh R
in a split terminal next to my script opened in helix and send code to it (both in normal or select mode) with 2x Ctrl-C. Of course that also works on a remote R-session via ssh and whatnot.