diff options
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | build | 1 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 6 | ||||
-rw-r--r-- | syntax/cql.vim | 134 |
4 files changed, 142 insertions, 0 deletions
@@ -33,6 +33,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin) - [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect) - [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect) +- [cql](https://github.com/elubow/cql-vim) (syntax, ftdetect) - [css](https://github.com/JulesWang/css.vim) (syntax) - [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect) - [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin, ftdetect) @@ -104,6 +104,7 @@ PACKS=" cjsx:mtscout6/vim-cjsx clojure:guns/vim-clojure-static coffee-script:kchmck/vim-coffee-script + cql:elubow/cql-vim css:JulesWang/css.vim cucumber:tpope/vim-cucumber dart:dart-lang/dart-vim-plugin diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index ee6cd63a..80938e78 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -45,6 +45,12 @@ function! s:DetectCoffee() endfunction autocmd BufNewFile,BufRead * call s:DetectCoffee() endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cql') == -1 + +if has("autocmd") + au BufNewFile,BufRead *.cql set filetype=cql +endif +endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cucumber') == -1 autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber diff --git a/syntax/cql.vim b/syntax/cql.vim new file mode 100644 index 00000000..616f7af3 --- /dev/null +++ b/syntax/cql.vim @@ -0,0 +1,134 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cql') == -1 + +" Vim syntax file +" Language: cql +" Maintainer: Eric Lubow <eric@lubow.org +" Filenames: *.cql +" URL: https://github.com/elubow/cql-vim +" Note: + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Always ignore case +syn case ignore + +" General keywords which don't fall into other categories +syn keyword cqlKeyword apply and batch +syn keyword cqlKeyword column columnfamily create delete drop +syn keyword cqlKeyword family first from +syn keyword cqlKeyword in index insert into +syn keyword cqlKeyword limit key keyspace +syn keyword cqlKeyword on or primary reversed +syn keyword cqlKeyword select set truncate +syn keyword cqlKeyword where with update use using values + +" CQL 3 additions +syn keyword cqlKeyword table order by type if exists not frozen + + +" Column family/table options +syn keyword cqlKeyword comparator key_cache_size row_cache_size read_repair_chance +syn keyword cqlKeyword gc_grace_seconds default_validation min_compaction_threshold +syn keyword cqlKeyword max_compaction_threshold row_cache_save_period_in_seconds +syn keyword cqlKeyword key_cache_save_period_in_seconds memtable_flush_after_mins +syn keyword cqlKeyword memtable_throughput_in_mb memtable_operations_in_millions replication_on_write +syn keyword cqlKeyword replication_on_write default_validation_class key_validation_class +syn keyword cqlKeyword rows_cached row_cache_save_period row_cache_keys_to_save keys_cached +syn keyword cqlKeyword column_type key_cache_save_period gc_grace replicate_on_write +syn keyword cqlKeyword row_cache_provider compaction_strategy column_metadata +syn keyword cqlKeyword column_name validation_class subcomparator replication +syn keyword cqlKeyword index_name index_type caching dclocal_read_repair_chance +syn keyword cqlKeyword bloom_filter_fp_chance populate_io_cache_on_flush compaction +syn keyword cqlKeyword compression class sstable_compression + +" CQL 3 additions +syn keyword cqlKeyword clustering + +" Keyspace options +syn keyword cqlKeyword placement_strategy strategy_options durable_writes replication_factor +syn keyword cqlKeyword strategy_class + +" Hadoop keywords +syn keyword cqlKeyword currentJobTracker + + +" TODO Fix to use regions properly +syn keyword cqlColType standard super +syn region cqlColumnType start="column_type\W" end="\"'" contains=cqlColType + +" TODO Fix to use regions properly +syn keyword cqlPStrategy simplestrategy localstrategy networktopologystrategy +syn region cqlPlacementStrategy start="placement_strategy\W" end="\"'" contains=cqlPlaceStrategy + +" Comments highlight the word as a keyword and comment as blue +syn region cqlKeyword start=/comment\s*=\s*'/ end=/'/ contains=cqlComment +syn region cqlKeyword start=/comment\s*=\s*"/ end=/"/ contains=cqlComment +syn region cqlComment start="/\*" end="\*/" contains=cqlComment +syn match cqlComment /'\zs\%(\\.\|[^\\']\)*\ze'/ contained +syn match cqlComment /"\zs\%(\\.\|[^\\"]\)*\ze"/ contained +syn match cqlComment "--.*$" contains=cqlComment +syn match cqlComment "//.*$" contains=cqlComment +syn match cqlComment "/\*\*/" + +" Special values +syn keyword cqlSpecial false null true + +" TODO Add ability to include entire Java class name for compaction strategies +syn keyword cqlType SizeTieredCompactionStrategy LeveledCompactionStrategy + +" Variable Types +syn keyword cqlType bytea ascii text varchar uuid varint int bigint +syn keyword cqlType bytestype utf8type timeuuidtype timeuuid timestamp +syn keyword cqlType blob boolean counter decimal double float +syn keyword cqlType serializingcacheprovider +syn keyword cqlType set list map tuple + +" Consistency Levels +syn region cqlType start="consistency" end="zero" +syn region cqlType start="consistency" end="one" +syn region cqlType start="consistency" end="quorum" +syn region cqlType start="consistency" end="all" +syn region cqlType start="consistency" end="local_quorum" +syn region cqlType start="consistency" end="each_quorum" + +" Numbers and hexidecimal values +syn match cqlNumber "-\=\<[0-9]*\>" +syn match cqlNumber "-\=\<[0-9]*\.[0-9]*\>" +syn match cqlNumber "-\=\<[0-9][0-9]*e[+-]\=[0-9]*\>" +syn match cqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>" +syn match cqlNumber "\<0x[abcdefABCDEF0-9]*\>" + +" 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_cql_syn_inits") + if version < 508 + let did_cql_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink cqlKeyword Statement + HiLink cqlSpecial Special + HiLink cqlString String + HiLink cqlNumber Number + HiLink cqlVariable Identifier + HiLink cqlComment Comment + HiLink cqlType Type + HiLink cqlOperator Statement + HiLink cqlConsistency Statement + HiLink cqlColType Type + HiLink cqlPStrategy Type + + delcommand HiLink +endif + +let b:current_syntax = "cql" + + +endif |