In Sublime when you have nothing selected and click ctrl+c you will copy whole line with the new line. How to remove that new line, so ctrl+c will copy only current line.
I'm using Sublime on Windows.
In Sublime when you have nothing selected and click ctrl+c you will copy whole line with the new line. How to remove that new line, so ctrl+c will copy only current line.
I'm using Sublime on Windows.
Copyright © 2021 Jogjafile Inc.
There's not a direct setting that has this effect on the copy of a line when nothing is selected (other than turning off that ability entirely) but you can still achieve this.
One would be to create a macro that selects the entire line but without the newline on the end and then does the
copy(orcutif you want it to work that way too), and then bind the keys forcopyand/orcutto execute the macro if the selection is empty.An example of that can be found in: How to copy line without end of line character
This will definitely work, but it does have the effect of altering the selection to encompass the whole line, which at the least changes the location of the cursor from where it is to the end of the line.
If that is not desirable, then the way forward is a plugin that adjusts the clipboard operations to not include the newlines.
An example of that would be:
This plugin listens for a
copyorcutoperation to finish, and then, if all of the selections are empty, adjusts the text on the clipboard so that it doesn't include newlines at the end of any of the copied lines.See this YouTube video (disclaimer: created by me) on How to use plugins in Sublime Text if you're unsure of how to set the plugin up.