patchGNU nano - Patches: patch #6798, syntax highlighting for Octave /...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6798: syntax highlighting for Octave / Matlab

Submitter:  Ati Sharma <atisharma>
Submitted:  Fri 03 Apr 2009 12:44:44 PM UTC
   
 
Priority:  3 - Low Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  None

Jump to the original submission

Fri 01 Oct 2021 12:46:00 PM UTC, comment #8: 

The syntax file has been uploaded to
https://nano-editor.org/more-syntaxes/,
where it is more likely to be found by interested people.

Benno Schulenberg <bens>
Group administrator
Mon 30 Apr 2018 03:57:19 PM UTC, comment #7: 

(Sorry.  I had forgotten about this.)

Yes, when you simply include *.nanorc, then the globbing will sort the files and octave.nanorc will come after groff.nanorc and after objc.nanorc, and for nano later defined syntaxes have priority over earlier defined ones.  (If you would rename your file to actave.nanorc, then your .m files would get colored as Obj-C files.)

So, if I would include octave.nanorc into nano, then files that would formerly be colored as Obj-C would then get colored as Octave files.  :|  Obj-C users would not be happy.

So... maybe we have to devise a way to package certain syntax files with nano without them getting installed by default -- the user has to copy them manually if he/she wants them.  A special directory for extra syntax files would also be useful for putting files like gentoo.nanorc and debian.nanorc into -- things that are not generally useful.

Benno Schulenberg <bens>
Group administrator
Tue 20 Mar 2018 04:26:50 PM UTC, comment #6: 

Nano highlights .m files as octave syntax when I include nano/.nanorc in ~/.nanorc. I don't know how to color octave and objc correctly, since their filename extensions are both '.m'.

