seankhl / fzf-mksh

mksh files for junegunn's fzf
13 stars 1 forks source link

unix support? #4

Open mbauhardt opened 1 year ago

mbauhardt commented 1 year ago

Hey, it looks like the history ctrl-r depends on the GNU version of sed/sort/uniq

sed: unknown option -- z
Usage:  sed [-aElnru] command [file ...]
        sed [-aElnru] [-e command] [-f command_file] [-I[extension]]
            [-i[extension]] [file ...]
uniq: unknown option -- z
usage: uniq [-cdu] [-f fields] [-s chars] [input_file [output_file]]
sort: unknown option -- z
usage: sort [-bdfHilmnrSsu] [-k kstart[,kend]] [-o output] [-R char] [-T dir]
             [-t char] [file ...]
   or: sort -C|-c [-bdfilnru] [-k kstart[,kend]] [-o output] [-R char]
             [-t char] [file]
sort: unknown option -- z

any chance to migrate it to support non-gnu version of these tools?

I'm on NetBSD 9.1 (GENERIC)

seankhl commented 11 months ago

Indeed it does. Let me try to make this functionality portable.

I'll try to see what I can do in pure mksh, and then move to portable versions of external tools that should be as widely available as possible.

mbauhardt commented 11 months ago

I ported your idea into as a kind of prototype in my dotfiles but with fzy and not fzf on a netbsd.

function __fzy_history__ {
  history 1 | sort -k2 | uniq -f1 | sort -k1nr | sed 's/[[:space:]]/\t/' | fzy -l 25 | sed 's/^[0-9\t]*//'
}

it is working okayish, but I believe the newes dupclicates are removed from the final list, and not the oldest ones.