This tutorial explains about nanorc file with examples.
.nanorc file is used to store the user-customized configuration and settings required for the nano editor.
It contains customized behavior of nano such as indentation, line wrap, settings, and syntax formatting.
The location of .nanorc file is in the
~/.nanorcin Linux, Unix, and Mac
This file loads by nano editor at startup and configure default settings.
Any feature can be enabled by adding a line with set or unset in
nanorc file settings
Following are some settings configured
To disable line wrapping:
To disable syntax highlighting:
Syntax directive tells to enable or disable. color to define a single syntax color
set quiet syntax "disabled" "." or syntax "" "" color gree black "."
Disable confirm on save:
By default, modifying a file shows you to save the modified buffer prompt when closing the file,
For nano versions greater than 5.0
For nano versions less than 5.0
It says don’t show prompts to save the file when closing. It can also be enabled with command line arguments
nano -t command
tab size change spaces
By default, the tab size is 8 white spaces. If you want to change the spaces permanently
set tabsize 8 set tabstospaces
It changes white spaces from 8 to 4 for tab space.
This makes the tab character 4 spaces instead of 8 spaces.
- Mouse support
To get mouse clicks to work in the nano editor,
One way, change the below settings in the
or open the editor with the
nano -m option
Nano editor configuration examples
The following page shows a list of all settings required in the Nano Editor.
|set tabsize n||change tab size with n spaces|
|set autoindent||Automatic indentation|
|set smooth||configure Smooth scrolling|
|set linenumbers||Show line numbers|
|set tabstospaces||change tab to spaces|
|set mouse||change to mouse|
|set nonewlines||New lines are not added to the end of the file|
|set nowrap||No lines wrap|
|set nohelp||No Help option shown|
|set casesensitive||Case sensitive search|