ReSharper in Detail: CamelHumps

CamelHumps is a feature that identifies parts of compound names composed according to CamelCase, where each part starts with a capital letter (“hump”).
 
By default, it works in four navigation commands, namely Go To Type, Go To File, Go To File Member, and Go To Symbol, like this:

 
However, you should take an additional step to activate CamelHumps for the Extend/Shrink Selection (Ctrl + (Shift) + W, or Ctrl + Alt + Right/Left in the Visual Studio keyboard layout) and Next/Previous Word (Ctrl + Left/Right) navigation actions. To do that, choose ReSharper | Options | Environment | Editor and select Use CamelHumps.
 
From now on, CamelHumps is switched on, and jumping to next/previous word works in a slightly different manner. Specifically, when you press Ctrl + Left/Right, the caret moves to the next/previous uppercase character in the current word, and only after that, it moves on to the next/previous word.
 
Extend/Shrink Selection commands are also affected by CamelHumps. Suppose that the caret is in the middle of a compound word with several parts that begin with uppercase letters:

If CamelHumps is switched on, pressing Ctrl + W for the first time selects the current part of the word:

It’s only after pressing this keystroke for the second time that you can select the whole word:

All subsequent keystokes are processed as usual.
 
In addition, ReSharper provides four actions for using CamelHumps locally when the global option (Use CamelHumps) is switched off:
 

  • ReSharper_HumpNext – move caret to next hump/word
  • ReSharper_HumpPrev – move caret to previous hump/word
  • ReSharper_HumpNextExtend – expand selection to next hump
  • ReSharper_HumpPrevExtend – expand selection to previous hump

 
Of course, you can assign individual shortcuts to these actions in the Visual Studio Options dialog box (Tools | Options | Environment | Keyboard).
 
Note that both HumpNextExtend and HumpPrevExtend only work in a linear fashion, without additional functionality of Extend/Shrink Selection.

This entry was posted in How-To's, Links and Opinions, Other. Bookmark the permalink.

4 Responses to ReSharper in Detail: CamelHumps

  1. Paulius says:

    I did not notice before the follow-up comment on the previous post, so thanks a lot for this post :-)
    These are very helpful actions.

  2. Pingback: More ReSharper Shortcuts : phazed.com

  3. Pingback: phazed.com » More ReSharper Shortcuts

  4. Pingback: JetBrains .NET Tools Blog » Blog Archive » ReSharper in Detail: Code Completion in ReSharper 4.0

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">