• Login
Community
  • Login

Style for Saved Search files?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 4 Posters 426 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jo Wagner
    last edited by Apr 28, 2021, 10:41 AM

    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.

    1 Reply Last reply Reply Quote 1
    • A
      Alan Kilborn
      last edited by Apr 28, 2021, 12:04 PM

      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

      1 Reply Last reply Reply Quote 1
      • J
        Jo Wagner
        last edited by Jo Wagner Apr 28, 2021, 3:44 PM Apr 28, 2021, 3:43 PM

        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.

        M 1 Reply Last reply Apr 28, 2021, 4:01 PM Reply Quote 0
        • J
          Jo Wagner
          last edited by Apr 28, 2021, 3:49 PM

          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).

          1 Reply Last reply Reply Quote 0
          • M
            Michael Vincent @Jo Wagner
            last edited by Apr 28, 2021, 4:01 PM

            @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.

            M 1 Reply Last reply Apr 28, 2021, 4:26 PM Reply Quote 0
            • M
              Michael Vincent @Michael Vincent
              last edited by Apr 28, 2021, 4:26 PM

              @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.

              E 1 Reply Last reply Apr 28, 2021, 5:17 PM Reply Quote 2
              • E
                Ekopalypse @Michael Vincent
                last edited by Apr 28, 2021, 5:17 PM

                @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.

                1 Reply Last reply Reply Quote 1
                6 out of 7
                • First post
                  6/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors