2

I saw Long line wrapping in Nano and while the manpage says -

set fill number - Hard-wrap lines at column number number. If number is 0 or less, the maximum line length will be the screen width less number columns. The default value is -8.

This is how my ~/.nanorc is looking -

[$] cat ~/.nanorc

set autoindent
set backup
set constantshow
set fill 80  

What I want is that once I start writing something, I should not have to have to break my rhythm of writing and once 80 characters exceed on a line it should hand-wrap and come to the starting of next line which does not happen atm.

What am I doing wrong ?

Update - I tried doing at thomas shared -

[$] cat .nanorc

set autoindent
set backup
set constantshow
set fill 64 columns

still no go, Using nano 2.7.1-1

3 Answers 3

2

Your .nanorc is correct. The issue is that you have to enable hard wrapping once you open the file (Esc L). set fill configures the number of columns inside hard wrapping.

2

In ~/.nanorc, make sure you have these lines:

set fill 80
set breaklonglines

Alternatively, you can do this:

nano -b -r 80

or

nano --breaklonglines --fill=80

These will make it so it hard wraps at 80 characters.

As others have said, Alt+l will toggle on/off hard wrapping.

Justifying with Ctrl+j will hard-wrap the entire file, once.

This answer was tested on Nano 6.4, compiled myself for x86_64 (on Xubuntu 22.04).

If you want to compile it yourself (to get the latest version, since my instructions may or may not work with old versions of Nano), on Ubuntu (possibly works on Debian, too), I recommend enabling the source code repositories, and then typing sudo apt build-dep nano. Then download the nano source code from nano-editor.org, and then compile according to the instructions in the source code.

0

Your .nanorc appears to be trying to set the margin at eighty-percent. But the manual says that the number is columns. Perhaps you meant something like

80 * .80 = 64 columns
3
  • I have updated my question, maybe you can help me figure it out, I didn't get your answer.
    – shirish
    Nov 10, 2016 at 21:37
  • In a quick check, using your .nanorc and current code it wraps for me. You'll have to provide more details. Nov 10, 2016 at 22:40
  • I am using the buffer as a text editor. It doesn't wrap the text for me. Could you share you nanorc, the way it is written at your end. Maybe something I missed or it's a bug, have to know to figure it out. Sharing a single line text I created dropbox.com/s/tb1n8vmyxm7jiuv/sample.txt?dl=0 and s12.postimg.org/p2ln0k10d/nano_buffer_no_wrapping.png as a screenshot of the buffer. Hopefully you will be able to figure out what is going wrong.
    – shirish
    Nov 11, 2016 at 6:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .