• Login
Community
  • Login

How can I mark multiples selected lines (to use with F2 after)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 5.2k 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.
  • O
    OverlordBR
    last edited by Dec 11, 2020, 11:49 AM

    Hi!

    I want to select multiple lines (lines are in sequence)
    and, some how, mark them so

    Example:

    1 random text of line 1
    2 random text of line 2
    3 random text of line 3
    …
    N-1 random text of line N-1
    N random text of line N

    I want to select lines 2 to N - 1 and mark them
    so i can use F2 to navigate between them (or any other possible marker’s action)

    I can’t use the FIND\MARK line cause the text in the selected lines is random.

    Thanks in advance for any help!
    Sorry about my English (

    P 1 Reply Last reply Dec 11, 2020, 2:13 PM Reply Quote 0
    • P
      PeterJones @OverlordBR
      last edited by Dec 11, 2020, 2:13 PM

      @OverlordBR ,

      I am not 100% sure I understand what you want, but I have a guess.

      My original thought was that you’d be able to just select all N lines with shift-and-arrows or dragging the mouse, then hitting Ctrl+F2 to bookmark, but that only bookmarks the last line in the selection.

      So instead,

      1. Select all N lines with shift-and-arrows or dragging the mouse
      2. Ctrl+M (or Search > Mark) to bring up the Mark dialog
      3. Fill out the Mark dialog:
        • Find what: \R
        • enable ☑ Bookmark line (this turns on bookmarking)
        • enable ☑ In Selection (the block should still be selected from step 1)
        • set Search Mode to ☑ Regular expression
        • click Mark All

      At this point, F2 (Next bookmark) should take you to the next bookmarked line

      If the last line of your selection happened to be the last line in the file, with no EOL sequence, that expression might miss the last line. You can either then manually bookmark that line (Ctrl+F2 or click in the bookmark column of the GUI), or you could change the expression to something like \R|^.*\Z …

      A O 2 Replies Last reply Dec 11, 2020, 2:25 PM Reply Quote 2
      • A
        Alan Kilborn @PeterJones
        last edited by Alan Kilborn Dec 11, 2020, 2:26 PM Dec 11, 2020, 2:25 PM

        @PeterJones said in How can I mark multiples selected lines (to use with F2 after):

        to something like \R|^.*\Z …

        Or \R|.\z

        Interestingly, I noticed that with the above expression and a partial-line selection on the last line of the file, the character that gets marked (in red, because of the .) is the last character in the selection.

        Aside: Note that I used the single . because \z by itself won’t cause the bookmark to happen because the marking operation doesn’t register zero-length assertions.

        I do understand why this happens… ; with an In selection search, we have to be careful in our thinking about \z being strictly an “end-of-file” thing. In this case it is more of an “end-of-selection” thing. :-)

        BTW, the @PeterJones solution is one that cries out for a macro to be recorded for it, so that it appears as a nice command in the Macro menu and can optionally be tied to a keycombo for quick usage.

        O 1 Reply Last reply Dec 14, 2020, 1:20 PM Reply Quote 2
        • A
          Alan Kilborn
          last edited by Alan Kilborn Dec 11, 2020, 2:31 PM Dec 11, 2020, 2:29 PM

          A reference to a very similar topic is HERE.

          1 Reply Last reply Reply Quote 1
          • O
            OverlordBR @PeterJones
            last edited by Dec 14, 2020, 1:16 PM

            @PeterJones said in How can I mark multiples selected lines (to use with F2 after):

            \R

            YES… you nailed!
            I forgot about the mark + regular expression + \R stuff
            :)

            Thanks, Peter!

            1 Reply Last reply Reply Quote 2
            • O
              OverlordBR @Alan Kilborn
              last edited by Dec 14, 2020, 1:20 PM

              @Alan-Kilborn said in How can I mark multiples selected lines (to use with F2 after):

              BTW, the @PeterJones solution is one that cries out for a macro to be recorded for it, so that it appears as a nice command in the Macro menu and can optionally be tied to a keycombo for quick usage.

              Thanks for you extended explanation abou the problem, Alan!

              I will put both solutions on macros tu use with a key combo.

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