Copy source for reddit
This commit is contained in:
@@ -15,3 +15,16 @@
|
|||||||
|
|
||||||
(use-package dockerfile-mode
|
(use-package dockerfile-mode
|
||||||
:ensure t)
|
: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)
|
||||||
|
|||||||
Reference in New Issue
Block a user