Add tptp syntax

This commit is contained in:
Adam Stankiewicz 2019-06-08 12:46:43 +02:00
parent 671078ef6c
commit 7aae831309
4 changed files with 168 additions and 1 deletions

View File

@ -10,7 +10,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->134<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->135<!--/Package Count--> packages it consists of.
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
@ -166,6 +166,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin)
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin)
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent)

1
build
View File

@ -274,6 +274,7 @@ PACKS="
tmux:keith/tmux.vim
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
tptp:c-cube/vim-tptp
twig:lumiliet/vim-twig
typescript:leafgarland/typescript-vim
vala:arrufat/vala.vim

View File

@ -1343,6 +1343,19 @@ autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,*/.cargo
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tptp') == -1
augroup filetypedetect
" tptp, from tptp.vim in c-cube/vim-tptp
au BufRead,BufNewFile *.p set filetype=tptp
au BufRead,BufNewFile *.p set syntax=tptp
au BufRead,BufNewFile *.tptp set filetype=tptp
au BufRead,BufNewFile *.tptp set syntax=tptp
au BufRead,BufNewFile *.ax set filetype=tptp
au BufRead,BufNewFile *.ax set syntax=tptp
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
augroup filetypedetect
" twig, from twig.vim in lumiliet/vim-twig

152
syntax/tptp.vim Normal file
View File

@ -0,0 +1,152 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tptp') != -1
finish
endif
" Vim syntax file
" Language: TPTP
" Filename extensions: *.p (collides with Pascal/Progress),
" Maintainer: Simon Cruanes (heavily inspired from progress.vim file)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
"elseif exists("b:current_syntax")
" finish
endif
if version >= 600
setlocal iskeyword=@,48-57,_,-,!,#,$,%
else
set iskeyword=@,48-57,_,-,!,#,$,%
endif
" tabs = evil
set expandtab
syn case match
syn keyword tptpRole axiom hypothesis definition assumption lemma theorem corollary conjecture negated_conjecture plain fi_domain fi_functors fi_predicates type unknown
syn keyword tptpLogic fof tff thf cnf include
syn match tptpBuiltin "$o\>"
syn match tptpBuiltin "$i\>"
syn match tptpBuiltin "$true\>"
syn match tptpBuiltin "$false\>"
syn match tptpBuiltin "$int\>"
syn match tptpBuiltin "$rat\>"
syn match tptpBuiltin "$real\>"
syn match tptpBuiltin "$tType\>"
syn match tptpBuiltin "$_\>"
syn match tptpBuiltin "$floor"
syn match tptpBuiltin "$ceiling"
syn match tptpBuiltin "$truncate"
syn match tptpBuiltin "$round"
syn match tptpBuiltin "$prec"
syn match tptpBuiltin "$succ"
syn match tptpBuiltin "$sum"
syn match tptpBuiltin "$difference"
syn match tptpBuiltin "$uminus"
syn match tptpBuiltin "$product"
syn match tptpBuiltin "$quotient"
syn match tptpBuiltin "$quotient_e"
syn match tptpBuiltin "$quotient_t"
syn match tptpBuiltin "$quotient_f"
syn match tptpBuiltin "$remainder_e"
syn match tptpBuiltin "$remainder_t"
syn match tptpBuiltin "$remainder_f"
syn match tptpBuiltin "$is_int"
syn match tptpBuiltin "$is_rat"
syn match tptpBuiltin "$to_int"
syn match tptpBuiltin "$to_rat"
syn match tptpBuiltin "$less"
syn match tptpBuiltin "$lesseq"
syn match tptpBuiltin "$greater"
syn match tptpBuiltin "$greatereq"
" generic dollar
syn match tptpDollar "\<\$\w+\>"
syn match tptpDollarDollar "\<\$\$\w+\>"
syn match tptpQuote "'[^']*'"
syn match tptpDoubleQuote "\"[^"]*\""
syn match tptpConnective ":"
syn match tptpConnective "|"
syn match tptpConnective "&"
syn match tptpConnective "="
syn match tptpConnective "=>"
syn match tptpConnective "<="
syn match tptpConnective "<=>"
syn match tptpConnective "<\~>"
syn match tptpConnective "!"
syn match tptpConnective "?"
syn match tptpConnective "!>"
syn match tptpConnective "!="
syn match tptpConnective "\~"
syn match tptpConnective "\."
syn match tptpConnective "\*"
syn match tptpConnective ">"
syn match tptpVar "\<\u\w*\>"
syn match tptpNum "\<-\?[0-9]\+\>"
syn match tptpNum "\<-\?[0-9]\+/[0-9]\+\>"
" errors
"syn match tptpBraceError "\]"
"syn match tptpParenError ")"
" delimiters
syn region tptpParen matchgroup=tptpDelim start="(" end=")" contains=ALLBUT,tptpParenError keepend contained
syn region tptpParen matchgroup=tptpDelim start="\[" end="\]" contains=ALLBUT,tptpBraceError keepend contained
syn keyword tptpTodo contained TODO BUG FIX FIXME NOTE
syn region tptpComment start=+/\*+ end=+\*/+ contains=tptpTodo
syn match tptpComment +%.*+ contains=tptpTodo
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_tptp_syntax_inits")
if version < 508
let did_tptp_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink tptpTodo Todo
HiLink tptpComment Comment
HiLink tptpComment Comment
HiLink tptpRole Keyword
HiLink tptpLogic Keyword
HiLink tptpConnective Keyword
HiLink tptpDelim Delimiter
HiLink tptpBuiltin Special
HiLink tptpDollar String
HiLink tptpDollarDollar String
HiLink tptpQuote String
HiLink tptpDoubleQuote String
HiLink tptpVar Constant
HiLink tptpNum Number
HiLink tptpBraceError Error
HiLink tptpParenError Error
delcommand HiLink
end
let b:current_syntax = "tptp"
" vim: ts=8 sw=8