mirror of
https://github.com/neovim/neovim.git
synced 2026-07-11 03:49:41 +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>
31 lines
1.2 KiB
VimL
31 lines
1.2 KiB
VimL
" Vim syntax file
|
|
" Language: OpenSSH public key
|
|
" Author: Fionn Fitzmaurice (github.com/fionn)
|
|
" Maintainer: Fionn Fitzmaurice (github.com/fionn)
|
|
" License: Vim & Apache 2.0
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
setlocal iskeyword=_,.,@-@,-,a-z,A-Z,48-57
|
|
|
|
syn keyword sshKeyType ssh-ed25519 nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType sk-ssh-ed25519@openssh.com nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType ecdsa-sha2-nistp256 nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType ecdsa-sha2-nistp384 nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType ecdsa-sha2-nistp521 nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType sk-ecdsa-sha2-nistp256@openssh.com nextgroup=sshKeyBase64Encoded skipwhite
|
|
syn keyword sshKeyType ssh-rsa nextgroup=sshKeyBase64Encoded skipwhite
|
|
|
|
syn match sshKeyBase64Encoded "AAAA[a-zA-Z0-9/+]\{64,8000}=\{,2}" contained nextgroup=sshKeyComment
|
|
syn match sshKeyComment ".*$" contained
|
|
|
|
syn match sshKeyComment "#.*$"
|
|
|
|
hi def link sshKeyType Type
|
|
hi def link sshKeyBase64Encoded String
|
|
hi def link sshKeyComment Comment
|
|
|
|
let b:current_syntax = "sshpublickey"
|