Nano is a simple and intuitive editor preinstalled on many Unix-based computers. All the necessary keyboard shortcuts are presented all the time in the footer of this program, so you don't get lost when you need to edit a file in the shell.
Check for \*.nanorc
files at one of the following directories:
- /usr/share/nano/*.nanorc - for Linux
- /fbsd/usr/iports/share/nano/*.nanorc - for FreeBSD
- /usr/local/share/nano/*.nanorc - for Mac OS X
If you are using a Mac and the mentioned files don't exist there, run the following:
$ brew tap homebrew/dupes
$ brew install nano
Decide whether you want to do changes for all users or just for the current user:
- If you want to configure nano globally for all users, edit or create a file
/etc/nanorc
. - If you want to configure nano for the current user, edit or create a file
~/.nanorc
.
Add the following lines there:
set nowrap
include "/usr/local/share/nano/*.nanorc"
The first line disables automatic word wrapping for long lines (that is very annoying for files like Python scripts or Apache configuration). The second line enables syntax highlighting for all different formats.
Decide whether you want to do changes for all users or just for the current user:
- If you want to make nano the default editor globally for all users, edit or create a file
/etc/profile
. - If you want to make nano the default editor for the current user, edit or create a file
~/.profile
.
Add the following line there:
export EDITOR=nano
Now nano is the default editor in the shell.
If you run nano from homebrew, it expects the system file in /usr/local/etc/nanorc. May want to suggest a symlink to /etc/nanorc.