" Vim syntax file " Language: mysql " Maintainer: Kenneth J. Pronovici " Filenames: *.mysql " URL: ftp://cedar-solutions.com/software/mysql.vim (https://github.com/pronovic/vim-syntax/blob/master/mysql.vim) " Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23 and have been updated " in July 2024 with the docs for version 8.4 " Last Change: 2016 Apr 11 " 2024-07-21: update MySQL functions as of MySQL 8.4 (by Vim Project) " " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif " Always ignore case syn case ignore " General keywords which don't fall into other categories syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg_row_length syn keyword mysqlKeyword both by syn keyword mysqlKeyword cascade change character check checksum column columns comment constraint create cross syn keyword mysqlKeyword current_date current_time current_timestamp syn keyword mysqlKeyword data database databases day day_hour day_minute day_second syn keyword mysqlKeyword default delayed delay_key_write delete desc describe distinct distinctrow drop syn keyword mysqlKeyword enclosed escape escaped explain syn keyword mysqlKeyword fields file first flush for foreign from full function syn keyword mysqlKeyword global grant grants group syn keyword mysqlKeyword having heap high_priority hosts hour hour_minute hour_second syn keyword mysqlKeyword identified ignore index infile inner insert insert_id into isam syn keyword mysqlKeyword join syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long syn keyword mysqlKeyword low_priority syn keyword mysqlKeyword match max_rows middleint min_rows minute minute_second modify month myisam syn keyword mysqlKeyword natural no syn keyword mysqlKeyword on optimize option optionally order outer outfile syn keyword mysqlKeyword pack_keys partial password primary privileges procedure process processlist syn keyword mysqlKeyword read references reload rename replace restrict returns revoke right row rows syn keyword mysqlKeyword second select show shutdown soname sql_big_result sql_big_selects sql_big_tables sql_log_off syn keyword mysqlKeyword sql_log_update sql_low_priority_updates sql_select_limit sql_small_result sql_warnings starting syn keyword mysqlKeyword status straight_join string syn keyword mysqlKeyword table tables temporary terminated to trailing type syn keyword mysqlKeyword unique unlock unsigned update usage use using syn keyword mysqlKeyword values varbinary variables varying syn keyword mysqlKeyword where with write syn keyword mysqlKeyword year_month syn keyword mysqlKeyword zerofill " Special values syn keyword mysqlSpecial false null true " Strings (single- and double-quote) syn region mysqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ syn region mysqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ " Numbers and hexidecimal values syn match mysqlNumber "-\=\<[0-9]*\>" syn match mysqlNumber "-\=\<[0-9]*\.[0-9]*\>" syn match mysqlNumber "-\=\<[0-9][0-9]*e[+-]\=[0-9]*\>" syn match mysqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>" syn match mysqlNumber "\<0x[abcdefABCDEF0-9]*\>" " User variables syn match mysqlVariable "@\a*[A-Za-z0-9]*\([._]*[A-Za-z0-9]\)*" " Escaped column names syn match mysqlEscaped "`[^`]*`" " Comments (c-style, mysql-style and modified sql-style) syn region mysqlComment start="/\*" end="\*/" syn match mysqlComment "#.*" syn match mysqlComment "--\_s.*" syn sync ccomment mysqlComment " Column types " " This gets a bit ugly. There are two different problems we have to " deal with. " " The first problem is that some keywords like 'float' can be used " both with and without specifiers, i.e. 'float', 'float(1)' and " 'float(@var)' are all valid. We have to account for this and we " also have to make sure that garbage like floatn or float_(1) is not " highlighted. " " The second problem is that some of these keywords are included in " function names. For instance, year() is part of the name of the " dayofyear() function, and the dec keyword (no parenthesis) is part of " the name of the decode() function. syn keyword mysqlType tinyint smallint mediumint int integer bigint syn keyword mysqlType date datetime time bit bool syn keyword mysqlType tinytext mediumtext longtext text syn keyword mysqlType tinyblob mediumblob longblob blob syn region mysqlType start="float\W" end="."me=s-1 syn region mysqlType start="float$" end="."me=s-1 syn region mysqlType start="\