knqyf263 / pet

Simple command-line snippet manager
MIT License
4.45k stars 224 forks source link

Chain Commands #169

Closed raf1312 closed 7 months ago

raf1312 commented 3 years ago

Dear all,

is there a way to pick one command with pet, do a pipe and then select another one with pet? Would be nice if I can hit ^s again to select the next command.

Thank you in advance.

jaroslawhartman commented 7 months ago

If you're using zsh you would need to set this widget definition in .zshrc:

function pet-select() {
  RBUFFER=$(pet search)
  CURSOR=$#BUFFER
  zle redisplay
}
zle -N pet-select
stty -ixon
bindkey '^s' pet-select

Screen Recording 2024-02-02 at 21 19 26

RamiAwar commented 7 months ago

Thanks @jaroslawhartman , didn't even know this was possible! @raf1312 Your question is answered :)