Re: changing the default comment string for nano -- not possible

Benno Schulenberg <[email protected]> Thu, 8 Dec 2022 16:03:23 +0100
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
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
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed