78

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.

  • 6
    Click View menu --> toggle Word wrap. – Eric Leschinski Nov 26 '14 at 15:40
  • 7
    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 '15 at 18:47
56

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
| improve this answer | |
  • 11
    That doesn't wrap text to a custom number of characters... – Jerry Apr 18 '14 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 '14 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.

| improve this answer | |
  • 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. – r_alex_hall May 23 at 18:27
10

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.

| improve this answer | |
  • This works pretty well, although if you have very long tokens (e.g. urls) it won't work on those lines. – Keith Tyler Oct 16 '17 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. – Stephen Klancher Apr 15 '18 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 '18 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 at 7:20
  • 1
    This answers for hard wrap (inserting newlines), not soft wrap (display wrapped lines only, don't use actual newlines). – r_alex_hall Jun 18 at 16:48
6

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.

| improve this answer | |
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.

| improve this answer | |

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.