(file #43602)

JunWang <junwang>
Mon 19 Mar 2018 07:12:36 PM UTC, comment #5: 

Hello JunWang,

How do you get nano to color .m files with the Octave syntax?  Because also the objc.nanorc triggers on the .m filename ending (and groff.nanorc does too).  I guess because you inlcude it last in your ~/.nanorc?

Also, please add an authership line and a license line to the file.  (See for example json.nanorc or lua.nanorc.)  And, if it's not too much trouble, please provide your file as a git patch.

Benno Schulenberg <bens>
Group administrator
Fri 16 Mar 2018 04:12:29 PM UTC, comment #4: 

Syntax highlighting for octave without built-in functions.
(file #43573)

JunWang <junwang>
Sat 25 Apr 2015 04:05:43 PM UTC, comment #3: 

Since Matlab appears to be proprietary, I am not going to take the file as is.

But if you call the syntax "octave" instead and make sure the small Octave extensions are coloured properly too, and clean up the file a bit (remove unneeded lines/comments, and split some of the overly long lines), I will reconsider.

Benno Schulenberg <bens>
Group administrator
Sat 06 Sep 2014 08:50:40 AM UTC, comment #2: 

The following two lines will add additional Matlab/Octave commands to the syntax highlighting definition:

color brightgreen "\<(bsxfun|numel|lower|speye|svds|eig|eigs|chol|fminunc|cputime|lsode|sparse|sprand|sprandn|spdiags|deval|ode45|ode23|tic|toc)\>"
color brightred "\<(xlim|ylim|zlim|xlabel|ylabel|zlabel|title|surf|colorbar|caxis|imagesc|print|set)\>"



CH <atcl>
Fri 03 Apr 2009 12:46:25 PM UTC, comment #1: 

nanorc file for matlab. Includes list of functions etc.
String highlighting can be flaky.

(file #17858)

Ati Sharma <atisharma>
Fri 03 Apr 2009 12:44:44 PM UTC, original submission:  

syntax "matlab" "\.m?$"
color brightred "\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?"
color brightgreen "\<(size|zeros|ones|min|max|varargs|sqrt|atan2|asin|acos|log10|log|real|error|isscalar|isstr|strcmp|log2|Inf|isvector|strcat|fsolve|islogical|isempty|isnumeric|prod|round|dims|cumprod|ismatrix|floor|sort|ceil|linspace|isnan|isinf|nan_inf|repmat|colums|rows|sum|rem|reshape|conv|length|usage|log2|abs|setstr|printf|sprintf|fprintf|fread|fopen|fclose|system|unlink)\>"
color magenta "\<(function|endfunction|switch|case|endswitch|otherwise|unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch|end|if|else|elseif|endif|break|continue|for|endfor|return|do|until|while|endwhile|global|nargin|nargout|assert)\>"
color brightred "\<(function|endfunction|global|for|end|while|if|else|elseif|endif|break|switch|case|and|or|and)\>"
color brightyellow "\<(info|whatsnew|hostid|help|lookfor|what|which|type|edit|pcode|quit|exit|who|whos|save|load|memory|clear|pack|workspace|pathdef|path|addpath|echo|format|diary|pwd|cd|dir)\>"
color brightgreen "\<(logical|isnumeric|islogical|isempty|isequal|reshape|repmat|find|length|size|cross|kron|linspace|logspace|meshgrid|zeros|ones|rand|randn|end|ind2sub|sub2ind|repmat|cat|ndims|ndgrid|permute|ipermute|shiftdim|flipdim|squeeze|struct|fieldnames|getfield|setfield|rmfield|isfield|isstruct|cell|celldisp|cellplot|cellstr|deal|iscell|num2cell|cell2struct|struct2cell|lists|varargin|varargout|inline|argnames|formula|char|vectorsize|class|isa|isobject|methods|inferioto|superioto|horzcat|vertcat|subsref|subsasgn|subsindex)\>"
color brightgreen "\<(ans|inf|NaN|Pi|eps|log2|pow2|realmin|realmax|all|any|exist|bitset|bitget|bitmax|bitcmp|bitand|bitor|bitxor|bitshift|ismember|unique|union|intersect|setdiff|setxor|eval|feval|builtin|assignin|evalin|run|nargchk|nargin|nargout|inputname|input|pause|error|warning|lasterr|lastwarn|disp|fprintf|sprintf)\>"
color brightgreen "\<(abs|angle|real|imag|conj|cplxpair|ceil|fix|floor|round|mod|rem|sign|factor|primes|gcd|lcm|rat|rats|perms|nchoosek|sqrt|exp|log|pow2|nextpow|log2|log10|sin|sinh|asin|asinh|csc|csch|ascc|ascch|cos|cosh|acos|acosh|sec|sech|asec|asech|tan|tanh|atan|atan2|atanh|cot|coth|acot|acoth|cart2pol|cart2sph|pol2cartsph2cart|besselj|bessely|besseli|besselk|besselh|airy|beta|betainc|betaln|ellipj|ellipke|erf|erfc|erfcx|erfinv|gamma|gammainc|gammaln|expint|legendre)\>"
color brightgreen "\<(eye|diag|tril|triu|fliplr|flipud|rot90|compan|cond|normest|norm|det|see|rank|trace|null|orth|inv|lu|qr|svd|gsvd|roots|poly)\>"
color brightgreen "\<(sum|cumsum|prod|cumprod|sort|sortrows|max|min|median|mean|std|cov|corrcoef|diff|gradient|polyfit|interpft|spline|ppval|fft|ifft|fft2|ifft2|fftn|ifftn|filter|filter2)\>"
color brightred "\<(root|figure|axes|line|patch|surface|text|plot|fplot|ezplot|loglog|semilogx|semilogy|polar|piotyy|plot3|meshgrid|mesh|meshc|meshz|axis|hold|grid|bar|barh|pie|subplot|zoom|colormap|label|legend|errorbar|hist|stem|stairs|scatter|roze)\>"

##color red "\{[0-9:(end)-+]*?\}"
##color red "\([0-9:(end)-+\[\]]*?\)"
color red "[\{\}\(\)]"

##
##
## String highlighting.  You will in general want your comments and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
##
## Comment highlighting
color cyan "%.*"
## string highlighting
color yellow "(\s|,|\[|\()'.*?'(\)|,|\s|\])"
##color yellow "'.*'"
color white "\[" "\]" "[\*+-=<>;\\/\.\^!&|,]"
icolor green "\\.|\\[A-Z]*"

## Trailing whitespace
color ,green "[[:space:]]+$"

Ati Sharma <atisharma>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #43602:  nano-octave-syntax.patch added by junwang (1KiB - text/x-patch - add author and license line)
file #43573:  octave.nanorc added by junwang (781B - application/octet-stream - nanorc file for octave without built-in functions.)
file #17858:  matlab.nanorc added by atisharma (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by junwang (Updated the item)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by atcl (Posted a comment)
  • -email is unavailable- added by atisharma (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-01 bens StatusPostponed None
        Open/ClosedOpen Closed
    2018-04-30 bens Summarysyntax highlighting for matlab / octave syntax highlighting for Octave / Matlab
    2018-03-20 junwang Attached File- Added nano-octave-syntax.patch, #43602
    2018-03-19 bens Summarysyntax highlighting for matlab syntax highlighting for matlab / octave
    2018-03-16 junwang Attached File- Added octave.nanorc, #43573
    2015-04-25 bens StatusNone Postponed
        Summarynanorc for matlab syntax highlighting for matlab
    2015-04-25 bens Priority5 - Normal 3 - Low
    2009-04-03 atisharma Attached File- Added matlab.nanorc, #17858

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code