[SOLVED] Enable word wrap (and soft word wrap) in nano text editor…

Hi all.

I have noticed this ages ago and it annoyed the BeeGeeses out of me. When You enter a long line of text in nano editor it “wraps” the lines. It “wraps” them like other text editors do – fine. The problem occurs when You try to save the file… all of the sudden long line of text becomes 3 or 4 lines of text… Now imagine using nano on Your /boot/grub/grub.cfg file. Edit the line – even just change the vga=xxx mode and when You reboot Your grub is going into “YOU MESSED UP DUDE!” mode.

By now – most of the distro’s devs have implemented this solution by default but just in case they didn’t – here is what needs to be done.

Run this command from the terminal:

su -c "sed -i 's/# set nowrap/set nowrap/' /etc/nanorc"

and give it a root password when asked for it.

This will turn off the word wrap completely.

However if You are like me and You like the word wrap option BUT You want to keep one line as one line You may want to use this command as well:

su -c "sed -i 's/# set softwrap/set softwrap/' /etc/nanorc"

This will cause the nano editor to softly wrap the lines and when You will save the file – the lines won’t break. In other words if You will type a long line it will be shown as many rows of text BUT when You will save the file it will still be a one long line. Both commands have to be used in order for the soft wrap to work.





"Never meet Your heroes. Most of the time you'll only end up disappointed." White Polak Male Husband Employee Hetero Carnivorous Fugly Geek @$$hole with ADD Catholic “Some men just want to watch the world burn.”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.