80

I was trying to find a way to highlight a selected block of code in Notepad++ like Microsoft Word allows you to do for a document. Is this possible?

hichris123
  • 10,145
  • 15
  • 56
  • 70
user2127480
  • 4,623
  • 5
  • 19
  • 17

2 Answers2

183

To highlight a block of code in Notepad++, please do the following steps

  1. Select the required text.
  2. Right click to display the context menu
  3. Choose Style token and select any of the five choices available ( styles from Using 1st style to using 5th style). Each is of different colors.If you want yellow color choose using 3rd style.

If you want to create your own style you can use Style Configurator under Settings menu.

Saju
  • 3,201
  • 2
  • 23
  • 28
  • I can see it in version v6.5, but not in version v5.8.7 on Windows. – Thomas Jan 30 '14 at 10:19
  • 5
    the problem is that if you highlight the text with text say for example "Integer.valueOf()" wherever you have "Integer.valueOf()" in your entire code it is highlighted. How do you highlight something just at one place? – Bhushan Feb 01 '14 at 03:46
  • 4
    also those styles aren't permanently saved – Bhushan Feb 01 '14 at 03:55
  • 10
    Be careful that Notepad++ is a text editor not a word processor. It just save the text as it is. It means you cannot save your highlights in the file. – Arashsoft Aug 26 '16 at 15:49
  • In short, This is not a permanent highlight – ASharma7 Nov 19 '19 at 10:16
9

"Select your text, right click, then choose Style Token and then using 1st style (2nd style, etc …). At the moment is not possible to save the style tokens but there is an idea pending on Idea torrent you may vote for if your are interested in that."

It should be default, but it might be hidden.

"It might be that something happened to your contextMenu.xml so that you only get the basic standard. Have a look in NPPs config folder (%appdata%\Notepad++\) if the contextMenu.xml is there. If no: that would be the answer; if yes: it might be defect. Anyway you can grab the original standart contextMenu.xml from here and place it into the config folder (or replace the existing xml). Start NPP and you should have quite a long context menu. Tip: have a look at the contextmenu.xml itself - because you're allowed to change it to your own needs."

See this for more information

Zach Saucier
  • 24,871
  • 12
  • 85
  • 147