Here’s an updated version which captures ANSI escapes and tries to put the cursor close to where it was. It’s more complicated, and could use some more love, but I think it’s finally better than above:
Of course, you’ll need to bind to your existing copy-mode key, not my weird pane-menu thing.
When you say “my weird pane-menu” thing what do you mean exactly? I’d love to put this to use in my own tmux config, but I’m not very well versed with tmux’s config language.
In the first version that you proposed @eraserhd , why not dumping the pane to stdout and directly pipe it to kak? I understand that it does not handle ansi, but as a quick solution, what are the drawbacks compared to what you proposed? What is the point of having a temporary file?
set user option @copy-pane-id instead of setting buffer
split-window -Z instead of new-window in order to avoid referring to pane index :copy-mode.0 because index 0 can be invalid in case of set-option -wg pane-base-index 1.
tmux’s capture-pane has option -b buffer-name, so I think it’s possible to avoid creating temporary file by capturing pane directly into a buffer but I’m lazy to implement this.