Dynamic word wrap in nano

Asked by oddemirci

Do you know if "nano" has dynamic word wrap capability? I mean, when you open a document, can it automatically wrap at the screen width? In man pages, it is talking about -r option but it does not seem to be working.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
oddemirci
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
George Standish (george-standish-deactivatedaccount) said :
#1

Yes, it took some experimentation and help from erUSUL in #ubuntu for me to figure this out.

You need to edit the file /etc/nanorc with elevated privileges, like "gksu gedit /etc/nanorc"

Find the line:

   #set softwrap

and remove the comment (#) from the beginning of the line so it looks like:

   set softwrap

Then you should have dynamic wrapping of text instead of lines showing $ when they reach the end of the terminal

Revision history for this message
oddemirci (oddemirci) said :
#2

Hi

In that file there is no such line. If I insert such a line, when nano starts it gives error

     Error in /etc/nanorc on line 95: Unknown flag "softwrap"

But there is a line like this

     set nowrap

I commented it out. Now nano is wrapping text. But it is not "dynamic wrap" in the sense that, when I change window size, it does not adjust lines.

Revision history for this message
oddemirci (oddemirci) said :
#3

Sorry I closed the question unintentionally.

(Let this question remain open until a clear answer. I could not find answer on the web, and this may be relevant to other people also.)

Revision history for this message
George Standish (george-standish-deactivatedaccount) said :
#4

Perhaps we are using different versions of Nano - my machine is running Lucid, so it very possible we are (GNU nano version 2.2.2).

On my system the "set nowrap" had no effect at all - still had the $ at end of terminal lines.

With the "set softwrap" I am getting dynamic wrap changes, ie when I change the terminal size the lines auto-adjust - too bad it is not available in the nano version you are using.

I'm sorry you could only partially resolve your issue, best of luck.

Revision history for this message
oddemirci (oddemirci) said :
#5

Hello George,

Your answer actually clarified the issue. I think it is a matter with different versions. I am using nano version 2.0.0.

I am using latest Ubuntu release with all updates. May be Ubuntu guys did not put the latest version yet.

Anyway. Thank you for the reply.

Revision history for this message
sdaau (sd-imi) said :
#6

Just a note about shortcuts: once in nano, hit Ctrl-G (that is "^G Get Help"); then on the very bottom of that page, you can see:

  (M-$) Soft line wrapping enable/disable

... and given "M" here stands for Alt key, you should press Alt-$ (dollar) or rather Alt-Shift-4 to toggle the soft line wrapping.