Overview
tmux-select-window is designed to help tmux users navigate between multiple windows quickly and efficiently. This tool is typically bound to a key combination, which, when pressed, displays a list of all windows in the current session. Users can then search by name or scroll to select the desired window.
Key Features
- Interactive window list display
- Fast search and filtering via fuzzy finders like fzf
- Instant window switching through key bindings
- Enhanced tmux workflow efficiency
Installation
tmux-select-window is not included in default Linux commands and is typically installed via a tmux plugin manager (like tpm). It requires fzf to be installed to function correctly.
Install fzf (Required)
tmux-select-window primarily uses fzf for its interactive selection functionality. You must install fzf first.
Debian/Ubuntu
sudo apt update && sudo apt install fzf
Fedora/CentOS
sudo dnf install fzf
Arch Linux
sudo pacman -S fzf
Install tmux-select-window (Using tpm)
You can easily install it using a tmux plugin manager (tpm). If you don't have tpm installed yet, you need to install it first.
tpm Installation Steps
- 1. Add the following line to your `.tmux.conf` file: `set -g @plugin 'tmux-plugins/tmux-select-window'`
- 2. Restart tmux or reload your configuration by running `source ~/.tmux.conf`.
- 3. Press `prefix + I` (uppercase i) to install the plugin. (The prefix is `Ctrl+b` by default.)
Usage Examples
tmux-select-window is typically used by adding it as a key binding in your tmux configuration file (.tmux.conf).
Default Key Binding Setup
You can enable the window selection feature by adding the following line to your `.tmux.conf` file to bind it to `prefix + w`. (Note: It might be automatically bound after plugin installation.)
.tmux.conf Configuration
bind-key w run-shell "~/.tmux/plugins/tmux-select-window/scripts/select_window.sh"
This configuration executes the `tmux-select-window` script when `prefix + w` is pressed. The actual script path may vary depending on your tpm installation location.
How to Use
Within a tmux session, press the configured key binding (e.g., `Ctrl+b` followed by `w`). A list of all windows in the current session will appear with the fzf interface. You can then type to filter by window name, or use the arrow keys to navigate and press `Enter` to switch to the selected window.
Tips & Notes
Here are some tips and notes for using tmux-select-window more effectively.
fzf Customization
You can customize the interface of tmux-select-window by setting fzf environment variables (e.g., `FZF_DEFAULT_OPTS`). For instance, you can adjust color themes or layout.
- Example: `export FZF_DEFAULT_OPTS="--layout=reverse --info=inline --height=40%"`
Key Binding Conflicts
Be mindful of potential conflicts with existing tmux key bindings. You can check your currently bound keys using the `tmux list-keys` command.
Verify Script Path
If you installed it manually instead of using tpm, ensure the script path specified in the `run-shell` command in your `.tmux.conf` is correct. The script is typically located at `~/.tmux/plugins/tmux-select-window/scripts/select_window.sh`.