I presume this is also called Word Highlighting, I'm not sure. I'm using Javascript (a .js file) and in Notepad++ (v7.3.3) given these two lines:


With my Notepad++, if I double click param on the first line it gets param. And on the second line it gets 'param'. While this might be fine for English, I'm writing in Javascript here and I don't like this behavior. Its stops the smart highlighting from working correctly. Unless everything is in double quotes. Which is not always possible or its just a big pain in the ass. I have crafted an example of bad programming as a quick one line example:

x.innerHTML = "<span class='foo bar' onclick='this.className=\"bar\"'>foo bar</span>";


x.innerHTML = '<span class="foo bar" onclick="this.className=\'bar\'">foo bar</span>';

If I double click foo or bar it won't smart highlight all of them. Because if you double click and highlight a word next to a ' it will select the ' and not find the others, and vice versa.

(Although, using \"bar\" in the second example does work.)

Is there any way to adjust how it highlights for the double click so that in the two examples above if you click any foo or bar it will not highlight ' ? (and therefore, smart highlight will highlight them all)

P.s. Also, I am using the Obsidian theme. But, doing a quick change back to default theme does not fix it.



I too ran into this problem. My solution requires the "NppExec" plugin. Use this command in the NppExec console:

sci_sendmsg 2077  0 @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"

You will lose the ability to double-click select words like "can't", but when writing code that is such a rare case. Also, I believe this affects other word matching functionality.

For a more complete solution:

  • Save that code as "StartupScript".
  • Go to the NppExec "Advanced Options".
  • Set the "Execute this script when Notepad++ starts" drop-down to "StartupScript".

Pro Tip: You can add other characters to the string to be included in matching, such as $ to select a whole variable name in PHP.

Edit: I just realized that this script is only run on the current document, so double clicking in a different document will have unwanted behavior. When I figure out a way to apply it to all the documents I'll update my answer.

  • Thanks, this is neat. Also, my NP++ does not select - so some HTML element attributes do not select. (For sites that have element attributes like message-id). Anyhow, having to run a script at startup is not the solution I was hoping for. I guess there is not a simple setting, possibly global, somewhere. – Pimp Trizkit Mar 28 '17 at 19:09
  • @PimpTrizkit At least for adding delimiters go to Settings > Preferences > Delimiter, then toggle "Add your character as part of word" then you can add w/e characters you want to be part of a word. Unfortunately this doesn't remove characters... – Jeffrey Baldridge Mar 29 '17 at 19:29
  • Oh, I guess that could solve my issue. I can just add the '. I'm still questioning the - tho. Because I would like border-width to select but not the x-y in this example : "style='border-width:"+(x-y)+";'" – Pimp Trizkit Mar 29 '17 at 21:25
  • Maybe it stores the data for that setting somewhere like the registry or an .ini file? maybe deleting can be done that way – Pimp Trizkit Mar 29 '17 at 21:27
  • The strangest thing happened. I rebooted my computer. And now notepad++ is working fine again. It does not highlight ' on double click. And I have not yet done your suggestion. – Pimp Trizkit Mar 30 '17 at 17:17

I just tested this and it's working fine in Notepad++. What is the file extension of the file you are using? What version of Notepad++ (I'm using 7.2.2)

  • EDITED OP - v7.3.3 - Always the newest. Its a .js file. Notepad++ has recognized it as such and using the associated style configuration. I did change the style theme to Obsidian.... – Pimp Trizkit Mar 22 '17 at 19:22
  • @PimpTrizkit Have you tried to copy and paste the text in the original post into a blank document? That's how I'm testing it even with Obsidian theme it works fine. – RayG Mar 22 '17 at 22:28
  • Yup, just tried. No change. I guess something is wrong with my configuration, but I don't know where to look to change the setting. Hence, the question. – Pimp Trizkit Mar 23 '17 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.