-
-
Save ElectricCoffee/9387e27397a70e1a6d4d to your computer and use it in GitHub Desktop.
OSX Version of rand00's copy function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun copy-to-clipboard () | |
(interactive) | |
(if (region-active-p) | |
(progn (shell-command-on-region | |
(region-beginning) (region-end) | |
"pbcopy") | |
(message "Copied region to clipboard!") | |
(deactivate-mark)) | |
(message "No mark set."))) | |
;; optional | |
(defun copy-whole-buffer-to-clipboard () | |
(interactive) | |
(mark-whole-buffer) | |
(copy-to-clipboard)) | |
(global-set-key (kbd "C-c c") 'copy-to-clipboard) | |
(global-set-key (kbd "C-c M-c") 'copy-whole-buffer-to-clipboard) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment