24

How can I reformat a paragraph in Notepad++?

In UltraEdit I can select one or more long lines and reformat the paragraph to the set right margin (e.g. 60 or 80) by menu command Format/Reformat Paragraph, keyboard shortcut Ctrl + T. Note that it is hard formatting (inserting line ends), not how the document is displayed in the editor.

How can the equivalent be done in Notepad++?

18

It's sort of weird.

If you just want to wrap a paragraph at 72 characters you can just go to TextFX>TextFX Edit>ReWrap Text to (Clipboard or 72) width. Which will re-wrap your selected text to 72 characters.

If you want a 61 or 87 character wrap however, you need to copy the text "61" into your clipboard and then do the same thing (TextFX>TextFX Edit>ReWrap Text to (Clipboardor 72) width).

I'm sure Don HO would be interested in a patch for some TextFX Reformat Paragraph stuff, if you were so inclined.

  • 1
    The clipboard thing is impractical as I am constantly using this feature, but the hardcoded value of 72 is probably acceptable. I will see if I can figure out how to attach a keyboard shortcut to the ReWrap command. – Peter Mortensen Jan 24 '10 at 23:55
  • 1
    Good-However. It will 'join' my lines together. It does not respect the new-lines I have manually inserted. – Felipe Alvarez Sep 17 '10 at 11:12
  • This doesn't preserve indentation, either – endolith Oct 16 '12 at 15:44
  • Note that TextFX is not supported with 64-bit Notepad++. You can, however, keep a 32-bit and a 64-bit version of the program on your machine, and use the 32-bit version to run TextFX. Alternatively, if all you want to do is wrap lines, you can use the methods described in the other answers to this question, which work in the 64-bit version (at least in v7.5.4). – Alan Jan 22 '18 at 17:00
32

This can now be done (at least in v5.9.8) via the combination of some commands in the Edit menu. Edit > Line Operations > Split Lines will insert a hard wrap at the width of the window. The hotkey for this is Ctrl-I. Edit > Line Operations > Join Line will join lines and has a hotkey of Ctrl-J.

So for a paragraph on one line, if you want to wrap at 60 or 80, resize your window to 60 or 80 characters wide, select the line you would like to hard-wrap, and hit Ctrl-I.

Alternatively, if your paragraph was already formatted to a different width, select all the lines of the paragraph and hit Ctrl-J. Then follow the aforementioned steps and you'll have a newly formatted paragraph!

  • This doesn't preserve indentation of the first line, though. – endolith Oct 16 '12 at 15:45
  • 4
    +1 for solution not involving additional plugins – Benny Dec 28 '12 at 3:51
  • 1
    this doesn't preserve functional formatting either, eg textbf{beup} isn't considered as one word :( – Gunther Struyf May 20 '13 at 10:03
  • I think if you have a vertical edge enabled it wraps to that instead of the window size, as CodeLurker points out in his answer and as I experienced today (npp version=6.9.2). – Samuel Aug 31 '16 at 23:25
5

To put it all together, go to Settings > Preferences > Editing > Show Vertical Edge, and check it. If you don't actually want to see the "Vertical Edge," i.e. the wrapping line, select "Background Mode". Next, set your column width by clicking the number after Number of Columns.

Select your text, then hit Ctrl-J (i.e. Join Lines), Ctrl-I (Split Lines).

Edit: If Show Vertical Edge isn't checked, it wraps to the window instead.

0

Try Settings > Preferences > Editing > Show Vertical Edge

0

Pro-tip if you're looking to wrap by comma/delimiter (based on the answer by Michael Herold above):

  • Use a macro to separate each symbol into a new line
  • e.g. Home, Ctrl+Right, Right, Enter, for comma-delimited entries
  • then Play back the macro N times
  • Select all
  • Size your window to the desired column width (Settings -> Preferences -> Editing -> Number of Columns, and on the same page Show Verical Edge)
  • Ctrl+J
  • DON'T CHANGE THE WINDOW SIZE
  • Select all
  • Ctrl+I

This trick will size by e.g. comma delimiter, whereas just using Ctrl+I will not, very useful if you have e.g. 1000+ such lines.

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.