1

In Emacs I activated the option to use CUA keys for copy/cut-pasting with C-c/C-x/C-v. However sometimes it creates a problem when using Latex/Auctex key shortcuts, because it "eats" the first C-c or C-x. To explain myself better, assume I want to comment out some lines in Tex. So I select them and then hit C-c ; However the result is that it copies the selected region, deselects the region and types ";" in the beginning of the region.

Is there a way to setup Emacs so as to use Super-c/Super-x/Super-v for copying, cutting and pasting?

1 Answer 1

2

You can setup your own keybindings using an init.el file inside your .emacs.d. Just copy and paste the following code in your startup script:

(define-key global-map [?\s-x] 'kill-region)
(define-key global-map [?\s-c] 'kill-ring-save)
(define-key global-map [?\s-v] 'yank)

If you don't know the names of the commands executed by a key sequence, you can discover using C-h k and then pressing the key binding you want to know about. Then you just use the define-key to create new keybindings for this command.

You can also unmap using global-unset-key. Make sure your key bindings don't conflict with the operating system.

More on this:

1
  • Thanks, works as it is expected! Although I put it in my .emacs file. I also added command (define-key global-map [?\s-z] 'undo) for undoing.
    – Elena
    Nov 27, 2014 at 12:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .