Follow

TIL Nano, the simple text editor that comes with MacOS, does line wrapping by default.

This makes it unsuitable for editing or files.

@peterdrake I don't know about macOS, but on Linux I've always had in my ~/.sh_aliases (I use same aliases for both BASH and Zsh) a line that says:

alias nano="nano -w"

According to the man page (man nano) on Arch Linux, no-wrap is default:

man.archlinux.org/man/nano.1#w

-w, --nowrap
Do not automatically hard-wrap the current line when it becomes overlong. This is the default. (This option is the opposite of -b (--breaklonglines) -- the last one given takes effect.)

@jpyper @jupiter Interesting!

When I ask for man nano, I get a man page for pico, which offers "-w Disable word wrap (thus allow editing of long lines)."

So when I run nano in MacOS 13.2.1, it really runs pico (which seems to have the opposite behavior to proper nano in this regard), even though:

% which nano
/usr/bin/nano

@peterdrake @jupiter Have you tried "man pico" to see if there's a man page for it? Pico was the basis for Nano.

nano-editor.org/dist/latest/fa

@peterdrake @jupiter Since I don't know much about Macs, the only other thing I can suggest would be to check Homebrew to see if there's anything they can help with.

Actually, I just checked. There is a listing for nano, but I don't have any idea what to do from there.

formulae.brew.sh/formula/nano

I hope this helps in some manner.

@trinsec Yes, you can get the desired behavior with either a command-line flag or a config file. I was just surprised to see this as the default.

@peterdrake I'm not. I'm sure many users might want to just edit a textfile, then nowrap is kind of an inconvenience.

@trinsec If you're editing prose paragraphs, TextEdit might be a more natural choice. Soft wrapping could also be a reasonable compromise.

What's really surprising is that, according to the responses, this nano has the *opposite* behavior of nano on other platforms.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.