tmux-bash-completion icon indicating copy to clipboard operation
tmux-bash-completion copied to clipboard

Failover to default completions

Open truthdoug opened this issue 9 years ago • 2 comments

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."

truthdoug avatar Sep 13 '16 15:09 truthdoug

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.

imomaliev avatar Sep 14 '16 10:09 imomaliev

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.

truthdoug avatar Sep 14 '16 13:09 truthdoug