Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there any way to move cursor multiple lines at the time in sublime text with keyboard shortcut instead of one line at the time?

I used to move cursor up and down with "UP" and "DOWN" keys. but it can only move 1 line at the time. sometimes I would love to move 2 or 3 lines at the time. i'm wondering if thers's such feature in sublime text editor ?

like image 845
Chun Pin Chen Avatar asked Dec 13 '25 14:12

Chun Pin Chen


1 Answers

You can record a macro (CTRL+Q or Tools -> Record/Stop Macro) and save it (just use cursor up/down as often as you like.

Then assign a key or key-combination to the macro file. The key assignement has to look like this. I called the macros "multiple_lines_down" and "multiple_lines_up". Then assign the macros to your keymap:

{ "keys": ["alt+down"], "command": "run_macro_file", "args": {"file": "Packages/User/multiple_lines_down.sublime-macro"}},
{ "keys": ["alt+up"], "command": "run_macro_file", "args": {"file": "Packages/User/multiple_lines_up.sublime-macro"}},

Macro-File (5 times up) looks like this. Replace false with true to move downwards or just record another macro.

[
    {
        "args":
        {
            "by": "lines",
            "forward": false
        },
        "command": "move"
    },
    {
        "args":
        {
            "by": "lines",
            "forward": false
        },
        "command": "move"
    },
    {
        "args":
        {
            "by": "lines",
            "forward": false
        },
        "command": "move"
    },
    {
        "args":
        {
            "by": "lines",
            "forward": false
        },
        "command": "move"
    },
    {
        "args":
        {
            "by": "lines",
            "forward": false
        },
        "command": "move"
    }
]
like image 110
lrsppp Avatar answered Dec 15 '25 04:12

lrsppp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!