Matlab cell mode highlight mechanism



  • In matlab, we can ‘section’ the script file into sections by using %% at the beginning of a line. The line itself is treated as a comment.
    How can I get notepad++ to give a different style to comment lines beginning with %% ?
    I am using latest version of notepad++ (Notepad++ 7.5.3)
    I do not want to define a new user defined language for this if possible.



  • @Ms-N

    I’ve used Matlab a little bit but I didn’t know about code-sections until I read your posting in this thread. If I were you I’d be tempted to not care so much about the color of those lines but rather I’d get them into the Function List so that they appear in there with the normal Matlab "function"s. This assumes that the %% code-section lines also have some text after those symbols (to be meaningful if put in the Function List), but I’d assume most such lines do? The helpers here can give more information about this if you end up wanting to go that way with it…



  • Sorry for the late feedback.
    Well, my idea is not to have autocomplete or ‘jump to’ capabilities. But just to have a visual feedback. Also, the text after the %% usually gives brief description of code below and is different for different scripts that i work with.
    I don’t think a function list will do since each script that I receive will have different text following the %%.



  • @Ms-N said:

    my idea is not to have … ‘jump to’ capabilities

    Well, why not if you get it for free? :-D

    just to have a visual feedback

    So that wouldn’t be my area of expertise but others are here that I think could help with that part.

    the text after the %% usually gives brief description of code below…
    …I don’t think a function list will do since each script that I receive will have different text following the %%

    That’s perfect for the Function List! Think about it! :-)



  • I think you are right. I will give the function list method a go.
    https://notepad-plus-plus.org/features/function-list.html


Log in to reply