[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-nano] Bash syntax highlighting: Quoted text in comments

From: Michael Siegel
Subject: Re: [Help-nano] Bash syntax highlighting: Quoted text in comments
Date: Mon, 19 Feb 2018 17:09:07 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

Am 18.02.2018 um 11:11 schrieb Benno Schulenberg:

> In general, it cannot be fixed.  Nano does not do a full parse of the
> script -- it simply uses regexes to color certain patterns.  This means
> that either you get quoted things in comments highlighted as strings,
> or you get the part of a string after " #" highlighted as a comment.
> The first option has been chosen.

I see.

> You could change the order of the Comments and Strings commands
> ("color cyan" and "color brightyellow") in /usr/share/nano/sh.nanorc.
> But that has the disadvantage of getting overwritten upon the next
> update of nano.
> Better would be to add in your nanorc file:
>   extendsyntax sh color cyan "(^|[[:space:]])#.*$"
> That will make sure that comments are always colored in cyan.
> But... maybe a point could be made that quotes in comments are more
> common than space plus hash in strings?  What do you think?  Do you
> have a large set of scripts that you can grep?

Unfortunately, I don't. And I would say that whatever such statistics
may show, potentially having the highlighting of your actual code
screwed up is definitely worse than having strings in comments
highlighted in a different color, which is, after all, kind of trivial.

> (I now see that the order of comment and string highlighting was
> changed in the beginning of 2014, from nano-2.3.2 onwards.  Maybe
> that swap should be turned back?)

Well, I haven't noticed any differences between versions 2.2.6 (which
I'm still using on one of my systems) and 2.7.4 so far, as far as
highlighting Bash scripts goes.

So, are there any chances that nano will gain the ability to fully parse
scripts for highlighting in the near future? It would be great to have that.



PS: Another small thing I noticed: Why would you bind the copy-to-buffer
action to M-^/M-6 when cut to buffer is ^K/F9 and paste is ^U/F10? Seems
inconsistent to me.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]