Sublime Forum

How to disable selecting newline on triple click?

#1

How to disable selecting newline on triple click?

I appreciate that’s how it’s supposed to work but my workflow includes selecting entire lines a lot, which I then need to copy and paste elsewhere, but without the newline. As it is I can’t just triple-click; I have to select-drag (or double-click + drag) instead.

Is there a config switch to turn off newline selection on triple mouse click in ST3? An N-click+key combo perhaps?

Thanks!

0 Likes

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

Behavior is defined on Default (Windows).sublime-mousemap, inside default packages.

Probably you can create a short plugin that selects the whole line from start to end without line ending char.

0 Likes

#3

A potential workaround for you (a.k.a. here’s what I do): If I copy a whole line, including the newline character, and then place my insertion point all the way on the left and paste without ever hitting enter, usually it does exactly what I want.

0 Likes

#4

I created a simple macro to do what I want (including copying the selected text to the clipboard because why not :wink: )

SelectLineNoEOL.sublime-macro

{ "command": "move_to", "args": { "to": "hardbol" } }, { "command": "move_to", "args": { "to": "eol", "extend": true } }, { "command": "copy", "args": null } ]

And bound it to a key shortcut (Cmd+B is a random choice just to test it):

	{ "keys": "super+b"], "command": "run_macro_file", "args": {"file": "res://Packages/User/SelectLineNoEOL.sublime-macro"} },

So far so good, next I mapped it to a mouse action, Alt+triple-click in this case:
~/Library/Application Support/Sublime Text 3/Default (OSX).sublime-mousemap

{ "button": "button1", "count": 3,"modifiers": "alt"], "press_command": "run_macro_file", "press_args": {"file": "res://Packages/User/SelectLineNoEOL.sublime-macro"} } ]

Thanks for pointing me in the right direction!

0 Likes

#5

FYI, To select a/some line(s) without newlines, I use this sequence of standard command:
-Expand Selection To Line (CTRL+L)
-Split Into Lines (CTRL+SHIFT+L)

1 Like

#6

That seems like a more robust solution, thanks @bizoo!

0 Likes