DEV Community

loading...
Cover image for My 8 favorite VS Code Shortcut #1

My 8 favorite VS Code Shortcut #1

codeozz profile image CodeOzz ・2 min read

Hey ! Welcome here, I'm CodeOz and I'm sharing with you my favorite VS Code shortcut !

Indent the whole line

By default when you are indenting a line on VSCode, the entire line is not indented, so there is a option for this :

editor.action.indentLines

    {
        "key": "tab",
        "command": "editor.action.indentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
Enter fullscreen mode Exit fullscreen mode

Before

Webp.net-gifmaker

After

Webp.net-gifmaker (1)

Rename variable in all files

If you want to rename a variable from a file you will need to update the name in all other file where you need to use this variable, thanks to this shortcut, it will be more easier to rename your variable across your project !

editor.action.rename

    {
        "key": "shift+f2",
        "command": "editor.action.rename",
        "when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
    },
Enter fullscreen mode Exit fullscreen mode

ezgif.com-gif-maker

Select all word in the file

You can also select all word from a word !

editor.action.changeAll

    {
        "key": "ctrl+shift+f2",
        "command": "editor.action.changeAll",
        "when": "editorTextFocus && editorTextFocus && !editorReadonly"
    },
Enter fullscreen mode Exit fullscreen mode

select-all-word

Navigation back, forward and last edit

One of my favorite ! You can navigate across your mouse's historical, from back to forward and from your last edit, it can be very very usefull

workbench.action.navigateBack

workbench.action.navigateForward

workbench.action.navigateToLastEditLocation

    {
        "key": "f1",
        "command": "workbench.action.navigateBack"
    },
    {
        "key": "f2",
        "command": "workbench.action.navigateForward"
    },
    {
        "key": "f3",
        "command": "workbench.action.navigateToLastEditLocation"
    },
Enter fullscreen mode Exit fullscreen mode

naviguate

Navigation at the start and the end of a line

You will earn a lot of time of using this, as mentioned in the title, you can navigate from the start or the end of a line !

cursorLineStart

cursorLineEnd

    {
        "key": "alt+left",
        "command": "cursorLineStart"
    },
    {
        "key": "alt+right",
        "command": "cursorLineEnd"
    }
Enter fullscreen mode Exit fullscreen mode

ezgif.com-gif-maker

Discussion (3)

pic
Editor guide
Collapse
anikcreative profile image
Anik

thanks for this!

Collapse
flutch profile image
flutch

Nice thanks

Collapse
yarip28 profile image
Yarip28

I like the gif in order to understand the short cut !