commit defcdaef8282bb45f0d569ef4a57d3dfe87621d1
parent 4bd6a41e60facdc6d3a5bdd166609afe0b700015
Author: Chris Bracken <chris@bracken.jp>
Date: Thu, 16 Oct 2025 10:05:39 +0900
tmux: add keybinding to edit in editor then paste
Opens $EDITOR (or vim by default) in a tmux popup pane, then on
successful exit, writes the buffer contents to the originating pane.
Great for when some tool has a terrible editor and you want a good one
instead.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
@@ -74,5 +74,9 @@ bind-key -r Space select-layout even-horizontal
bind-key ^ split-window -h -c "#{pane_current_path}"\; split-window -v -c "#{pane_current_path}"\; select-pane -U\; select-pane -L
bind-key \\ split-window -h -c "#{pane_current_path}"\; split-window -h -c "#{pane_current_path}"\; select-layout even-horizontal\; select-pane -L
+# Register keybinding to open nvim in a popup.
+# On exit with status 0, paste the buffer contents into the pane we started in.
+bind-key e run-shell 'f=$(mktemp); tmux display-popup -E -d "#{pane_current_path}" "nvim +set\ wrap\ linebreak\ nolist\ textwidth=0\ noendofline\ nofixendofline \"$f\""; if [ -s "$f" ]; then tmux load-buffer "$f"; tmux paste-buffer -d; fi; rm "$f"'
+
# Use the Solarized Osaka colour scheme.
source ~/.config/tmux/solarized-osaka_moon.tmux