Home / Emacs / Password Store
Configure!
Install the package.
(with-eval-after-load 'package
(add-to-list 'package-selected-packages 'password-store))
Define “unsafe” copy functions.
Unlike the password-store-copy function that copies the passwords, these
functions do not clear the copied information from the kill ring.
(defun password-store-copy-field-unsafely+ (field)
(interactive)
(require 'password-store)
(let ((entry (completing-read
(concat "Get '" field '" field from: ")
(password-store-list) nil 'require-match)))
(kill-new (password-store-get-field entry field))))
(defun password-store-copy-url+ ()
"Add the 'url' field for selected entry into the kill ring."
(interactive)
(password-store-copy-field-unsafely+ "url"))
(defun password-store-copy-username+ ()
"Add the 'username' field for selected entry into the kill ring."
(interactive)
(password-store-copy-field-unsafely+ "username"))
Define the keys.
(keymap-global-set "C-c p p" #'password-store-copy)
(keymap-global-set "C-c p u" #'password-store-copy-username+)
(keymap-global-set "C-c p U" #'password-store-copy-url+)
(keymap-global-set "C-c p f" #'password-store-copy-field)
(keymap-global-set "C-c p e" #'password-store-edit)
(keymap-global-set "C-c p b" #'password-store-url)