Some useful Zsh extensions I use for simplifying Tmux

Tmux a command line based way of handling terminal panes. Its a very useful tool that I use whenever I open a terminal.

Despite the utility of the said application, its interface is verbose and unwieldy. To combat that, I made some aliases and a zsh completion function that makes using Tmux a whole lot better.

Here is the Zsh part

# Reload the Tmux Configuration
alias tt="tmux source ~/.tmux.conf" 

# Edit the Tmux configuration with Vim, and then reload it
alias v.t="vim ~/.tmux.conf; tt" 

# List Running Tmux Sessions
alias'tmux ls'
function t.c() {
  if [ "$1" != "" ]
    tmux attach -t "$1" || tmux new -s "$1"
    echo -e "Give the name of the session as a parameter"
_t.c() {   
 _arguments ":es:(tmux ls  2> /dev/null | cut -d ':' -f 1)"

compdef _t.c t.c

Here is a demonstration on how it works. I am pressing tab to autocomplete the open sessions.

Leave a Reply

%d bloggers like this: