__zmx_format_sessions.fish

 1function __zmx_format_sessions --description "Format zmx list output for fzf"
 2    while read -l line
 3        set -l fields (string split \t -- $line)
 4
 5        if test (count $fields) -lt 5
 6            continue
 7        end
 8
 9        set -l name (string replace -r '^session_name=' '' -- $fields[1])
10        set -l pid (string replace -r '^pid=' '' -- $fields[2])
11        set -l clients (string replace -r '^clients=' '' -- $fields[3])
12        set -l dir (string replace -r '^started_in=' '' -- $fields[5])
13
14        printf "%-20s  pid:%-8s  clients:%-2s  %s\n" $name $pid $clients $dir
15    end
16end