Make Nano work for you!

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.

  1. Create a folder called ~/.nano
  2. Create the file ~/.nanorc and paste in the following:
    1. set backup
    2. set backupdir "~/.nano"
    3. set brackets ""')>]}"
    4. set const
    5. set matchbrackets "(<[{)>]}"
    6. set morespace
    7. set nowrap
    8. set smarthome
    9. set smooth
    10. set softwrap
    11. set speller "aspell -x -c"
    12. set tabsize 2
    13. set tabstospaces
    14.  
    15.  
    16. ## Syntax Highlighting for .module & .inc files
    17. ##
    18. syntax "module" "\.module[2345s~]?$" "inc" "\.inc[2345s~]?$"
    19. ## php markings
    20. color brightgreen "(<\?(php)?|\?>)"
    21. ## functions
    22. color white "\<[a-z_]*\("
    23. ## types
    24. color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
    25. ## structure
    26. color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
    27. ## control flow
    28. color magenta "\<(goto|continue|break|return)\>"
    29. ## strings
    30. color brightyellow "<[^= ]*>" ""(\.|[^"])*""
    31. ## comments
    32. color brightblue "//.*"
    33. color brightblue start="/\*" end="\*/"
    34. #color blue start="<" end=">"
    35. #color red "&[^;[[:space:]]]*;"
    36. ## Trailing whitespace
    37. color ,green "[[:space:]]+$"
    38.  
    39. ## Syntax Highlighting for .js & .info files
    40. syntax "javascript" "\.js$" "info" "\.info[2345s~]?$"
    41. color brightred "\<[A-Z_][0-9A-Z_]+\>"
    42. color green "\<(const|function|let|this|typeof|var|void)\>"
    43. color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>"
    44. color brightyellow "\<(export|try|throw|catch|new|delete)\>"
    45. color magenta "\<(continue|break|return|yield)\>"
    46. color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
    47. # Strings.
    48. color brightyellow "<[^= ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'"
    49. # Comments.
    50. color brightblue "//.*"
    51. color brightblue start="/\*" end="\*/"
    52. # Trailing whitespace.
    53. color ,green "[[:space:]]+$"

Drupal Association Individual Member      Drupal Association Individual Member      #DrupalCares Supporter      Acquia Certified Site Builder