Home Download Buy Blog Forum Support

[Feature request] Option to disable copy of whole

[Feature request] Option to disable copy of whole

Postby edanm on Mon Jun 14, 2010 1:29 pm

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).
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: [Feature request] Option to disable copy of whole

Postby Anomareh on Mon Jun 14, 2010 2:28 pm

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.
Anomareh
 
Posts: 221
Joined: Thu Oct 01, 2009 7:32 pm

Re: [Feature request] Option to disable copy of whole

Postby edanm on Mon Jun 14, 2010 5:39 pm

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.
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: [Feature request] Option to disable copy of whole

Postby GreyWyvern on Mon Jun 14, 2010 6:50 pm

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 :)

Code: Select all
  <binding key="ctrl+c" command="">
    <context name="allSelectionsEmpty" value="true"/>
  </binding>
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia

Re: [Feature request] Option to disable copy of whole

Postby GreyWyvern on Thu Jul 21, 2011 7:32 pm

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

Code: Select all
  { "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 }
    ]
  },


Also prevents cutting whole lines when nothing is selected.
GreyWyvern
 
Posts: 106
Joined: Fri Oct 23, 2009 7:08 pm
Location: Canadia

Re: [Feature request] Option to disable copy of whole

Postby d-Pixie on Thu Nov 15, 2012 9:23 am

That code did not work for me on a recent build of Sublime Text 2. But modify it to this and it did:
Code: Select all
  { "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.
d-Pixie
 
Posts: 1
Joined: Thu Nov 15, 2012 9:21 am

Re: [Feature request] Option to disable copy of whole

Postby bizoo on Thu Nov 15, 2012 9:52 am

Last build add a setting for that:
Build 2220
Added copy_with_empty_selection setting, to control the behavior of the copy and cut commands when no text is selected
bizoo
 
Posts: 859
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [Feature request] Option to disable copy of whole

Postby jazzerus on Wed Mar 13, 2013 3:57 pm

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

Code: Select all
{ "keys": ["super+c"], "command": "noop", ... }
jazzerus
 
Posts: 1
Joined: Wed Mar 13, 2013 3:53 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 3 guests

cron