3

I would like to set the following keyboard shortcuts:

  • Copy (selected text): C-c
  • Cut (selected text): C-x
  • Paste from clipboard: C-v
  • Debugger (GDB): M-g

Now I realize that to do this I merely need the command for each of these, and add lines of the form:

(global-set-key (kbd "shortcut") 'command) 

to my ~/.emacs file. The problem is that Googling emacs commands hasn't revealed the emacs commands for each of these. So all I need is the commands for each of these.

1 Answer 1

3
  • kill-ring-save for C-c
  • kill-region for C-x
  • yank for C-v
  • gdb for M-g

You should also look into enabling cua-mode, which ships with Emacs by default and allows usage of common keyboard shortcuts as expected with minimal setup. You can also use C-h k to see what a keybinding does and C-h f to see what a particular function does and what it's bound to currently.

2
  • I have set kill-ring-save to C-c but when I press C-c in Emacs it doesn't copy highlighted text. I only tried using this .emacs snippet because Cua mode doesn't seem to do this for me. Commented Dec 8, 2016 at 3:25
  • @BrentonHorne Hmm, I hadn't actually tried these solutions till now, but I had the same problem as you wrt C-c not working for copying. This happened both with enabling cua-mode and with running (global-set-key (kbd "C-c") 'kill-ring-save). I suspect that this is happening b/c there are other keybindings to which C-c is already bound to, but as a prefix. You might want to try unbinding all other bindings to C-c and then see if it works correctly for copying regions. Commented Dec 8, 2016 at 16:09

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.