Log in

MySQL syntax highlighting in Vim - Fish Magic

> Recent Entries
> Archive
> Friends
> Profile
> My photos at flickr

November 9th, 2006

Previous Entry Share Next Entry
02:00 am - MySQL syntax highlighting in Vim
I didn't know such a thing exists.
kostja@bodhi:/usr/share/vim/vim70/syntax> ls -al mysql.vim 
-rw-r--r-- 1 root root 16078 2006-05-24 20:16 mysql.vim

kostja@bodhi:/usr/share/vim/vim70/syntax> head -7 mysql.vim 
" Vim syntax file
" Language:     mysql
" Maintainer:   Kenneth J. Pronovici <pronovic@ieee.org>
" Last Change:  $Date: 2004/06/13 20:12:39 $
" Filenames:    *.mysql
" URL:		ftp://cedar-solutions.com/software/mysql.vim
" Note:		The definitions below are taken from the mysql user manual as of April 2002, for version 3.23
To enable it in the editor:
:set filetype=mysql

Or, in your .vimrc to highlight all .sql and .test files:
if has("autocmd")
        autocmd BufRead *.sql set filetype=mysql      
        autocmd BufRead *.test set filetype=mysql

Current Music: Thievery Corporation, The Heart`s A Lonely Hunter
Tags: ,

(5 comments | Leave a comment)


[User Picture]
Date:November 9th, 2006 01:47 pm (UTC)

Now added to my vim files :)
Date:November 9th, 2006 02:10 pm (UTC)

Yeah baby!

Thanks for the tip. I didn't know about this!
[User Picture]
Date:November 11th, 2006 12:02 am (UTC)
neat! Makes me happy...
[User Picture]
Date:March 5th, 2011 03:46 pm (UTC)
Is there a definition for MySQL 5.5?
[User Picture]
Date:March 5th, 2011 04:29 pm (UTC)
My vim72 has a version from 2009:

" Language: mysql
" Maintainer: Kenneth J. Pronovici
" Last Change: $LastChangedDate: 2009-06-29 23:08:37 -0500 (Mon, 29 Jun 2009) $

but I don't think it contains 5.5 reserved words. On the other hand, they should be few.

> Go to Top