From a26e5fa8ef4cb2b4cc90dccfdf82a960306051b3 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Tue, 27 Jul 2021 12:48:11 +0300 Subject: [PATCH] feat(emacs): pass --- .config/guix/manifests/console.scm | 1 + .emacs.d/init.el | 36 +++++++++++++++++++++--------- Console.org | 1 + Emacs.org | 35 ++++++++++++++++++++++++----- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/.config/guix/manifests/console.scm b/.config/guix/manifests/console.scm index 4ba6627..136f0b3 100644 --- a/.config/guix/manifests/console.scm +++ b/.config/guix/manifests/console.scm @@ -1,5 +1,6 @@ (specifications->manifest '( + "password-store" "p7zip" "fzf" "neofetch" diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 0914b6b..6c8af10 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -139,6 +139,7 @@ '(eww proced emms + pass calendar dired debug @@ -715,6 +716,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (setq my/project-title-separators "[-_ ]") +(setq my/project-names-override-alist + '((".password-store" . "pass"))) + (defun my/shorten-project-name-elem (elem crop) (if (string-match "^\\[.*\\]$" elem) (concat "[" @@ -730,12 +734,14 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (concat prefix rest)))) (defun my/shorten-project-name (project-name) - (let ((elems (s-slice-at my/project-title-separators project-name))) - (concat - (apply - #'concat - (cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems))) - (my/shorten-project-name-elem (car (last elems)) nil)))) + (or + (cdr (assoc project-name my/project-names-override-alist)) + (let ((elems (s-slice-at my/project-title-separators project-name))) + (concat + (apply + #'concat + (cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems))) + (my/shorten-project-name-elem (car (last elems)) nil))))) (defun my/tab-bar-name-function () (let ((project-name (projectile-project-name))) @@ -967,11 +973,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (completing-read "Dired: " bookmarks nil nil "^") bookmarks))))) -(use-package vlf - :straight t - :config - (require 'vlf-setup)) - (use-package vterm ;; :straight t :commands (vterm vterm-other-window) @@ -2963,6 +2964,19 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (evil-collection-define-key 'normal 'Info-mode-map (kbd "RET") 'Info-follow-nearest-node) +(defun my/man-fix-width (&rest _) + (setq-local Man-width (- (window-width) 4))) + +(advice-add #'Man-update-manpage :before #'my/man-fix-width) + +(use-package pass + :straight t + :commands (pass) + :init + (my-leader-def "ak" #'pass) + :config + (setq pass-show-keybindings nil)) + (use-package docker :straight t :commands (docker) diff --git a/Console.org b/Console.org index 2a6f8d0..8ec7840 100644 --- a/Console.org +++ b/Console.org @@ -789,6 +789,7 @@ key_bindings: | neofetch | Fetch system info | | fzf | fuzzy finder | | p7zip | archiver | +| password-store | CLI password manager | | Note | Description | |------+-----------------| diff --git a/Emacs.org b/Emacs.org index 087bbe8..fcd12bf 100644 --- a/Emacs.org +++ b/Emacs.org @@ -509,6 +509,7 @@ I don't enable the entire package, just the modes I need. '(eww proced emms + pass calendar dired debug @@ -1398,6 +1399,9 @@ Prepend tab name with the shortened projectile project title #+begin_src emacs-lisp (setq my/project-title-separators "[-_ ]") +(setq my/project-names-override-alist + '((".password-store" . "pass"))) + (defun my/shorten-project-name-elem (elem crop) (if (string-match "^\\[.*\\]$" elem) (concat "[" @@ -1413,12 +1417,14 @@ Prepend tab name with the shortened projectile project title (concat prefix rest)))) (defun my/shorten-project-name (project-name) - (let ((elems (s-slice-at my/project-title-separators project-name))) - (concat - (apply - #'concat - (cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems))) - (my/shorten-project-name-elem (car (last elems)) nil)))) + (or + (cdr (assoc project-name my/project-names-override-alist)) + (let ((elems (s-slice-at my/project-title-separators project-name))) + (concat + (apply + #'concat + (cl-mapcar (lambda (elem) (my/shorten-project-name-elem elem t)) (butlast elems))) + (my/shorten-project-name-elem (car (last elems)) nil))))) (defun my/tab-bar-name-function () (let ((project-name (projectile-project-name))) @@ -4465,6 +4471,23 @@ Of course, Emacs can also display man and info pages. (evil-collection-define-key 'normal 'Info-mode-map (kbd "RET") 'Info-follow-nearest-node) + +(defun my/man-fix-width (&rest _) + (setq-local Man-width (- (window-width) 4))) + +(advice-add #'Man-update-manpage :before #'my/man-fix-width) +#+end_src +*** pass +I use [[https://www.passwordstore.org/][pass]] as my password manager. Expectedly, there is Emacs frontend for it. + +#+begin_src emacs-lisp +(use-package pass + :straight t + :commands (pass) + :init + (my-leader-def "ak" #'pass) + :config + (setq pass-show-keybindings nil)) #+end_src *** Docker A package to manage docker containers from Emacs.