Nano is a great text editor for those who are intimidated by the command line and the prospect of coding with vim or Emacs.
That said, Nano can be much better than what is traditionally provided by your machine, by default. Here's some easy changes you can make, by creating a .nanorc file.
- Create a folder called
~/.nano
- Create the file
~/.nanorc
and paste in the following:- set backup
- set backupdir "~/.nano"
- set brackets ""')>]}"
- set const
- set matchbrackets "(<[{)>]}"
- set morespace
- set nowrap
- set smarthome
- set smooth
- set softwrap
- set speller "aspell -x -c"
- set tabsize 2
- set tabstospaces
- ## Syntax Highlighting for .module & .inc files
- ##
- syntax "module" "\.module[2345s~]?$" "inc" "\.inc[2345s~]?$"
- ## php markings
- color brightgreen "(<\?(php)?|\?>)"
- ## functions
- color white "\<[a-z_]*\("
- ## types
- color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
- ## structure
- color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
- ## control flow
- color magenta "\<(goto|continue|break|return)\>"
- ## strings
- color brightyellow "<[^= ]*>" ""(\.|[^"])*""
- ## comments
- color brightblue "//.*"
- color brightblue start="/\*" end="\*/"
- #color blue start="<" end=">"
- #color red "&[^;[[:space:]]]*;"
- ## Trailing whitespace
- color ,green "[[:space:]]+$"
- ## Syntax Highlighting for .js & .info files
- syntax "javascript" "\.js$" "info" "\.info[2345s~]?$"
- color brightred "\<[A-Z_][0-9A-Z_]+\>"
- color green "\<(const|function|let|this|typeof|var|void)\>"
- color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>"
- color brightyellow "\<(export|try|throw|catch|new|delete)\>"
- color magenta "\<(continue|break|return|yield)\>"
- color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
- # Strings.
- color brightyellow "<[^= ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'"
- # Comments.
- color brightblue "//.*"
- color brightblue start="/\*" end="\*/"
- # Trailing whitespace.
- color ,green "[[:space:]]+$"