Nano: Difference between revisions
Jump to navigation
Jump to search
Carandraug (talk | contribs) (Moved nano section from the old wiki) |
Waldyrious (talk | contribs) (fix syntax error (tested with nano 2.9.3)) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
== Syntax highlight == | == Syntax highlight == | ||
Nano can extended to highlight octave code. The following can be added to | Nano can be extended to highlight octave code. The following can be added to {{File|~/.nanorc|<pre> | ||
<pre> | |||
# Octave syntax colors | # Octave syntax colors | ||
syntax "octave" "\.m$" "\.octaverc$" | syntax "octave" "\.m$" "\.octaverc$" | ||
Line 18: | Line 17: | ||
# embraced | # embraced | ||
color brightred start="\(" end="\)" | # TODO: the next line needs to be fixed to work properly in all cases | ||
color brightred start="\(" end="\)" | |||
color blue start="\[|\{" end="\]|\}" | color blue start="\[|\{" end="\]|\}" | ||
Line 26: | Line 26: | ||
# comments | # comments | ||
color brightblue "#.*|%.*" | color brightblue "#.*|%.*" | ||
</pre> | </pre>}} | ||
Alternatively, it can be an individual file available system-wide such as | Alternatively, it can be an individual file available system-wide such as {{Path|/usr/share/nano/octave.nanorc}} which can then be included in {{Path|/etc/nanorc}} (again, system-wide), or in {{Path|~/.nanorc}} with | ||
<pre>include "/usr/share/nano/octave.nanorc"</pre> | <pre>include "/usr/share/nano/octave.nanorc"</pre> | ||
[[Category:Editors]] |
Latest revision as of 17:16, 7 February 2018
Nano is a very useful text editor. Even if you don't use a command line that often, and never bothered to learn vim or emacs, nano will always be there and is simple enough.
Syntax highlight
Nano can be extended to highlight octave code. The following can be added to
File: ~/.nanorc
# Octave syntax colors syntax "octave" "\.m$" "\.octaverc$" # keywords color brightyellow "(case|catch|do|else(if)?|for|function|if|otherwise|switch|try|until|unwind_protect(_cleanup)?|vararg(in|out)|while)" color brightyellow "end(_try_catch|_unwind_protect|for|function|if|switch|while)?" color magenta "(break|continue|return)" # storage-type color green "(global|persistent|static)" # data-type color green "(cell(str)?|char|double|(u)?int(8|16|32|64)|logical|single|struct)" # embraced # TODO: the next line needs to be fixed to work properly in all cases color brightred start="\(" end="\)" color blue start="\[|\{" end="\]|\}" # strings color yellow ""(\\.|[^\"])*"|'(\\.|[^\"])*'" # comments color brightblue "#.*|%.*"
Alternatively, it can be an individual file available system-wide such as /usr/share/nano/octave.nanorc which can then be included in /etc/nanorc (again, system-wide), or in ~/.nanorc with
include "/usr/share/nano/octave.nanorc"