Community

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

    Trick to easily bookmark one or several range(s) of lines, in the current file

    General Discussion
    2
    4
    1297
    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.
    • guy038
      guy038 last edited by guy038

      Hi, All,

      If you need to bookmark one or more bunch(s) of consecutive lines, all at once, here is my trick :

      • First put any number of consecutive # symbol(s) at the end of, both, the first and last lines to be bookmarked

      • Repeat this action for any other range of lines, which needs bookmarking

      • Use the Mark dialog and search a specific regular expression


      So, here is the road map, with a recent N++ release :

      • Put, for instance, the string ### at the end of a first line to be bookmarked

      • Put an other string ### at the end of a last line to be bookmarked

      • Repeat these two points above, for any range of lines, which needs bookmarking ( any number of # symbols is valid )

      • Now, open the Mark dialog ( Edit > MArk... ) I personally mapped the Ctrl + M to the Mark dialog !

      • SEARCH #+$(?s).+?#+$

      • Tick the Bookmark line, Purge for each search and Wrap around options

      • Untick the Backward direction options, if necessary

      • Select the Regular expression search mode

      • Click on the Mark All button

      Voilà !

      • Now, untick the Bookmark line option ( IMPORTANT )

      • Click on the Clear all marks, again, to delete the red highlighting => Only the bookmarks remain visible

      • Eventually, you may remove all these # symbols, at end of lines, with the simple regex S/R :

      SEARCH #+$

      REPLACE Leave EMPTY

      Best Regards,

      guy038

      P.S. :

      On reflection, I’d say that it would be nice if, after an Edit > Begin/End Select action, a Ctrl + F2 would bookmark / unbookmark all the lines of that selection !

      Of course, in case of a normal selection, a Ctrl + F2 action would just bookmark, as now, the last line of the selection

      Alan Kilborn 1 Reply Last reply Reply Quote 4
      • Alan Kilborn
        Alan Kilborn @guy038 last edited by

        @guy038 said in Trick to easily bookmark one or several range(s) of lines, in the current file:

        Tick the … Wrap around option
        Untick the Backward direction option

        My experience has shown that, any time the Wrap around checkbox is ticked, the state of the Backward direction checkbox is meaningless.

        1 Reply Last reply Reply Quote 2
        • guy038
          guy038 last edited by

          Hi, @alan-kilborn and All,

          Alan, thanks for this information ! I rarely use the backward direction and rather with normal search mode !

          Indeed, when the Wrap around option is ticked, a click on buttons :

          • Find All in Current Document

          • Replace All

          • Mark All

          processes current file from beginning to end of file, whatever the state of the Baskward direction option

          However, a click on buttons :

          • Find Next

          • Replace

          does depend on the state of the two independent options Backward direction and Wrap around


          As for the other buttons :

          • Find All in All Opened Documents

          • Replace All in All Opened Documents

          • Find All

          • Replace in Files

          obviously, they act on the scanned files, from beginning to end, independently of the state of the options Backward direction and/or Wrap around !

          Cheers,

          guy038

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

            @guy038

            I was a little loose with my “any time” verbage. Your context was the Mark operation, which was what I meant, but said poorly.

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