From 6df3b9be01d3536d884ab6fad6761e6d640e5f39 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 2 Oct 2012 15:34:05 -0500 Subject: [PATCH 1/3] Added sunburst theme. --- .vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.vim/vimrc b/.vim/vimrc index 3c05433..2cecd09 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -122,6 +122,7 @@ Bundle 'https://github.com/blackgate/tropikos-vim-theme.git' Bundle 'https://github.com/zaki/zazen.git' Bundle 'https://github.com/jonathanfilip/vim-lucius.git' Bundle 'https://github.com/chriskempson/vim-tomorrow-theme.git' +Bundle 'https://github.com/tangphillip/SunburstVIM.git' filetype plugin indent on From df558ec172795046ddd4d1465e5a6b699fb62122 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 2 Oct 2012 23:12:55 -0500 Subject: [PATCH 2/3] Added Jinja/Twig template highlighting. --- .vim/syntax/htmljinja.vim | 27 +++++++++ .vim/syntax/jinja.vim | 113 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 .vim/syntax/htmljinja.vim create mode 100644 .vim/syntax/jinja.vim diff --git a/.vim/syntax/htmljinja.vim b/.vim/syntax/htmljinja.vim new file mode 100644 index 0000000..3f9cba4 --- /dev/null +++ b/.vim/syntax/htmljinja.vim @@ -0,0 +1,27 @@ +" Vim syntax file +" Language: Jinja HTML template +" Maintainer: Armin Ronacher +" Last Change: 2007 Apr 8 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'html' +endif + +if version < 600 + so :p:h/jinja.vim + so :p:h/html.vim +else + runtime! syntax/jinja.vim + runtime! syntax/html.vim + unlet b:current_syntax +endif + +let b:current_syntax = "htmljinja" diff --git a/.vim/syntax/jinja.vim b/.vim/syntax/jinja.vim new file mode 100644 index 0000000..7704e3a --- /dev/null +++ b/.vim/syntax/jinja.vim @@ -0,0 +1,113 @@ +" Vim syntax file +" Language: Jinja template +" Maintainer: Armin Ronacher +" Last Change: 2008 May 9 +" Version: 1.1 +" +" Known Bugs: +" because of odd limitations dicts and the modulo operator +" appear wrong in the template. +" +" Changes: +" +" 2008 May 9: Added support for Jinja2 changes (new keyword rules) + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syntax case match + +" Jinja template built-in tags and parameters (without filter, macro, is and raw, they +" have special threatment) +syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import + +syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter +syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction +syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName + +" Variable Names +syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/ +syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none loop super caller varargs kwargs + +" Filters +syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained nextgroup=jinjaFilter +syn match jinjaFilter contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/ +syn match jinjaFunction contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/ +syn match jinjaBlockName contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/ + +" Jinja template constants +syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\\"/ end=/"/ +syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\\'/ end=/'/ +syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/ + +" Operators +syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/ +syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/ +syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute +syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/ + +" Jinja template tag and variable blocks +syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained +syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained +syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained +syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ skipwhite containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment + +syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment + +" Jinja template 'raw' tag +syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment + +" Jinja comments +syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString + +" Block start keywords. A bit tricker. We only highlight at the start of a +" tag block and only if the name is not followed by a comma or equals sign +" which usually means that we have to deal with an assignment. +syn match jinjaStatement containedin=jinjaTagBlock contained skipwhite /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/ + +" and context modifiers +syn match jinjaStatement containedin=jinjaTagBlock contained /\/ skipwhite + + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_jinja_syn_inits") + if version < 508 + let did_jinja_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink jinjaPunctuation jinjaOperator + HiLink jinjaAttribute jinjaVariable + HiLink jinjaFunction jinjaFilter + + HiLink jinjaTagDelim jinjaTagBlock + HiLink jinjaVarDelim jinjaVarBlock + HiLink jinjaCommentDelim jinjaComment + HiLink jinjaRawDelim jinja + + HiLink jinjaSpecial Special + HiLink jinjaOperator Normal + HiLink jinjaRaw Normal + HiLink jinjaTagBlock PreProc + HiLink jinjaVarBlock PreProc + HiLink jinjaStatement Statement + HiLink jinjaFilter Function + HiLink jinjaBlockName Function + HiLink jinjaVariable Identifier + HiLink jinjaString Constant + HiLink jinjaNumber Constant + HiLink jinjaComment Comment + + delcommand HiLink +endif + +let b:current_syntax = "jinja" From 1b93d82817c9e845f6c9e1add828e40c52d2c0c6 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 9 Oct 2012 14:58:51 -0500 Subject: [PATCH 3/3] Enabled ruler and added auto commands for Twig. --- .vim/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vim/vimrc b/.vim/vimrc index 2cecd09..ad41a8c 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -34,6 +34,7 @@ set expandtab set backspace=indent,eol set textwidth=80 set spell +set ruler if has("win32") silent execute "!mkdir " . $HOME . "\\vimfiles\\backup" @@ -52,6 +53,7 @@ au FileType text set tw=72 spell spelllang=en_us nonumber au FileType mail set tw=72 spell spelllang=en_us nonumber au FileType gitcommit set tw=72 spell spelllang=en_us nonumber au BufNewFile,BufEnter *.phtml set tabstop=2 shiftwidth=2 softtabstop=2 +au BufNewFile,BufEnter *.twig set tabstop=2 shiftwidth=2 softtabstop=2 ft=htmljinja au FileType html set tabstop=2 shiftwidth=2 softtabstop=2 au FileType xml set tabstop=2 shiftwidth=2 softtabstop=2 au FileType ant set tabstop=2 shiftwidth=2 softtabstop=2