You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
'copy' keyboard shortcut should not copy empty space #7103
It's too frequent that someone might accidentally hit the 'c' key instead of the 'v' key when pasting in atom.
instead of copying empty space, the copy shortcut should simply not do anything.
I can write the pull request myself if someone can point me in the right direction, either way if we could improve this very annoying problem it would be great!
Reacted by syuilo, Elmar Zander, Thomas, nh, neuronet, Mr Speaker, sinisarudan, Vladislav and Arel Cordero
I second this issue. People actually leveraging the current behavior may like a similiar but different key-binding: command-shift-c (free by default) could copy the current line regardless of selection.
People actually leveraging the current behavior may like a similar but different key-binding.
This is good idea. @davidawad I think that the best way to do this would be to add a new command, editor:copy-selection that would write to the clipboard only if text were selected. That way, users who prefer that behavior could simply add this to their keymap:
'atom-text-editor':`command-c`: `editor:copy-selection`# mac os`ctrl-c`: `editor:copy-selection`# linux and windows
I've been playing with this locally and just looking for some input. For me I think it would be nice if copy didn't work unless something was selected or the cursor is at the beginning of the line. In that case I think I would find it useful if copy copied the line. Any thoughts?
For me, I would prefer copy to do nothing if nothing is selected, even if the cursor is at the beginning of the line. If I accidentally hit ^c instead of ^v, I don't want it to blow away my clipboard contents, even if the cursor is at the beginning of the line. Nothing selected => nothing to do.
Reacted by Elmar Zander, Ramsés López, Mr Speaker, Vladislav, Joel Mason and Arel Cordero
Thanks so much! This drove me mad. Here's how to implement it:
Update Atom (doesn't work on 1.0.3. Works on 1.3.3)
Edit -> Preferences -> Keybindings -> Click link at very top "your keymap file"
This should open a file in the editor.
Paste this:
'atom-text-editor':'ctrl-c':'editor:copy-selection'# linux and windows
Close and open Atom.
Reacted by John Smith, Andrew Aladjev, Elmar Zander, Jiminikiz, Sean Hastings, Thomas, Ramsés López, Derek Benda, Mr Speaker and Vladislav
the suggested solution doesn't work in newer versions (e.g. ver 1.22.1), as worked before, because of different coding of the keymap.cson file:
but these steps work:
Atom -> Preferences -> Keybindings -> Click link at very top "your keymap file"
This should open a keymap.cson file in the editor.
Paste this:
'body':
'cmd-c': 'editor:copy-selection' # mac os
'ctrl-c': 'editor:copy-selection' # linux and windows
(I tested it on Mac, if it doesn't work on Win, you might need to adjust 'ctrl-c' code)
P.S. if the internal coding of the keymap.cson file changes over time, you can go to
Atom -> Preferences -> Keybindings
and then you find there an entry with 'Keystroke' equal to 'cmd-c' and Selector equal to 'body'.
You should copy the code of this settting by clicking on the icon on the left of that entry-row, and use it as a model for your entry in keymap.cson
Here is screenshot (for Mac) of the above-writen:
Reacted by Chris Fontenot, Spots2, Katelyn Dinkgrave and ghostbrick
I think, that there's no any use case for copying empty lines.
If somebody needs empty line - he could just press enter. It's much simpler than copying empty line than pasting it.
Also empty line is often copied by mistake, when wanted to press "ctrl + v".
So such behaviour is not just neuter, but harmful.
You forced to press "ctrl+z" and return to other place in file, or switch to other file and do such operation there.
And modifying this in settings... Strange decision. Probably it would be better to leave old behaviour by default and such strange option may be turned on only by need.
P.S. And yes, any of solutions doesn't work on Atom 1.23.3 under Linux Mint 18.3.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!
Activity
benogle commentedon Jun 4, 2015
This was a deliberate decision. cc @maxbrunsfeld. I admit, I dislike it as well, but many people wanted this behavior.
mnquintana commentedon Jun 4, 2015
@benogle This seems like an ideal candidate for a config option though
davidawad commentedon Jun 4, 2015
A config option would be perfect!
maxbrunsfeld commentedon Jun 4, 2015
Just to clarify, in general it copies the line under the cursor, not empty space. I'd be ok w/ a config option.
davidawad commentedon Jun 9, 2015
So how would I implement this? I have no problem submitting a PR for it, it seems like a simple request.
vemv-kantox commentedon Jun 10, 2015
I second this issue. People actually leveraging the current behavior may like a similiar but different key-binding:
command-shift-c(free by default) could copy the current line regardless of selection.maxbrunsfeld commentedon Jun 10, 2015
This is good idea. @davidawad I think that the best way to do this would be to add a new command,
editor:copy-selectionthat would write to the clipboard only if text were selected. That way, users who prefer that behavior could simply add this to their keymap:lpommers commentedon Jul 20, 2015
I've been playing with this locally and just looking for some input. For me I think it would be nice if copy didn't work unless something was selected or the cursor is at the beginning of the line. In that case I think I would find it useful if
copycopied the line. Any thoughts?jschroeder9000 commentedon Jul 22, 2015
For me, I would prefer copy to do nothing if nothing is selected, even if the cursor is at the beginning of the line. If I accidentally hit ^c instead of ^v, I don't want it to blow away my clipboard contents, even if the cursor is at the beginning of the line. Nothing selected => nothing to do.
MichaelJCole commentedon Jan 9, 2016
Thanks so much! This drove me mad. Here's how to implement it:
Update Atom (doesn't work on 1.0.3. Works on 1.3.3)
Edit -> Preferences -> Keybindings -> Click link at very top "your keymap file"
This should open a file in the editor.
Paste this:
Close and open Atom.
MichaelJCole commentedon Apr 20, 2016
Unfortunately, this seems to have stopped working. The command pastes at the beginning of the line, instead of the cursor.
UPDATE: It's working again in 1.18.0
sinisarudan commentedon Nov 20, 2017
Still not solved?? :( Not by a simple config option as suggested here ...?
This
solution doesn't seem to work any more (ver 1.22.1), as worked before
sinisarudan commentedon Nov 20, 2017
the suggested solution doesn't work in newer versions (e.g. ver 1.22.1), as worked before, because of different coding of the
keymap.csonfile:but these steps work:
Atom -> Preferences -> Keybindings -> Click link at very top "your keymap file"
This should open a
keymap.csonfile in the editor.Paste this:
(I tested it on Mac, if it doesn't work on Win, you might need to adjust 'ctrl-c' code)
P.S. if the internal coding of the
keymap.csonfile changes over time, you can go toAtom -> Preferences -> Keybindings
and then you find there an entry with 'Keystroke' equal to 'cmd-c' and Selector equal to 'body'.
You should copy the code of this settting by clicking on the icon on the left of that entry-row, and use it as a model for your entry in
keymap.csonHere is screenshot (for Mac) of the above-writen:

vlad0337187 commentedon Feb 9, 2018
I think, that there's no any use case for copying empty lines.
If somebody needs empty line - he could just press enter. It's much simpler than copying empty line than pasting it.
Also empty line is often copied by mistake, when wanted to press "ctrl + v".
So such behaviour is not just neuter, but harmful.
You forced to press "ctrl+z" and return to other place in file, or switch to other file and do such operation there.
And modifying this in settings... Strange decision. Probably it would be better to leave old behaviour by default and such strange option may be turned on only by need.
P.S. And yes, any of solutions doesn't work on Atom 1.23.3 under Linux Mint 18.3.
MichaelJCole commentedon Feb 9, 2018
Hey @vlad1777d this issue is closed, so won't get any traction. You might have more luck if you open a new issue and reference this one...
lock commentedon Aug 8, 2018
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!