# Note: jade is changing its name to pug (https://github.com/pugjs/pug/issues/2184) # This appears to be a work in progress -- the pug-lang domain is parked, while # the jade-lang one is active. This highlighter will recognize .pug and .jade extensions, # http://jade-lang.com (will be http://pug-lang.com) # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # Detection # ‾‾‾‾‾‾‾‾‾ hook global BufSetOption mimetype=text/x-pug %{ set buffer filetype pug } hook global BufCreate .*[.](pug|jade) %{ set buffer filetype pug } # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ addhl -group / regions -default code pug \ text ^\h*\|\s $ '' \ text ^\h*([A-Za-z][A-Za-z0-9_-]*)?(\#[A-Za-z][A-Za-z0-9_-]*)?((?:\.[A-Za-z][A-Za-z0-9_-]*)*)?(?<=\S)\h+\K.* $ '' \ javascript ^\h*[-=!] $ '' \ double_string '"' (?:(? s \h+$ d } } def -hidden _pug_indent_on_new_line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } # filter previous line try %{ exec -draft k : _pug_filter_around_selections } # copy '//', '|', '-' or '(!)=' prefix and following whitespace try %{ exec -draft k x s ^\h*\K[/|!=-]{1,2}\h* y j p } # indent unless we copied something above try %{ exec -draft b s \S g l } } } # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ hook global WinSetOption filetype=pug %{ addhl ref pug hook window InsertEnd .* -group pug-hooks _pug_filter_around_selections hook window InsertChar \n -group pug-indent _pug_indent_on_new_line } hook global WinSetOption filetype=(?!pug).* %{ rmhl pug rmhooks window pug-indent rmhooks window pug-hooks }