Skip to content

imomaliev/tmux-bash-completion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

TMUX bash completion based on bash-it's tmux completion

Available completions

  • commands
  • files
  • sessions
  • windows

Installation

This installation method requires bash-completion 1.2 or higher.

  1. Follow the installation instructions for bash-completion

  2. Determine the correct spot to place this plugin.

From the bash-completion FAQ

Q. Where should I install my own local completions?

A. Put them in the completions subdir of $BASH_COMPLETION_USER_DIR (defaults to $XDG_DATA_HOME/bash-completion or ~/.local/share/bash-completion if $XDG_DATA_HOME is not set) to have them loaded automatically on demand when the respective command is being completed. See also the next question's answer for considerations for these files' names, they apply here as well. Alternatively, you can write them directly in ~/.bash_completion which is loaded eagerly by our main script.

$ dir="${BASH_COMPLETION_DIR:-"${XDG_DATA_HOME:-"$HOME/.local/share"}/bash-completion"}/completions"
$ mkdir -p "$dir"
  1. Download the file
$ curl -fSsL "https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux" > "${dir?error: dir not set: you must run the previous commands first}/tmux"
  1. Reload your configuration files
$ source ~/.bashrc

Without bash-completion

You can simply download the completion file and source it as part of your shell startup.

$ curl -fSsL "https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux" > ~/.bash.tmux-bash-completion
$ echo 'source ~/.bash.tmux-bash-completion' >> ~/.bashrc
$ source ~/.bashrc # load it for your current session

TODO

  • use list-sessions -F
  • check all cases for complete -o default