I want to configure Sublime to only copy to the clipboard if I actually have text selected. If nothing is selected I want super+c to do nothing at all.
I quite often accidentally press super+c (copy) when I really wanted to do super+v (paste). This is not normally a problem in other applications which only copy to the clipboard when something is actually selected. But with Sublime if I have nothing selected, it copies the current line to the clipboard.
This is really annoying since that usually means I end up cloning a line instead of pasting what I had previously copied, but more importantly I loose what I had intended to paste and have to go and find it again so I can copy it a second time.
I’m no stranger to configuring keyboard shortcuts in Sublime, having remapped several shortcuts, but I’m not having any luck with this one. Here’s what I’m currently using in my User keymap:
[code] // remap copy to only work if something is selected
{ “keys”: “super+c”], “command”: “copy”, “context”:
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
[/code]
but this seems to have no effect. What’s even more strange is if I completely comment this out and the default keymap so that nothing is assigned to the keyboard shortcut super+c, the default behaviour still applies. Even after restarting Sublime.
Is there any way to get this to work the way I want?