简体   繁体   中英

vscode define select n lines shortcut

I have some custom shortcuts to move with cmd+up and cmd+down with intervals of 5 lines.

   {
        "key": "cmd+up",
        "command": "cursorMove",
        "args": {
            "to": "up",
            "by": "line",
            "value": 5
        },
        "when": "editorTextFocus"
    },
    {
        "key": "cmd+down",
        "command": "cursorMove",
        "args": {
            "to": "down",
            "by": "line",
            "value": 5
        },
        "when": "editorTextFocus"
    },

What I would like is when pressing shift+cmd+[up,down] to select 5 lines up and down . I've found that there are a few "commands" such as { cursorDownSelect , cursorPageDownSelect , CursorEndSelect } but none of them allow me to define some args to jump a few lines, does anybody know how to do it ?

You can add the select option to the cursorMove command. Search for cursorMove at this commands page: https://code.visualstudio.com/api/references/commands

  {
        "key": "cmd+up",
        "command": "cursorMove",
        "args": {
            "to": "up",
            "by": "line",
            "value": 5
            "select": true       // the default is false
        },
        "when": "editorTextFocus"
    },
    {
        "key": "cmd+down",
        "command": "cursorMove",
        "args": {
            "to": "down",
            "by": "line",
            "value": 5,
            "select": true
        },
        "when": "editorTextFocus"
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM