Add zsh anything.el plugin
[zsh.git] / .zsh / zaw / sources / screens.zsh
1 #
2 # zaw-src-screens
3 #
4 # select screen session and attache it
5 #
6
7 function zaw-src-screens() {
8 local session state
9
10 screen -ls | awk 'NR==1,/^There (is a|are) screens? on:/ { next } /^[0-9]+ Sockets? in/ { exit } 1' | \
11 while read session state; do
12 candidates+=("${session}")
13 cand_descriptions+=("${(r:30:::::)session} ${state}")
14 done
15 actions=('zaw-callback-screens-attach')
16 act_descriptions=('attach session')
17 }
18
19 zaw-register-src -n screens zaw-src-screens
20
21 function zaw-callback-screens-attach() {
22 BUFFER="screen -rx ${(q)1}"
23 zle accept-line
24 }