Visual Studio Tips and tricks: Subword navigation
Starting with Visual Studio 2022, you can navigate between subwords using the Subword Navigation feature. This is very convenient when you want to move the caret to a part of an identifier, for example. So PascalCaseIdentifier
has 3 sub-words, Pascal
, Case
, and Identifier
. Using subword navigation, you can move the caret to the next or previous subword. Note that it also works with other separators, such as _
.
#Method 1: Ctrl + Alt + Left and Right
You can use the keyboard shortcut Ctrl + Alt + Left and Ctrl + Alt + Right to navigate to the next or previous subword:
You can use the keyboard shortcut Ctrl + Alt + Shift + Left and Ctrl + Alt + Shift + Right to select the next or previous subword:
#Method 2: Always enable Subword Navigation
You can change the configuration of Visual Studio to always enable Subword Navigation. When you enable this option the shortcut Ctrl + Left and Ctrl + Right will navigate to the next or previous subword.
Visual Studio Options - Subword navigation
This post is part of the series 'Visual Studio Tips and Tricks'. Be sure to check out the rest of the blog posts of the series!
- View and edit the Tab Order of Windows Forms Controls
- Comparing files using Visual Studio
- Visual Studio Tips and tricks: Clipboard history
- Visual Studio Tips and tricks: Open recently closed files
- Visual Studio Tips and tricks: Multi-line and multi-cursor editing
- Visual Studio Tips and tricks: Extend/Reduce selection
- Visual Studio Tips and tricks: Undock/Re-dock a tool window
- Visual Studio Tips and tricks: Regex editing
- Visual Studio Tips and tricks: Find the current opened file in the solution explorer
- Visual Studio Tips and tricks: Default startup project
- Visual Studio Tips and tricks: Open the documentation of a symbol
- Visual Studio Tips and tricks: Paste as JSON
- Visual Studio Tips and tricks: Add project reference using drag & drop
- Visualizing the code coverage results from Azure Pipelines in Visual Studio
- Debugging a .NET assembly without the source code with Visual Studio
- Visual Studio Tips and tricks: Subword navigation (this post)
Do you have a question or a suggestion about this post? Contact me!