PyCharm开启驼峰识别后如何选中完整驼峰单词
Got it, I totally get your frustration—wanting to keep the camel humps navigation enabled for jumping between parts of a camel-case word, but needing a quick way to select the entire word when you want it. Here are two reliable methods to fix this:
Method 1: Use Expand Selection (Quick & Built-In)
PyCharm's built-in Expand Selection feature is perfect for this. Here's how it works:
- Place your cursor anywhere inside the camel-case word (e.g.,
ImCamelCase) - Press
Ctrl+W(Windows/Linux) orCmd+W(Mac) once: this selects the current camel-hump segment (likeImif your cursor is there) - Press the same shortcut again: it will expand to select the entire camel-case word (
ImCamelCase)
This is great because it’s context-aware—you can keep expanding to select larger chunks (like the whole line or function) if needed, but it stops at the full camel word on the second press when you’re in a camel-case identifier.
Method 2: Customize a Dedicated Shortcut
If you want a one-press shortcut to select the full camel-case word immediately, you can set up a custom keybinding:
- Open File > Settings (Windows/Linux) or PyCharm > Settings (Mac)
- Navigate to the Keymap section
- In the search bar at the top, type
Select CamelHump Wordto find the specific action - Right-click the action and choose Add Keyboard Shortcut
- Press the key combination you want to use (e.g.,
Ctrl+Shift+Alt+→)—make sure it doesn’t conflict with existing shortcuts - Click OK to save the changes
Now, whenever you press your custom shortcut, it will select the entire camel-case word in one go, while keeping your camel humps navigation enabled for Ctrl+→/← jumps.
内容的提问来源于stack exchange,提问作者Waseem Francis

