267

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

blue_note
  • 27,712
  • 9
  • 72
  • 90
Jan Zyka
  • 17,460
  • 16
  • 70
  • 118
  • 1
    Possible duplicate of [How do I select individual words of a camelized word in IntelliJ IDEA](http://stackoverflow.com/questions/411240/how-do-i-select-individual-words-of-a-camelized-word-in-intellij-idea) – Sled May 30 '16 at 17:07

3 Answers3

411

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

Gustavo Maciel
  • 652
  • 7
  • 20
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 18
    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? – mafonya Jul 31 '13 at 13:16
  • 1
    in the latest Idea the flow is `Settings | Editor | General | Smart Keys` – Jiri Kremser Jan 19 '15 at 14:06
  • 51
    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". – Paul Lammertsma Jan 22 '15 at 13:14
  • 9
    In case anyone else missed it, the 'Honor "CamelHumps"...' setting is in `Settings | Editor | General` – Carl G Mar 03 '15 at 21:51
  • I agree that this should be the default behavior. For anyone coming from Eclipse this is like built into our muscle memory from day one. – Pierre Dec 02 '15 at 21:14
  • Ctrl+Shift+A type smartkeyscamel will allow to put it on straight away. – Vadim Jul 25 '18 at 09:58
  • IDEA should enable this by default. – Eric Jan 16 '19 at 11:22
  • Changed my life. – bouwerp Feb 26 '20 at 05:21
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

Carl G
  • 17,394
  • 14
  • 91
  • 115
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.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
blue_note
  • 27,712
  • 9
  • 72
  • 90
  • For curiosity, did you map both of them? If yes, which combination did you choose? – elect Mar 09 '17 at 14:42
  • 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) – blue_note Mar 11 '17 at 11:06
  • 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. – blue_note Mar 13 '17 at 13:59
  • 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 Sep 20 '18 at 14:34
  • @mbm29414: works fine for me on macos. even if it's already assigned to something else. maybe it's some setting external to intellij – blue_note Sep 20 '18 at 15:10
  • @blue_note I got in touch with IntelliJ support and got it resolved. Not sure why, but it appeared that my installation was preventing me from using the `ctrl` key at all. Of course, I can't reproduce, and it could easily be a `ID10T` or `EBKAC` error. ;-) – mbm29414 Sep 20 '18 at 16:51