Skip to content

Instantly share code, notes, and snippets.

@mooz
Created November 30, 2012 12:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mooz/4175464 to your computer and use it in GitHub Desktop.
Save mooz/4175464 to your computer and use it in GitHub Desktop.
zle widget which launches tmux
function tmux-attach() {
# Launching tmux inside a zle widget is not easy
# Hence, We delegate the work to the parent zsh
BUFFER=" { tmux list-sessions >& /dev/null && tmux attach } || tmux"
zle accept-line
}
zle -N tmux-attach
# Define a shortcut key for launching tmux (Ctrl+t)
bindkey '^T' tmux-attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment