Skip to main content
2 of 5
added 252 characters in body

Dump to a file and automatically open the file in vim

This is sweet:

bind-key v 'capture-pane' \; \
  capture-pane -JS - \; \
  save-buffer /tmp/tmux \; \
  delete-buffer \; \
  send-keys Escape 'ddivim /tmp/tmux' Enter

I'm also using -J because you obviously don't want newlines to be arbitrarily inserted on every arbitrary terminal wrap!

It supposes that your shell is in vi mode, so that:

  • Escape goes into normal mode
  • dd clears any existing command
  • i goes into insert mode
  • then we run vim /tmp/tmux

Tested in tmux 3.0.