__zmx_format_sessions.fish

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