Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active November 17, 2020 21:35
Show Gist options
  • Select an option

  • Save tyjak/52f7443b52fce7270066095101c93099 to your computer and use it in GitHub Desktop.

Select an option

Save tyjak/52f7443b52fce7270066095101c93099 to your computer and use it in GitHub Desktop.
Autofill password field on vimb with the password from pasword-store
#!/bin/sh
# Desccription: autofill password field on vimb with the password from pasword-store
# Dependencies: password-store, vimb
# Installation:
# 1. copy this file in you local bin : ~/.local/bin
# 2. add this line in your vimb conf : nmap ,,; ::sh! ~/.local/bin/passgenvimb<CR>
# Last rev: 18-10-2020
# License: WTFPL
# GistID: 52f7443b52fce7270066095101c93099
# the domain of the websote
DOMAIN=$(echo -n "$VIMB_URI" | cut -d'/' -f3 | sed -e 's/\(\([[:alnum:]]\+\.\)\+[[:alnum:]]\+\).*$/\1/g')
# check if the password exists
PASS=$(pass show web/$DOMAIN | head -n 1)
if [ ! "$PASS" ]; then
#pass generate -cn web/$DOMAIN # TOFIX error with the pass git hook
pass generate -n web/$DOMAIN 2>/dev/null
PASS=$(pass show web/$DOMAIN | head -n 1)
fi
# type the password in the password field
xdotool type i${PASS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment