jsuth
jsuth

Reputation: 171

pipe fzf selection to text manipulation to zsh prompt (without executing)

Here's a function that executes a selected alias using fzf:

fa() { 
  eval $(alias | fzf | cut -d'=' -f2 | sd -p "'" '') 
}

The problem is that sometimes you want to add more arguments to an alias rather than immediately execute it. Is this possible?

Upvotes: 1

Views: 612

Answers (1)

jsuth
jsuth

Reputation: 171

Solution using zsh:

fa() { 
  print -z $(alias | fzf | cut -d'=' -f2 | sd -p "'" '') 
}

Upvotes: 2

Related Questions