Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime 3: Ctrl-c triggers even if no text is selected, drops text in clipboard

I'm using Sublime 3083.

Suppose I cut some text (Ctrl-x) in a file and then attempt to paste it somewhere else, in that same file or another one.

  1. I position the cursor on the line I want to paste the text.

  2. If I hit Ctrl-v the text is pasted with no issues.

  3. But if I accidentally hit Ctrl-c instead, the text that was cut can no longer be pasted. It is dropped from the clipboard and I'm forced to Ctrl-z back to the point before the text was cut.

This happens even if no text is selected when hitting Ctrl-c.

I tested and this behaviour seems to be exclusive from Sublime. Is this a feature? If so, can it be disabled?

like image 659
Gabriel Avatar asked Jun 25 '15 22:06

Gabriel


2 Answers

There is a setting in Preferences > Settings - Default which can change the behavior:

// If true, the copy and cut commands will operate on the current line
// when the selection is empty, rather than doing nothing.

"copy_with_empty_selection": false,

Changing it to false should make it so that it doesn't copy an empty selection.

like image 156
l'L'l Avatar answered Oct 15 '22 02:10

l'L'l


Add this to your User settings:

"copy_with_empty_selection": false

Step-by-Step:

  1. Preferences > Settings
  2. A new window will open with 2 files:

enter image description here

  1. In sublime-settings -- User (the one on the right) paste this:

    "copy_with_empty_selection": false

Why?

If you do it in Default settings it will be overwritten when sublime updates. Any changes you make to settings should be in User Settings.

like image 35
Travis Heeter Avatar answered Oct 15 '22 02:10

Travis Heeter