mirror of
https://github.com/neovim/neovim.git
synced 2026-07-10 19:39:38 +00:00
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>
32 lines
1.5 KiB
VimL
32 lines
1.5 KiB
VimL
" Vim syntax file
|
|
" Language: OpenSSH allowed signers file
|
|
" Author: Fionn Fitzmaurice (github.com/fionn)
|
|
" Maintainer: Fionn Fitzmaurice (github.com/fionn)
|
|
" License: Vim & Apache 2.0
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
syn match sshAllowedSignersPrincipal "!\?[a-zA-Z0-9.*?_+-]\+@[a-zA-Z0-9.*?-]\+" nextgroup=sshAllowedSignersPrincipalSeparator,sshAllowedSignersOptions,sshKeyType skipwhite
|
|
syn match sshAllowedSignersPrincipalSeparator "," contained nextgroup=sshAllowedSignersPrincipal
|
|
|
|
syn region sshAllowedSignersOptions start="[a-z]" end="\s\@=" contains=@sshAllowedSignersOption nextgroup=sshKeyType skipwhite oneline contained
|
|
syn cluster sshAllowedSignersOption contains=sshAllowedSignersOptionKeyword,sshAllowedSignersOptionSeparator,sshAllowedSignersOptionAssignment,sshAllowedSignersOptionValue
|
|
syn keyword sshAllowedSignersOptionKeyword namespaces cert-authority valid-after valid-before contained
|
|
syn match sshAllowedSignersOptionSeparator "," contained
|
|
syn match sshAllowedSignersOptionAssignment "=" contained
|
|
syn match sshAllowedSignersOptionValue '"\(\\\"\|[^"]\)*"' contained
|
|
|
|
runtime! syntax/sshpublickey.vim
|
|
|
|
hi def link sshAllowedSignersPrincipal Identifier
|
|
hi def link sshAllowedSignersPrincipalSeparator Punctuation
|
|
|
|
hi def link sshAllowedSignersOptionKeyword Keyword
|
|
hi def link sshAllowedSignersOptionSeparator Punctuation
|
|
hi def link sshAllowedSignersOptionAssignment Operator
|
|
hi def link sshAllowedSignersOptionValue String
|
|
|
|
let b:current_syntax = "sshallowedsigners"
|