From the reddit thread about pacseek (@moson), I got a cool fzf command to search for packages (source).
I modified it slightly
- AUR activated by default
- minor aesthetics (no --black background)
- addition of installed packages browsing with CTRL+I
- to avoid straining Arch servers unreasonably, I found that a simple sleep in the review command works nicely – I didn’t analyse my traffic, but I tested that by writing to a local file before the query; only the packages I lingered on were logged, so I assume fzf terminates the preview command when switching entry. Good to know.
# fzf aided package installer;
# originally from https://github.com/IBArbitrary/dotfiles/blob/master/.config/fish/config.fish#L72-L78
function pacs {
yay -Slq | fzf --prompt 'yay> ' \
--header 'Install packages. CTRL+(Pacman/Aur/Installed)' \
--bind 'ctrl-p:change-prompt(pacman> )+reload(pacman -Slq)' \
--bind 'ctrl-a:change-prompt(yay> )+reload(yay -Slq)' \
--bind 'ctrl-i:change-prompt(inst> )+reload(yay -Qq)' \
--multi --height=80% --preview 'sleep 2; yay -Si {1}' \
--preview-window bottom | xargs -ro yay -S
}
There is one other thing I’d like to do: instead of just passing the packages directly to yay -S through xarg, I’d like to prewrite “yay -S [packages]” in the prompt, for me to read and manually alter if needed, and so that it shows up in the command logs as though I had manually typed it from the get go, instead of just “pacs” showing up.
I use ZSH, and I assume ZLE is what I should look into, but it’s not immediately clear to me how to operate it.
zle -U <string>
seems to be what I’m looking for, but requires a “widget”, whatever that is.
I could R more of TFM, but I’m feeling a bit lazy, so if anybody knows ZLE like the back of their hand (or knows it’s not the right/simplest tool for the job) I’ll be glad for tips and advice.