Community
    • Login

    How to fold while at the closing element?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 16 Views 2 Watching
    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.
    • fml2F Offline
      fml2
      last edited by

      Hello,

      when I edit e.g. an XML file in NP++, there are folding marks at the beginning of the structure (squared plus or dash). I can easily fold or unfold the structure by clicking on that mark.

      Quite often I find myself wanting to fold (collapse) the structure while I’m at its closing element. How can I quickly do this?

      Ideally, I’d have a folding mark at the end of the structure as well.

      A second best solution would be to quickly navigate to the matching start element and fold from there.

      Is there an easy solution to what I want? Thank you for any hints!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @fml2
        last edited by

        @fml2 ,

        old (collapse) the structure while I’m at its closing element. How can I quickly do this?

        View > Fold Current Level (Ctrl+Alt+F) (use the shifted version to unfold, or checkmark Settings > Preferences > Editing 1 > ☑ Make current level folding/unfolding commands toggleable to make it a toggle, so the same keystroke folds and unfolds the current level). This will work whether it’s XML or HTML or JSON or anything else with folding.

        Even though it has “level” in the name, it only does it for the current group, so in

        <one>
          <two>
            <three/>
          </two>
          <anotherTwo>
            <anotherThree/>
          </a|notherTwo>
        </one>
        

        if the caret is at the | in </a|notherTwo>, it will only collapse <anotherTwo>...</anotherTwo>, not anything at level 2.

        To answer your subquestion, though it’s not as important, there is also a way to:

        quickly navigate to the matching start element and fold from there.

        @rdipardo’s “HTML Tag” plugin has the Plugins > HTML Tag > Find Matching Tag feature (defaults to Alt+T), which does that aspect (even in an XML file, even though the plugin has “HTML” in the name). (You can install the plugin through Plugins > Plugins Admin)

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors