7

Is there an option highlighting all strings matching the actual selection in PhpStorm (like in SublimeText) ?

Ivan Gabriele
  • 6,433
  • 5
  • 39
  • 60
  • How "big" is selection -- just one word or any number of words? – LazyOne Nov 16 '14 at 15:15
  • I could say one word. In fact it's just that I'm used to regularly change the name of an object property, an array key or a parameter name at multiple places in same document. In Sublime, they are all highlighted when I double click on it, thus it's really easier not to miss any of them when I paste their new name. – Ivan Gabriele Nov 16 '14 at 18:19
  • 3
    Please install **BrowseWordAtCaret plugin** and check `Settings | Editor | General | Appearance` for "Browse Word At Caret" settings after restarting IDE. Other than that: select word and press `Ctrl+F` to invoke "find on page" -- it will highlight all matches. – LazyOne Nov 16 '14 at 18:35
  • Thank you, it works like a charm ! Even by default it does exactly what I was looking for. You should re-write it as an answer ;) – Ivan Gabriele Nov 16 '14 at 18:48

2 Answers2

6

You can use Ctrl + Shift + F7 for this in PhpStorm.

This will highlight all usages of selected text.

danronmoon
  • 3,814
  • 5
  • 34
  • 56
Gerard de Visser
  • 7,590
  • 9
  • 50
  • 58
4

Using built-in functionality: select text and hit Ctrl + F that will bring "Find in page" functionality: it will highlight all matches of selected text in this document. But it's not always convenient as you have to hit extra keys and have "find in page" bar open...

You can install and use BrowseWordAtCaret plugin that will automatically highlight word under caret in whole document (regardless of it's nature -- variable or just plain text) + you can easily navigate between all matches.

P.S. You have mentioned that "I'm used to regularly change the name of an object property, an array key or a parameter name at multiple places in same document."

Consider using Refactor | Rename for variables/class members/etc -- it works across multiple files.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • Any advice on how to change the highlight color? Thanks! – Adrian Moisa Aug 18 '15 at 13:47
  • @AdrianMoisa Color for what exactly? Please be more specific as I have described 2 approaches here and they use different styles. – LazyOne Aug 18 '15 at 13:48
  • Sorry for confusion, I meant how to change the color of the highlighted background for word matches when double clicking on words. I'm using the browse word at caret plugin. – Adrian Moisa Aug 18 '15 at 13:51
  • The highlighted background colour and the text colour are blending in making it hard to read the text. – Adrian Moisa Aug 18 '15 at 13:57
  • 2
    @AdrianMoisa For BrowseWordAtCaret plugin it's `Settings (Preferences on Mac) | Editor | Colors & Fonts | BrowseWordAtCaret --> BrowseWordAtCaret` – LazyOne Aug 18 '15 at 14:03