Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode: How to set that when I press CTRL + up or down arrow, the cursor move with the page?

my problem is that when I press CTRL + up or down arrow, the cursor doesn't move when it reaches the border of the page, and therefore when I release the CTRL button, the page "bumps" to where the cursor is.

Is it possible to change this behaviour? For example in Visual Studio, the cursor is "anchored" to the top of the page if you press CTRL + down arrow.

Thanks in advance

like image 677
Luca Avatar asked Apr 24 '18 08:04

Luca


People also ask

How do I enable auto format in VS Code?

VS Code Auto Format On SaveOpen Visual Studio Code editor. Click the “Settings” gear icon in the bottom-left corner. Search “Formatter” and click the “Editor: Default Formatter” option. From the drop-down menu, select whichever code formatter you want to use.

What is Ctrl Shift P in VS Code?

You can define a keyboard shortcut for any task. From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench.action.tasks.runTask command, and define the Task as args .


1 Answers

There is a workaround. Edit your keybinding.json and add this...

{
    "key": "ctrl+up",
    "command": "editorScroll",
    "when": "editorTextFocus",
    "args": 
    {
        "to": "up",
        "by": "line",
        "revealCursor": true
    }
},
{
    "key": "ctrl+down",
    "command": "editorScroll",
    "when": "editorTextFocus",
    "args": 
    {
        "to": "down",
        "by": "line",
        "revealCursor": true
    }
}
like image 112
AshF Avatar answered Nov 09 '22 19:11

AshF