diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2014-08-12 23:45:36 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-08-12 23:45:36 +0200 |
commit | 90b24287deb9da69a8079599b8525e2be412f7f2 (patch) | |
tree | 78225d68b68f45ffa55d9fc84b10e64941abf96a /indent | |
parent | 5f1223fbc5285689db812236c9100329740a805b (diff) | |
download | vim-polyglot-90b24287deb9da69a8079599b8525e2be412f7f2.tar.gz vim-polyglot-90b24287deb9da69a8079599b8525e2be412f7f2.zip |
Update
Diffstat (limited to 'indent')
-rw-r--r-- | indent/go.vim | 77 | ||||
-rw-r--r-- | indent/html.vim | 2 | ||||
-rw-r--r-- | indent/puppet.vim | 13 |
3 files changed, 15 insertions, 77 deletions
diff --git a/indent/go.vim b/indent/go.vim deleted file mode 100644 index e3d6e841..00000000 --- a/indent/go.vim +++ /dev/null @@ -1,77 +0,0 @@ -" Copyright 2011 The Go Authors. All rights reserved. -" Use of this source code is governed by a BSD-style -" license that can be found in the LICENSE file. -" -" indent/go.vim: Vim indent file for Go. -" -" TODO: -" - function invocations split across lines -" - general line splits (line ends in an operator) - -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -" C indentation is too far off useful, mainly due to Go's := operator. -" Let's just define our own. -setlocal nolisp -setlocal autoindent -setlocal indentexpr=GoIndent(v:lnum) -setlocal indentkeys+=<:>,0=},0=) - -if exists("*GoIndent") - finish -endif - -" The shiftwidth() function is relatively new. -" Don't require it to exist. -if exists('*shiftwidth') - func s:sw() - return shiftwidth() - endfunc -else - func s:sw() - return &shiftwidth - endfunc -endif - -function! GoIndent(lnum) - let prevlnum = prevnonblank(a:lnum-1) - if prevlnum == 0 - " top of file - return 0 - endif - - " grab the previous and current line, stripping comments. - let prevl = substitute(getline(prevlnum), '//.*$', '', '') - let thisl = substitute(getline(a:lnum), '//.*$', '', '') - let previ = indent(prevlnum) - - let ind = previ - - if prevl =~ '[({]\s*$' - " previous line opened a block - let ind += s:sw() - endif - if prevl =~# '^\s*\(case .*\|default\):$' - " previous line is part of a switch statement - let ind += s:sw() - endif - " TODO: handle if the previous line is a label. - - if thisl =~ '^\s*[)}]' - " this line closed a block - let ind -= s:sw() - endif - - " Colons are tricky. - " We want to outdent if it's part of a switch ("case foo:" or "default:"). - " We ignore trying to deal with jump labels because (a) they're rare, and - " (b) they're hard to disambiguate from a composite literal key. - if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= s:sw() - endif - - return ind -endfunction diff --git a/indent/html.vim b/indent/html.vim index ab8a72fa..cbd324bc 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -61,6 +61,8 @@ call add(s:tags, 'dfn') call add(s:tags, 'dir') call add(s:tags, 'div') call add(s:tags, 'dl') +call add(s:tags, 'dt') +call add(s:tags, 'dd') call add(s:tags, 'em') call add(s:tags, 'fieldset') call add(s:tags, 'font') diff --git a/indent/puppet.vim b/indent/puppet.vim index 56ee46d5..cf49de88 100644 --- a/indent/puppet.vim +++ b/indent/puppet.vim @@ -76,6 +76,19 @@ function! GetPuppetIndent() if line =~ '^\s*}\s*els\(e\|if\).*{\s*$' let ind -= &sw endif + + " Don't indent resources that are one after another with a ->(ordering arrow) + " file {'somefile': + " ... + " } -> + " + " package { 'mycoolpackage': + " ... + " } + if line =~ '->$' + let ind -= &sw + endif + return ind endfunction |