From 8ae9c465242c5e379877a15832043113021d714e Mon Sep 17 00:00:00 2001 From: Adam Hovorka Date: Mon, 4 Sep 2017 13:42:23 -0600 Subject: Switch from stowsh to dotbot --- base/.vim/indent/json.vim | 177 ------------------------------ base/.vim/indent/php.vim | 272 ---------------------------------------------- 2 files changed, 449 deletions(-) delete mode 100644 base/.vim/indent/json.vim delete mode 100644 base/.vim/indent/php.vim (limited to 'base/.vim/indent') diff --git a/base/.vim/indent/json.vim b/base/.vim/indent/json.vim deleted file mode 100644 index 7873d65..0000000 --- a/base/.vim/indent/json.vim +++ /dev/null @@ -1,177 +0,0 @@ -" Vim indent file -" Language: JSON -" Mantainer: Eli Parra 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 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 deleted file mode 100644 index 3c498a7..0000000 --- a/base/.vim/indent/php.vim +++ /dev/null @@ -1,272 +0,0 @@ -" Vim indent file -" Language: Php -" Authors: Miles Lott , Johannes Zellner , Pim Snel -" 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 -" - added changelog -" - added default indention of 3 spaces after the ,<>>,,{,} - -" 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 = HtmlIndentSum(lnum, -1) - let ind = ind + HtmlIndentSum(v:lnum, 0) - - let &ic=restore_ic - - let ind = indent(lnum) + (&sw * ind) - - " Indent after php open tags - if line =~ '' - let ind = ind + &sw - endif - if cline =~ '^\s*[?>]' " // Fix from Holger Dzeik 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,*,<>>,,{,} - - - -" [-- helper function to assemble tag list --] -fun! 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 - - -" [-- --] -call HtmlIndentPush('a') -call HtmlIndentPush('abbr') -call HtmlIndentPush('acronym') -call HtmlIndentPush('address') -call HtmlIndentPush('b') -call HtmlIndentPush('bdo') -call HtmlIndentPush('big') -call HtmlIndentPush('blockquote') -call HtmlIndentPush('button') -call HtmlIndentPush('caption') -call HtmlIndentPush('center') -call HtmlIndentPush('cite') -call HtmlIndentPush('code') -call HtmlIndentPush('colgroup') -call HtmlIndentPush('del') -call HtmlIndentPush('dfn') -call HtmlIndentPush('dir') -call HtmlIndentPush('div') -call HtmlIndentPush('dl') -call HtmlIndentPush('em') -call HtmlIndentPush('fieldset') -call HtmlIndentPush('font') -call HtmlIndentPush('form') -call HtmlIndentPush('frameset') -call HtmlIndentPush('h1') -call HtmlIndentPush('h2') -call HtmlIndentPush('h3') -call HtmlIndentPush('h4') -call HtmlIndentPush('h5') -call HtmlIndentPush('h6') -call HtmlIndentPush('i') -call HtmlIndentPush('iframe') -call HtmlIndentPush('ins') -call HtmlIndentPush('kbd') -call HtmlIndentPush('label') -call HtmlIndentPush('legend') -call HtmlIndentPush('map') -call HtmlIndentPush('menu') -call HtmlIndentPush('noframes') -call HtmlIndentPush('noscript') -call HtmlIndentPush('object') -call HtmlIndentPush('ol') -call HtmlIndentPush('optgroup') -call HtmlIndentPush('pre') -call HtmlIndentPush('q') -call HtmlIndentPush('s') -call HtmlIndentPush('samp') -call HtmlIndentPush('script') -call HtmlIndentPush('select') -call HtmlIndentPush('small') -call HtmlIndentPush('span') -call HtmlIndentPush('strong') -call HtmlIndentPush('style') -call HtmlIndentPush('sub') -call HtmlIndentPush('sup') -call HtmlIndentPush('table') -call HtmlIndentPush('textarea') -call HtmlIndentPush('title') -call HtmlIndentPush('tt') -call HtmlIndentPush('u') -call HtmlIndentPush('ul') -call HtmlIndentPush('var') - - -" [-- --] -if !exists('g:html_indent_strict') - call HtmlIndentPush('body') - call HtmlIndentPush('head') - call HtmlIndentPush('html') - call HtmlIndentPush('tbody') -endif - - -" [-- --] -if !exists('g:html_indent_strict_table') - call HtmlIndentPush('th') - call HtmlIndentPush('td') - call HtmlIndentPush('tr') - call HtmlIndentPush('tfoot') - call HtmlIndentPush('thead') -endif - -delfun HtmlIndentPush - -set cpo-=C - -" [-- count indent-increasing tags of line a:lnum --] -fun! 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! 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! HtmlIndentOpenAlt(lnum) - return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g')) -endfun - -" [-- count indent-decreasing '}' of (java|css) line a:lnum --] -fun! HtmlIndentCloseAlt(lnum) - return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g')) -endfun - -" [-- return the sum of indents respecting the syntax of a:lnum --] -fun! HtmlIndentSum(lnum, style) - if a:style == match(getline(a:lnum), '^\s*') - let open = HtmlIndentOpen(a:lnum) - let close = 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 HtmlIndentOpenAlt(a:lnum) - HtmlIndentCloseAlt(a:lnum) - endif - endif - return 0 -endfun - -" vim: set ts=3 sw=3: -- cgit v1.2.3-70-g09d2