nanorc 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. ## general behaviour
  2. # Keep the same indentation after ENTER
  3. set autoindent
  4. # 72 character width paragraphs
  5. set fill 72
  6. set tabsize 8
  7. # Use Ctrl-J to justify paragraphs, Ctrl-U to unjustify
  8. set nowrap
  9. # Show cursor position constantly
  10. set constantshow
  11. # First HOME returs to end of first whitespace, second to start of line
  12. set smarthome
  13. # Allow opening of multiple files in different buffers
  14. set multibuffer
  15. ## syntax highlighting for bash scripts
  16. syntax "sh" "\.sh$"
  17. header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
  18. icolor brightgreen "^[0-9A-Z_]+\(\)"
  19. color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
  20. color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
  21. color green "-[Ldefgruwx]\>"
  22. color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
  23. color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
  24. icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
  25. color cyan "(^|[[:space:]])#.*$"
  26. color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
  27. color ,green "[[:space:]]+$"
  28. ## syntax highlighting for C/C++
  29. syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
  30. color brightred "\<[A-Z_][0-9A-Z_]+\>"
  31. color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
  32. color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
  33. color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
  34. color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
  35. color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
  36. color magenta "\<(goto|continue|break|return)\>"
  37. color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
  38. color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
  39. ## GCC builtins
  40. color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
  41. ## String highlighting. You will in general want your comments and
  42. ## strings to come last, because syntax highlighting rules will be
  43. ## applied in the order they are read in.
  44. color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
  45. ## This string is VERY resource intensive!
  46. color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
  47. ## Comment highlighting
  48. color brightblue "//.*"
  49. color brightblue start="/\*" end="\*/"
  50. ## Trailing whitespace
  51. color ,green "[[:space:]]+$"
  52. ## syntax highlighting for HTML and MathJax
  53. syntax "html" "\.html?$"
  54. #<!-- reserved for comments, "< " might be just comparison in JS
  55. color cyan start="<[^! =]" end=">"
  56. #but <!doctype html> should be cyan
  57. icolor cyan start="<!doctype" end=">"
  58. color red "&[^;[:space:]]*;"
  59. color brightcyan ""(\\.|[^"])*""
  60. #seems not possible to avoid \$ or setting it back to default color
  61. color magenta "\\\(|\\\)|\\\[|\\\]|\$"
  62. #anything of the form "\begin{...}" or "\end{...}"
  63. color magenta "\\begin\{[^\}]*\}|\\end\{[^\}]*\}"
  64. color brightblue start="<!--" end="-->"
  65. ## syntax highlighting for CSS
  66. syntax "css" "\.css$"
  67. color brightred "."
  68. color brightyellow start="\{" end="\}"
  69. color brightwhite start=":" end="([;^\{]|$)"
  70. color brightblue ":active|:focus|:hover|:link|:visited|:link|:after|:before|$"
  71. color brightblue start="\/\*" end="\\*/"
  72. color green ";|:|\{|\}"
  73. ## syntax highlighting for TeX
  74. syntax "tex" "\.tex$" "\.bib$"
  75. #icolor cyan "\\.|\\[A-Z]*"
  76. color cyan "\\(documentclass|usepackage|theoremstyle|newtheorem)"
  77. color cyan "\\(DeclareMathOperator|newcommand|renewcommand|maketitle)"
  78. color cyan "\\(emph|addcontentsline|bibitem|cite|ref|eqref|label|pageref)"
  79. color cyan "\\(numberwithin)"
  80. color brightcyan "\\(title|author|date|section|subsection|subsubsection)"
  81. #but <!doctype html> should be cyan
  82. icolor cyan start="<!doctype" end=">"
  83. color brightcyan ""(\\.|[^"])*""
  84. #seems not possible to avoid \$ or setting it back to default color
  85. color magenta "\\\(|\\\)|\\\[|\\\]|\$"
  86. #anything of the form "\begin{...}" or "\end{...}"
  87. color magenta "\\begin\{[^\}]*\}|\\end\{[^\}]*\}"
  88. #comments
  89. color brightblue "(|[^\])%.*"
  90. ## syntax highlighting for nanorc
  91. syntax "nanorc" "\.?nanorc$"
  92. ## Possible errors and parameters
  93. icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
  94. ## Keywords
  95. icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>"
  96. icolor green "^[[:space:]]*(set|unset|include|syntax|header)\>"
  97. ## Colors
  98. icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
  99. icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
  100. ## Strings
  101. icolor white ""(\\.|[^"])*""
  102. ## Comments
  103. icolor brightblue "^[[:space:]]*#.*$"
  104. icolor cyan "^[[:space:]]*##.*$"
  105. ## syntax highlighting for JavaScript
  106. syntax "javascript" "\.js$"
  107. color brightred "\<[A-Z_][0-9A-Z_]+\>"
  108. color green "\<(const|function|let|this|typeof|var|void)\>"
  109. color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>"
  110. color brightyellow "\<(export|try|throw|catch|new|delete)\>"
  111. color magenta "\<(continue|break|return|yield)\>"
  112. color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
  113. # Comments.
  114. color brightblue "//.*"
  115. color brightblue start="/\*" end="\*/"
  116. # Strings.
  117. color brightyellow "<[^= ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'"
  118. # Trailing whitespace.
  119. color ,green "[[:space:]]+$"
  120. ## syntax highlighting for Asymptote
  121. syntax "asy" "\.asy$"
  122. color brightred "\<[A-Z_][0-9A-Z_]+\>"
  123. color green "\<(real|pair|triple|bool|bool3|int|static|struct|typedef|string)\>"
  124. color green "\<(path|path3|guide|guide3|surface|pen|material|transform|frame)\>"
  125. color green "\(picture|file)\>"
  126. color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
  127. color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
  128. color magenta "\<(goto|continue|break|return)\>"
  129. color brightcyan "\<(import|from|access|unravel|as)\>"
  130. # Strings. In general you will want your strings and comments to come last,
  131. # because highlighting rules are applied in the order they are read in.
  132. color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
  133. # Multiline strings. This regex is VERY resource intensive!
  134. color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
  135. # Comments.
  136. color brightblue "//.*"
  137. color brightblue start="/\*" end="\*/"
  138. # Reminders.
  139. color ,yellow "(FIXME|TODO|XXX)"
  140. # Trailing whitespace.
  141. color ,white "[[:space:]]+$"