tmux-bash-completion
tmux-bash-completion copied to clipboard
Failover to default completions
Problem: When I try to write the tmux copy buffer to a file, tab completion doesn't work for the file name.
I copied text in my tmux session and tried redirect the output tmux show-buffer to append it to an existing file, like this:
$ tmux show-buffer >> /tmp/mylog.txt
I typed /tmp/m and hit tab to complete the filename but nothing happened.
The fix is to change this line:
complete -F _tmux tmux
to:
complete -o bashdefault -F _tmux tmux
The bash man page says -o bashdefault will "Perform the rest of the default bash completions if the compspec generates no matches."
Hello. Yes. I specifically disabled this option because it was completing other commands where it shouldn't have.
For filecompletion you can read more there http://stackoverflow.com/questions/14343464/bash-completion-after-redirection-symbol#14343925
Also if it is only case for show-buffer, I can enable file completion for it explicitly.
Ah, interesting - I wasn't familiar with the complete-filename option although I use that key combination for completion in emacs.
I've only encountered this when trying show-buffer. I can't think of other tmux commands for which I would want to redirect output.