LoginSignup
7
2

More than 5 years have passed since last update.

tmux のアウトプットを適当なエディタで開く

Last updated at Posted at 2019-03-19

image

デフォルトでも tmux のアウトプットは c-b [ で遡ったりできるが、通常のエディタで開きたかった。

幸運にも、 tmux には capture-pane というナイスなコマンドがある。

$HOME/bin/vim-edit-tmux-output

#!/bin/bash

file=`mktemp`.sh
tmux capture-pane -pS -32768 > $file
tmux new-window -n:mywindow "vim $file"

chmod +x $HOME/bin/vim-edit-tmux-output

$HOME/.tmux.conf

setenv -g PATH "$HOME/bin:$PATH"

bind-key C-e run-shell "vim-edit-tmux-output"

あとは C-b C-e を押せば良い。

嬉しいのは、 tmux は 自動的に Vim が終了した後のペインを消してくれるところだ。

7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2