0

When I'm in Overwrite Mode in Sublime Text 3/gedit, normal keystrokes overwrite characters underneath the cursor.

I expected that pasting from the clipboard would similarly replace characters, but instead it worked as in Insert Mode.

Here's an example to make this clearer: | stands for cursor. Overwrite Mode is on, the clipboard contains aaa. This is the text editor:

12|3456789

After pressing Ctrl+V, I'd expect the following to happen:

12aaa|6789

Instead, in both Sublime Text 3 and gedit, I get:

12aaa|3456789

I've tried the modifier keys Shift and Alt during Ctrl+V, but to no avail.

Is there a way to achieve this functionality?

In particular, I don't want to select the characters that will get overwritten beforehand.

0

There is no way to achieve this functionality in an elegant way (one could always script something using xdotool). This is not how it works. It would be a rather dangerous option. If your clipboard contained a lot of text, the reminder of your file could be overwritten upon pasting.

You will need to adapt your workflow and either select what you want to be deleted before pasting, or paste, then delete.

For a smarter workflow that is much more based on "telling" the editor to do what you want, (e.g. "replace next six characters with the clipboard contents"), consider learning and using Vim.

4
  • Thanks! (A) How is this dangerous if one has Undo? (B) I thought I was telling the editor what I want when I switched to Overwrite Mode.
    – snwflk
    Jun 19 '19 at 15:36
  • Still, unpredictably overwriting a document is probably not a good idea as a feature for the general user. Could quickly become very confusing. Overwrite mode applies, by design, to typing. Clipboard paste is another function. Insert file yet another.
    – vanadium
    Jun 19 '19 at 15:38
  • "Overwrite mode applies, by design, to typing" Do you know of a source for that? If there was one, that'd make a great addition to your answer.
    – snwflk
    Jun 19 '19 at 15:42
  • Overwrite mode existed in terminals before the clipboard existed. It is unlikely that I will find a clear reference for this ;)
    – vanadium
    Jun 19 '19 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.