Copy source for reddit

This commit is contained in:
2024-07-19 00:06:22 -07:00
parent 6ea19a081f
commit 941aedc474

View File

@@ -15,3 +15,16 @@
(use-package dockerfile-mode
:ensure t)
;; TODO - replace with https://github.com/sshaw/copy-as-format if necessary
(defun copy-source-for-reddit ()
(interactive)
(let ((contents (buffer-substring (point) (mark))))
(with-temp-buffer
(insert contents)
(mark-whole-buffer)
(indent-rigidly (point) (mark) 4 t)
(mark-whole-buffer)
(kill-ring-save 0 0 t))))
(keymap-global-set "C-c o r" #'copy-source-for-reddit)