Community
    • Login

    sidebar with lines i need to have reference to

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 583 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.
    • Sylfir The WhiteS
      Sylfir The White
      last edited by

      Hi, is there a way in notepad++ to create a sidebar where i can see certain lines from the document i work on?

      The document has lines beginning with keyword page. And i need to see on my left side these lines as gathered list. And when i click on the line in sidebar the document will jump to that line so i can edit text from there.

      And everytime i type a next page line or delete page line the sidebar updates too.

      Ideally if i could turn on/off the sorting of sidebar list by a-z order or unsorted order as it is typed in document.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Sylfir The White
        last edited by

        @Sylfir-The-White said in sidebar with lines i need to have reference to:

        The document has lines beginning with keyword page.

        You could do a Find All in Current Document search for ^page in Regular expression search mode:

        dec8d8a5-b2f8-41c0-9713-c8839f900c2f-image.png

        This would get your desired lines appearing in the Search results window, which provides double-click jumping to the source line. Here’s an example (I changed search to ^to to search N++'s license.txt file):

        abb6de5f-4da1-4255-92e4-15b09add8f96-image.png

        And i need to see on my left side these lines as gathered list

        The Search results window appears by default on the bottom, but it can be undocked and moved where you like.

        And everytime i type a next page line or delete page line the sidebar updates too.

        Auto-update is probably unreasonable, but you could make a macro out of the search action and tie it to a keycombo, so one keycombo press updates the list.

        sorting

        Probably not an easy way to add in sorting to the mix.

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn
          last edited by Alan Kilborn

          Actually, using the Function List feature might be a better idea as it updates automatically, and has some sort capability. See HERE and look for info on how to customize the function list.

          Alan KilbornA 1 Reply Last reply Reply Quote 2
          • Alan KilbornA
            Alan Kilborn @Alan Kilborn
            last edited by Alan Kilborn

            @Alan-Kilborn said in sidebar with lines i need to have reference to:

            as it updates automatically

            I should clarify that – it updates when the document is saved, not just “as you type”. So, a keypress is still involved to get an update.

            Also, if you use the function-list approach, the ^page regular expression I showed before is still useful, but you’ll probably want to capture what comes after that as well, to be displayed in the function-list panel. We can help with that if you get stuck and don’t know how to make that happen (after reading the docs I linked to earlier).

            1 Reply Last reply Reply Quote 1
            • Sylfir The WhiteS
              Sylfir The White
              last edited by

              I confirm, it is about function list. Looking at the docs it is about regex, which is kind of my problem too :-/. I found a lua regex and tried to do some experiments but nothing is seen.

              a) i did not write the regex correctly
              b) i need to set somewhere that the plotline.xml is connected to plotline syntax highlighter which i managed to setup correctly

              Yes, what i need to see in the list is something like this :
              game.txt
              page roomKitchen kitchen
              page roomBalcony balcony
              page itemBucket

              This is what i seek. All commands are defined as lines. So everything else from page is thrown away when parsing to function list.

              Here is the plotline.xml that i inserted into notepad++/functionList folder. Of course if i change it i restart the notepad and see if it works. This currently does nothing else and i have no idea if the class xml part i should remove, keep, or rework?

              <?xml version="1.0" encoding="UTF-8" ?>
              <NotepadPlus>
              	<functionList>
              		<parser displayName="Plotline" id="plotline_function" commentExpr="--.*?$" >
                      <!-- My own plotline engine supported -->
                      <classRange
                          mainExpr="[.\w]+[\s]*=[\s]*\{"
                          openSymbole="\{"
                          closeSymbole="\}"
                          displayMode="node">
                          <className>
                              <nameExpr expr="[.\w]+"/>
                          </className>
                          <function
                              mainExpr="[.\w]+[\s]*=[\s]*['&quot;]?[\w]+['&quot;]?">
                              <functionName>
                                  <funcNameExpr expr=".*"/>
                              </functionName>
                          </function>
                      </classRange>
                      <!-- Basic lua functions support -->
                      <function
                          mainExpr="(\>page)"
                          displayMode="$className->$functionName">
                          <functionName>
                              <nameExpr expr="(\<page")+(A-Za-z0-9)* />
                          </functionName>
                          <className>
                              <nameExpr expr="[.\w]+(?=:)"/>
                          </className>
                      </function>
                  </parser>
              	</functionList>
              </NotepadPlus>
              
              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Sylfir The White
                last edited by

                @Sylfir-The-White said in sidebar with lines i need to have reference to:

                This currently does nothing

                To get a function list for an arbitrary file type, for example your “plotline” type:

                1. You have to have a User Defined Language created for that type: for yours, name the UDL “Plotline” – it doesn’t need any formatting defined, just needs to exist (though the formatting might make it nicer to look at in the editor pane)
                2. functionList\overrideMap.xml must contain a reference to that UDL: <association id= "plotline.xml" userDefinedLangName="Plotline"/>
                3. you have to have the plotline.xml
                4. restart Notepad++
                5. if you define the active file as Language > Plotline, then the Plotline FunctionList will try to work.

                It often takes a lot of debug to get the FunctionList working the way you want it to. I usually start with a super-simple definition (like just looking for the word “page”), and get it to display just those… then I slowly expand it to more features (restarting after every update to the defnition).

                1 Reply Last reply Reply Quote 2
                • Sylfir The WhiteS
                  Sylfir The White
                  last edited by

                  Thx for the info you provided. I got it at least. It is just a simple “(page |rule ).*?$” regex after all.

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