vim-patch:9.2.0742: filetype: SSH keys and related filetypes not recognized (#40469)

Problem:  filetype: SSH keys and related filetypes not recognized
Solution: Detect sshpublickey, sshknownhosts sshauthorizedkeys and
          sshallowedsigners filetypes, add syntax scripts for those
          filetypes (Fionn Fitzmaurice)

This adds syntax highlighting for SSH public keys, as well as related
filetypes derived from this (SSH authorized keys, SSH known hosts and
SSH allowed signers).

Also add filetype detection based on the path and name.

closes: vim/vim#20635

6e66ebc0fd

Co-authored-by: Fionn Fitzmaurice <git@fionn.computer>
This commit is contained in:
zeertzjq
2026-06-29 07:48:17 +08:00
committed by GitHub
parent 4d18693c49
commit 84cd87908e
6 changed files with 127 additions and 3 deletions

View File

@@ -1279,6 +1279,7 @@ local extension = {
srt = 'srt',
ssa = 'ssa',
ass = 'ssa',
allowed_signers = 'sshallowedsigners',
st = 'st',
ipd = 'starlark',
sky = 'starlark',
@@ -1981,8 +1982,9 @@ local filename = {
Snakefile = 'snakemake',
['.sqlite_history'] = 'sql',
['squid.conf'] = 'squid',
['ssh_config'] = 'sshconfig',
['sshd_config'] = 'sshdconfig',
allowed_signers = 'sshallowedsigners',
ssh_config = 'sshconfig',
sshd_config = 'sshdconfig',
['/etc/sudoers'] = 'sudoers',
['sudoers.tmp'] = 'sudoers',
['/etc/sysctl.conf'] = 'sysctl',
@@ -2181,9 +2183,11 @@ local pattern = {
['/etc/slp%.conf$'] = 'slpconf',
['/etc/slp%.reg$'] = 'slpreg',
['/etc/slp%.spi$'] = 'slpspi',
['/etc/sudoers%.d/'] = starsetf('sudoers'),
['/etc/ssh/ssh_config%.d/.*%.conf$'] = 'sshconfig',
['/etc/ssh/sshd_config%.d/.*%.conf$'] = 'sshdconfig',
['^/etc/ssh/ssh_known_hosts$'] = 'sshknownhosts',
['^/etc/ssh/.+%.pub$'] = 'sshpublickey',
['/etc/sudoers%.d/'] = starsetf('sudoers'),
['/etc/sudoers$'] = 'sudoers',
['/etc/sysctl%.conf$'] = 'sysctl',
['/etc/sysctl%.d/.*%.conf$'] = 'sysctl',
@@ -2543,6 +2547,9 @@ local pattern = {
['/%.pinforc$'] = 'pinfo',
['^${HOME}/%.xinitrc$'] = 'sh',
['^${HOME}/%.xserverrc$'] = 'sh',
['/%.ssh/authorized_keys$'] = 'sshauthorizedkeys',
['/%.ssh/known_hosts$'] = 'sshknownhosts',
['/%.ssh/.+%.pub$'] = 'sshpublickey',
['/%.cargo/credentials$'] = 'toml',
['/%.init/.*%.override$'] = 'upstart',
['/%.kube/kuberc$'] = 'yaml',