Skip to content

Instantly share code, notes, and snippets.

@benjamin-asdf
Created July 10, 2025 07:35
Show Gist options
  • Save benjamin-asdf/d2d76e41578f3689133d73e073384ae4 to your computer and use it in GitHub Desktop.
Save benjamin-asdf/d2d76e41578f3689133d73e073384ae4 to your computer and use it in GitHub Desktop.
Emacs minor mode for removing prefix dollars for shell commands
;; -*- lexical-binding: t; -*-
(define-minor-mode remove-dollars-when-yanking-lines-mode
"Minor mode that removes prefix dollars from lines when pasting.
Meant to be used in shell buffer contexts."
:group 'benjamin
(add-hook
'yank-transform-functions
(defun remove-dollars-line-start (string)
(s-chop-prefixes '(" " "$" " " "$") string))
nil
'local))
(add-hook 'shell-command-mode-hook 'remove-dollars-when-yanking-lines-mode)
;; or tell me how this is not an issue for you?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment