Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force emacs's pasting to behave like in other apps

Tags:

emacs

paste

I am new emacs user and one of the things that irritates me is that when I want to replace current selected text with the one from clipboard I need to delete it first. Every other application that I know replaces pasted text with the current selection by default.

Here's a little bit more detailed description:

  1. Select some block of text
  2. Paste text from clipboard
  3. Emacs just pastes text where the cursor was and previously selected text it is still there. I want that selected text was deleted first.
like image 651
Krzysztof Kaczor Avatar asked Dec 30 '25 15:12

Krzysztof Kaczor


1 Answers

As artscan wrote in a comment, you can get this functionaly for the normal yank (paste) operations by adding:

(delete-selection-mode 1)

to your configuration.

If you want yank by mouse to also delete the current selection, you can add:

(put 'mouse-yank-primary 'delete-selection 'yank)

in your configuration as well.

like image 53
asjo Avatar answered Jan 02 '26 05:01

asjo