Menu

howto insrt line breaks at word-wrap line?

Felipe1982
2009-09-08
2013-02-08
  • Felipe1982

    Felipe1982 - 2009-09-08

    I have a document open in notepad++ that is one very long string (or several very long strings). I'd like to be able to automatically "shape" the document, so that it inserts line breaks (\n or \r\n) just before the word wrap line (about 80 chars) without chopping words in two pieces. I have scoured the web, and search as much as I could on the notepad++ UI and web site. I have found no solution to this.

    Could anyone help me find a way to insert line breaks at the word wrap line?

     
    • Robert Shaw

      Robert Shaw - 2009-09-08

      I had to fool around to find this method:
      Adjust the window so that wrapping to it gives the line length you want.  Select the text to be wrapped.  Turn off the word-wrapping display function so that only the front part of lines display.  Use "Split lines" on the Edit menu.

       
      • Bruce Calvert

        Bruce Calvert - 2013-02-08

        The problem with this is that the "wrap" will not split a "word". I need to insert <CR><LF> to create lines of exactly 80 characters. How can I do this? The "word-wrap/Split lines" method described by you will not split a "word" in he middle. I have also played around with TextFX plug-in's "Rewrap Text to (Clipboard or 72) width" function, but it removes multiple occurances of blanks and this is unacceptable.

         
        • Fool4UAnyway

          Fool4UAnyway - 2013-02-08

          In that case you may try using a Regular Expression Find/Replace action.

          If it's not a problem for your computer (memory) and Notepad++, you could first remove all newline characters to create a single line.
          Then, you would replace the search expression (.{80}) by \1\r\n throughout that line.
          It will leave you with all lines without possibly (probably) the last one consisting of 80 characters exactly.

           
  • GVC

    GVC - 2009-11-20

    I'm also interested in having that feature.  Any chance it's already currently possible and if so, how to do that?

    If not present yet, can this be a future feature?

    Best rgds,
    -Geert

     
  • GVC

    GVC - 2009-11-20

    Forgot to clearly mention:

    What I mean is, first set a line length and then apply the split lines (as rshaw22 was indicating).
    Changing the window size should not be needed with an elegant solution.

    Best rgds,

    -Geert