273

I remember when I was using Eclipse that when holding CTRL and using left or right arrows Eclipse would navigate over the LongCamelCaseWrittenWord in several steps. One camel case word at time.

So it will go like follows (pipe | represents the actual cursor position):

|LongCamelCaseWrittenWord -> CTRL+RIGHT_ARROW -> Long|CamelCaseWrittenWord -> CTRL+RIGHT_ARROW -> LongCamel|CaseWrittenWord -> CTRL+RIGHT_ARROW -> LongCamelCase|WrittenWord -> CTRL+RIGHT_ARROW -> LongCamelCaseWritten|Word -> CTRL+RIGHT_ARROW -> LongCamelCaseWrittenWord| 

Is there a way how to achieve this in IntelliJ? Currently IntelliJ steps over the whole word at once.

Using IntelliJ 9.0

1

3 Answers 3

418

Yes, enable Use "CamelHumps" words in Settings | Editor | General | Smart Keys.

Sign up to request clarification or add additional context in comments.

8 Comments

CamelHumps makes Ctrl+Right, Ctrl+Left jump by camel humps. How can I still have both functionalities, i.e. jump by words and by CamelHumps with different keys?
in the latest Idea the flow is Settings | Editor | General | Smart Keys
As @mafonya mentions in a different answer, the behavior for double-clicking can be restored by locating and disabling the setting called "Honor "CamelHumps" words settings when selecting on double click".
In case anyone else missed it, the 'Honor "CamelHumps"...' setting is in Settings | Editor | General
Ctrl+Shift+A type smartkeyscamel will allow to put it on straight away.
|
50

As answered elsewhere, you can enable Use "CamelHumps" words in Settings | Editor | General | Smart Keys to switch the shortcuts to work with camelCase instead of whole-word.

You can also access the previous behavior by assigning keyboard shortcuts to the appropriate actions under Settings | Appearance & Behavior | Keymap | Editor Actions. This image shows an example where I access the previous behavior by adding ctrl:

keymap screenshot

2 Comments

Awesome! This should be default behaviour in intellij!
Thank you! This is perfect. Double click does the whole word, but ctrl + direction uses came case.
25

You can have both functionalities at the same time:

  1. In "Settings->Editor->General->Smart Keys", disable "Use CamelHumps words".
  2. In "keymap", create shortcuts for:
    • "Move caret to next word"
    • "Move caret to next word in different camelhumps mode"

Note that these steps correspond to IntelliJ 14, so they might be slightly different in other versions.

6 Comments

For curiosity, did you map both of them? If yes, which combination did you choose?
Yes, I mapped both, it is useful when you have long class names. In general, you don't want to have different shortcuts for every program. So, I used ctrl+arrow for whole words (that is the shortcut used everywhere), and alt+arrow for camelhumps words (that's the only remaining modifier, since shift is used for selection in every program)
I remapped that to ctrl+PgUp/PgDn and Ctrl+(shift)+Tab, since it is used in all browsers and most programs, so it is already in my muscle memory.
I'd like to use alt+arrow to move by entire words and ctrl+arrow to navigate by camel hump. (This is the default behavior in Xcode, which is my "muscle memory".) I'm trying to do this using IntelliJ's Preferences, but I can't get a simple ctrl+{anything} to register. ctrl+alt+{something} seems to work, as does alt+{something}, but not ctrl+{something}. I'm on a Mac. My current Keymap is Mac OS X 10.5+. Any suggestions?
@mbm29414: works fine for me on macos. even if it's already assigned to something else. maybe it's some setting external to intellij
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.