Emacs: Setup Standard Copy Cut Paste Keys

By Xah Lee. Date: . Last updated: .

Set standard keyboard shortcuts for Copy and Paste

If you prefer standard keys such as Ctrl+c for copy, Ctrl+x for cut Ctrl+v for paste, then turn on CUA mode. Alt+x cua-mode to toggle it on/off.

emacs cua mode menu 2021-07-19
emacs cua mode menu

cua-mode activates the following keyboard shortcuts:

To have cua-mode always on, put this in your Emacs Init File:

;; make {copy, cut, paste, undo} have {C-c, C-x, C-v, C-z} keys
(cua-mode 1)

standard keyboard shortcuts for {Open, Close, Save, Save As, Select All, etc}

Put this in your Emacs Init File:

(progn
  ;; make emacs use standard keys

  ;; Select All. was move-beginning-of-line
  (global-set-key (kbd "C-a") 'mark-whole-buffer-buffer)

  ;; Find. was forward-char
  (global-set-key (kbd "C-f") 'isearch-forward)

  ;; New. was next-line
  (global-set-key (kbd "C-n") 'xah-new-empty-buffer)

  ;; New Window. was nil
  (global-set-key (kbd "C-S-n") 'make-frame-command)

  ;; Open. was open-line
  (global-set-key (kbd "C-o") 'ido-find-file)

  ;; Save. was isearch-forward
  (global-set-key (kbd "C-s") 'save-buffer)

  ;; Save As. was nil
  (global-set-key (kbd "C-S-s") 'write-file)

  ;; Paste. was scroll-up-command
  (global-set-key (kbd "C-v") 'yank)

  ;; Close. was kill-region
  (global-set-key (kbd "C-w") 'kill-buffer)

  ;; Redo. was yank. (undo-redo is new in emacs 28)
  (global-set-key (kbd "C-y") 'undo-redo)

  ;; Undo. was suspend-frame
  (global-set-key (kbd "C-z") 'undo)
  ;;
  )

For the command xah-new-empty-buffer, get it at Emacs: New Empty Buffer 🚀.

For the command redo, you need emacs 28's undo-redo [see Emacs Version History] , install redo mode.

Note: The customization above don't always work, because some Major Mode or Minor Mode override global keys, and also you lost some default emacs cursor movement keys.

A robust solution is to install the package ergoemacs-mode at https://ergoemacs.github.io/ or Emacs: Xah Fly Keys

Customize Emacs Keys

For detail, see Emacs Keys

Emacs Copy/Paste


Emacs Init

Init Basics

Keys

Font

Text Editing

Completion

File

Restore Things

Backup/AutoSave

Line

Appearance

Misc

Advanced Init Tips

packages

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial