aboutsummaryrefslogtreecommitdiff
path: root/base/.vim
diff options
context:
space:
mode:
authorAdam Hovorka <[email protected]>2017-09-04 11:54:46 -0600
committerAdam Hovorka <[email protected]>2017-09-04 11:54:46 -0600
commit8916659e0e1cb67b860373f2d094445bb1f657aa (patch)
tree97f3e8cc1d0dbfe43ca5e64f596a39c61c10b121 /base/.vim
parent4a95cb44441d4e5b80bf7b4ff442923fc5e33b92 (diff)
Add custom vim filetype plugins for php and json
Diffstat (limited to 'base/.vim')
-rw-r--r--base/.vim/ftdetect/json.vim3
-rw-r--r--base/.vim/ftplugin/json.vim40
-rw-r--r--base/.vim/ftplugin/php.vim272
-rw-r--r--base/.vim/indent/json.vim177
-rw-r--r--base/.vim/indent/php.vim272
-rw-r--r--base/.vim/syntax/json.vim137
6 files changed, 901 insertions, 0 deletions
diff --git a/base/.vim/ftdetect/json.vim b/base/.vim/ftdetect/json.vim
new file mode 100644
index 0000000..b4a5cd7
--- /dev/null
+++ b/base/.vim/ftdetect/json.vim
@@ -0,0 +1,3 @@
+autocmd BufNewFile,BufRead *.json setlocal filetype=json
+autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
+autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
diff --git a/base/.vim/ftplugin/json.vim b/base/.vim/ftplugin/json.vim
new file mode 100644
index 0000000..3ee1062
--- /dev/null
+++ b/base/.vim/ftplugin/json.vim
@@ -0,0 +1,40 @@
+" Vim syntax file
+" Language: JSON
+" Maintainer: Eli Parra <[email protected]> https://github.com/elzr/vim-json
+" Last Change: 2014-05-20 added warning toggle
+
+"uncomment to enable folding of `{...}` and `[...]` blocks
+"setlocal foldmethod=syntax
+
+"conceal by default
+if !exists("g:vim_json_syntax_conceal")
+ let g:vim_json_syntax_conceal = 1
+end
+
+"have warnings by default
+if !exists("g:vim_json_warnings")
+ let g:vim_json_warnings = 1
+end
+
+"set concealcursor blank by default
+"this should turn off the concealing in the current line (where the cursor is at),
+"on all modes (normal, visual, insert)
+if !exists("g:vim_json_syntax_concealcursor")
+ let g:vim_json_syntax_concealcursor = ""
+end
+
+if has('conceal')
+ if (g:vim_json_syntax_conceal == 1)
+ "level 2 means concealed text gets completely hidden unless a
+ "replacement is defined (none is defined by us)
+ setlocal conceallevel=2
+ let &l:concealcursor = g:vim_json_syntax_concealcursor
+ else
+ "level 0 means text is shown normally = no concealing
+ setlocal conceallevel=0
+ endif
+ "maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
+ "directly to vim's conceallevels? unsure if anyone cares
+endif
+
+setlocal foldmethod=syntax
diff --git a/base/.vim/ftplugin/php.vim b/base/.vim/ftplugin/php.vim
new file mode 100644
index 0000000..3c498a7
--- /dev/null
+++ b/base/.vim/ftplugin/php.vim
@@ -0,0 +1,272 @@
+" Vim indent file
+" Language: Php
+" Authors: Miles Lott <[email protected]>, Johannes Zellner <[email protected]>, Pim Snel <[email protected]>
+" URL: http://lingewoud.nl/downloads.php
+" Last Change: 23 feb 2004
+" Version: 0.3
+" Notes: This is a combination of the PHP indent file of Miles Lott with
+" the HTML indent file of Johannes Zellner. Usefull for editing
+" php-files with html parts in it.
+"
+" Changelog:
+" 0.3 - 25 mar 2004
+" - fixed wrong indention when a php-tag is opened and closed on
+" one single line.
+" 0.2 - 23 feb 2004
+" - applied patch from Holger Dzeik <[email protected]>
+" - added changelog
+" - added default indention of 3 spaces after the <?php for better
+" reading
+" - replaced URL
+" - reformatted the options section
+" 0.1 - 27 mar 2003
+" - initial creation of html-enhanced php indent-file
+
+" Options:
+let php_noindent_switch=0 " set this to '1' to not try to indent switch/case statements
+set sw=3 " default shiftwidth of 3 spaces
+
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetPhpIndent()
+"setlocal indentkeys+=0=,0),=EO
+setlocal indentkeys+=0=,0),=EO,o,O,*<Return>,<>>,<bs>,{,}
+
+" Only define the function once.
+if exists("*GetPhpIndent")
+ finish
+endif
+
+" Handle option(s)
+if exists("php_noindent_switch")
+ let b:php_noindent_switch=1
+endif
+
+if exists('g:html_indent_tags')
+ unlet g:html_indent_tags
+endif
+
+function GetPhpIndent()
+ " Find a non-empty line above the current line.
+ let lnum = prevnonblank(v:lnum - 1)
+
+ " Hit the start of the file, use zero indent.
+ if lnum == 0
+ return 0
+ endif
+
+ let line = getline(lnum) " last line
+ let cline = getline(v:lnum) " current line
+ let pline = getline(lnum - 1) " previous to last line
+ let ind = indent(lnum)
+
+ let restore_ic=&ic
+ let &ic=1 " ignore case
+
+ let ind = <SID>HtmlIndentSum(lnum, -1)
+ let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
+
+ let &ic=restore_ic
+
+ let ind = indent(lnum) + (&sw * ind)
+
+ " Indent after php open tags
+ if line =~ '<?php' && line !~ '?>'
+ let ind = ind + &sw
+ endif
+ if cline =~ '^\s*[?>]' " // Fix from Holger Dzeik <[email protected]> Thanks!
+ let ind = ind - &sw
+ endif
+
+
+ if exists("b:php_noindent_switch") " version 1 behavior, diy switch/case,etc
+ " Indent blocks enclosed by {} or ()
+ if line =~ '[{(]\s*\(#[^)}]*\)\=$'
+ let ind = ind + &sw
+ endif
+ if cline =~ '^\s*[)}]'
+ let ind = ind - &sw
+ endif
+ return ind
+ else " Try to indent switch/case statements as well
+ " Indent blocks enclosed by {} or () or case statements, with some anal requirements
+ if line =~ 'case.*:\|[{(]\s*\(#[^)}]*\)\=$'
+ let ind = ind + &sw
+ " return if the current line is not another case statement of the previous line is a bracket open
+ if cline !~ '.*case.*:\|default:' || line =~ '[{(]\s*\(#[^)}]*\)\=$'
+ return ind
+ endif
+ endif
+ if cline =~ '^\s*case.*:\|^\s*default:\|^\s*[)}]'
+ let ind = ind - &sw
+ " if the last line is a break or return, or the current line is a close bracket,
+ " or if the previous line is a default statement, subtract another
+ if line =~ '^\s*break;\|^\s*return\|' && cline =~ '^\s*[)}]' && pline =~ 'default:'
+ let ind = ind - &sw
+ endif
+ endif
+
+ if line =~ 'default:'
+ let ind = ind + &sw
+ endif
+ return ind
+ endif
+endfunction
+
+
+" [-- local settings (must come before aborting the script) --]
+"setlocal indentexpr=HtmlIndentGet(v:lnum)
+"setlocal indentkeys=o,O,*<Return>,<>>,<bs>,{,}
+
+
+
+" [-- helper function to assemble tag list --]
+fun! <SID>HtmlIndentPush(tag)
+ if exists('g:html_indent_tags')
+ let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
+ else
+ let g:html_indent_tags = a:tag
+ endif
+endfun
+
+
+" [-- <ELEMENT ? - - ...> --]
+call <SID>HtmlIndentPush('a')
+call <SID>HtmlIndentPush('abbr')
+call <SID>HtmlIndentPush('acronym')
+call <SID>HtmlIndentPush('address')
+call <SID>HtmlIndentPush('b')
+call <SID>HtmlIndentPush('bdo')
+call <SID>HtmlIndentPush('big')
+call <SID>HtmlIndentPush('blockquote')
+call <SID>HtmlIndentPush('button')
+call <SID>HtmlIndentPush('caption')
+call <SID>HtmlIndentPush('center')
+call <SID>HtmlIndentPush('cite')
+call <SID>HtmlIndentPush('code')
+call <SID>HtmlIndentPush('colgroup')
+call <SID>HtmlIndentPush('del')
+call <SID>HtmlIndentPush('dfn')
+call <SID>HtmlIndentPush('dir')
+call <SID>HtmlIndentPush('div')
+call <SID>HtmlIndentPush('dl')
+call <SID>HtmlIndentPush('em')
+call <SID>HtmlIndentPush('fieldset')
+call <SID>HtmlIndentPush('font')
+call <SID>HtmlIndentPush('form')
+call <SID>HtmlIndentPush('frameset')
+call <SID>HtmlIndentPush('h1')
+call <SID>HtmlIndentPush('h2')
+call <SID>HtmlIndentPush('h3')
+call <SID>HtmlIndentPush('h4')
+call <SID>HtmlIndentPush('h5')
+call <SID>HtmlIndentPush('h6')
+call <SID>HtmlIndentPush('i')
+call <SID>HtmlIndentPush('iframe')
+call <SID>HtmlIndentPush('ins')
+call <SID>HtmlIndentPush('kbd')
+call <SID>HtmlIndentPush('label')
+call <SID>HtmlIndentPush('legend')
+call <SID>HtmlIndentPush('map')
+call <SID>HtmlIndentPush('menu')
+call <SID>HtmlIndentPush('noframes')
+call <SID>HtmlIndentPush('noscript')
+call <SID>HtmlIndentPush('object')
+call <SID>HtmlIndentPush('ol')
+call <SID>HtmlIndentPush('optgroup')
+call <SID>HtmlIndentPush('pre')
+call <SID>HtmlIndentPush('q')
+call <SID>HtmlIndentPush('s')
+call <SID>HtmlIndentPush('samp')
+call <SID>HtmlIndentPush('script')
+call <SID>HtmlIndentPush('select')
+call <SID>HtmlIndentPush('small')
+call <SID>HtmlIndentPush('span')
+call <SID>HtmlIndentPush('strong')
+call <SID>HtmlIndentPush('style')
+call <SID>HtmlIndentPush('sub')
+call <SID>HtmlIndentPush('sup')
+call <SID>HtmlIndentPush('table')
+call <SID>HtmlIndentPush('textarea')
+call <SID>HtmlIndentPush('title')
+call <SID>HtmlIndentPush('tt')
+call <SID>HtmlIndentPush('u')
+call <SID>HtmlIndentPush('ul')
+call <SID>HtmlIndentPush('var')
+
+
+" [-- <ELEMENT ? O O ...> --]
+if !exists('g:html_indent_strict')
+ call <SID>HtmlIndentPush('body')
+ call <SID>HtmlIndentPush('head')
+ call <SID>HtmlIndentPush('html')
+ call <SID>HtmlIndentPush('tbody')
+endif
+
+
+" [-- <ELEMENT ? O - ...> --]
+if !exists('g:html_indent_strict_table')
+ call <SID>HtmlIndentPush('th')
+ call <SID>HtmlIndentPush('td')
+ call <SID>HtmlIndentPush('tr')
+ call <SID>HtmlIndentPush('tfoot')
+ call <SID>HtmlIndentPush('thead')
+endif
+
+delfun <SID>HtmlIndentPush
+
+set cpo-=C
+
+" [-- count indent-increasing tags of line a:lnum --]
+fun! <SID>HtmlIndentOpen(lnum)
+ let s = substitute('x'.getline(a:lnum),
+ \ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
+ let s = substitute(s, "[^\1].*$", '', '')
+ return strlen(s)
+endfun
+
+" [-- count indent-decreasing tags of line a:lnum --]
+fun! <SID>HtmlIndentClose(lnum)
+ let s = substitute('x'.getline(a:lnum),
+ \ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
+ let s = substitute(s, "[^\1].*$", '', '')
+ return strlen(s)
+endfun
+
+" [-- count indent-increasing '{' of (java|css) line a:lnum --]
+fun! <SID>HtmlIndentOpenAlt(lnum)
+ return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
+endfun
+
+" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
+fun! <SID>HtmlIndentCloseAlt(lnum)
+ return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
+endfun
+
+" [-- return the sum of indents respecting the syntax of a:lnum --]
+fun! <SID>HtmlIndentSum(lnum, style)
+ if a:style == match(getline(a:lnum), '^\s*</')
+ if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
+ let open = <SID>HtmlIndentOpen(a:lnum)
+ let close = <SID>HtmlIndentClose(a:lnum)
+ if 0 != open || 0 != close
+ return open - close
+ endif
+ endif
+ endif
+ if '' != &syntax &&
+ \ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
+ \ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
+ \ =~ '\(css\|java\).*'
+ if a:style == match(getline(a:lnum), '^\s*}')
+ return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
+ endif
+ endif
+ return 0
+endfun
+
+" vim: set ts=3 sw=3:
diff --git a/base/.vim/indent/json.vim b/base/.vim/indent/json.vim
new file mode 100644
index 0000000..7873d65
--- /dev/null
+++ b/base/.vim/indent/json.vim
@@ -0,0 +1,177 @@
+" Vim indent file
+" Language: JSON
+" Mantainer: Eli Parra <[email protected]> https://github.com/elzr/vim-json
+" Last Change: 2014-05-13: merged Fix for square bracket matching by Jakar
+" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
+" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
+" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
+" http://www.vim.org/scripts/script.php?script_id=2765
+
+" 0. Initialization {{{1
+" =================
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nosmartindent
+
+" Now, set up our indentation expression and keys that trigger it.
+setlocal indentexpr=GetJSONIndent()
+setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e
+
+" Only define the function once.
+if exists("*GetJSONIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" 1. Variables {{{1
+" ============
+
+let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
+" Regex that defines blocks.
+let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
+
+" 2. Auxiliary Functions {{{1
+" ======================
+
+" Check if the character at lnum:col is inside a string.
+function s:IsInString(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') == "jsonString"
+endfunction
+
+" Find line above 'lnum' that isn't empty, or in a string.
+function s:PrevNonBlankNonString(lnum)
+ let lnum = prevnonblank(a:lnum)
+ while lnum > 0
+ " If the line isn't empty or in a string, end search.
+ let line = getline(lnum)
+ if !(s:IsInString(lnum, 1) && s:IsInString(lnum, strlen(line)))
+ break
+ endif
+ let lnum = prevnonblank(lnum - 1)
+ endwhile
+ return lnum
+endfunction
+
+" Check if line 'lnum' has more opening brackets than closing ones.
+function s:LineHasOpeningBrackets(lnum)
+ let open_0 = 0
+ let open_2 = 0
+ let open_4 = 0
+ let line = getline(a:lnum)
+ let pos = match(line, '[][(){}]', 0)
+ while pos != -1
+ let idx = stridx('(){}[]', line[pos])
+ if idx % 2 == 0
+ let open_{idx} = open_{idx} + 1
+ else
+ let open_{idx - 1} = open_{idx - 1} - 1
+ endif
+ let pos = match(line, '[][(){}]', pos + 1)
+ endwhile
+ return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
+endfunction
+
+function s:Match(lnum, regex)
+ let col = match(getline(a:lnum), a:regex) + 1
+ return col > 0 && !s:IsInString(a:lnum, col) ? col : 0
+endfunction
+
+" 3. GetJSONIndent Function {{{1
+" =========================
+
+function GetJSONIndent()
+ " 3.1. Setup {{{2
+ " ----------
+
+ " Set up variables for restoring position in file. Could use v:lnum here.
+ let vcol = col('.')
+
+ " 3.2. Work on the current line {{{2
+ " -----------------------------
+
+ " Get the current line.
+ let line = getline(v:lnum)
+ let ind = -1
+
+ " If we got a closing bracket on an empty line, find its match and indent
+ " according to it.
+ let col = matchend(line, '^\s*[]}]')
+
+ if col > 0 && !s:IsInString(v:lnum, col)
+ call cursor(v:lnum, col)
+ let bs = strpart('{}[]', stridx('}]', line[col - 1]) * 2, 2)
+
+ let pairstart = escape(bs[0], '[')
+ let pairend = escape(bs[1], ']')
+ let pairline = searchpair(pairstart, '', pairend, 'bW')
+
+ if pairline > 0
+ let ind = indent(pairline)
+ else
+ let ind = virtcol('.') - 1
+ endif
+
+ return ind
+ endif
+
+ " If we are in a multi-line string, don't do anything to it.
+ if s:IsInString(v:lnum, matchend(line, '^\s*') + 1)
+ return indent('.')
+ endif
+
+ " 3.3. Work on the previous line. {{{2
+ " -------------------------------
+
+ let lnum = prevnonblank(v:lnum - 1)
+
+ if lnum == 0
+ return 0
+ endif
+
+ " Set up variables for current line.
+ let line = getline(lnum)
+ let ind = indent(lnum)
+
+ " If the previous line ended with a block opening, add a level of indent.
+ " if s:Match(lnum, s:block_regex)
+ " if exists('*shiftwidth')
+ " return indent(lnum) + shiftwidth()
+ " else
+ " return indent(lnum) + &sw
+ " endif
+ " endif
+
+ " If the previous line contained an opening bracket, and we are still in it,
+ " add indent depending on the bracket type.
+ if line =~ '[[({]'
+ let counts = s:LineHasOpeningBrackets(lnum)
+ if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
+ if exists('*shiftwidth')
+ return ind + shiftwidth()
+ else
+ return ind + &sw
+ endif
+ else
+ call cursor(v:lnum, vcol)
+ end
+ endif
+
+ " }}}2
+
+ return ind
+endfunction
+
+" }}}1
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2 ts=8 noet:
+
diff --git a/base/.vim/indent/php.vim b/base/.vim/indent/php.vim
new file mode 100644
index 0000000..3c498a7
--- /dev/null
+++ b/base/.vim/indent/php.vim
@@ -0,0 +1,272 @@
+" Vim indent file
+" Language: Php
+" Authors: Miles Lott <[email protected]>, Johannes Zellner <[email protected]>, Pim Snel <[email protected]>
+" URL: http://lingewoud.nl/downloads.php
+" Last Change: 23 feb 2004
+" Version: 0.3
+" Notes: This is a combination of the PHP indent file of Miles Lott with
+" the HTML indent file of Johannes Zellner. Usefull for editing
+" php-files with html parts in it.
+"
+" Changelog:
+" 0.3 - 25 mar 2004
+" - fixed wrong indention when a php-tag is opened and closed on
+" one single line.
+" 0.2 - 23 feb 2004
+" - applied patch from Holger Dzeik <[email protected]>
+" - added changelog
+" - added default indention of 3 spaces after the <?php for better
+" reading
+" - replaced URL
+" - reformatted the options section
+" 0.1 - 27 mar 2003
+" - initial creation of html-enhanced php indent-file
+
+" Options:
+let php_noindent_switch=0 " set this to '1' to not try to indent switch/case statements
+set sw=3 " default shiftwidth of 3 spaces
+
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetPhpIndent()
+"setlocal indentkeys+=0=,0),=EO
+setlocal indentkeys+=0=,0),=EO,o,O,*<Return>,<>>,<bs>,{,}
+
+" Only define the function once.
+if exists("*GetPhpIndent")
+ finish
+endif
+
+" Handle option(s)
+if exists("php_noindent_switch")
+ let b:php_noindent_switch=1
+endif
+
+if exists('g:html_indent_tags')
+ unlet g:html_indent_tags
+endif
+
+function GetPhpIndent()
+ " Find a non-empty line above the current line.
+ let lnum = prevnonblank(v:lnum - 1)
+
+ " Hit the start of the file, use zero indent.
+ if lnum == 0
+ return 0
+ endif
+
+ let line = getline(lnum) " last line
+ let cline = getline(v:lnum) " current line
+ let pline = getline(lnum - 1) " previous to last line
+ let ind = indent(lnum)
+
+ let restore_ic=&ic
+ let &ic=1 " ignore case
+
+ let ind = <SID>HtmlIndentSum(lnum, -1)
+ let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
+
+ let &ic=restore_ic
+
+ let ind = indent(lnum) + (&sw * ind)
+
+ " Indent after php open tags
+ if line =~ '<?php' && line !~ '?>'
+ let ind = ind + &sw
+ endif
+ if cline =~ '^\s*[?>]' " // Fix from Holger Dzeik <[email protected]> Thanks!
+ let ind = ind - &sw
+ endif
+
+
+ if exists("b:php_noindent_switch") " version 1 behavior, diy switch/case,etc
+ " Indent blocks enclosed by {} or ()
+ if line =~ '[{(]\s*\(#[^)}]*\)\=$'
+ let ind = ind + &sw
+ endif
+ if cline =~ '^\s*[)}]'
+ let ind = ind - &sw
+ endif
+ return ind
+ else " Try to indent switch/case statements as well
+ " Indent blocks enclosed by {} or () or case statements, with some anal requirements
+ if line =~ 'case.*:\|[{(]\s*\(#[^)}]*\)\=$'
+ let ind = ind + &sw
+ " return if the current line is not another case statement of the previous line is a bracket open
+ if cline !~ '.*case.*:\|default:' || line =~ '[{(]\s*\(#[^)}]*\)\=$'
+ return ind
+ endif
+ endif
+ if cline =~ '^\s*case.*:\|^\s*default:\|^\s*[)}]'
+ let ind = ind - &sw
+ " if the last line is a break or return, or the current line is a close bracket,
+ " or if the previous line is a default statement, subtract another
+ if line =~ '^\s*break;\|^\s*return\|' && cline =~ '^\s*[)}]' && pline =~ 'default:'
+ let ind = ind - &sw
+ endif
+ endif
+
+ if line =~ 'default:'
+ let ind = ind + &sw
+ endif
+ return ind
+ endif
+endfunction
+
+
+" [-- local settings (must come before aborting the script) --]
+"setlocal indentexpr=HtmlIndentGet(v:lnum)
+"setlocal indentkeys=o,O,*<Return>,<>>,<bs>,{,}
+
+
+
+" [-- helper function to assemble tag list --]
+fun! <SID>HtmlIndentPush(tag)
+ if exists('g:html_indent_tags')
+ let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
+ else
+ let g:html_indent_tags = a:tag
+ endif
+endfun
+
+
+" [-- <ELEMENT ? - - ...> --]
+call <SID>HtmlIndentPush('a')
+call <SID>HtmlIndentPush('abbr')
+call <SID>HtmlIndentPush('acronym')
+call <SID>HtmlIndentPush('address')
+call <SID>HtmlIndentPush('b')
+call <SID>HtmlIndentPush('bdo')
+call <SID>HtmlIndentPush('big')
+call <SID>HtmlIndentPush('blockquote')
+call <SID>HtmlIndentPush('button')
+call <SID>HtmlIndentPush('caption')
+call <SID>HtmlIndentPush('center')
+call <SID>HtmlIndentPush('cite')
+call <SID>HtmlIndentPush('code')
+call <SID>HtmlIndentPush('colgroup')
+call <SID>HtmlIndentPush('del')
+call <SID>HtmlIndentPush('dfn')
+call <SID>HtmlIndentPush('dir')
+call <SID>HtmlIndentPush('div')
+call <SID>HtmlIndentPush('dl')
+call <SID>HtmlIndentPush('em')
+call <SID>HtmlIndentPush('fieldset')
+call <SID>HtmlIndentPush('font')
+call <SID>HtmlIndentPush('form')
+call <SID>HtmlIndentPush('frameset')
+call <SID>HtmlIndentPush('h1')
+call <SID>HtmlIndentPush('h2')
+call <SID>HtmlIndentPush('h3')
+call <SID>HtmlIndentPush('h4')
+call <SID>HtmlIndentPush('h5')
+call <SID>HtmlIndentPush('h6')
+call <SID>HtmlIndentPush('i')
+call <SID>HtmlIndentPush('iframe')
+call <SID>HtmlIndentPush('ins')
+call <SID>HtmlIndentPush('kbd')
+call <SID>HtmlIndentPush('label')
+call <SID>HtmlIndentPush('legend')
+call <SID>HtmlIndentPush('map')
+call <SID>HtmlIndentPush('menu')
+call <SID>HtmlIndentPush('noframes')
+call <SID>HtmlIndentPush('noscript')
+call <SID>HtmlIndentPush('object')
+call <SID>HtmlIndentPush('ol')
+call <SID>HtmlIndentPush('optgroup')
+call <SID>HtmlIndentPush('pre')
+call <SID>HtmlIndentPush('q')
+call <SID>HtmlIndentPush('s')
+call <SID>HtmlIndentPush('samp')
+call <SID>HtmlIndentPush('script')
+call <SID>HtmlIndentPush('select')
+call <SID>HtmlIndentPush('small')
+call <SID>HtmlIndentPush('span')
+call <SID>HtmlIndentPush('strong')
+call <SID>HtmlIndentPush('style')
+call <SID>HtmlIndentPush('sub')
+call <SID>HtmlIndentPush('sup')
+call <SID>HtmlIndentPush('table')
+call <SID>HtmlIndentPush('textarea')
+call <SID>HtmlIndentPush('title')
+call <SID>HtmlIndentPush('tt')
+call <SID>HtmlIndentPush('u')
+call <SID>HtmlIndentPush('ul')
+call <SID>HtmlIndentPush('var')
+
+
+" [-- <ELEMENT ? O O ...> --]
+if !exists('g:html_indent_strict')
+ call <SID>HtmlIndentPush('body')
+ call <SID>HtmlIndentPush('head')
+ call <SID>HtmlIndentPush('html')
+ call <SID>HtmlIndentPush('tbody')
+endif
+
+
+" [-- <ELEMENT ? O - ...> --]
+if !exists('g:html_indent_strict_table')
+ call <SID>HtmlIndentPush('th')
+ call <SID>HtmlIndentPush('td')
+ call <SID>HtmlIndentPush('tr')
+ call <SID>HtmlIndentPush('tfoot')
+ call <SID>HtmlIndentPush('thead')
+endif
+
+delfun <SID>HtmlIndentPush
+
+set cpo-=C
+
+" [-- count indent-increasing tags of line a:lnum --]
+fun! <SID>HtmlIndentOpen(lnum)
+ let s = substitute('x'.getline(a:lnum),
+ \ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
+ let s = substitute(s, "[^\1].*$", '', '')
+ return strlen(s)
+endfun
+
+" [-- count indent-decreasing tags of line a:lnum --]
+fun! <SID>HtmlIndentClose(lnum)
+ let s = substitute('x'.getline(a:lnum),
+ \ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
+ let s = substitute(s, "[^\1].*$", '', '')
+ return strlen(s)
+endfun
+
+" [-- count indent-increasing '{' of (java|css) line a:lnum --]
+fun! <SID>HtmlIndentOpenAlt(lnum)
+ return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
+endfun
+
+" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
+fun! <SID>HtmlIndentCloseAlt(lnum)
+ return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
+endfun
+
+" [-- return the sum of indents respecting the syntax of a:lnum --]
+fun! <SID>HtmlIndentSum(lnum, style)
+ if a:style == match(getline(a:lnum), '^\s*</')
+ if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
+ let open = <SID>HtmlIndentOpen(a:lnum)
+ let close = <SID>HtmlIndentClose(a:lnum)
+ if 0 != open || 0 != close
+ return open - close
+ endif
+ endif
+ endif
+ if '' != &syntax &&
+ \ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
+ \ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
+ \ =~ '\(css\|java\).*'
+ if a:style == match(getline(a:lnum), '^\s*}')
+ return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
+ endif
+ endif
+ return 0
+endfun
+
+" vim: set ts=3 sw=3:
diff --git a/base/.vim/syntax/json.vim b/base/.vim/syntax/json.vim
new file mode 100644
index 0000000..3423eba
--- /dev/null
+++ b/base/.vim/syntax/json.vim
@@ -0,0 +1,137 @@
+" Vim syntax file
+" Language: JSON
+" Maintainer: Eli Parra <[email protected]> https://github.com/elzr/vim-json
+" Last Change: 2014-12-20 Load ftplugin/json.vim
+
+" Reload the definition of g:vim_json_syntax_conceal
+" see https://github.com/elzr/vim-json/issues/42
+runtime! ftplugin/json.vim
+
+if !exists("main_syntax")
+ if version < 600
+ syntax clear
+ elseif exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'json'
+endif
+
+syntax match jsonNoise /\%(:\|,\)/
+
+" NOTE that for the concealing to work your conceallevel should be set to 2
+
+" Syntax: Strings
+" Separated into a match and region because a region by itself is always greedy
+syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
+if has('conceal') && g:vim_json_syntax_conceal == 1
+ syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
+else
+ syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
+endif
+
+" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
+syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
+
+" Syntax: JSON Keywords
+" Separated into a match and region because a region by itself is always greedy
+syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
+if has('conceal') && g:vim_json_syntax_conceal == 1
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contains=jsonEscape contained
+else
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained
+endif
+
+" Syntax: Escape sequences
+syn match jsonEscape "\\["\\/bfnrt]" contained
+syn match jsonEscape "\\u\x\{4}" contained
+
+" Syntax: Numbers
+syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
+
+" ERROR WARNINGS **********************************************
+if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
+ " Syntax: Strings should always be enclosed with quotes.
+ syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
+ syn match jsonTripleQuotesError /"""/
+
+ " Syntax: An integer part of 0 followed by other digits is not allowed.
+ syn match jsonNumError "-\=\<0\d\.\d*\>"
+
+ " Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1).
+ syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+"
+
+ " Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
+ syn match jsonCommentError "//.*"
+ syn match jsonCommentError "\(/\*\)\|\(\*/\)"
+
+ " Syntax: No semicolons in JSON
+ syn match jsonSemicolonError ";"
+
+ " Syntax: No trailing comma after the last element of arrays or objects
+ syn match jsonTrailingCommaError ",\_s*[}\]]"
+
+ " Syntax: Watch out for missing commas between elements
+ syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
+ syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
+ syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
+ syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
+endif
+
+" ********************************************** END OF ERROR WARNINGS
+" Allowances for JSONP: function call at the beginning of the file,
+" parenthesis and semicolon at the end.
+" Function name validation based on
+" http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name/2008444#2008444
+syn match jsonPadding "\%^[[:blank:]\r\n]*[_$[:alpha:]][_$[:alnum:]]*[[:blank:]\r\n]*("
+syn match jsonPadding ");[[:blank:]\r\n]*\%$"
+
+" Syntax: Boolean
+syn match jsonBoolean /\(true\|false\)\(\_s\+\ze"\)\@!/
+
+" Syntax: Null
+syn keyword jsonNull null
+
+" Syntax: Braces
+syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold
+syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold
+
+" Define the default highlighting.
+if version >= 508 || !exists("did_json_syn_inits")
+ hi def link jsonPadding Operator
+ hi def link jsonString String
+ hi def link jsonTest Label
+ hi def link jsonEscape Special
+ hi def link jsonNumber Delimiter
+ hi def link jsonBraces Delimiter
+ hi def link jsonNull Function
+ hi def link jsonBoolean Delimiter
+ hi def link jsonKeyword Label
+
+ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
+ hi def link jsonNumError Error
+ hi def link jsonCommentError Error
+ hi def link jsonSemicolonError Error
+ hi def link jsonTrailingCommaError Error
+ hi def link jsonMissingCommaError Error
+ hi def link jsonStringSQError Error
+ hi def link jsonNoQuotesError Error
+ hi def link jsonTripleQuotesError Error
+ endif
+ hi def link jsonQuote Quote
+ hi def link jsonNoise Noise
+endif
+
+let b:current_syntax = "json"
+if main_syntax == 'json'
+ unlet main_syntax
+endif
+
+" Vim settings
+" vim: ts=8 fdm=marker
+
+" MIT License
+" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra
+"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+"THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+"See https://twitter.com/elzr/status/294964017926119424