Is there an existing request for this?
Is your feature request related to a problem?
When opening /etc/ssh/sshd_config (or /etc/ssh/ssh_config, and their *.d/*.conf drop-ins) in mcedit, no syntax highlighting is applied and Options -> Syntax Highlighting shows unknown. These are among the most commonly edited system files on any Linux host, and editing them with highlighting would be nice.
The reason is that misc/syntax/Syntax.in only maps files whose name ends in .cfg, .cnf, or .conf to conf.syntax:
file ..\*\\.(?i:cfg|cnf|conf)$ Config\sfile
include conf.syntax
Since sshd_config and ssh_config use an underscore and have no extension, they fall through to the final file .\* unknown rule and get unknown.syntax.
Describe the solution you'd like
Map OpenSSH's canonical config filenames to a syntax definition by default. Two reasonable options:
-
Minimal (preferred for a first step) — reuse the existing generic conf.syntax. In misc/syntax/Syntax.in, before the unknown catch-all, add:
file (.*/)?ssh(d)?_config(\\..*)?$ OpenSSH\sconfig\sfile
include conf.syntax
This covers ssh_config, sshd_config, and drop-ins under ssh_config.d/ / sshd_config.d/ (e.g. 50-cloud-init.conf users typically also have a parent ssh_config to edit). It immediately fixes the "unknown" status and gives #-comments, quoted strings, numbers, and = highlighting from conf.syntax.
-
Nicer (optional follow-up) — ship a dedicated misc/syntax/sshd.syntax (or openssh.syntax) that additionally highlights the well-known OpenSSH keywords as defined in sshd_config(5) and ssh_config(5) — e.g. Host, Match, Port, ListenAddress, PermitRootLogin, PasswordAuthentication, PubkeyAuthentication, AuthorizedKeysFile, AllowUsers, Ciphers, MACs, KexAlgorithms, HostKey, Subsystem, Include, etc., and the yes/no/prohibit-password value tokens. Then point the Syntax.in rule above at it instead of conf.syntax.
Either way, the user-visible improvement is: opening sshd_config in mcedit no longer shows "unknown" and gets at least baseline coloring out of the box.
Describe alternatives you've considered
- Temporarily tenaming/symlinking system files to
sshd.conf so the existing *.conf rule kicks is
- Relying on the first-line regex in
Syntax.in. sshd_config typically starts with # $OpenBSD: sshd_config,v ... but it's not unique enough to safely key off, so a filename rule is the right place.
Additional context
Happy to send a PR for option 1 (one-liner in Syntax.in) and if desired, a follow-up PR adding a dedicated sshd.syntax.
Is there an existing request for this?
Is your feature request related to a problem?
When opening
/etc/ssh/sshd_config(or/etc/ssh/ssh_config, and their*.d/*.confdrop-ins) inmcedit, no syntax highlighting is applied and Options -> Syntax Highlighting showsunknown. These are among the most commonly edited system files on any Linux host, and editing them with highlighting would be nice.The reason is that
misc/syntax/Syntax.inonly maps files whose name ends in.cfg,.cnf, or.conftoconf.syntax:Since
sshd_configandssh_configuse an underscore and have no extension, they fall through to the finalfile .\* unknownrule and getunknown.syntax.Describe the solution you'd like
Map OpenSSH's canonical config filenames to a syntax definition by default. Two reasonable options:
Minimal (preferred for a first step) — reuse the existing generic
conf.syntax. Inmisc/syntax/Syntax.in, before theunknowncatch-all, add:This covers
ssh_config,sshd_config, and drop-ins underssh_config.d//sshd_config.d/(e.g.50-cloud-init.confusers typically also have a parentssh_configto edit). It immediately fixes the "unknown" status and gives#-comments, quoted strings, numbers, and=highlighting fromconf.syntax.Nicer (optional follow-up) — ship a dedicated
misc/syntax/sshd.syntax(oropenssh.syntax) that additionally highlights the well-known OpenSSH keywords as defined insshd_config(5)andssh_config(5)— e.g.Host,Match,Port,ListenAddress,PermitRootLogin,PasswordAuthentication,PubkeyAuthentication,AuthorizedKeysFile,AllowUsers,Ciphers,MACs,KexAlgorithms,HostKey,Subsystem,Include, etc., and theyes/no/prohibit-passwordvalue tokens. Then point theSyntax.inrule above at it instead ofconf.syntax.Either way, the user-visible improvement is: opening
sshd_configin mcedit no longer shows "unknown" and gets at least baseline coloring out of the box.Describe alternatives you've considered
sshd.confso the existing*.confrule kicks isSyntax.in.sshd_configtypically starts with# $OpenBSD: sshd_config,v ...but it's not unique enough to safely key off, so a filename rule is the right place.Additional context
Happy to send a PR for option 1 (one-liner in
Syntax.in) and if desired, a follow-up PR adding a dedicatedsshd.syntax.