Initial commit.

This commit is contained in:
yan
2011-11-17 15:45:33 -06:00
commit 882015bc6d
1819 changed files with 111625 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
" Source the standard indentation file, since we only want to adjust the
" default indentation.
sou $VIMRUNTIME/indent/html.vim
" Set the default indentation to be that of the standard indent file.
let b:defaultIndentExpr = &indentexpr
" Use IndentAnything
setlocal indentexpr=IndentAnything()
" Echo info about indentations
let b:indent_anything_echo = 1
"
" Adjust the default indentation for comments. Set the comments for html to
" look like this:
"
" <!--
" - comment here
" -->
"
setl comments=sr:<!--,m:-,e:-->
let b:blockCommentStartRE = '<!--'
let b:blockCommentMiddleRE = '-'
let b:blockCommentEndRE = '-->'
let b:blockCommentMiddleExtra = 3
" Specify the syntax names for html comments and strings
let b:blockCommentRE = 'htmlComment'
let b:commentRE = b:blockCommentRE
let b:stringRE = 'htmlString'
let b:singleQuoteStringRE = b:stringRE
let b:doubleQuoteStringRE = b:stringRE

40
vim/indent/cucumber.vim Normal file
View File

@@ -0,0 +1,40 @@
" Vim indent file
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetCucumberIndent()
setlocal indentkeys=o,O,*<Return>,<:>,0<Bar>,0#,=,!^F
" Only define the function once.
if exists("*GetCucumberIndent")
finish
endif
function! GetCucumberIndent()
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
if cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
return &sw
elseif cline =~# '^\s*\%(Examples\|Scenarios\):'
return 2 * &sw
elseif line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
return 2 * &sw
elseif line =~# '^\s*\%(Examples\|Scenarios\):'
return 3 * &sw
elseif cline =~# '^\s*|' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|#]'
return indent(prevnonblank(v:lnum-1)) + &sw
elseif cline =~# '^\s*[^|#]' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1)) - &sw
endif
return -1
endfunction
" vim:set sts=2 sw=2:

80
vim/indent/eruby.vim Normal file
View File

@@ -0,0 +1,80 @@
" Vim indent file
" Language: eRuby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: http://vim-ruby.rubyforge.org
" Anon CVS: See above site
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
if exists("b:did_indent")
finish
endif
runtime! indent/ruby.vim
unlet! b:did_indent
setlocal indentexpr=
if exists("b:eruby_subtype")
exe "runtime! indent/".b:eruby_subtype.".vim"
else
runtime! indent/html.vim
endif
unlet! b:did_indent
if &l:indentexpr == ''
if &l:cindent
let &l:indentexpr = 'cindent(v:lnum)'
else
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
endif
endif
let b:eruby_subtype_indentexpr = &l:indentexpr
let b:did_indent = 1
setlocal indentexpr=GetErubyIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
" Only define the function once.
if exists("*GetErubyIndent")
finish
endif
function! GetErubyIndent(...)
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
let v:lnum = a:1
endif
let vcol = col('.')
call cursor(v:lnum,1)
let inruby = searchpair('<%','','%>','W')
call cursor(v:lnum,vcol)
if inruby && getline(v:lnum) !~ '^<%\|^\s*-\=%>'
let ind = GetRubyIndent()
else
exe "let ind = ".b:eruby_subtype_indentexpr
endif
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
if cline =~# '^\s*<%-\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%(-\=%>\|$\)'
let ind = ind - &sw
endif
if line =~# '\S\s*<%-\=\s*\%(}\|end\).\{-\}\)\s*\%(-\=%>\|$\)'
let ind = ind - &sw
endif
if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*-\=%>'
let ind = ind + &sw
elseif line =~# '<%-\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>'
let ind = ind + &sw
endif
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
let ind = ind + &sw
endif
if cline =~# '^\s*-\=%>\s*$'
let ind = ind - &sw
endif
return ind
endfunction
" vim:set sw=2 sts=2 ts=8 noet:

35
vim/indent/gitconfig.vim Normal file
View File

@@ -0,0 +1,35 @@
" Vim indent file
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetGitconfigIndent()
setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
" Only define the function once.
if exists("*GetGitconfigIndent")
finish
endif
function! GetGitconfigIndent()
let line = getline(v:lnum-1)
let cline = getline(v:lnum)
if line =~ '[^\\]\@<=\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
return -1
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
return &sw
elseif cline == '' && line =~ '^\['
return &sw
else
return -1
endif
endfunction

73
vim/indent/haml.vim Normal file
View File

@@ -0,0 +1,73 @@
" Vim indent file
" Language: HAML
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2008 Sep 11
if exists("b:did_indent")
finish
endif
runtime! indent/ruby.vim
unlet! b:did_indent
let b:did_indent = 1
setlocal autoindent sw=2 et
setlocal indentexpr=GetHamlIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
" Only define the function once.
if exists("*GetHamlIndent")
finish
endif
let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
if !exists('g:haml_self_closing_tags')
let g:haml_self_closing_tags = 'meta|link|img|hr|br'
endif
function! GetHamlIndent()
let lnum = prevnonblank(v:lnum-1)
if lnum == 0
return 0
endif
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
if cline =~# '\v^-\s*%(elsif|else|when)>'
let indent = cindent < indent ? cindent : indent - &sw
endif
let increase = indent + &sw
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
"let indent = indent == indent(lnum) ? -1 : indent
"let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent
let group = synIDattr(synID(lnum,lastcol,1),'name')
if line =~ '^!!!'
return indent
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
return increase
elseif line =~ '^:'
return increase
elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
return increase
elseif line == '-#'
return increase
elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^%\v%('.g:haml_self_closing_tags.')>'
return indent
elseif group =~? '\v^%(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$'
return increase
elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter'
return GetRubyIndent()
else
return indent
endif
endfunction
" vim:set sw=2:

121
vim/indent/ruby.vim Normal file
View File

@@ -0,0 +1,121 @@
"
" Copyright 2009 IGREQUE IGREQUE, All rights reserved.
"
" Lisence: BSD
"
" Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
"
" * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
" * Neither the name of the IGREQUE IGREQUE nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"
"
" Script:
"
" Ruby Indentation with IndentAnything
"
" Version: 0.1.6
"
" Description:
" This script requires IndentAnything version 1.2.2 or above.
" See http://www.vim.org/scripts/script.php?script_id=1839 .
"
" Installation:
"
" Copy this file in your home directory under ~/.vim/indent/
"
" Maintainer: IGREQUE IGREQUE
"
" Note:
" This script requires IndentAnything version 1.2.2 or above.
" See http://www.vim.org/scripts/script.php?script_id=1839
"
" Thanks: Tye Zdrojewski, the creater of IndentAnything.
"
" History:
" 2009.8.17: First release.
" 2009.8.17: Corrected a simple mistake and make one of b:indentTrios better.
" 2009.8.18: Fixed a bug that it indents by mistake after you type a line like "asif=1"
" 2009.8.19: Fixed a bug which happens when you use a statement modifier.
" 2009.11.21: Removed '*' and '/' from b:lineContList. Because '/' causes a mis-indent when using a Regexp literal.
"
" Known Bugs:
"* doesn't work well when you type such a line like below.
" if foo == "foo" then puts "Yes" else puts "*Not end*" end #Only if the line *starts with* "if" etc.
"
"* In a block( starts with a word, like 'if', 'when', 'do' etc. ), reindents by mistake when you type
" an identifier which starts with "els", "when", "rescue", and "ensure" at the beginning of a line.
" Example.
" if a > 1
" when_to_go = Time.new #Reindent by mistake here.
" end
"2009.8.17: This switch must be on. But I forgot.
let IndentAnything_Dbg = 1
" Only load this indent file when no other was loaded.
if exists("b:did_indent") && ! IndentAnything_Dbg
finish
endif
let b:did_indent = 1
setlocal indentexpr=IndentAnything()
setlocal indentkeys+=0),0},0],0=end,0=els,0=when,0=rescue,0=ensure
" Only define the function once.
if exists("*IndentAnything") && ! IndentAnything_Dbg
finish
endif
setlocal indentexpr=IndentAnything()
""" BEGIN IndentAnything specification
"
" Syntax name REs for comments and strings.
" But these REs are perfect for avoiding matching of pairs.
" And I'm sorry I don't know how to test this part.
"
let b:commentRE = 'rubyComment'
"let b:lineCommentRE = 'javaScriptLineComment'
"let b:blockCommentRE = 'javaScriptComment'
let b:stringRE = 'rubyString'
"let b:singleQuoteStringRE = 'javaScriptStringS'
"let b:doubleQuoteStringRE = 'javaScriptStringD'
"Special statement(class def do if...) and parenthesis.
"2009.08.19: Divided keywords into two groups:
" "usually used at the beginning of the line of the block( module, class, def, if, unless, while, until, case, and for )"
" and not so.
let b:indentTrios = [
\ [
\'\(^\s*module\|^\s*class\|^\s*def\|\<do\|^\s*if\|^\s*unless\|^\s*while\|^\s*until\|^\s*for\|^\s*case\|^\s*begin\)\>\([^#]*\(\<end\>\)\)\@!',
\'\<\(els\|when\|rescue\|ensure\)',
\'end'
\ ],
\ [ '(', '', ')' ],
\ [ '{', '', '}' ],
\ [ '\[', '', '\]' ],
\]
"
" Line continuations. Lines that are continued on the next line are
" if/unless/for/while/until statements that are NOT followed by a '{' block and operators
" at the end of a line.
"
"Operators which don't have the right-hand-side, and a backslash in the end of a statement.
"You might want more operators in this regexp.
let b:lineContList = [
\ { 'pattern' : '\(+\|-\|=\|+=\|\*=\|/=\|-=\|\\\)\s*\(#.*\)\?$' },
\]
"
" If a continued line and its continuation can have line-comments between them, then this should be true.
"
let b:contTraversesLineComments = 1

39
vim/indent/sass.vim Normal file
View File

@@ -0,0 +1,39 @@
" Vim indent file
" Language: SASS
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent sw=2 et
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
" Only define the function once.
if exists("*GetSassIndent")
finish
endif
let s:property = '^\s*:\|^\s*[[:alnum:]-]\+:'
function! GetSassIndent()
let lnum = prevnonblank(v:lnum-1)
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
if line !~ s:property && cline =~ s:property
return indent + &sw
"elseif line =~ s:property && cline !~ s:property
"return indent - &sw
else
return -1
endif
endfunction
" vim:set sw=2: