loading...
Cover image for How I came to appreciate editor line wrapping

How I came to appreciate editor line wrapping

yujiri8 profile image Ryan Westlund ・3 min read

A couple years ago, I hated the idea of my editor wrapping lines. I was a REEL CODUH and I would tell my computer where I wanted those newlines, thank you very much. I guess I kind of saw line wrapping in the same light as I still see auto-spell-(in)correct, insertion of closing parentheses, browser search bar autosuggestion where the suggestion is accepted by default if you don't backspace it, and a bunch of other "smart" software features. I hated the thought of my comuter doing something I didn't choose and wanted it to show me the newlines exactly as I typed them.

But every time I found myself writing or editing an article in HTML source (as of more recently I write most of my website's new content in markdown but I haven't converted the old HTML pages), if I changed the line length of a line other than the last one in a paragraph, I had to break it, and look at a paragraph like this:

text text text text text text text
text
text text text text text

And think okay, that's awful, I can't stand to look at that, so I usually ended up reformatting the entire paragraph whenever I made an edit like this. I told myself it was fine, but it was misery.

Then one day I decided to try out Nano's soft wrapping. And it was glorious. I could just keep the whole paragraph on one line and let Nano wrap everything for me. What had I been thinking before? What kind of REEL CODUH doesn't want to automate one of his most menial tasks?

While I was at it, I learned the difference between hard wrapping and soft wrapping. I use soft wrapping. To be honest I don't see any real case for hard wrapping; the point the second answer there mentions is legit but seems like a very small drawback to me.

I guess I can think of another small drawback of soft wrapping, which is that if you cut a block of text by lines (like with ^K in Nano) the speed at which you cut visible lines is inconsistent, which can cost up to a few seconds in case of mistake, but it's not like I do that all the time, so I still consider it pretty insigifcant compared to the glories of soft wrapping.

I do have a dissatisfaction with the way Nano implements soft wrapping, which isn't an inherent problem with soft wrapping itself: it doesn't respect indentation, so if I have an indented line that needs to get wrapped (which I sometimes do in HTML source for bullet points and the <dl>'s I hardly use anymore):

    blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah

But after I came to terms with this I decided it was a much smaller evil than all the manual work I was doing before.

Of course, line wrapping is a horrible thing for code, but since it's soft wrapping, it doesn't actually edit the code, so I can just alt-s to toggle it. It's glorious!

Discussion

pic
Editor guide