gopass secret selection with fzf

What it is

FZF to create a zsh functiona to interactively search for passwords or other information in the gopass databases

FZF is a nice tool for all kinds of fuzzy finding on your computer. It really shines when combined with other tools to make them interactive.

What it does for you

The function we create here can do the following for us:

  • show all secrets from all password stores that gopass knows of
  • optinally takes an fzf query string to prepopulate fzf
  • allow for fuzzy-finding the one we want with fzf interactively
  • help with the selection by showing any additional info of a secret in fzf's preview
  • select one and copy it to the clipboard

The Code

  if [ -z "$QUERY" ]; then
  gopass show -C \
    $(gopass ls --flat \
      | fzf -q "$QUERY" --preview "gopass show {}" \

How to use it

Put the code into a file, e.g. fzf_gopass.zsh and source it. If you like it, add the command to source it to one of your shell initialization scripts.

Then type


# optionally followed by some (fuzzy) search text to start with

p goo

Type some more search characters - it can be a fuzzy-find - and/or use the arrow keys to select a branch.

Then press <Enter> to copy the password to the clipboard. Use <ESC> to exit without copying anything.

You can also use this command to quickly get any additional information stored in your secrets database.