Rach Smith's Notes & Nuggets

Keyboard shortcuts for navigating a large file in VSCode

note : development Added October 30, 2022

When writing the code gets a bit dull at my job, I try to make things more interesting by setting myself a challenge in other ways. Currently, I am training myself to use the keyboard to get around VSCode instead of a mouse. I'll list a few of my favourites (on macOS).

Fold all: command+k command+0

This folds all the foldable sections of a file. I find it makes files easier to scan at a high level.

Go to Symbol: shift+command+O

This allows you to search for and jump to any symbol on the page. Great for getting to the start of a method or function.

Go to line: control+G

Enter the line number, and there you go. Great for when you're dealing with stack traces. I use it more to jump around a file quickly without needing to scroll.

control+option (with Space Block Jumper extension): Jump to next empty line

I use the Space Block Jumper extension to do this one. It takes you to the next blank line in the file. It allows you to move through a file faster than you would by scrolling with the up/down keys.

Comments

Comments are closed. You can still reply by email.

  • tracey

    Keyboard shortcuts are SO helpful. This will be very helpful this summer - my colleague and I are teaching a coding class to visually impaired/blind students and we're using VS Code for our environment.

    Justs fyi, I had a boss once who said, "you're only productive when your hands are on the keys." Not sure he was completely right but if nothing else, you can't be very creative when you're clicking on other folks' stuff.

  • Smutny

    Another great way to move in bigger files is using back / forward button on mouse (or key shortcut). Often I am coding in different parts of file and I want to switch between them. I found out that works quite well.