DEV Community

Cover image for VS Code Tips: 🚀 Master the 'Balance Outward' Shortcut for Efficient Code Navigation! 💻
Burhanuddin S. Tinwala
Burhanuddin S. Tinwala

Posted on

VS Code Tips: 🚀 Master the 'Balance Outward' Shortcut for Efficient Code Navigation! 💻

Ever spent too much time trying to select just the right chunk of code? 🤔 The "Balance Outward" shortcut in VS Code can save you tons of time!

What Does It Do?

The Balance Outward shortcut intelligently expands your current selection to include the next logical "block" of code based on the structure you're working in. This works great for:

  • Selecting content inside parentheses (), brackets [], or curly braces {}.
  • Expanding to encompass larger blocks like entire function bodies, HTML tags, or JSX components.

How to Use It 🚀

  1. Open VS Code and place your cursor inside the code you want to select.
  2. Open the Command Palette:
    • Press Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac) to open the Command Palette.
  3. Search for the "Balance Outward" Command:
    • Type “Balance Outward” in the Command Palette search bar.
    • Select the Balance Outward option to activate it.
  4. Also you can create a keyboard shortcut by
    • Click on Settings
    • Click on Keyboard Shortcuts
    • Search Balance Outward and assign a key binding to it say Ctrl + Shift + →
  5. Shortcut:
    • After creating the shortcut, you can also use the shortcut to quickly expand your selection:
    • Windows/Linux: Ctrl + Shift + →
    • Mac: Cmd + Shift + →

Each time you press the shortcut, the selection expands outward to the next logical scope, allowing you to quickly select entire blocks of code. 🖱️

Demo:

Balance Outward Demo GIF

Say goodbye to manual dragging with your mouse. 🎉 Share this tip with your dev friends who love clean workflows!

Follow me for more content like this...
Let's connect LinkedIn

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more