Skip to content

Commit

Permalink
Add syntax and completion files
Browse files Browse the repository at this point in the history
Syntax for vim (very minimalistic) and completions for zsh
  • Loading branch information
AMDmi3 committed Apr 1, 2024
1 parent 87977d7 commit c214e81
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
8 changes: 8 additions & 0 deletions share/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PREFIX?= /usr/local

all:
@echo 'run `${MAKE} install` to install additional files'

install:
install -m 644 completion-zsh.sh "${DESTDIR}${PREFIX}/share/zsh/site-functions/_omnilinter"
install -m 644 syntax.vim "${DESTDIR}${PREFIX}/share/vim/vimfiles/syntax/omnilinter.vim"
14 changes: 14 additions & 0 deletions share/completion-zsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#compdef omnilinter

_arguments \
'*'{-c+,--config=}'[Path(s) to configuration file(s)]:file:_files' \
'(-t --tags)'{-t+,--tags=}'[Only process rules tagged with these values]:tag:' \
'--skip-tags=[Ignore rules tagged with these values]:tag:' \
'(-f --format)'{-f+,--format=}'[Output format]:format:(by-root full-paths by-rule by-path json)' \
'--color=[Coloring]:mode:(auto always never)' \
'--palette=[Palette to use for rule coloring]:palette:(none simple severity true-color)' \
'--error-exitcode=[If any matches are found, exit with given code]:exit code:' \
{-j+,--jobs=}'[Number of target directories to process simultaneously]:number:' \
'(* -)'{-h,--help}'[Print help]' \
'(* -)'{-V,--version}'[Print version]' \
'*:directory:_files -/'
25 changes: 25 additions & 0 deletions share/syntax.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
" Vim syntax file
" Language: omnilinter config file
" Maintainer: Dmitry Marakasov <[email protected]>

if exists("b:current_syntax")
finish
endif

syn keyword omnilinterTodo contained TODO FIXME XXX
syn match omnilinterIgnore contained "omnilinter: ignore"
syn match omnilinterComment "#.*" contains=omnilinterIgnore,omnilinterTodo,@Spell
syn match omnilinterTag "[^ \t,]\+" contained

syn region omnilinterRuleTitle skipwhite keepend start=+\[+ skip=+\]\]+ end=+\]+
syn keyword omnilinterDirective tags files nofiles match nomatch size lines
syn region omnilinterDirectiveTags matchgroup=omnilinterDirective start=+^\s*tags+ skip=+,+ end=+\s*$+ contains=omnilinterTag

hi def link omnilinterComment Comment
hi def link omnilinterRuleTitle Keyword
hi def link omnilinterDirective Identifier
hi def link omnilinterIgnore SpecialComment
hi def link omnilinterTodo Todo
hi def link omnilinterTag String

let b:current_syntax = "omnilinter"

0 comments on commit c214e81

Please sign in to comment.