71

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.

4 Answers 4

89

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

1
  • 2
    Aha! I was looking for that in Preferences... Thank you, your answer will be accepted in 10 minutes.
    – jcora
    Mar 24, 2012 at 17:19
37

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)

4
  • 1
    Wow. That is awesome! Jul 14, 2016 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 6, 2017 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, 2017 at 15:46
  • Great! Works for all text in document, not for selected text, easy workaround is create new doc and copy to that. Dec 30, 2022 at 10:47
13

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.

4
  • Welcome to Superuser, I do believe that your post must have proper illustrations to solve the issue. Sep 11, 2018 at 11:17
  • 2
    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 7, 2020 at 17:11
  • 1
    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. Dec 12, 2022 at 14:43
  • 1
    @HorstWalter workaround: you can see the column position in bottom right ln: [linenumber] : col [colNumber] Resize until that's the last col position visible on a line, then "Split Lines". Or if you need to do this repeatedly/without adjust the window width please see info about "TextFx Edit" Plugin superuser.com/a/1290378/110773 Oct 17, 2023 at 19:12
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .