Skip to content

Instantly share code, notes, and snippets.

@nanki
Created September 19, 2011 19:51
Show Gist options
  • Save nanki/1227405 to your computer and use it in GitHub Desktop.
Save nanki/1227405 to your computer and use it in GitHub Desktop.
vim syntax file for grepedit.
function! s:syntax(name, ext)
let l:separator = "^# ============================================================ "
let l:ext = empty(a:ext) ? "" : "¥¥.".a:ext
let l:cmd = "syntax region GEBlock".a:name
¥." matchgroup=FileLine "
¥."start=/".l:separator.".*¥¥v".l:ext."$/ "
¥."end=/¥¥(".l:separator.".*$¥¥)¥¥@=¥¥|¥¥%$/ "
¥."keepend transparent contains=FileLine"
let l:cmd .= empty(a:name) ? "" : ",@".a:name
execute l:cmd
endfunction
function! s:import(name, ext)
unlet! b:current_syntax
execute "syntax include @".a:name." syntax/".a:name.".vim"
call s:syntax(a:name, a:ext)
endfunction
call s:syntax("", "")
let b:ruby_no_expensive = 1
call s:import("ruby", "rb")
call s:import("css", "css")
call s:import("javascript", "js")
call s:import("java", "java")
call s:import("eruby", "(rhtml|erb)")
call s:import("html", "html")
call s:import("objc", "m")
highlight link FileLine Comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment