Style for Saved Search files?



  • Hi all,

    I am kind of newbie to Notepad++ “internals”. The question here is for the portable version, if that makes a difference at all …

    I like the search capabilities and how results are shown (colors for files and findings).

    Now, would like to copy the result (which sometimes is quite big and for me is like a “work-to-be-done-list”) to a file and re-open that file in another instance of NP++. The copying works just fine, but I fail to apply the same (or even an individual) color-scheme to that file.

    I tried to select “search result” from the language menu but could not find it. So, I made a new entry in the “stylers.xml” AND the “langs.xml” … but still I fail.

    Any help?

    I would have attached the two xml files, but could not find how.



  • So, for clarity, you are talking about the data that appears in the Search results area, and its colorings; example:

    adfca39f-4093-49aa-b23b-4423dce2db2a-image.png

    So you like the blue-on-blue “Search” line, the greenish filename line (here the file is new 1), the nice red-on-yellow of the search hits, etc.

    Well, sad to say, these are just visual effects within Notepad++. And with Notepad++ being a “text editor”, the only thing that is copied when you copy, is…text.

    That’s why if you copy and paste the data I show, you’ll get:

    0664acc1-087c-49b8-85ef-6aaf015cb8e2-image.png



  • Yes. exactly. That’s my result. BUT: If I would save taht text with a different extension, let’s say “srch”, I could connect a §Language" Scheme with it, right?

    And then, gvcen the structure of the text (all findiings start with “Line #:” while the files usually start in another column, it should not be too difficult, to have kind of a “language” style definition to accomplish wat I want?

    For example, when I apply the language “diff” to that file, it looks quite similar to what I am searching for.

    Maybe it would be a good idea to make something like that to be a “standard feature”? A file format representing a search? For sure I am not the only one that uses this capability to compile “worklists”?

    This especially applies to a serach within a whoile project … i.e. When you want to change the name of an element like a variable or a function. THen it’s interesting WHERE you need to adjust the code.



  • one addition: I do NOT expect that the Phrase/Regex I used for the search will be highlighted when I open the stored file.

    It is sufficient, to have the fifferent fonts and backgrounds just to have a better overlook AND it would also be nice to be able to collapse/expand “sections” (files).



  • @Jo-Wagner said in Style for Saved Search files?:

    And then, gvcen the structure of the text (all findiings start with “Line #:” while the files usually start in another column, it should not be too difficult, to have kind of a “language” style definition to accomplish wat I want?

    You want a “Notepad++ Search Window - User Defined Language”. You can find them here:

    https://github.com/notepad-plus-plus/userDefinedLanguages/tree/master/UDLs

    There is not a “search” keyword in any of the names. You could surely read the UDL documentation and create your own based on the things you said (e.g., "all findiings start with “Line #:” ").

    Cheers.



  • @Michael-Vincent said in Style for Saved Search files?:

    You want a “Notepad++ Search Window - User Defined Language”

    Thought maybe I could force a buffer to use the internal Search Result language defined in the lang.xml file by using NppExec as such:

    a2e48d5e-6882-4cd3-9fe5-e86dffa9d8c7-image.png

    The document type (notice bottom left status bar) now reflects “Internal Search” instead of “Normal text file” (my default), but no lexing. Perhaps I’m missing something?

    Cheers.



  • @Michael-Vincent

    I haven’t checked the source code, but I assume that no styles are set, probably because npp doesn’t expect the lexer to be assigned in the default views.


Log in to reply