Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good explanation. Thanks.

Talking of contiguous lines. I like macros of the following form for quickly hopping around vertically in a file:

    // .sublime-macro

    [
        {"command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}}
    ]

    // .sublime-macro

    [
        {"command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}}
    ]

    // .sublime-keymap

    { "keys": ["ctrl+up"], "command": "run_macro_file", "args": {"file": "Packages/User/HopUp.sublime-macro"} }
    { "keys": ["ctrl+shift+up"], "command": "run_macro_file", "args": {"file": "Packages/User/HopUpSelect.sublime-macro"} },


Very nice, I'm copying that one! You don't actually have to use macros for that. This will suffice (in your .sublime-keymap):

    {"keys": ["alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
    {"keys": ["alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true}},
    {"keys": ["shift+alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}},
    {"keys": ["shift+alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true}},
(Changed it to alt instead of ctrl because that's how I like it.)


Oops. Right enough. It was in its own file because before I knew about stops+empty_line, the macro was simply a compound equivalent to pressing up 4 times.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: