39

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.

52

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

  • 1
    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
18

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)

  • 1
    Wow. That is awesome! – javaPlease42 Jul 14 '16 at 14:47
  • 1
    Ah - remove the \s if you're splitting lines without whitespace. I needed it to split a base-64 string. – mwardm Mar 6 '17 at 18:13
  • 2
    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
-1

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.

  • Welcome to Superuser, I do believe that your post must have proper illustrations to solve the issue. – Rajesh S Sep 11 '18 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.