66

I usually use Notepad++ for programming, but recently I started doing some writing in it as well.

Writing usually involves long paragraphs with no line breaks, and currently those are displayed in one row, which is extremely inconvenient.

How can I get N++ to to split lines? I believe that the option is called "split lines" in Gedit.

Hennes
  • 64,768
  • 7
  • 111
  • 168
jcora
  • 1,762
  • 3
  • 22
  • 32

4 Answers4

84

Go to View -> Word Wrap. Make sure that is checked.

Mayank
  • 2,158
  • 6
  • 22
  • 27
  • 2
    Aha! I was looking for that in `Preferences`... Thank you, your answer will be accepted in 10 minutes. – jcora Mar 24 '12 at 17:19
36

If you do want hard breaks in lines of text, you can use this regexp find & replace all:

Find:      (?<=.{80})\s
Replace:   $0\n

Will look for a space after 80 characters and replace the whole match with itself and a new line (replace with $0\r\n for a Dos\Windows file)

Mike
  • 361
  • 3
  • 2
  • 1
    Wow. That is awesome! – javaPlease42 Jul 14 '16 at 14:47
  • 2
    Ah - remove the \s if you're splitting lines without whitespace. I needed it to split a base-64 string. – mwardm Mar 06 '17 at 18:13
  • 3
    Since I looked up the regular expression to understand it better, I might as well share what I found: It's a zero-width positive lookbehind assertion that looks for a sequence of 80 characters followed by a space. Since it's not anchored to the beginning of a line, the matching sequence can be the tail of a sequence that contains more than 80 characters. – Alan Apr 14 '17 at 15:46
  • Great! Works for _all_ text in document, not for selected text, easy workaround is create new doc and copy to that. – Laurie Stearn Dec 30 '22 at 10:47
12

Reduce the window size of Notepad++ to your prefered size (move the right window margin). Then select all + Ctrl + I (Edit > Line Operations > Split Lines).

Done.

MichaEL
  • 3
  • 2
Dirk
  • 131
  • 1
  • 2
  • Welcome to Superuser, I do believe that your post must have proper illustrations to solve the issue. – Rajesh Sinha Sep 11 '18 at 11:17
  • 1
    This worked great! Thank you, Dirk. Previously, one could hard wrap by selecting Preferences → Editing → Show Vertical Edge, then Split Lines (Ctrl-I), but somewhere along the way they removed this. Now, the trick of changing the window width, then selecting Split Lines (Ctrl-I) works just as well. – ViperGeek Jul 07 '20 at 17:11
  • I wonder if there is a setting where to split (column number). It appears to use the window width, which is fine for the moment. – Horst Walter Dec 12 '22 at 14:43
0

I'm not familiar with notepad++ but I'm positive it's the same method:

Click on Format in the menu bar and enable Wrap option.

Bik
  • 1