aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-05-02 15:12:26 +0800
committerAaron LI <aaronly.me@gmail.com>2016-05-02 15:13:13 +0800
commitb0f791221329cf56d62c063f16922901dde8091e (patch)
treeccb3aabc7f1dbed56cd1af74f68afb6a60561b23
parent1dc93cc76a88d8f0aba6c625858c49889d838b5c (diff)
downloaddotfiles-b0f791221329cf56d62c063f16922901dde8091e.tar.bz2
_zsh: add 80-tmux.zsh with "percol" integration
-rw-r--r--_zsh/80-tmux.zsh34
-rw-r--r--_zsh/90-aliases.zsh6
2 files changed, 34 insertions, 6 deletions
diff --git a/_zsh/80-tmux.zsh b/_zsh/80-tmux.zsh
new file mode 100644
index 0000000..ae0f1c5
--- /dev/null
+++ b/_zsh/80-tmux.zsh
@@ -0,0 +1,34 @@
+#
+# zsh/tmux.zsh
+#
+
+
+# Integrate `tmux` attach with `percol`
+# Credit: https://github.com/mooz/percol
+if exists percol; then
+ function tmattach() {
+ if [[ $1 == "" ]]; then
+ PERCOL=percol
+ else
+ PERCOL="percol --query $1"
+ fi
+
+ sessions=$(tmux list-sessions)
+ [ $? -ne 0 ] && return
+
+ session=$(echo ${sessions} | eval ${PERCOL} | cut -d: -f1)
+ if [[ -n "${session}" ]]; then
+ tmux attach -t ${session}
+ fi
+ }
+fi
+
+
+alias ta='tmux attach -t'
+alias tl='tmux list-sessions'
+alias ts='tmux new-session -s'
+alias tkss='tmux kill-session -t'
+alias tksv='tmux kill-server'
+
+
+# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #
diff --git a/_zsh/90-aliases.zsh b/_zsh/90-aliases.zsh
index 1327721..a530fba 100644
--- a/_zsh/90-aliases.zsh
+++ b/_zsh/90-aliases.zsh
@@ -22,10 +22,4 @@ alias lsa='ls -lah'
alias grep='grep --color=auto'
-alias ta='tmux attach -t'
-alias tl='tmux list-sessions'
-alias ts='tmux new-session -s'
-alias tkss='tmux kill-session -t'
-alias tksv='tmux kill-server'
-
# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #