help-nano
[Top][All Lists]
Advanced

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

on syntax recognition


From: Calvin Smith
Subject: on syntax recognition
Date: Thu, 8 Dec 2022 18:50:54 +0000 (UTC)

Thank you Benno, I'm pretty new to programming. What is a "syntax" to nano? Does something about a file you create tell nano that a file
has a particular syntax? Not sure how that works from a practical vantage point:

  syntax name ["fileregex" ...]
        Start the definition of a syntax with this name.  All subsequent
        color and other such commands will be added to this syntax, until
        a new syntax command is encountered.

On Thursday, December 8, 2022 at 12:04:46 PM EST, help-nano-request@gnu.org <help-nano-request@gnu.org> wrote:


Send Help-nano mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Help-nano digest..."


Today's Topics:

  1. Request help in changing default comment string for nano
      (Calvin Smith)
  2. Re: changing the default comment string for nano -- not
      possible (Benno Schulenberg)


----------------------------------------------------------------------

Message: 1
Date: Thu, 8 Dec 2022 01:43:47 +0000 (UTC)
From: Calvin Smith <calvinsmith99993@yahoo.com>
Subject: Request help in changing default comment string for nano
Content-Type: text/plain; charset="utf-8"

Hello everyone, nano is a great text editor overall, i like it much better than vim and i have been using it for the past 6 months. However, i would like to know how you can change the comment character from # to something else for a different programming language. The documentation says this:
 
      -   


  - comment "string"
      -   
Use the given string for commenting and uncommenting lines.If the string contains a vertical bar or pipe character (|),this designates bracket-style comments; for example, "/*|*/" forCSS files. The characters before the pipe are prepended to the line and thecharacters after the pipe are appended at the end of the line. If no pipecharacter is present, the full string is prepended; for example, "#" forPython files. If empty double quotes are specified, the comment/uncommentfunctions are disabled; for example, "" for JSON.The default value is "#". 


I try to put 
comment "//"
in my .nanorc file, but the program just gives me an error and the default comment remains a #. What's the proper way to change this setting? I tried to fool around with it but i just get red text, which is nano's way of saying that it's an error.
Thanks



-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Thu, 8 Dec 2022 16:03:23 +0100
From: Benno Schulenberg <bensberg@telfort.nl>
Subject: Re: changing the default comment string for nano -- not
    possible
Content-Type: text/plain; charset="utf-8"; Format="flowed"


Op 08-12-2022 om 02:43 schreef Calvin Smith:
> i would like to know how you can change the comment character from # to
> something else for a different programming language.  [...]

You set the comment character in the syntax file for the relevant language.

> I try to put
>
> comment "//"
>
> in my .nanorc file, but the program just gives me an error and the default
> comment remains a #. What's the proper way to change this setting?

There is no way to change the default comment character _globally_ -- you
can only change the comment character per syntax.  As 'man nanorc' says:

  For each kind of file a separate syntax can be defined via the following
  commands:

  syntax name ["fileregex" ...]
        Start the definition of a syntax with this name.  All subsequent
        color and other such commands will be added to this syntax, until
        a new syntax command is encountered.

(And the 'comment' command is one of these subsequent commands.)

Benno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature

------------------------------

Subject: Digest Footer

_______________________________________________
Help-nano mailing list


------------------------------

End of Help-nano Digest, Vol 177, Issue 1
*****************************************

reply via email to

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