DEV Community

Cover image for My 8 favorite VS Code Shortcut #1
Code Oz
Code Oz

Posted on • Edited on

My 8 favorite VS Code Shortcut #1

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


I hope you like this reading!

🎁 You can get my new book Underrated skills in javascript, make the difference for FREE if you follow me on Twitter and MP me 😁

Or get it HERE

🎁 MY NEWSLETTER

☕️ You can SUPPORT MY WORKS 🙏

🏃‍♂️ You can follow me on 👇

🕊 Twitter : https://twitter.com/code__oz

👨‍💻 Github: https://github.com/Code-Oz

And you can mark 🔖 this article!

Top comments (3)

Collapse
 
anikcreative profile image
Anik

thanks for this!

Collapse
 
flutch profile image
flutch

Nice thanks

Some comments may only be visible to logged-in visitors. Sign in to view all comments.