Custom line break in gedit 3.36.2

265 views Asked by At

I'm looking for the option to set the line break at a specific point (e.g. after 75 characters). The option Text Wrapping allows only the line break when the text reaches the end of the screen.

1

There are 1 answers

0
rubotnik On

For a cheap solution, you could try the following regex (Hotkey: Ctrl + H)

For tl;dr:

Find (.{75})\s
Replace with \1\n

and then "Replace All"

long version:

Explanation for Find: look for a space character after position 75 of any literal.
Explanation for Replace with: replace this space (i.e. matchgroup 1) with a newline character

For a more sophisticated approach, that means in order to split at a certain operand position and insert a hyphen, there is still room for improvement.

However, I hope this may serve you as a starting point ...

PS: Awh, don't forget to tick "Regular expression" and "Wrap around".