Created
November 30, 2012 12:19
-
-
Save mooz/4175464 to your computer and use it in GitHub Desktop.
zle widget which launches tmux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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