Home Download Buy Blog Forum Support

Selecting Lines

Selecting Lines

Postby Deadpool13 on Wed Mar 06, 2013 7:12 pm

Hello all, I'm new to Sublime Text and have a question regarding selection behavior. I just installed the OpenURL plugin, as my previous editor was EditPad Pro and I grew attached to the clickable URLs (which btw would be an amazing feature to port over to Sublime if someone would like to take up that task, I was pretty shocked it's not a default feature already). My problem is this; the plugin features the option to open file paths, however when you select a path via the line # it includes the line break at the end of the selection. This breaks the Explorer functionality of the plugin and instead forces a browser search to pop up. I'd like to avoid having to manually select the entire path by mouse dragging every time, so my question is this...
Is there a way to change the default behavior of ST to *not* include the line break when selecting a line via the line #? I'm hoping this might be the easier route by simply changing a setting rather than having to depend on the plugin developer or waiting until I've learned enough Python to edit the plugin myself.

Any help would be appreciated, thanks for your time.
Nil nisi veritatem video, nil scio, nil studeo. Veritas sum.
Deadpool13
 
Posts: 5
Joined: Wed Mar 06, 2013 6:55 pm

Re: Selecting Lines

Postby myunlessor on Thu Mar 07, 2013 3:20 am

`Expand Selection to Line` then `Shift + Left` to exclude line break
myunlessor
 
Posts: 19
Joined: Thu Mar 07, 2013 3:07 am

Re: Selecting Lines

Postby Deadpool13 on Mon Mar 11, 2013 11:05 pm

Thanks for the reply, but that's not quite what I was looking for. I'm looking for a way to change the behavior *without* having to use a subsequent hotkey functionality. I don't want the line break selected at all. Using your expand then shift+left hotkey method does work for making use of the Explorer functionality, but I'm trying to cut down on keystrokes. Is there a way to make your method into a macro so I could do it all in one action rather than multiple?
Nil nisi veritatem video, nil scio, nil studeo. Veritas sum.
Deadpool13
 
Posts: 5
Joined: Wed Mar 06, 2013 6:55 pm

Re: Selecting Lines

Postby myunlessor on Tue Mar 12, 2013 1:17 am

Deadpool13 wrote:Thanks for the reply, but that's not quite what I was looking for. I'm looking for a way to change the behavior *without* having to use a subsequent hotkey functionality. I don't want the line break selected at all. Using your expand then shift+left hotkey method does work for making use of the Explorer functionality, but I'm trying to cut down on keystrokes. Is there a way to make your method into a macro so I could do it all in one action rather than multiple?

Here is the macro you may want:
Code: Select all
[
   {
      "args":
      {
         "to": "line"
      },
      "command": "expand_selection"
   },
   {
      "args": null,
      "command": "split_selection_into_lines"
   },
   {
      "args": null,
      "command": "copy"
   }
]

I usually save my macros in `X:\Users\{user name}\AppData\Roaming\Sublime Text 2\Packages\User\macros` directory, and you can assign a keyboard shortcut to it, like this:
{ "keys": ["ctrl+alt+c"], "command": "run_macro_file", "args": {"file": "Packages/User/macros/copy_line_wo_cr.sublime-macro"}}
myunlessor
 
Posts: 19
Joined: Thu Mar 07, 2013 3:07 am

Re: Selecting Lines

Postby Deadpool13 on Tue Mar 12, 2013 8:04 am

That worked perfectly thanks! Now I just need to figure out what hotkey to use lol. Thinking maybe I can combine this macro with the plugin function to make the necessary changes for it to work all in one go. I'll post again if/when I figure something out. Thanks for your help.
Nil nisi veritatem video, nil scio, nil studeo. Veritas sum.
Deadpool13
 
Posts: 5
Joined: Wed Mar 06, 2013 6:55 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests