96

I would like to have my lines in plain text in Notepad++ wrapped (soft wrapping for display, not insertion of line ends) after a reasonable amount of symbols (like 65 or 80). Is it possible?

The only option I came across is wrapping at window width, which gives ridiculous results provided one uses high resolution, non-gigantic fonts and maximized windows.

3
  • 7
    Click View menu --> toggle Word wrap. Nov 26, 2014 at 15:40
  • 10
    He's looking for a way to wrap to a certain number of characters, not just at window width. View -> Word Wrap only wraps to window width.
    – keyofnight
    Aug 3, 2015 at 18:47
  • I'd like a method that does NOT try to "word warp" - trying to hunt down any random space within the text and splitting the text at it, leaving lone timestamps or header entries dangling because the following "word" is a kilobyte long and splitting at the space will result in it being cut at the end of the window 14 times instead of 15. In particular, like all text editors of the old, obey newlines but not treat spaces as anything special.
    – SF.
    Sep 23, 2021 at 10:45

6 Answers 6

71

According to this source you can somewhat mimic such behavior at least since Notepad++ 5.7

  1. Select “View” from menu bar.
  2. From the dropdown menu that appears click on “Word wrap” option.
  3. either open another editor in other view and move the divider (or alternatively resize editor window) until text wraps at the desired number of characters
2
  • 14
    That doesn't wrap text to a custom number of characters...
    – Jerry
    Apr 18, 2014 at 13:01
  • 2
    @Jerry That's right, to mimic such behavior you have to open another editor in other view and move the divider until wrapping is to your liking.
    – Jörg
    Apr 22, 2014 at 9:21
28

First Install the TextFX plugin from the plugin menu. Note: it available only for 32-bit version of Notepad++.

You can split long lines with this menu command: TextFX -> TextFX Edit -> ReWrap Text to (Clipboard or 72) width which means if you want to rewrap to something other than 72 characters you should type and copy that number (without any spaces) to clipboard and then use this option.

It works in my Notepad++ v6.9 and you have to select the lines you want to split.

1
  • This solves for hard wrap (inserting hard line breaks), but not soft wrap (simulating line breaks in the display). The OP asked for a soft wrap solution. May 23, 2020 at 18:27
19

This regex replace worked well enough for me:

Find what:

^(.{60,80})\s

Replace with:

\1\n

Replace All

If some lines couldn't be split to between 60 and 80 characters, those lines will be left unmodified. Hopefully they will be few enough to deal with manually.

7
  • This works pretty well, although if you have very long tokens (e.g. urls) it won't work on those lines. Oct 16, 2017 at 23:36
  • 2
    Obvious in retrospect, but make sure you don't have ". matches newline" checked. Otherwise existing line breaks are part of the 80 characters found, then you will have lines that end up shorter than intended. Apr 15, 2018 at 17:50
  • This is the best answer presented, IMHO. While answers involving adding plug-ins are helpful, they don;t describe how to do it with the software as provided. Some of us cannot install things. This solution does not "automatically" wrap at a specified column (equivalent to number of symbols, so long as we agree that white space is symbols), but it automates it enough for my purposes. Also, the comment by Stephen Klancher is of great value. Finally, I see that this question has not had an answer selected. I nominate this answer -- it solved my problem.
    – user268926
    Jun 9, 2018 at 6:50
  • Unless I am seriously mistaken, this solution inserts newlines (\n) into the text. The OP explicitly did state that he does not want this. Excerpt from the original question: "[...] (soft wrapping for display, not insertion of line ends) [...]".
    – Binarus
    Feb 4, 2020 at 7:20
  • 1
    This answers for hard wrap (inserting newlines), not soft wrap (display wrapped lines only, don't use actual newlines). Jun 18, 2020 at 16:48
9

No, it is not possible is current versions of Notepad++. There is a feature request for it, but it has not been implemented yet.

As close as you can get (which isn't very):

  1. Create a vertical line at a specified number of columns Preferences -> Editing -> Vertical Split but N++ will not wrap to it.
  2. A very gimmicky option is to split the display using View -> Clone but obviously does not really solve the issue.
  3. Hard coding is possible with TextFX plugins, or using Ctrl + I shortcuts

For more details you can see the N++ wiki on manging line lengths.

1
1

There is a solution/workaround for this; Sourceforge Notepad++ Forum - Enable/disable word wrap by language? Involving the use of NPPExec and a python script, adjusting a given language's word wrap property. Not ideal but it may work for you.

There is also a feature request on IdeaTorrent for this problem.

1

Do this:

Config > Edit > Mode Line> Number Coluns

Note: Appers a colun line.

After that do:

Edit > Line operation> Divid lines or simple do CTRL+ I

Before

After

1
  • 3
    For English users, and for newer versions of Notepad++, do "Settings > Preferences... > Margins/Borders/Edge > Vertical Edge Settings > N" where N is the desired number of columns (e.g., 65). After you configure this setting, you can then use the keyboard shortcut CTRL+I to split the currently-selected line(s) at column N. Aug 27, 2021 at 15:48

You must log in to answer this question.

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