Highlights in Notepad++

  • Hey,

    Is there anyway to save the highlighted text in a notepad++ document. I do style token everytime and save the file, But when reopen it, the highlights are gone.


  • @Priya-Chilongia

    Simple answer, no.

    Npp is coloring code by using lexers. Each time a file gets loaded it is checked if
    there is a lexer available which should color different parts of that file.
    If it is, it will color it.

    If tokens, you have styled, are often or always used you may think about creating
    your own lexer by using the user defined language dialog.
    Put your words into one of the keywords section and assign the color you want.
    Add an extension to the new defined language and every time such a file opens
    the keywords will get colored.


  • The problem is, where do you put the styling information. I created a named bookmarks plugin that lets you add permanent bookmarks to a file of code in a C-like language. In that case I solved the problem by using special comments to contain the information. I have wondered whether to extend that concept to include styled regions - but that would not work for a file containing some arbitrary data.

Log in to reply