doomemacs/modules/tools/password-store/config.el

45 lines
1.3 KiB
EmacsLisp
Raw Normal View History

;;; tools/password-store/config.el -*- lexical-binding: t; -*-
(defvar +pass-user-fields '("login" "user" "username" "email")
"A list of fields for `+pass/ivy' to search for the username.")
(defvar +pass-url-fields '("url" "site" "location")
"A list of fields for `+pass/ivy' to search for the username.")
;;
;; Plugins
;;
;; `password-store'
(setq password-store-password-length 12)
2018-05-29 17:50:55 +02:00
;; Fix hard-coded password-store location; respect PASSWORD_STORE_DIR envvar
(defun +password-store*read-entry (entry)
"Return a string with the file content of ENTRY."
(with-temp-buffer
(insert-file-contents
(expand-file-name (format "%s.gpg" entry) (password-store-dir)))
(buffer-substring-no-properties (point-min) (point-max))))
(advice-add #'auth-source-pass--read-entry :override #'+password-store*read-entry)
;; `pass'
2018-05-29 17:50:55 +02:00
(after! pass
(set! :env "PASSWORD_STORE_DIR")
2017-06-11 16:40:57 +02:00
(set! :evil-state 'pass-mode 'emacs)
(set! :popup "^\\*Password-Store"
'((side . left) (size . 0.25))
'((quit)))
(define-key! pass-mode-map
"j" #'pass-next-entry
"k" #'pass-prev-entry
"d" #'pass-kill
"\C-j" #'pass-next-directory
"\C-k" #'pass-next-directory))
2017-06-11 16:40:57 +02:00
;; Is built into Emacs 26+
(when (and EMACS26+ (featurep! +auth))
(auth-source-pass-enable))