mirror of
https://github.com/neovim/neovim.git
synced 2026-07-17 22:51:20 +00:00
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:
25
runtime/syntax/sshauthorizedkeys.vim
Normal file
25
runtime/syntax/sshauthorizedkeys.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Vim syntax file
|
||||
" Language: OpenSSH authorized keys 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 region sshAuthorizedKeyOptions start="^[a-z]" end="\s" contains=@sshAuthorizedKeyOption nextgroup=sshKeyType skipwhite oneline
|
||||
syn cluster sshAuthorizedKeyOption contains=sshAuthorizedKeyOptionKeyword,sshAuthorizedKeyOptionSeparator,sshAuthorizedKeyOptionAssignment,sshAuthorizedKeyOptionValue
|
||||
syn match sshAuthorizedKeyOptionKeyword "[a-z-]\+" contained
|
||||
syn match sshAuthorizedKeyOptionSeparator "," contained
|
||||
syn match sshAuthorizedKeyOptionAssignment "=" contained
|
||||
syn match sshAuthorizedKeyOptionValue '"\(\\\"\|[^"]\)*"' contained
|
||||
|
||||
runtime! syntax/sshpublickey.vim
|
||||
|
||||
hi def link sshAuthorizedKeyOptionKeyword Keyword
|
||||
hi def link sshAuthorizedKeyOptionSeparator Punctuation
|
||||
hi def link sshAuthorizedKeyOptionAssignment Operator
|
||||
hi def link sshAuthorizedKeyOptionValue String
|
||||
|
||||
let b:current_syntax = "sshauthorizedkeys"
|
||||
Reference in New Issue
Block a user