pub / helix-term

Interactive console for the Helix-Editor using TMUX
git clone https://src.jayvii.de/pub/helix-term.git
Home | Log | Files | Exports | Refs | README | RSS

send-to-tmux (476B)


      1 #!/usr/bin/env bash
      2 # SPDX-License-Identifier: GPL-3.0-or-later
      3 # SPDX-FileCopyrightText: 2023-2024 JayVii <jayvii[AT]posteo[DOT]de>
      4 
      5 # fetch tmux session
      6 if [ -f "./.helixterm_session" ]; then
      7   TMUX_SESSION=$(cat "./.helixterm_session")
      8 else
      9   echo "There is no open session!"
     10   exit 1;
     11 fi
     12 
     13 # read piped input
     14 readarray -t lines
     15 
     16 # enter input into tmux line-by-line
     17 for line in "${lines[@]}"; do
     18   tmux send-keys -t "$TMUX_SESSION" "$line" "Enter"
     19 done
     20 
     21 # EOF send-to-tmux