Search code examples
line-breaksword-wrapnano

How to disable wrapping lines in nano?


My nano did not wrap long lines automatically at first, they just kept going. I do not know what I did but now the automatic wrapping is enabled.

I want to know how to reconfigure nano to disable automatic line wrapping, this has bothered me a lot.

I've seen the nano -w command that it comes without wrapping, but what I want is to disable it by default and run nano without having to worry about wrapping.


Solution

  • To change persistent settings for nano, we can edit the user-specific .nanorc file (/home/user/.nanorc). This file contains configuration settings that nano loads on start-up.

    To disable line-wrapping, we need to specify the nowrap directive. Add this line to .nanorc:

    set nowrap 
    

    We may need to create this file if it doesn't exist. For more information about the available settings in this file, see the .nanorc man page:

    $ man nanorc