54

In Notepad++, when I select (eg. double-click) a "word", it gets highlighted. It needs to be separated with a non-alpha character from the rest of the text. The highlight remains until the text is selected.

Is there a way to make this highlight "permanent", ie. remain when the word is not selected any more?

Nice to have: can partial words be highlighted?

3 Answers 3

92

Just use the mark feature.

  1. Open the Search & Replace dialog and go to the Mark tab.

  2. Enter your search term and click Mark All.

    enter image description here

  3. All occurrences are now permanently marked:

    enter image description here

To remove the marks, simply open the dialog again and click Clear all marks.

Alternatively, while you have the word selected, you can use the Mark functionality in the Search menu:

enter image description here

This also allows you to mark all occurrences of a given string in the document (and you can even have multiple markers going on simultaneously).

Please note that both approaches work perfectly fine with partial words. In fact, multiple markers can apply to the same partial string. Here I've used a marker for port and one for mporta:

Using multiple markers simultaneously

1
  • 5
    Warning. This does not permanently highlight the text. After closing and re-opening the file the marks will be gone.
    – jiggunjer
    Commented Jun 25, 2016 at 10:19
15

Note: This is not permanent, all highlighting will be gone upon re-opening the file.

Steps:

  • Select your text.
  • Right-click on the text area.
  • Choose Style Token from the context menu.
  • Apply the style you need.
5
  • 2
    This one is very handy!
    – n611x007
    Commented Mar 3, 2014 at 11:17
  • 3
    This is also not permanent. All highlighting will be gone upon re-opening the file.
    – Makesh
    Commented Jan 11, 2017 at 11:25
  • @Makesh I am not aware of any permanent solution which will work on re-opening the file.
    – Saikat
    Commented Jan 11, 2017 at 11:39
  • It is gone after reload of the file also. This is a usual scenario for logfiles.
    – Nicolas
    Commented Jun 19, 2023 at 12:01
  • @Nicolas You can check my answer, where you define your own language. I use that for logs and it works great.
    – user276648
    Commented Aug 4, 2023 at 3:12
0

You can create your own language. This allows you to simply select that language for any file, without having to manually mark all words again. It will also work when the file is reloaded from the disk.

  1. Go to Language > User Defined Language > Define your language...
  2. In the Keyword Lists tab, add the words you want highlighted. You have 8 groups, each one can have a different style. Click Styler to set the style
  3. You can specify the extension of the file, so all such files will always have that style when opened, in the Ext. textbox at the top
  4. Once you're done, click Save As...
  5. To select the language for a file, go to Language, and you should see you language almost at the bottom

I use that at least with log files, where Trace, Debug, Info, ... have all a different color.

1
  • Thank you for this answer, we are using this mechanism for basic formatting already. Maybe this is the right approach for the OP also. But in addition, when analysing log files, there are volatile values that help being highlighted. These are only relevant for the current scenario.
    – Nicolas
    Commented Aug 23, 2023 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .