Tmux and External Editor Revived #31
Frederick888
started this conversation in
Show and tell
Replies: 1 comment
-
macOS version #!/usr/bin/env bash
set -e
if ! pgrep kitty || ! tmux list-sessions; then
# start a new Kitty if either Kitty or Tmux is not already running
kitty --start-as=normal -- nvim "$1"
exit 0
fi
TMUX_CHANNEL="$(basename "$1")"
# start a new Tmux window
tmux new-window -n ExtEditorR "nvim $1; tmux wait-for -S $TMUX_CHANNEL;"
# focus Kitty
open -a Kitty
# wait until Tmux channel is awaken
tmux wait-for "$TMUX_CHANNEL"
# focus Thunderbird
open -a Thunderbird |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Custom template in ExtEditorR offers great flexibility to users.
I often have a Kitty and Tmux session open right after I log in, so instead of firing a new window every time, it'd be less intrusive to my workflow if it can reuse the existing Kitty and Tmux.
To achieve this under Linux (with Xorg), save the Bash script below (and
chmod +x
it):Then in ExtEditorR's preferences UI, select custom and add absolute path of the script to command template:
![image](https://user-images.githubusercontent.com/4507647/178139990-cc50f2cc-6d78-4f59-b57e-784284811e1e.png)
Next time you edit an email, it'll reuse existing Kitty and Tmux if they are both already running, focus the Kitty window, wait until Neovim exits, and in the end focus back Thunderbird.
Beta Was this translation helpful? Give feedback.
All reactions