├── ftdetect └── cql.vim ├── README.md ├── syntax └── cql.vim └── test └── test.cql /ftdetect/cql.vim: -------------------------------------------------------------------------------- 1 | if has("autocmd") 2 | au BufNewFile,BufRead *.cql set filetype=cql 3 | endif 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cassandra CQL Syntax Highlighter for Vim 2 | Highlight CQL syntaxes inside the vim editor. 3 | 4 | ## Install with plugin manager 5 | 6 | " Plug (https://github.com/junegunn/vim-plug) 7 | Plug 'elubow/cql-vim' 8 | 9 | " Vundle (https://github.com/VundleVim/Vundle.vim) 10 | Plugin 'elubow/cql-vim' 11 | 12 | ## Install with pathogen 13 | 14 | cd ~/.vim/ 15 | git clone git@github.com:elubow/cql-vim.git bundle/cql-vim 16 | 17 | ## Manual install 18 | 19 | cd ~/.local/src 20 | git clone git@github.com:elubow/cql-vim.git 21 | cp -R cql-vim/syntax/* ~/.vim/syntax/ 22 | cp -R cql-vim/ftdetect/* ~/.vim/ftdetect/ 23 | 24 | ## Alternative plugin collection 25 | 26 | cql-vim is also bundled in https://github.com/sheerun/vim-polyglot 27 | -------------------------------------------------------------------------------- /syntax/cql.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: cql 3 | " Maintainer: Eric Lubow " 99 | syn match cqlNumber "-\=\<[0-9]*\.[0-9]*\>" 100 | syn match cqlNumber "-\=\<[0-9][0-9]*e[+-]\=[0-9]*\>" 101 | syn match cqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>" 102 | syn match cqlNumber "\<0x[abcdefABCDEF0-9]*\>" 103 | 104 | " Define the default highlighting. 105 | " For version 5.7 and earlier: only when not done already 106 | " For version 5.8 and later: only when an item doesn't have highlighting yet 107 | if version >= 508 || !exists("did_cql_syn_inits") 108 | if version < 508 109 | let did_cql_syn_inits = 1 110 | command -nargs=+ HiLink hi link 111 | else 112 | command -nargs=+ HiLink hi def link 113 | endif 114 | 115 | HiLink cqlKeyword Statement 116 | HiLink cqlSpecial Special 117 | HiLink cqlString String 118 | HiLink cqlNumber Number 119 | HiLink cqlVariable Identifier 120 | HiLink cqlComment Comment 121 | HiLink cqlType Type 122 | HiLink cqlOperator Statement 123 | HiLink cqlConsistency Statement 124 | HiLink cqlColType Type 125 | HiLink cqlPStrategy Type 126 | 127 | delcommand HiLink 128 | endif 129 | 130 | let b:current_syntax = "cql" 131 | 132 | -------------------------------------------------------------------------------- /test/test.cql: -------------------------------------------------------------------------------- 1 | create keyspace HiveMetaStore 2 | with placement_strategy = 'SimpleStrategy' 3 | and strategy_options = {replication_factor : 1} 4 | and durable_writes = true; 5 | 6 | use HiveMetaStore; 7 | 8 | create column family MetaStore 9 | with column_type = 'Standard' 10 | and comparator = 'UTF8Type' 11 | and default_validation_class = 'BytesType' 12 | and key_validation_class = 'UTF8Type' 13 | and rows_cached = 0.0 14 | and row_cache_save_period = 0 15 | and row_cache_keys_to_save = 2147483647 16 | and keys_cached = 200000.0 17 | and key_cache_save_period = 14400 18 | and read_repair_chance = 1.0 19 | and gc_grace = 864000 20 | and min_compaction_threshold = 4 21 | and max_compaction_threshold = 32 22 | and replicate_on_write = true 23 | and row_cache_provider = 'SerializingCacheProvider' 24 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'; 25 | 26 | 27 | 28 | create keyspace cfs 29 | with placement_strategy = 'SimpleStrategy' 30 | and strategy_options = {replication_factor : 1} 31 | and durable_writes = true; 32 | 33 | use cfs; 34 | 35 | create column family cleanup 36 | with column_type = 'Standard' 37 | and comparator = 'BytesType' 38 | and default_validation_class = 'BytesType' 39 | and key_validation_class = 'BytesType' 40 | and rows_cached = 0.0 41 | and row_cache_save_period = 0 42 | and row_cache_keys_to_save = 2147483647 43 | and keys_cached = 1000000.0 44 | and key_cache_save_period = 14400 45 | and read_repair_chance = 1.0 46 | and gc_grace = 60 47 | and min_compaction_threshold = 4 48 | and max_compaction_threshold = 32 49 | and replicate_on_write = true 50 | and row_cache_provider = 'SerializingCacheProvider' 51 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 52 | and comment = 'Stores blocks row key to perform a cleanup for when jobs fail'; 53 | 54 | create column family inode 55 | with column_type = 'Standard' 56 | and comparator = 'DynamicCompositeType(t=>org.apache.cassandra.db.marshal.TimeUUIDType,s=>org.apache.cassandra.db.marshal.UTF8Type,b=>org.apache.cassandra.db.marshal.BytesType)' 57 | and default_validation_class = 'BytesType' 58 | and key_validation_class = 'BytesType' 59 | and rows_cached = 0.0 60 | and row_cache_save_period = 0 61 | and row_cache_keys_to_save = 2147483647 62 | and keys_cached = 1000000.0 63 | and key_cache_save_period = 14400 64 | and read_repair_chance = 1.0 65 | and gc_grace = 60 66 | and min_compaction_threshold = 4 67 | and max_compaction_threshold = 32 68 | and replicate_on_write = true 69 | and row_cache_provider = 'SerializingCacheProvider' 70 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 71 | and comment = 'Stores file meta data' 72 | and column_metadata = [ 73 | {column_name : 'b@70617468', 74 | validation_class : BytesType, 75 | index_name : 'path', 76 | index_type : 0, 77 | }, 78 | {column_name : 'b@73656e74696e656c', 79 | validation_class : BytesType, 80 | index_name : 'sentinel', 81 | index_type : 0, 82 | }, 83 | {column_name : 'b@706172656e745f70617468', 84 | validation_class : BytesType, 85 | index_name : 'parent_path', 86 | index_type : 0, 87 | }]; 88 | 89 | create column family inode_archive 90 | with column_type = 'Standard' 91 | and comparator = 'DynamicCompositeType(t=>org.apache.cassandra.db.marshal.TimeUUIDType,s=>org.apache.cassandra.db.marshal.UTF8Type,b=>org.apache.cassandra.db.marshal.BytesType)' 92 | and default_validation_class = 'BytesType' 93 | and key_validation_class = 'BytesType' 94 | and rows_cached = 0.0 95 | and row_cache_save_period = 0 96 | and row_cache_keys_to_save = 2147483647 97 | and keys_cached = 1000000.0 98 | and key_cache_save_period = 14400 99 | and read_repair_chance = 1.0 100 | and gc_grace = 60 101 | and min_compaction_threshold = 4 102 | and max_compaction_threshold = 32 103 | and replicate_on_write = true 104 | and row_cache_provider = 'SerializingCacheProvider' 105 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 106 | and comment = 'Stores file meta data' 107 | and column_metadata = [ 108 | {column_name : 'b@70617468', 109 | validation_class : BytesType, 110 | index_name : 'path', 111 | index_type : 0, 112 | }, 113 | {column_name : 'b@73656e74696e656c', 114 | validation_class : BytesType, 115 | index_name : 'sentinel', 116 | index_type : 0, 117 | }, 118 | {column_name : 'b@706172656e745f70617468', 119 | validation_class : BytesType, 120 | index_name : 'parent_path', 121 | index_type : 0, 122 | }]; 123 | 124 | create column family sblocks 125 | with column_type = 'Standard' 126 | and comparator = 'BytesType' 127 | and default_validation_class = 'BytesType' 128 | and key_validation_class = 'BytesType' 129 | and rows_cached = 0.0 130 | and row_cache_save_period = 0 131 | and row_cache_keys_to_save = 2147483647 132 | and keys_cached = 1000000.0 133 | and key_cache_save_period = 14400 134 | and read_repair_chance = 1.0 135 | and gc_grace = 60 136 | and min_compaction_threshold = 16 137 | and max_compaction_threshold = 64 138 | and replicate_on_write = true 139 | and row_cache_provider = 'SerializingCacheProvider' 140 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 141 | and comment = 'Stores blocks of information associated with a inode'; 142 | 143 | create column family sblocks_archive 144 | with column_type = 'Standard' 145 | and comparator = 'BytesType' 146 | and default_validation_class = 'BytesType' 147 | and key_validation_class = 'BytesType' 148 | and rows_cached = 0.0 149 | and row_cache_save_period = 0 150 | and row_cache_keys_to_save = 2147483647 151 | and keys_cached = 1000000.0 152 | and key_cache_save_period = 14400 153 | and read_repair_chance = 1.0 154 | and gc_grace = 60 155 | and min_compaction_threshold = 0 156 | and max_compaction_threshold = 0 157 | and replicate_on_write = true 158 | and row_cache_provider = 'SerializingCacheProvider' 159 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 160 | and comment = 'Stores blocks of information associated with a inode'; 161 | 162 | 163 | 164 | create keyspace dse_system 165 | with placement_strategy = 'SimpleStrategy' 166 | and strategy_options = {replication_factor : 1, currentJobTracker : 10.209.174.47} 167 | and durable_writes = true; 168 | 169 | use dse_system; 170 | 171 | 172 | 173 | create keyspace system 174 | with placement_strategy = 'LocalStrategy' 175 | and strategy_options = {replication_factor : 1} 176 | and durable_writes = false; 177 | 178 | use system; 179 | 180 | create column family HintsColumnFamily 181 | with column_type = 'Super' 182 | and comparator = 'BytesType' 183 | and subcomparator = 'BytesType' 184 | and default_validation_class = 'BytesType' 185 | and key_validation_class = 'BytesType' 186 | and rows_cached = 0.0 187 | and row_cache_save_period = 0 188 | and row_cache_keys_to_save = 2147483647 189 | and keys_cached = 0.01 190 | and key_cache_save_period = 0 191 | and read_repair_chance = 0.0 192 | and gc_grace = 0 193 | and min_compaction_threshold = 4 194 | and max_compaction_threshold = 32 195 | and replicate_on_write = true 196 | and row_cache_provider = 'SerializingCacheProvider' 197 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 198 | and comment = 'hinted handoff data'; 199 | 200 | create column family IndexInfo 201 | with column_type = 'Standard' 202 | and comparator = 'UTF8Type' 203 | and default_validation_class = 'BytesType' 204 | and key_validation_class = 'BytesType' 205 | and rows_cached = 0.0 206 | and row_cache_save_period = 0 207 | and row_cache_keys_to_save = 2147483647 208 | and keys_cached = 0.01 209 | and key_cache_save_period = 0 210 | and read_repair_chance = 0.0 211 | and gc_grace = 0 212 | and min_compaction_threshold = 4 213 | and max_compaction_threshold = 32 214 | and replicate_on_write = true 215 | and row_cache_provider = 'SerializingCacheProvider' 216 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 217 | and comment = 'indexes that have been completed'; 218 | 219 | create column family LocationInfo 220 | with column_type = 'Standard' 221 | and comparator = 'BytesType' 222 | and default_validation_class = 'BytesType' 223 | and key_validation_class = 'BytesType' 224 | and rows_cached = 0.0 225 | and row_cache_save_period = 0 226 | and row_cache_keys_to_save = 2147483647 227 | and keys_cached = 0.01 228 | and key_cache_save_period = 0 229 | and read_repair_chance = 0.0 230 | and gc_grace = 0 231 | and min_compaction_threshold = 4 232 | and max_compaction_threshold = 32 233 | and replicate_on_write = true 234 | and row_cache_provider = 'SerializingCacheProvider' 235 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 236 | and comment = 'persistent metadata for the local node'; 237 | 238 | create column family Migrations 239 | with column_type = 'Standard' 240 | and comparator = 'TimeUUIDType' 241 | and default_validation_class = 'BytesType' 242 | and key_validation_class = 'BytesType' 243 | and rows_cached = 0.0 244 | and row_cache_save_period = 0 245 | and row_cache_keys_to_save = 2147483647 246 | and keys_cached = 0.01 247 | and key_cache_save_period = 0 248 | and read_repair_chance = 0.0 249 | and gc_grace = 0 250 | and min_compaction_threshold = 4 251 | and max_compaction_threshold = 32 252 | and replicate_on_write = true 253 | and row_cache_provider = 'SerializingCacheProvider' 254 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 255 | and comment = 'individual schema mutations'; 256 | 257 | create column family NodeIdInfo 258 | with column_type = 'Standard' 259 | and comparator = 'TimeUUIDType' 260 | and default_validation_class = 'BytesType' 261 | and key_validation_class = 'BytesType' 262 | and rows_cached = 0.0 263 | and row_cache_save_period = 0 264 | and row_cache_keys_to_save = 2147483647 265 | and keys_cached = 0.01 266 | and key_cache_save_period = 0 267 | and read_repair_chance = 0.0 268 | and gc_grace = 0 269 | and min_compaction_threshold = 4 270 | and max_compaction_threshold = 32 271 | and replicate_on_write = true 272 | and row_cache_provider = 'SerializingCacheProvider' 273 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 274 | and comment = 'nodeId and their metadata'; 275 | 276 | create column family Schema 277 | with column_type = 'Standard' 278 | and comparator = 'UTF8Type' 279 | and default_validation_class = 'BytesType' 280 | and key_validation_class = 'BytesType' 281 | and rows_cached = 0.0 282 | and row_cache_save_period = 0 283 | and row_cache_keys_to_save = 2147483647 284 | and keys_cached = 0.01 285 | and key_cache_save_period = 0 286 | and read_repair_chance = 0.0 287 | and gc_grace = 0 288 | and min_compaction_threshold = 4 289 | and max_compaction_threshold = 32 290 | and replicate_on_write = true 291 | and row_cache_provider = 'SerializingCacheProvider' 292 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 293 | and comment = 'current state of the schema'; 294 | 295 | create column family Versions 296 | with column_type = 'Standard' 297 | and comparator = 'UTF8Type' 298 | and default_validation_class = 'BytesType' 299 | and key_validation_class = 'UTF8Type' 300 | and rows_cached = 0.0 301 | and row_cache_save_period = 0 302 | and row_cache_keys_to_save = 2147483647 303 | and keys_cached = 0.01 304 | and key_cache_save_period = 0 305 | and read_repair_chance = 0.0 306 | and gc_grace = 0 307 | and min_compaction_threshold = 4 308 | and max_compaction_threshold = 32 309 | and replicate_on_write = true 310 | and row_cache_provider = 'SerializingCacheProvider' 311 | and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' 312 | and comment = 'server version information' 313 | and column_metadata = [ 314 | {column_name : 'version', 315 | validation_class : UTF8Type}]; 316 | --------------------------------------------------------------------------------