Rudy’s OBTF Rudolf Adamkovič

Home / Emacs / Password Store


Configure!

Install the package.

(with-eval-after-load 'package
  (add-to-list 'package-selected-packages 'password-store)
  (add-to-list 'package-selected-packages 'password-store-otp))

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 my-password-store-copy (field)
  (interactive)
  (require 'password-store)
  (let ((entry (completing-read (concat "Get '" field '" field from: ")
                                (password-store-list)
                                nil
                                'require-match)))
    (password-store-copy-field entry field)))
(defun my-password-store-copy-url ()
  "Add the 'url' field for selected entry into the kill ring."
  (interactive)
  (my-password-store-copy "url"))
(defun my-password-store-copy-username ()
  "Add the 'username' field for selected entry into the kill ring."
  (interactive)
  (my-password-store-copy "username"))

Define the keys.

(keymap-global-set "C-c p p" #'password-store-copy)
(keymap-global-set "C-c p t" #'password-store-otp-token-copy)
(keymap-global-set "C-c p u" #'my-password-store-copy-username)
(keymap-global-set "C-c p U" #'my-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)

© 2025 Rudolf Adamkovič under GNU General Public License (GPL) version 3 or later.
Made with Emacs and secret alien technologies of yesteryear.