aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAnna “CyberTailor” <cyber@sysrq.in>2021-07-11 17:14:04 +0500
committerOmar Polo <op@omarpolo.com>2021-07-11 14:27:31 +0200
commit1a115616cb276d48b468e6c647beef116ade36a9 (patch)
treef509b092442fe6da33dad6b0c8035a508dc65073 /contrib
parent8068d2ff33992fcaf0e5f38bc7b3d86789e7e92e (diff)
add simple vim syntax file
Diffstat (limited to 'contrib')
-rw-r--r--contrib/README6
-rw-r--r--contrib/vim/ftdetect/gmid.vim7
-rw-r--r--contrib/vim/ftplugin/gmid.vim10
-rw-r--r--contrib/vim/indent/gmid.vim11
-rw-r--r--contrib/vim/syntax/gmid.vim92
5 files changed, 126 insertions, 0 deletions
diff --git a/contrib/README b/contrib/README
new file mode 100644
index 0000000..1457ba5
--- /dev/null
+++ b/contrib/README
@@ -0,0 +1,6 @@
+This directory is for additional contributed files which may be useful.
+
+vim
+
+ Syntax highlighting of gmid configuration for vim, to be
+ placed into ~/.vim/ or /usr/share/vim/vimfiles.
diff --git a/contrib/vim/ftdetect/gmid.vim b/contrib/vim/ftdetect/gmid.vim
new file mode 100644
index 0000000..2a1290c
--- /dev/null
+++ b/contrib/vim/ftdetect/gmid.vim
@@ -0,0 +1,7 @@
+" Vim filetype detection file
+" Language: gmid(1) configuration files
+" Licence: ISC
+
+au BufNewFile,BufRead *.gmid set filetype=gmid
+au BufNewFile,BufRead */etc/gmid/* set filetype=gmid
+au BufNewFile,BufRead gmid.conf set filetype=gmid
diff --git a/contrib/vim/ftplugin/gmid.vim b/contrib/vim/ftplugin/gmid.vim
new file mode 100644
index 0000000..07315b4
--- /dev/null
+++ b/contrib/vim/ftplugin/gmid.vim
@@ -0,0 +1,10 @@
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+let b:undo_ftplugin = "setl cms< sua<"
+
+setlocal suffixesadd+=.conf,.gmid
+
+" vim-commentary support
+setlocal commentstring=#\ %s
diff --git a/contrib/vim/indent/gmid.vim b/contrib/vim/indent/gmid.vim
new file mode 100644
index 0000000..ea05ce5
--- /dev/null
+++ b/contrib/vim/indent/gmid.vim
@@ -0,0 +1,11 @@
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=
+
+" cindent actually works for simple file structure
+setlocal cindent
+" Just make sure that the comments are not reset as defs would be.
+setlocal cinkeys-=0#
diff --git a/contrib/vim/syntax/gmid.vim b/contrib/vim/syntax/gmid.vim
new file mode 100644
index 0000000..68526cd
--- /dev/null
+++ b/contrib/vim/syntax/gmid.vim
@@ -0,0 +1,92 @@
+" Vim syntax file
+" Language: gmid(1) configuration files
+" Licence: ISC
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Syntax Definition: {{{1
+" ==================
+syn case match
+setlocal iskeyword+=-
+
+" Value Types: {{{2
+" ============
+syn keyword gmidBoolean on
+syn keyword gmidBoolean off
+
+syn match gmidNumber "\<\d\+\>" display
+
+syn region gmidQuotedString start=+"+ end=+"+ skip=+\\"+
+syn region gmidQuotedString start=+'+ end=+'+ skip=+\\'+
+
+syn match gmidVariable "\$\w\w*" display
+syn match gmidMacro "@\w\w*" display
+
+" Errors: {{{2
+" ============
+" TODO: write comprehensive syntax rules so it can be checked with:
+" syn match gmidError '.'
+syn keyword gmidDirectiveDeprecated mime
+
+" Comments: {{{2
+" =========
+syn match gmidComment "\s*#.*$" display
+
+" Global Options: {{{2
+" ===============
+syn keyword gmidDirective chroot
+syn keyword gmidDirective include
+syn keyword gmidDirective ipv6 nextgroup=gmidBoolean skipwhite
+syn keyword gmidDirective map
+syn keyword gmidDirectiveContinuation to-ext
+syn keyword gmidDirective port nextgroup=gmidNumber skipwhite
+syn keyword gmidDirective prefork nextgroup=gmidNumber skipwhite
+syn keyword gmidDirective protocols
+syn keyword gmidDirective user
+
+" Server Blocks: {{{2
+" ==============
+syn region gmidBlock start="{" end="}" fold transparent
+
+syn keyword gmidDirectiveBlock server
+syn keyword gmidDirectiveBlock location
+
+syn keyword gmidDirective alias
+syn match gmidDirective "\<auto\s\+index\>" nextgroup=gmidBoolean skipwhite display
+syn keyword gmidDirective block
+syn keyword gmidDirectiveContinuation return nextgroup=gmidNumber skipwhite
+syn keyword gmidDirective cert
+syn keyword gmidDirective cgi
+syn match gmidDirective "\<default\s\+type>" display
+syn keyword gmidDirective entrypoint
+syn keyword gmidDirective fastcgi
+syn keyword gmidDirectiveContinuation tcp
+syn keyword gmidDirective index
+syn keyword gmidDirective key
+syn keyword gmidDirective lang
+syn keyword gmidDirective log nextgroup=gmidBoolean skipwhite
+syn keyword gmidDirective param
+syn keyword gmidDirective root
+syn match gmidDirective "\<require\s\+client\s\+ca>" display
+syn keyword gmidDirective strip nextgroup=gmidNumber skipwhite
+
+" Highlighting Settings: {{{1
+" ======================
+
+hi def link gmidComment Comment
+
+hi def link gmidBoolean Boolean
+hi def link gmidNumber Number
+hi def link gmidQuotedString String
+
+hi def link gmidVariable Identifier
+hi def link gmidMacro Macro
+
+hi def link gmidDirective Keyword
+hi def link gmidDirectiveBlock Function
+hi def link gmidDirectiveContinuation Type
+hi def link gmidDirectiveDeprecated Error
+
+let b:current_syntax = "gmid"