Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Custom Keyword highlighting

    Help wanted · · · – – – · · ·
    3
    8
    7416
    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.
    • ?
      A Former User last edited by

      Hello,

      I have some textfiles.
      In these textfiles I have marked keywords like this: {name} or {color}
      Afterwards I replace these keywords automatically with values from another program.

      How can I make these keywords {bla} stand out?
      Highlight in a specific color for example…

      Thanks!

      Claudia Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        Claudia Frank @Guest last edited by

        @Hans-de-Jager

        sorry don’t get the point - do have an example what exactly should be achieved?

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User last edited by

          Hi Claudia,

          Thanks for your response.
          I have text files that contain instructions for my customers. In these text files I have added variables, marked with {…}
          Afterwards I use a process to replace {name} with an actual customer name. And {city} with the actual customer city.

          I would like Notepad++ to highlight these ‘variables’… So any string starting with { and ending with } should be highlighted with font color red for example.

          Is this possible?

          Claudia Frank 1 Reply Last reply Reply Quote 0
          • Scott Sumner
            Scott Sumner last edited by

            A lot of things are possible, but the easy way to do this is to use the “Mark” feature (part of find). In the “Find what” field of the Mark tab (in the Find dialog), enter \{.+?\}. Make sure “Search Mode” is set to “Regular expression”. I also would advise checking the “Wrap around” checkbox.

            1 Reply Last reply Reply Quote 0
            • Claudia Frank
              Claudia Frank @Guest last edited by

              Hello Hans,

              Scotts solution might be the easiest.
              Another attempt would be to define your own UDL.
              Open UDL (Language->Define your language…)
              open tab Operators&Delimiters
              In Delimiter 1 style put { in Open: field
              and } in Close: field.
              Press the Styler button and select the foreground color of your choice.
              Save it with a meaningful name and close it.
              Your UDL should now be visible under the Language menu.
              When ever it is needed, select your user defined language (UDL) and everything between {} should be colored.

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • ?
                A Former User last edited by

                Thank you both for the response.
                I was looking for the solution provided by Claudia.
                One more question, is it possible to add this highlight to the existing HTML language?

                So to keep the default HTML syntax highlighting, but add this custom format to it?

                Claudia Frank 2 Replies Last reply Reply Quote 0
                • Claudia Frank
                  Claudia Frank @Guest last edited by

                  Hello Hans,

                  unfortunately not.
                  You can only have one lexer active at a time.

                  Not sure if you can hijack the lexer and do some lexer coloring
                  using another plugin in a reliable way. Some could mark a text, like Scott said,
                  but using styling … ???

                  Let me think about it.

                  Cheers
                  Claudia

                  1 Reply Last reply Reply Quote 0
                  • Claudia Frank
                    Claudia Frank @Guest last edited by

                    Hello Hans,

                    sorry, unfortunately I didn’t find a reliable way to style text while a lexer is active.

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright © 2014 NodeBB Forums | Contributors