Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime text select line without start tabs/spaces and end of string

Tags:

sublimetext

As you know, you can select line under cursor with hot key ctrl + L (linux ubuntu). But selected text include start spaces or tabs and \n at the end. enter image description here How can I select line without spaces or tabs?

like image 964
VelikiiNehochuha Avatar asked May 12 '16 21:05

VelikiiNehochuha


1 Answers

Save the following sublime-macro to:
Packages/MyMacroFolder/Select LineText.sublime-macro

[
    {
        "command": "move_to",
        "args": { "extend": false, "to": "eol" }
    },
    {
        "command": "move_to",
        "args": { "extend": true, "to": "bol" }
    }
]

Open your user sublime-keymap file by running Preferences: Key Bindings - User from the command palette.

Add a key-binding for Select LineText.sublime-macro.

{
    "keys": [ "ctrl+shift+alt+l" ],
    "command": "run_macro_file",
    "args": { "file": "res://Packages/MyMacroFolder/Select LineText.sublime-macro" },
},

You will now be able to select line text ( excluding leading & trailing whitespace ) with whatever key-binding you assigned in your sublime-keymap.

The key-binding in the example is Ctrl + Shift + Alt + L

like image 128
Enteleform Avatar answered Sep 28 '22 05:09

Enteleform