Created
January 3, 2015 06:08
-
-
Save xuchunyang/609cf66dd98309d048b8 to your computer and use it in GitHub Desktop.
Copy or Paste using one and the same key ("C-c c")
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
;;; Copy or Paste using one and the same key ("C-c c") | |
(defun copy-or-paste () | |
"Copy when there are selected text, paste otherwise." | |
(interactive) | |
(if (region-active-p) | |
(copy-region-as-kill (region-beginning) ; Copy | |
(region-end)) | |
;; TODO: deactive mark/region | |
;; Paste | |
(yank))) | |
(global-set-key (kbd "C-c c") 'copy-or-paste) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment