-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtm1files
27 lines (20 loc) · 806 Bytes
/
tm1files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# @desc: Display tags and files with tmsu
setopt extendedglob
local -a files tags sel
if [[ -z "${@}" ]] {
# sel=( ${(@f)"$(tmsu files | xargs tmsu --color=always tags )"} )
sel=( ${(@f)"$(rpar 'tmsu --color=always tags' ::: $(tmsu files))"} )
} else {
# sel=( ${(@f)"$(tmsu files "${@}" | xargs tmsu --color=always tags )"} )
sel=( ${(@f)"$(rpar 'tmsu --color=always tags' ::: $(tmsu files $@))"} )
}
files=( ${(@)${sel[@]//(#m)*/${${(As.:.)MATCH}[1]}}} )
tags=( ${(@)${sel[@]//(#m)*/${${${(As.:.)MATCH}[2]#${${(As.:.)MATCH}[2]%%[! $'\t']*}}%/}}} )
integer i longest=0
local t
local -a packs unpacked
for (( i=1; i<=$#tags; i++ )) {
packs+=( "$(lscolors ${files[$i]}): ${tags[$i]}" )
}
print -Pln "${(@%)packs}" | column -t -s ':'
# vim: ft=zsh:et:sw=0:ts=2:sts=2:fdm=marker:fmr=[[[,]]]: