Community
    • Login

    add line breaks without breaking word

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    line separatorhelphelpmacrosparagraph
    5 Posts 3 Posters 418 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.
    • Rose GreeneR
      Rose Greene
      last edited by

      i was wondering if there was a way i could add a line break every x amount of characters without breaking words? something kind of like this:

      before

      hello! this is just a fake line of text for this example. have a good day!
      

      after

      hello! this is just a 
      fake line of text for 
      this example. have a 
      good day!
      

      kind of like this website.

      i wanted to record a macro of it so i wouldn’t have to constantly go to the website mentioned.

      thank you!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Rose Greene
        last edited by

        @Rose-Greene ,

        It’s not a macro, because macro won’t change a setting… but if you go to Preferences > Margins/Border/Edge, and change the Vertical Edge Settings to 23 (for your example), then hit Ctrl+I (aka Edit > Line Operations > Split), it will split the line at the margin. So you can pick the appropriate Vertical Edge column and then use the Split command to do what you want.

        There are ways to get regular expression search/replace to do something similar, but this is much simpler, IMO.

        Rose GreeneR 1 Reply Last reply Reply Quote 4
        • Rose GreeneR
          Rose Greene @PeterJones
          last edited by

          @PeterJones This works great thanks!

          1 Reply Last reply Reply Quote 1
          • Abed99A
            Abed99
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • Abed99A
              Abed99
              last edited by Abed99

              PeterJones mention a good way and here is another way using regex:

              search for :(\w+\.?!?\s){2}
              replace with : $&\r\n
              search mode : regular expression
              

              change 2 to the X amount of characters you want
              3.png

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