Sublime Forum

[Feature request] Option to disable copy of whole

#1

Right now, hitting ctrl+c with no text actually selected will cause Sublime to copy the entire line. This is not standard behavior, and is getting in the way of another program I have running.

Any chance we could get a simple option to turn the behavior off? (Should be easy enough to cook up some keybindings to do it, but I think giving it as an option is a good idea).

0 Likes

Un-usual paste {CTRL + V} || paste not working as intended
#2

I find it pretty convenient. Having another program bind something to ctrl+c and not expecting conflicts is more “non standard behavior” than this handy shortcut. That’d be like binding something to alt+f4 and expecting things to not explode.

0 Likes

#3

Sorry, I wasn’t clear. The program is not binding things to ctrl+c, it’s just assuming that ctrl+c with no text selected results in an empty clipboard (it’s something I’m working on to do with AutoHotKey scripting).

I agree this feature should be in Sublime and on by default, I’m just hoping for an option to disable it.

0 Likes

Ctrl-c issue
#4

You can add the following to your user keybindings to disable the copy-line behaviour. I’ve had this in my keybindings almost since the beginning :smile:

<binding key="ctrl+c" command=""> <context name="allSelectionsEmpty" value="true"/> </binding>

0 Likes

#5

Here is the updated version in SublimeText 2 syntax, as requested by someone from Twitter:

[code] { “keys”: “ctrl+c”], “command”: “”, “context”:

  { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]

},
{ “keys”: “ctrl+x”], “command”: “”, “context”:

  { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]

},[/code]

Also prevents cutting whole lines when nothing is selected.

0 Likes

#6

That code did not work for me on a recent build of Sublime Text 2. But modify it to this and it did:

  { "keys": "ctrl+c"], "command": "noop", "context":
    
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
    ]
  },
  { "keys": "ctrl+x"], "command": "noop", "context":
    
      { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
    ]
  },

Note the insertion of “noop” as the command executed. Without this the override did not work.

0 Likes

#7

Last build add a setting for that:

[quote]Build 2220
Added copy_with_empty_selection setting, to control the behavior of the copy and cut commands when no text is selected[/quote]

0 Likes

#8

Reminder for folks on Mac OSX, use ‘super’ instead of ‘ctrl’:

{ "keys": "super+c"], "command": "noop", ... }
0 Likes