Created
June 5, 2014 21:40
-
-
Save xmasotto/290c8d54785baebcd2af to your computer and use it in GitHub Desktop.
; Syncs the clipboard and the emacs kill-ring
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
(global-set-key "\C-w" 'custom-kill-region) | |
(global-set-key "\M-w" 'custom-kill-ring-save) | |
(global-set-key "\C-y" 'clipboard-yank) | |
(defun custom-kill-region () | |
(interactive) | |
(let ((start (region-beginning)) | |
(end (region-end))) | |
(shell-command-on-region start end "pbcopy") | |
(clipboard-kill-region start end) | |
(message "cut selection!"))) | |
(defun custom-kill-ring-save () | |
(interactive) | |
(let ((start (region-beginning)) | |
(end (region-end))) | |
(shell-command-on-region start end "pbcopy") | |
(clipboard-kill-ring-save start end) | |
(message "copied selection!"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment