Add hive syntax, closes #396

This commit is contained in:
Adam Stankiewicz 2019-06-08 12:50:29 +02:00
parent 957228cc25
commit 5023da62ec
5 changed files with 157 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. > 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 **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->136<!--/Package Count--> packages it consists of. - It **installs and updates 120+ times faster** than the <!--Package Count-->137<!--/Package Count--> packages it consists of.
- Solid syntax and indentation support (other features skipped). Only the best language packs. - Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support). - All unnecessary files are ignored (like enormous documentation from php support).
- No support for esoteric languages, only most popular ones (modern too, like `slim`). - No support for esoteric languages, only most popular ones (modern too, like `slim`).
@ -91,6 +91,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax) - [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin) - [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax) - [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
- [hive](https://github.com/zebradil/hive.vim) (syntax, ftplugin)
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin) - [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
- [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin) - [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin)
- [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin) - [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin)

1
build
View File

@ -199,6 +199,7 @@ PACKS="
haproxy:CH-DanReif/haproxy.vim haproxy:CH-DanReif/haproxy.vim
haskell:neovimhaskell/haskell-vim haskell:neovimhaskell/haskell-vim
haxe:yaymukund/vim-haxe haxe:yaymukund/vim-haxe
hive:zebradil/hive.vim
html5:othree/html5.vim html5:othree/html5.vim
i3:mboughaba/i3config.vim i3:mboughaba/i3config.vim
idris:idris-hackers/idris-vim idris:idris-hackers/idris-vim

View File

@ -504,6 +504,15 @@ autocmd BufNewFile,BufRead *.hx setf haxe
augroup end augroup end
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'hive') == -1
augroup filetypedetect
" hive, from hive.vim in zebradil/hive.vim
autocmd BufNewFile,BufRead *.hql set filetype=hive
autocmd BufNewFile,BufRead *.ql set filetype=hive
autocmd BufNewFile,BufRead *.q set filetype=hive
augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
augroup filetypedetect augroup filetypedetect
" i3, from i3config.vim in mboughaba/i3config.vim " i3, from i3config.vim in mboughaba/i3config.vim

6
ftplugin/hive.vim Normal file
View File

@ -0,0 +1,6 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hive') != -1
finish
endif
setlocal comments=:--
setlocal commentstring=--\ %s

139
syntax/hive.vim Normal file
View File

@ -0,0 +1,139 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hive') != -1
finish
endif
" Vim syntax file
" Language: HIVE Query Language
" Maintainer: German Lashevich <german.lashevich@gmail.com>
" Last Change: 2019-04-30
if exists("b:current_syntax")
finish
endif
syn case ignore
syn keyword sqlSpecial false null true
syn keyword sqlKeyword access add as asc begin check cluster column
syn keyword sqlKeyword compress connect current cursor decimal default desc
syn keyword sqlKeyword if else elsif end exception exclusive file for from
syn keyword sqlKeyword function having identified immediate increment
syn keyword sqlKeyword index initial into level loop maxextents mode modify
syn keyword sqlKeyword nocompress nowait of offline on online start
syn keyword sqlKeyword successful synonym table partition then to trigger uid
syn keyword sqlKeyword unique user validate values view whenever hivevar
syn keyword sqlKeyword where with option pctfree privileges procedure limit
syn keyword sqlKeyword public resource return row rowlabel rownum rows
syn keyword sqlKeyword session share size smallint type using cross full outer left join right inner
syn keyword sqlKeyword format delimited fields terminated collection items external window msck repair
syn keyword sqlKeyword stored sequencefile partitioned data local inpath overwrite clustered buckets sorted
syn keyword sqlKeyword keys extended textfile location distribute directory tablesample using reduce lateral
syn keyword sqlKeyword case when database serde serdeproperties inputformat outputformat over
syn keyword sqlKeyword unbounded preceding parquet tblproperties
syn keyword sqlKeyword dmin after archive before bucket cascade change
syn keyword sqlKeyword lusterstatus columns compact compactions compute
syn keyword sqlKeyword oncatenate continue databases datetime dbproperties
syn keyword sqlKeyword eferred defined dependency directories disable elem_type
syn keyword sqlKeyword nable escaped export fileformat first formatted
syn keyword sqlKeyword unctions hold_ddltime idxproperties ignore indexes
syn keyword sqlKeyword nputdriver jar key_type lines locks logical long mapjoin
syn keyword sqlKeyword aterialized metadata noscan no_drop outputdriver owner
syn keyword sqlKeyword artitions plus pretty principals protection purge read
syn keyword sqlKeyword eadonly rebuild recordreader recordwriter reload replace
syn keyword sqlKeyword eplication restrict rewrite role roles schema schemas
syn keyword sqlKeyword emi server sets shared show show_database skewed sort
syn keyword sqlKeyword sl statistics streamtable tables temporary touch
syn keyword sqlKeyword ransactions unarchive undo uniontype unlock unset
syn keyword sqlKeyword nsigned uri utc utctimestamp value_type while
syn keyword sqlKeyword uthorization both by conf cube current_timestamp
syn keyword sqlKeyword xchange fetch following group grouping import interval
syn keyword sqlKeyword ess macro more none order partialscan percent preserve
syn keyword sqlKeyword ange reads rollup uniquejoin utc_tmestamp autocommit
syn keyword sqlKeyword solation offset snapshot transaction work write only
syn keyword sqlKeyword bort key last norely novalidate nulls rely cache
syn keyword sqlKeyword onstraint foreign primary references detail dow
syn keyword sqlKeyword xpression operator quarter summary vectorization week
syn keyword sqlKeyword ears months weeks days hours minutes seconds dayofweek
syn keyword sqlKeyword xtract integer precision views timestamptz zone time
syn keyword sqlKeyword umeric sync
syn match sqlKeyword 'group\s\+by'
syn match sqlKeyword 'order\s\+by'
syn keyword sqlOperator not and or < <= == >= > <> != is
syn keyword sqlOperator in any some all between exists
syn keyword sqlOperator like escape rlike regexp
syn keyword sqlOperator union intersect minus
syn keyword sqlOperator prior distinct isnull count
syn keyword sqlOperator sysdate out
syn keyword sqlOperator round floor ceil rand concat substr upper ucase
syn keyword sqlOperator lower lcase trim ltrim rtrim regexp_replace size
syn keyword sqlOperator coalesce cast from_unixtime to_date year month day get_json_object
syn keyword sqlOperator current_date add_months row_number date_format first_value
syn keyword sqlOperator sum avg min max transform
syn keyword sqlOperator variance var_samp stddev_pop stddev_samp
syn keyword sqlOperator covar_pop covar_samp corr percentile percentil_approx
syn keyword sqlOperator histogram_numeric collect_set inline explode
syn keyword sqlOperator exp ln log10 log2 log pow sqrt bin hex unhex conv
syn keyword sqlOperator abs pmod sin asin cos acos tan atan degrees radians
syn keyword sqlOperator positive negative sign e pi binary
syn keyword sqlOperator map_keys map_values array_contains sort_array
syn keyword sqlOperator unix_timestamp dayofmonth hour minute second weekofyear
syn keyword sqlOperator datediff date_add date_sub from_utc_timestamp to_utc_timestamp
syn keyword sqlOperator ascii context_ngrams concate_ws find_in_set format_number
syn keyword sqlOperator in_file instr length locate lpad ltrim ngrams parse_url
syn keyword sqlOperator printf regexp_extract repeat reverse rpad trim sentences
syn keyword sqlOperator space split str_to_map translate trim java_method reflect
syn keyword sqlOperator xpath xpath_string xpath_boolean xpath_short xpath_int xpath_long xpath_float xpath_double xpath_number
syn keyword sqlStatement alter analyze audit comment commit create
syn keyword sqlStatement delete drop execute explain grant insert lock noaudit
syn keyword sqlStatement rename revoke rollback savepoint select set
syn keyword sqlStatement truncate update describe load use
syn keyword sqlType tinyint smallint int bigint float double boolean string
syn keyword sqlType array map struct named_struct create_union timestamp date varchar char
syn match hiveVar "hive\.[a-zA-Z.]\+"
syn match hiveVar "mapred\.[a-zA-Z.]\+"
" Strings and characters:
syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+
" Numbers:
syn match sqlNumber "[-+]\=\d\+[ISL]\="
" Floating point number with decimal no E or e
syn match sqlNumber '[-+]\=\d\+\.\d\+'
" Floating point like number with E and no decimal point (+,-)
syn match sqlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+'
syn match sqlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+'
" Floating point like number with E and decimal point (+,-)
syn match sqlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match sqlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
" Comments:
syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
syn match sqlComment "--.*$" contains=sqlTodo
syn sync ccomment sqlComment
" Todo
syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE
hi link sqlComment Comment
hi link sqlKeyword Identifier
hi link sqlNumber Number
hi link sqlOperator Constant
hi link sqlSpecial Special
hi link sqlStatement Statement
hi link sqlString String
hi link sqlType Type
hi link sqlTodo Todo
hi link hiveVar Special
let b:current_syntax = "hive"
" vim: ts=4