diff options
Diffstat (limited to 'base/vim')
-rw-r--r-- | base/vim/colors/base16-default-dark.vim | 330 | ||||
-rw-r--r-- | base/vim/doc/matchit.txt | 406 | ||||
-rw-r--r-- | base/vim/doc/tags | 50 | ||||
-rw-r--r-- | base/vim/ftdetect/json.vim | 3 | ||||
-rw-r--r-- | base/vim/ftplugin/json.vim | 40 | ||||
-rw-r--r-- | base/vim/ftplugin/php.vim | 272 | ||||
-rw-r--r-- | base/vim/indent/json.vim | 177 | ||||
-rw-r--r-- | base/vim/indent/php.vim | 272 | ||||
-rw-r--r-- | base/vim/syntax/json.vim | 137 | ||||
-rw-r--r-- | base/vim/undo-dir/%home%adam%dotfiles%dotfiles%base.yaml | bin | 0 -> 561 bytes |
10 files changed, 1687 insertions, 0 deletions
diff --git a/base/vim/colors/base16-default-dark.vim b/base/vim/colors/base16-default-dark.vim new file mode 100644 index 0000000..ea529ec --- /dev/null +++ b/base/vim/colors/base16-default-dark.vim @@ -0,0 +1,330 @@ +" vi:syntax=vim + +" base16-vim (https://github.com/chriskempson/base16-vim) +" by Chris Kempson (http://chriskempson.com) +" Default Dark scheme by Chris Kempson (http://chriskempson.com) + +" This enables the coresponding base16-shell script to run so that +" :colorscheme works in terminals supported by base16-shell scripts +" User must set this variable in .vimrc +" let g:base16_shell_path=base16-builder/output/shell/ +if !has('gui_running') + if exists("g:base16_shell_path") + execute "silent !/bin/sh ".g:base16_shell_path."/base16-default-dark.sh" + endif +endif + +" GUI color definitions +let s:gui00 = "181818" +let s:gui01 = "282828" +let s:gui02 = "383838" +let s:gui03 = "585858" +let s:gui04 = "b8b8b8" +let s:gui05 = "d8d8d8" +let s:gui06 = "e8e8e8" +let s:gui07 = "f8f8f8" +let s:gui08 = "ab4642" +let s:gui09 = "dc9656" +let s:gui0A = "f7ca88" +let s:gui0B = "a1b56c" +let s:gui0C = "86c1b9" +let s:gui0D = "7cafc2" +let s:gui0E = "ba8baf" +let s:gui0F = "a16946" + +" Terminal color definitions +let s:cterm00 = "00" +let s:cterm03 = "08" +let s:cterm05 = "07" +let s:cterm07 = "15" +let s:cterm08 = "01" +let s:cterm0A = "03" +let s:cterm0B = "02" +let s:cterm0C = "06" +let s:cterm0D = "04" +let s:cterm0E = "05" +if exists('base16colorspace') && base16colorspace == "256" + let s:cterm01 = "18" + let s:cterm02 = "19" + let s:cterm04 = "20" + let s:cterm06 = "21" + let s:cterm09 = "16" + let s:cterm0F = "17" +else + let s:cterm01 = "10" + let s:cterm02 = "11" + let s:cterm04 = "12" + let s:cterm06 = "13" + let s:cterm09 = "09" + let s:cterm0F = "14" +endif + +" Neovim terminal colours +if has("nvim") + let g:terminal_color_0 = "#181818" + let g:terminal_color_1 = "#ab4642" + let g:terminal_color_2 = "#a1b56c" + let g:terminal_color_3 = "#f7ca88" + let g:terminal_color_4 = "#7cafc2" + let g:terminal_color_5 = "#ba8baf" + let g:terminal_color_6 = "#86c1b9" + let g:terminal_color_7 = "#d8d8d8" + let g:terminal_color_8 = "#585858" + let g:terminal_color_9 = "#dc9656" + let g:terminal_color_10 = "#282828" + let g:terminal_color_11 = "#383838" + let g:terminal_color_12 = "#b8b8b8" + let g:terminal_color_13 = "#e8e8e8" + let g:terminal_color_14 = "#a16946" + let g:terminal_color_15 = "#f8f8f8" + let g:terminal_color_background = g:terminal_color_0 + let g:terminal_color_foreground = g:terminal_color_7 + if &background == "light" + let g:terminal_color_background = g:terminal_color_7 + let g:terminal_color_foreground = g:terminal_color_2 + endif +endif + +" Theme setup +hi clear +syntax reset +let g:colors_name = "base16-default-dark" + +" Highlighting function +fun <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) + if a:guifg != "" + exec "hi " . a:group . " guifg=#" . a:guifg + endif + if a:guibg != "" + exec "hi " . a:group . " guibg=#" . a:guibg + endif + if a:ctermfg != "" + exec "hi " . a:group . " ctermfg=" . a:ctermfg + endif + if a:ctermbg != "" + exec "hi " . a:group . " ctermbg=" . a:ctermbg + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + if a:guisp != "" + exec "hi " . a:group . " guisp=#" . a:guisp + endif +endfun + +" Vim editor colors +call <sid>hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") +call <sid>hi("Bold", "", "", "", "", "bold", "") +call <sid>hi("Debug", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("Directory", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "") +call <sid>hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") +call <sid>hi("Exception", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "") +call <sid>hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call <sid>hi("IncSearch", s:gui01, s:gui09, s:cterm01, s:cterm09, "none", "") +call <sid>hi("Italic", "", "", "", "", "none", "") +call <sid>hi("Macro", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("MatchParen", "", s:gui03, "", s:cterm03, "", "") +call <sid>hi("ModeMsg", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("MoreMsg", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("Question", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("Search", s:gui03, s:gui0A, s:cterm03, s:cterm0A, "", "") +call <sid>hi("SpecialKey", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("TooLong", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("Underlined", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("Visual", "", s:gui02, "", s:cterm02, "", "") +call <sid>hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("WildMenu", s:gui08, s:gui0A, s:cterm08, "", "", "") +call <sid>hi("Title", s:gui0D, "", s:cterm0D, "", "none", "") +call <sid>hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") +call <sid>hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "") +call <sid>hi("NonText", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("LineNr", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call <sid>hi("SignColumn", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call <sid>hi("StatusLine", s:gui04, s:gui02, s:cterm04, s:cterm02, "none", "") +call <sid>hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call <sid>hi("VertSplit", s:gui02, s:gui02, s:cterm02, s:cterm02, "none", "") +call <sid>hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "") +call <sid>hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "") +call <sid>hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "") +call <sid>hi("CursorLineNr", s:gui04, s:gui01, s:cterm04, s:cterm01, "", "") +call <sid>hi("QuickFixLine", "", s:gui01, "", s:cterm01, "none", "") +call <sid>hi("PMenu", s:gui05, s:gui01, s:cterm05, s:cterm01, "none", "") +call <sid>hi("PMenuSel", s:gui01, s:gui05, s:cterm01, s:cterm05, "", "") +call <sid>hi("TabLine", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call <sid>hi("TabLineFill", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +call <sid>hi("TabLineSel", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "none", "") + +" Standard syntax highlighting +call <sid>hi("Boolean", s:gui09, "", s:cterm09, "", "", "") +call <sid>hi("Character", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("Comment", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("Conditional", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("Constant", s:gui09, "", s:cterm09, "", "", "") +call <sid>hi("Define", s:gui0E, "", s:cterm0E, "", "none", "") +call <sid>hi("Delimiter", s:gui0F, "", s:cterm0F, "", "", "") +call <sid>hi("Float", s:gui09, "", s:cterm09, "", "", "") +call <sid>hi("Function", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("Identifier", s:gui08, "", s:cterm08, "", "none", "") +call <sid>hi("Include", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("Keyword", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("Label", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("Number", s:gui09, "", s:cterm09, "", "", "") +call <sid>hi("Operator", s:gui05, "", s:cterm05, "", "none", "") +call <sid>hi("PreProc", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("Repeat", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("Special", s:gui0C, "", s:cterm0C, "", "", "") +call <sid>hi("SpecialChar", s:gui0F, "", s:cterm0F, "", "", "") +call <sid>hi("Statement", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("StorageClass", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("String", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("Structure", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("Tag", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("Todo", s:gui0A, s:gui01, s:cterm0A, s:cterm01, "", "") +call <sid>hi("Type", s:gui0A, "", s:cterm0A, "", "none", "") +call <sid>hi("Typedef", s:gui0A, "", s:cterm0A, "", "", "") + +" C highlighting +call <sid>hi("cOperator", s:gui0C, "", s:cterm0C, "", "", "") +call <sid>hi("cPreCondit", s:gui0E, "", s:cterm0E, "", "", "") + +" C# highlighting +call <sid>hi("csClass", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("csAttribute", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("csModifier", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("csType", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("csUnspecifiedStatement", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("csContextualStatement", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("csNewDecleration", s:gui08, "", s:cterm08, "", "", "") + +" CSS highlighting +call <sid>hi("cssBraces", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("cssClassName", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("cssColor", s:gui0C, "", s:cterm0C, "", "", "") + +" Diff highlighting +call <sid>hi("DiffAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call <sid>hi("DiffChange", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +call <sid>hi("DiffDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") +call <sid>hi("DiffText", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call <sid>hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +call <sid>hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") +call <sid>hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +call <sid>hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") +call <sid>hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") + +" Git highlighting +call <sid>hi("gitcommitOverflow", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("gitcommitSummary", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("gitcommitComment", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("gitcommitUntracked", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("gitcommitDiscarded", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("gitcommitSelected", s:gui03, "", s:cterm03, "", "", "") +call <sid>hi("gitcommitHeader", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("gitcommitSelectedType", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("gitcommitUnmergedType", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("gitcommitDiscardedType", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("gitcommitBranch", s:gui09, "", s:cterm09, "", "bold", "") +call <sid>hi("gitcommitUntrackedFile", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("gitcommitUnmergedFile", s:gui08, "", s:cterm08, "", "bold", "") +call <sid>hi("gitcommitDiscardedFile", s:gui08, "", s:cterm08, "", "bold", "") +call <sid>hi("gitcommitSelectedFile", s:gui0B, "", s:cterm0B, "", "bold", "") + +" GitGutter highlighting +call <sid>hi("GitGutterAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call <sid>hi("GitGutterChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call <sid>hi("GitGutterDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") +call <sid>hi("GitGutterChangeDelete", s:gui0E, s:gui01, s:cterm0E, s:cterm01, "", "") + +" HTML highlighting +call <sid>hi("htmlBold", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("htmlItalic", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("htmlEndTag", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("htmlTag", s:gui05, "", s:cterm05, "", "", "") + +" JavaScript highlighting +call <sid>hi("javaScript", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("javaScriptBraces", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("javaScriptNumber", s:gui09, "", s:cterm09, "", "", "") +" pangloss/vim-javascript highlighting +call <sid>hi("jsOperator", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("jsStatement", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("jsReturn", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("jsThis", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("jsClassDefinition", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("jsFunction", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("jsFuncName", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("jsFuncCall", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("jsClassFuncName", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("jsClassMethodType", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("jsRegexpString", s:gui0C, "", s:cterm0C, "", "", "") +call <sid>hi("jsGlobalObjects", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("jsGlobalNodeObjects", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("jsExceptions", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("jsBuiltins", s:gui0A, "", s:cterm0A, "", "", "") + +" Mail highlighting +call <sid>hi("mailQuoted1", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("mailQuoted2", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("mailQuoted3", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("mailQuoted4", s:gui0C, "", s:cterm0C, "", "", "") +call <sid>hi("mailQuoted5", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("mailQuoted6", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("mailURL", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("mailEmail", s:gui0D, "", s:cterm0D, "", "", "") + +" Markdown highlighting +call <sid>hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") +call <sid>hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "") + +" NERDTree highlighting +call <sid>hi("NERDTreeDirSlash", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("NERDTreeExecFile", s:gui05, "", s:cterm05, "", "", "") + +" PHP highlighting +call <sid>hi("phpMemberSelector", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("phpComparison", s:gui05, "", s:cterm05, "", "", "") +call <sid>hi("phpParent", s:gui05, "", s:cterm05, "", "", "") + +" Python highlighting +call <sid>hi("pythonOperator", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("pythonRepeat", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("pythonInclude", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("pythonStatement", s:gui0E, "", s:cterm0E, "", "", "") + +" Ruby highlighting +call <sid>hi("rubyAttribute", s:gui0D, "", s:cterm0D, "", "", "") +call <sid>hi("rubyConstant", s:gui0A, "", s:cterm0A, "", "", "") +call <sid>hi("rubyInterpolationDelimiter", s:gui0F, "", s:cterm0F, "", "", "") +call <sid>hi("rubyRegexp", s:gui0C, "", s:cterm0C, "", "", "") +call <sid>hi("rubySymbol", s:gui0B, "", s:cterm0B, "", "", "") +call <sid>hi("rubyStringDelimiter", s:gui0B, "", s:cterm0B, "", "", "") + +" SASS highlighting +call <sid>hi("sassidChar", s:gui08, "", s:cterm08, "", "", "") +call <sid>hi("sassClassChar", s:gui09, "", s:cterm09, "", "", "") +call <sid>hi("sassInclude", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("sassMixing", s:gui0E, "", s:cterm0E, "", "", "") +call <sid>hi("sassMixinName", s:gui0D, "", s:cterm0D, "", "", "") + +" Signify highlighting +call <sid>hi("SignifySignAdd", s:gui0B, s:gui01, s:cterm0B, s:cterm01, "", "") +call <sid>hi("SignifySignChange", s:gui0D, s:gui01, s:cterm0D, s:cterm01, "", "") +call <sid>hi("SignifySignDelete", s:gui08, s:gui01, s:cterm08, s:cterm01, "", "") + +" Spelling highlighting +call <sid>hi("SpellBad", "", s:gui00, "", s:cterm00, "undercurl", s:gui08) +call <sid>hi("SpellLocal", "", s:gui00, "", s:cterm00, "undercurl", s:gui0C) +call <sid>hi("SpellCap", "", s:gui00, "", s:cterm00, "undercurl", s:gui0D) +call <sid>hi("SpellRare", "", s:gui00, "", s:cterm00, "undercurl", s:gui0E) + +" Remove functions +delf <sid>hi + +" Remove color variables +unlet s:gui00 s:gui01 s:gui02 s:gui03 s:gui04 s:gui05 s:gui06 s:gui07 s:gui08 s:gui09 s:gui0A s:gui0B s:gui0C s:gui0D s:gui0E s:gui0F +unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F diff --git a/base/vim/doc/matchit.txt b/base/vim/doc/matchit.txt new file mode 100644 index 0000000..8a3a96e --- /dev/null +++ b/base/vim/doc/matchit.txt @@ -0,0 +1,406 @@ +*matchit.txt* Extended "%" matching + +For instructions on installing this file, type + :help matchit-install +inside Vim. + +For Vim version 6.3. Last change: 2007 Aug 29 + + + VIM REFERENCE MANUAL by Benji Fisher + +*matchit* *matchit.vim* + +1. Extended matching with "%" |matchit-intro| +2. Activation |matchit-activate| +3. Configuration |matchit-configure| +4. Supporting a New Language |matchit-newlang| +5. Known Bugs and Limitations |matchit-bugs| + +The functionality mentioned here is a plugin, see |add-plugin|. +This plugin is only available if 'compatible' is not set. +You can avoid loading this plugin by setting the "loaded_matchit" variable +in your |vimrc| file: > + :let loaded_matchit = 1 + +{Vi does not have any of this} + +============================================================================== +1. Extended matching with "%" *matchit-intro* + + *matchit-%* +% Cycle forward through matching groups, such as "if", "else", "endif", + as specified by |b:match_words|. + + *g%* *v_g%* *o_g%* +g% Cycle backwards through matching groups, as specified by + |b:match_words|. For example, go from "if" to "endif" to "else". + + *[%* *v_[%* *o_[%* +[% Go to [count] previous unmatched group, as specified by + |b:match_words|. Similar to |[{|. + + *]%* *v_]%* *o_]%* +]% Go to [count] next unmatched group, as specified by + |b:match_words|. Similar to |]}|. + + *v_a%* +a% In Visual mode, select the matching group, as specified by + |b:match_words|, containing the cursor. Similar to |v_a[|. + A [count] is ignored, and only the first character of the closing + pattern is selected. + +In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace, +bracket, or paren to its match. This can be configured with the 'matchpairs' +option. The matchit plugin extends this in several ways: + + You can match whole words, such as "if" and "endif", not just + single characters. You can also specify a |regular-expression|. + You can define groups with more than two words, such as "if", + "else", "endif". Banging on the "%" key will cycle from the "if" to + the first "else", the next "else", ..., the closing "endif", and back + to the opening "if". Nested structures are skipped. Using |g%| goes + in the reverse direction. + By default, words inside comments and strings are ignored, unless + the cursor is inside a comment or string when you type "%". If the + only thing you want to do is modify the behavior of "%" so that it + behaves this way, you do not have to define |b:match_words|, since the + script uses the 'matchpairs' option as well as this variable. + +See |matchit-details| for details on what the script does, and |b:match_words| +for how to specify matching patterns. + +MODES: *matchit-modes* *matchit-v_%* *matchit-o_%* + +Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in +|motion| commands in |Operator-pending| and |Visual| modes. However, you +cannot make these motions |linewise| or |characterwise|, since the |:omap|s +that define them start with "v" in order to make the default behavior +inclusive. (See |o_v|.) In other words, "dV%" will not work. The +work-around is to go through Visual mode: "V%d" will work. + +LANGUAGES: *matchit-languages* + +Currently, the following languages are supported: Ada, ASP with VBS, Csh, +DTD, Entity, Essbase, Fortran, HTML, JSP (same as HTML), LaTeX, Lua, Pascal, +SGML, Shell, Tcsh, Vim, XML. Other languages may already have support via +the default |filetype-plugin|s in the standard vim distribution. + +To support a new language, see |matchit-newlang| below. + +DETAILS: *matchit-details* *matchit-parse* + +Here is an outline of what matchit.vim does each time you hit the "%" key. If +there are |backref|s in |b:match_words| then the first step is to produce a +version in which these back references have been eliminated; if there are no +|backref|s then this step is skipped. This step is called parsing. For +example, "\(foo\|bar\):end\1" is parsed to yield +"\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are +nested groups. If debugging is turned on, the parsed version is saved as +|b:match_pat|. + + *matchit-choose* +Next, the script looks for a word on the current line that matches the pattern +just constructed. It includes the patterns from the 'matchpairs' option. +The goal is to do what you expect, which turns out to be a little complicated. +The script follows these rules: + + Insist on a match that ends on or after the cursor. + Prefer a match that includes the cursor position (that is, one that + starts on or before the cursor). + Prefer a match that starts as close to the cursor as possible. + If more than one pattern in |b:match_words| matches, choose the one + that is listed first. + +Examples: + + Suppose you > + :let b:match_words = '<:>,<tag>:</tag>' +< and hit "%" with the cursor on or before the "<" in "a <tag> is born". + The pattern '<' comes first, so it is preferred over '<tag>', which + also matches. If the cursor is on the "t", however, then '<tag>' is + preferred, because this matches a bit of text containing the cursor. + If the two groups of patterns were reversed then '<' would never be + preferred. + + Suppose you > + :let b:match_words = 'if:end if' +< (Note the space!) and hit "%" with the cursor at the end of "end if". + Then "if" matches, which is probably not what you want, but if the + cursor starts on the "end " then "end if" is chosen. (You can avoid + this problem by using a more complicated pattern.) + +If there is no match, the cursor does not move. (Before version 1.13 of the +script, it would fall back on the usual behavior of |%|). If debugging is +turned on, the matched bit of text is saved as |b:match_match| and the cursor +column of the start of the match is saved as |b:match_col|. + +Next, the script looks through |b:match_words| (original and parsed versions) +for the group and pattern that match. If debugging is turned on, the group is +saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If +there are |backref|s then, in addition, the matching pattern is saved as +|b:match_word| and a table of translations is saved as |b:match_table|. If +there are |backref|s, these are determined from the matching pattern and +|b:match_match| and substituted into each pattern in the matching group. + +The script decides whether to search forwards or backwards and chooses +arguments for the |searchpair()| function. Then, the cursor is moved to the +start of the match, and |searchpair()| is called. By default, matching +structures inside strings and comments are ignored. This can be changed by +setting |b:match_skip|. + +============================================================================== +2. Activation *matchit-activate* + +You can use this script as a plugin, by copying it to your plugin directory. +See |add-global-plugin| for instructions. You can also add a line to your +|vimrc| file, such as > + :source $VIMRUNTIME/macros/matchit.vim +or > + :runtime macros/matchit.vim +Either way, the script should start working the next time you start up Vim. + +(Earlier versions of the script did nothing unless a |buffer-variable| named +|b:match_words| was defined. Even earlier versions contained autocommands +that set this variable for various file types. Now, |b:match_words| is +defined in many of the default |filetype-plugin|s instead.) + +For a new language, you can add autocommands to the script or to your vimrc +file, but the recommended method is to add a line such as > + let b:match_words = '\<foo\>:\<bar\>' +to the |filetype-plugin| for your language. See |b:match_words| below for how +this variable is interpreted. + +TROUBLESHOOTING *matchit-troubleshoot* + +The script should work in most installations of Vim. It may not work if Vim +was compiled with a minimal feature set, for example if the |+syntax| option +was not enabled. If your Vim has support for syntax compiled in, but you do +not have |syntax| highlighting turned on, matchit.vim should work, but it may +fail to skip matching groups in comments and strings. If the |filetype| +mechanism is turned off, the |b:match_words| variable will probably not be +defined automatically. + +============================================================================== +3. Configuration *matchit-configure* + +There are several variables that govern the behavior of matchit.vim. Note +that these are variables local to the buffer, not options, so use |:let| to +define them, not |:set|. Some of these variables have values that matter; for +others, it only matters whether the variable has been defined. All of these +can be defined in the |filetype-plugin| or autocommand that defines +|b:match_words| or "on the fly." + +The main variable is |b:match_words|. It is described in the section below on +supporting a new language. + + *MatchError* *matchit-hl* *matchit-highlight* +MatchError is the highlight group for error messages from the script. By +default, it is linked to WarningMsg. If you do not want to be bothered by +error messages, you can define this to be something invisible. For example, +if you use the GUI version of Vim and your command line is normally white, you +can do > + :hi MatchError guifg=white guibg=white +< + *b:match_ignorecase* +If you > + :let b:match_ignorecase = 1 +then matchit.vim acts as if 'ignorecase' is set: for example, "end" and "END" +are equivalent. If you > + :let b:match_ignorecase = 0 +then matchit.vim treats "end" and "END" differently. (There will be no +b:match_infercase option unless someone requests it.) + + *b:match_debug* +Define b:match_debug if you want debugging information to be saved. See +|matchit-debug|, below. + + *b:match_skip* +If b:match_skip is defined, it is passed as the skip argument to +|searchpair()|. This controls when matching structures are skipped, or +ignored. By default, they are ignored inside comments and strings, as +determined by the |syntax| mechanism. (If syntax highlighting is turned off, +nothing is skipped.) You can set b:match_skip to a string, which evaluates to +a non-zero, numerical value if the match is to be skipped or zero if the match +should not be skipped. In addition, the following special values are +supported by matchit.vim: + s:foo becomes (current syntax item) =~ foo + S:foo becomes (current syntax item) !~ foo + r:foo becomes (line before cursor) =~ foo + R:foo becomes (line before cursor) !~ foo +(The "s" is meant to suggest "syntax", and the "r" is meant to suggest +"regular expression".) + +Examples: + + You can get the default behavior with > + :let b:match_skip = 's:comment\|string' +< + If you want to skip matching structures unless they are at the start + of the line (ignoring whitespace) then you can > + :let b:match_skip = 'R:^\s*' +< Do not do this if strings or comments can span several lines, since + the normal syntax checking will not be done if you set b:match_skip. + + In LaTeX, since "%" is used as the comment character, you can > + :let b:match_skip = 'r:%' +< Unfortunately, this will skip anything after "\%", an escaped "%". To + allow for this, and also "\\%" (an excaped backslash followed by the + comment character) you can > + :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' +< + See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both + syntax and a regular expression. + +============================================================================== +4. Supporting a New Language *matchit-newlang* + *b:match_words* +In order for matchit.vim to support a new language, you must define a suitable +pattern for |b:match_words|. You may also want to set some of the +|matchit-configure| variables, as described above. If your language has a +complicated syntax, or many keywords, you will need to know something about +Vim's |regular-expression|s. + +The format for |b:match_words| is similar to that of the 'matchpairs' option: +it is a comma (,)-separated list of groups; each group is a colon(:)-separated +list of patterns (regular expressions). Commas and backslashes that are part +of a pattern should be escaped with backslashes ('\:' and '\,'). It is OK to +have only one group; the effect is undefined if a group has only one pattern. +A simple example is > + :let b:match_words = '\<if\>:\<endif\>,' + \ . '\<while\>:\<continue\>:\<break\>:\<endwhile\>' +(In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if" +matches the end of "endif" but "\<if\>" does not.) Then banging on the "%" +key will bounce the cursor between "if" and the matching "endif"; and from +"while" to any matching "continue" or "break", then to the matching "endwhile" +and back to the "while". It is almost always easier to use |literal-string|s +(single quotes) as above: '\<if\>' rather than "\\<if\\>" and so on. + +Exception: If the ":" character does not appear in b:match_words, then it is +treated as an expression to be evaluated. For example, > + :let b:match_words = 'GetMatchWords()' +allows you to define a function. This can return a different string depending +on the current syntax, for example. + +Once you have defined the appropriate value of |b:match_words|, you will +probably want to have this set automatically each time you edit the +appropriate file type. The recommended way to do this is by adding the +definition to a |filetype-plugin| file. + +Tips: Be careful that your initial pattern does not match your final pattern. +See the example above for the use of word-boundary expressions. It is usually +better to use ".\{-}" (as many as necessary) instead of ".*" (as many as +possible). See |\{-|. For example, in the string "<tag>label</tag>", "<.*>" +matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "<tag>" and +"</tag>". + + *matchit-spaces* *matchit-s:notend* +If "if" is to be paired with "end if" (Note the space!) then word boundaries +are not enough. Instead, define a regular expression s:notend that will match +anything but "end" and use it as follows: > + :let s:notend = '\%(\<end\s\+\)\@<!' + :let b:match_words = s:notend . '\<if\>:\<end\s\+if\>' +< *matchit-s:sol* +This is a simplified version of what is done for Ada. The s:notend is a +|script-variable|. Similarly, you may want to define a start-of-line regular +expression > + :let s:sol = '\%(^\|;\)\s*' +if keywords are only recognized after the start of a line or after a +semicolon (;), with optional white space. + + *matchit-backref* *matchit-\1* +In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the +INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred +to as back references, or backrefs. For example, > + :let b:match_words = '\<b\(o\+\)\>:\(h\)\1\>' +means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note +that "\1" does not refer to the "\(h\)" in this example. If you have +"\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything +up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1" +refers to everything and "\2" refers to "\(parentheses\)". If you use a +variable such as |s:notend| or |s:sol| in the previous paragraph then remember +to count any "\(" patterns in this variable. You do not have to count groups +defined by |\%(\)|. + +It should be possible to resolve back references from any pattern in the +group. For example, > + :let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2' +would not work because "\2" cannot be determined from "morefoo" and "\1" +cannot be determined from "andbar". On the other hand, > + :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' +should work (and have the same effect as "foobar:barfoo:endfoobar"), although +this has not been thoroughly tested. + +You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has +not been thouroughly tested in matchit.vim.) For example, if the keyword "if" +must occur at the start of the line, with optional white space, you might use +the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of +at the start of the line. For another example, if HTML had only one tag then +one could > + :let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>' +so that "%" can bounce between matching "<" and ">" pairs or (starting on +"tag" or "/tag") between matching tags. Without the |\@<=|, the script would +bounce from "tag" to the "<" in "</tag>", and another "%" would not take you +back to where you started. + +DEBUGGING *matchit-debug* *:MatchDebug* + +If you are having trouble figuring out the appropriate definition of +|b:match_words| then you can take advantage of the same information I use when +debugging the script. This is especially true if you are not sure whether +your patterns or my script are at fault! To make this more convenient, I have +made the command :MatchDebug, which defines the variable |b:match_debug| and +creates a Matchit menu. This menu makes it convenient to check the values of +the variables described below. You will probably also want to read +|matchit-details| above. + +Defining the variable |b:match_debug| causes the script to set the following +variables, each time you hit the "%" key. Several of these are only defined +if |b:match_words| includes |backref|s. + + *b:match_pat* +The b:match_pat variable is set to |b:match_words| with |backref|s parsed. + *b:match_match* +The b:match_match variable is set to the bit of text that is recognized as a +match. + *b:match_col* +The b:match_col variable is set to the cursor column of the start of the +matching text. + *b:match_wholeBR* +The b:match_wholeBR variable is set to the comma-separated group of patterns +that matches, with |backref|s unparsed. + *b:match_iniBR* +The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|. + *b:match_ini* +The b:match_ini variable is set to the first pattern in |b:match_wholeBR|, +with |backref|s resolved from |b:match_match|. + *b:match_tail* +The b:match_tail variable is set to the remaining patterns in +|b:match_wholeBR|, with |backref|s resolved from |b:match_match|. + *b:match_word* +The b:match_word variable is set to the pattern from |b:match_wholeBR| that +matches |b:match_match|. + *b:match_table* +The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in +|b:match_word|. + +============================================================================== +5. Known Bugs and Limitations *matchit-bugs* + +Just because I know about a bug does not mean that it is on my todo list. I +try to respond to reports of bugs that cause real problems. If it does not +cause serious problems, or if there is a work-around, a bug may sit there for +a while. Moral: if a bug (known or not) bothers you, let me know. + +The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may +have undesired effects in Select mode |Select-mode-mapping|. At least, if you +want to replace the selection with any character in "ag%[]" there will be a +pause of |'updatetime'| first. + +It would be nice if "\0" were recognized as the entire pattern. That is, it +would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may +try to implement this in a future version. (This is not so easy to arrange as +you might think!) + +============================================================================== +vim:tw=78:fo=tcq2: diff --git a/base/vim/doc/tags b/base/vim/doc/tags new file mode 100644 index 0000000..4ccdc87 --- /dev/null +++ b/base/vim/doc/tags @@ -0,0 +1,50 @@ +:MatchDebug matchit.txt /*:MatchDebug* +MatchError matchit.txt /*MatchError* +[% matchit.txt /*[%* +]% matchit.txt /*]%* +b:match_col matchit.txt /*b:match_col* +b:match_debug matchit.txt /*b:match_debug* +b:match_ignorecase matchit.txt /*b:match_ignorecase* +b:match_ini matchit.txt /*b:match_ini* +b:match_iniBR matchit.txt /*b:match_iniBR* +b:match_match matchit.txt /*b:match_match* +b:match_pat matchit.txt /*b:match_pat* +b:match_skip matchit.txt /*b:match_skip* +b:match_table matchit.txt /*b:match_table* +b:match_tail matchit.txt /*b:match_tail* +b:match_wholeBR matchit.txt /*b:match_wholeBR* +b:match_word matchit.txt /*b:match_word* +b:match_words matchit.txt /*b:match_words* +g% matchit.txt /*g%* +matchit matchit.txt /*matchit* +matchit-% matchit.txt /*matchit-%* +matchit-\1 matchit.txt /*matchit-\\1* +matchit-activate matchit.txt /*matchit-activate* +matchit-backref matchit.txt /*matchit-backref* +matchit-bugs matchit.txt /*matchit-bugs* +matchit-choose matchit.txt /*matchit-choose* +matchit-configure matchit.txt /*matchit-configure* +matchit-debug matchit.txt /*matchit-debug* +matchit-details matchit.txt /*matchit-details* +matchit-highlight matchit.txt /*matchit-highlight* +matchit-hl matchit.txt /*matchit-hl* +matchit-intro matchit.txt /*matchit-intro* +matchit-languages matchit.txt /*matchit-languages* +matchit-modes matchit.txt /*matchit-modes* +matchit-newlang matchit.txt /*matchit-newlang* +matchit-o_% matchit.txt /*matchit-o_%* +matchit-parse matchit.txt /*matchit-parse* +matchit-s:notend matchit.txt /*matchit-s:notend* +matchit-s:sol matchit.txt /*matchit-s:sol* +matchit-spaces matchit.txt /*matchit-spaces* +matchit-troubleshoot matchit.txt /*matchit-troubleshoot* +matchit-v_% matchit.txt /*matchit-v_%* +matchit.txt matchit.txt /*matchit.txt* +matchit.vim matchit.txt /*matchit.vim* +o_[% matchit.txt /*o_[%* +o_]% matchit.txt /*o_]%* +o_g% matchit.txt /*o_g%* +v_[% matchit.txt /*v_[%* +v_]% matchit.txt /*v_]%* +v_a% matchit.txt /*v_a%* +v_g% matchit.txt /*v_g%* 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 diff --git a/base/vim/undo-dir/%home%adam%dotfiles%dotfiles%base.yaml b/base/vim/undo-dir/%home%adam%dotfiles%dotfiles%base.yaml Binary files differnew file mode 100644 index 0000000..ada8e68 --- /dev/null +++ b/base/vim/undo-dir/%home%adam%dotfiles%dotfiles%base.yaml |