Hacker News new | ask | show | jobs
by kevincox 1419 days ago
> To make this easily readable on small screens and terminals, I used vim’s text-width setting to make sure my lines do not exceed 80 characters:

I never understand comments like these. Now if my terminal is 78 characters it is a mess or if it is 100 characters it is wasting space. If you just don't wrap the lines my terminal does it at the right width.

Hard wrapping doesn't work well. You need to know the target width to wrap and you don't know that until someone actually opens the file. Every viewer I have ever tried is excellent at soft-wrapping. Let it do its thing.

3 comments

For me the reasoning is being able to distinguish between what needs to be wrapped, and what I would prefer not to be wrapped. In this case, code samples would preferrably not be wrapped. If I can wrap normal text manually, and keep code samples unwrapped, the client can disable wrapping entirely and see the code lines untouched.

This is possible with HTML and CSS, but not in plaintext. I think wasted space is something I can handle, but a badly wrapped code is something I dislike.

This is the exact reason the Linux kernel developers require plain text emails to be pre-wrapped. You cannot leave it to the reader, because readers will always/never wrap both text+code — they cannot distinguish, and text and code have very different wrapping requirements.
Now if my terminal is 78 characters it is a mess or if it is 100 characters it is wasting space. If you just don't wrap the lines my terminal does it at the right width.

Just tried it on a vintage early-80's 40-column terminal, and works better than I expected. I thought that a lot of words would be cut off on the right side, but the wrapping was about 90% correct. Perhaps it's just a coincidence, but this is what happened just now.

I will never understand this obsession with 80 characters as if we still use MS-DOS.
It is still useful though, when you open like 3 files next to each other on a screen. And if screens become bigger then 4 or 5 or ... Screens are wider than high, so putting things next to each other is often better than on top of another
My editor (Vim) can soft-wrap lines at word boundaries. I routinely have 3 or 4 files open next to each other and on my monitor that does not give 80 columns per file. Inserting hard-breaks at 80 columns would make it look horrible, while long lines get wrapped nicely.
I get that you can softwrap. Usually that means though, that when some code is indented, the content of a line that gets wrapped starts at the beginning of the next line (not indented). That just looks bad. I guess one could get used to it. If you can change that and make it continue at same indentation, then you need some additional marker, to distinguish softwrapping from an actual line break. Probably all possible in editors like VIM and Emacs. Just a question of configuration. I would claim though, that softwrapped lines are a bit more difficult to read, when it comes to code, than having short lines, all properly indented.
I also use vim. I prefer to keep wrapping off and line length go to 80 or so chars.

I find it easier to read this way rather than have wrapping turned on. Wrapping isn't nearly as good for my comprehension as a line break after 80 chars.

Different people have different preferences

Makes coding on a phone way easier.