You are not logged in.

#1 2022-11-26 09:50:29

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Fuzzy launch and fuzzy cd experiments

What does being fuzzy mean?
Vague or imprecise. synonyms ▲ Synonyms: ambiguous, equivocal; see also Thesaurus:vague. My recollection of that event is fuzzy. Not clear; unfocused. synonyms ▲ Synonyms: blurry, ill-defined; see also Thesaurus:indistinct.

alias launch='unset arr;arr=();arr+=($(compgen -c | fzy -p "launch >> ")) && "${arr[@]}"'
alias cdf='cd "$(fdfind -H -L -t d -d 3 | fzf -0 --height=10 --layout=reverse)"'

1st one needs 'fzy' (in repos), 2nd one needs 'fzf' and 'fd-find' (in repos).

cdf ** in action:
aAQHVW0.png

* Disclaimer: This is what it is: experiments, there is no doubt a better way to do this sort of stuff. Also there may be a way to do such stuff with fzf or fzy natively, that I'am not aware off.

** Turns out that fzf already comes with a cdf like widget, called 'fzf-cd-widget' (default keybind is alt+c).

Last edited by brontosaurusrex (2023-06-13 09:42:49)

Offline

#2 2022-11-26 14:17:55

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Fuzzy launch and fuzzy cd experiments

The whole thing is fuzzy to me.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#3 2022-11-27 12:36:32

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: Fuzzy launch and fuzzy cd experiments

asciiDemo: https://asciinema.org/a/oDodjH9TcVuumN2Ea6w5eWB0z
More: https://brontosaurusrex.github.io/2022/ … zy-launch/

Last edited by brontosaurusrex (2022-11-27 12:41:31)

Offline

#4 2022-11-27 15:32:03

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Fuzzy launch and fuzzy cd experiments

Now that is really above my paygrade¹

But looks interesting as all get up and go!

_________________
¹ brain cell capacity


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#5 2022-11-27 16:33:45

sleekmason
zoom
Registered: 2018-05-22
Posts: 1,108
Website

Re: Fuzzy launch and fuzzy cd experiments

To check out what Brontosaurusrex has going above, I did this:

sudo apt install fzy fzf fd-find

and then:

fdfind -H -L -t d -d 3 | fzf -0 --height=10 --layout=reverse

in a terminal to see how it worked without setting up the alias.

To try the whole setup, I placed the alias lines at the end of  ~/.bashrc and called it all with:

cdf

Just a really neat idea for a sort of terminal menu of existing files. fdfind to search and fzf to sort into a better order. Brilliant.

@Brontosuarusrex, Did you have a specific use in mind?

Last edited by sleekmason (2022-11-27 16:34:22)

Offline

#6 2022-11-27 17:20:17

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: Fuzzy launch and fuzzy cd experiments

@sleekmason, Well yes, one is 'launcher', another one is 'cd to', there is a third one called 'comhis'

# functions
comhis () {
    # Noninteractive fuzzy search history and available commands 
    if (( $# )) ; then
        var="$*"
        { { history | awk '{$1=""; print $0;}' | sed 's/^ //g'; } & compgen -c; } \
        | fzy -e "$var" | uniq | head -20 | column
    fi
} 

which is non-interactive and just searches history (if you happen to have the history format 'correct') and executables and prints them out. There must be a lot more here to discover.

p.s. Also 'cdf' and 'launch', if they survive the testing stage may be better out bind to a certain keys (instead of aliased).

Last edited by brontosaurusrex (2022-11-27 17:34:52)

Offline

#7 2022-11-28 15:32:48

sleekmason
zoom
Registered: 2018-05-22
Posts: 1,108
Website

Re: Fuzzy launch and fuzzy cd experiments

Just neat.  Thank you for sharing your work!

Offline

Board footer

Powered by FluxBB