summaryrefslogtreecommitdiffstats
path: root/indent
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
commit617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1 (patch)
tree97fc653e0c19839490bd7aac6beeb4f5754155be /indent
parentbd35da8e9ca0bddd95539bef0c8f4857dc4cc746 (diff)
downloadvim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.tar.gz
vim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.zip
Updatev1.10.3
Diffstat (limited to 'indent')
-rw-r--r--indent/blade.vim12
-rw-r--r--indent/coffee.vim2
-rw-r--r--indent/elixir.vim3
-rw-r--r--indent/haskell.vim10
-rw-r--r--indent/html.vim3
-rw-r--r--indent/rust.vim60
-rw-r--r--indent/tex.vim31
7 files changed, 72 insertions, 49 deletions
diff --git a/indent/blade.vim b/indent/blade.vim
deleted file mode 100644
index 73550fb7..00000000
--- a/indent/blade.vim
+++ /dev/null
@@ -1,12 +0,0 @@
-" Language: Blade (Laravel)
-" Maintainer: xsbeats <jwalton512@gmail.com>
-" URL: http://github.com/xsbeats/vim-blade
-" License: WTFPL
-
-if exists("b:did_indent")
- finish
-endif
-
-runtime! indent/html.vim
-
-let b:did_indent = 1
diff --git a/indent/coffee.vim b/indent/coffee.vim
index 7bd82e3e..4f4570a8 100644
--- a/indent/coffee.vim
+++ b/indent/coffee.vim
@@ -1,5 +1,5 @@
" Language: CoffeeScript
-" Maintainer: Mick Koch <kchmck@gmail.com>
+" Maintainer: Mick Koch <mick@kochm.co>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL
diff --git a/indent/elixir.vim b/indent/elixir.vim
index fababe48..3563f44a 100644
--- a/indent/elixir.vim
+++ b/indent/elixir.vim
@@ -11,7 +11,8 @@ let b:did_indent = 1
setlocal nosmartindent
setlocal indentexpr=GetElixirIndent()
-setlocal indentkeys+==end,=else:,=match:,=elsif:,=catch:,=after:,=rescue:
+setlocal indentkeys+=0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
+setlocal indentkeys+==->
if exists("*GetElixirIndent")
finish
diff --git a/indent/haskell.vim b/indent/haskell.vim
index 1d741032..1d500250 100644
--- a/indent/haskell.vim
+++ b/indent/haskell.vim
@@ -55,7 +55,7 @@ function! HIndent(lnum)
" This is the wrong thing if you are deeply indented already and want to put
" a where clause on the top-level construct, but there isn't much that can
" be done about that case...
- if thisl =~ '^\s*where\s*$'
+ if thisl =~ '^\s*where\s*'
return previ + &sw
endif
@@ -175,11 +175,11 @@ function! HIndent(lnum)
return previ - &sw
endif
- " On the other hand, if the previous line is a where with some bindings
+ " On the other hand, if the previous line is a do or where with some bindings
" following it on the same line, accommodate and align with the first non-ws
" char after the where
- if prevl =~ '\Wwhere\s\+\w'
- let bindStart = match(prevl, '\(\Wwhere\s\+\)\@<=\w')
+ if prevl =~ '\W\(do\|where\)\s\+\w'
+ let bindStart = match(prevl, '\(\W\(do\|where\)\s\+\)\@<=\w')
if bindStart != -1
return bindStart
endif
@@ -248,7 +248,7 @@ function! s:GetAndStripTrailingComments(lnum)
let aline = getline(a:lnum)
" We can't just remove the string literal since that leaves us with a
" trailing operator (=), so replace it with a fake identifier
- let noStrings = substitute(aline, '"\([^"]\|\\"\)*"', 's', '')
+ let noStrings = substitute(aline, '"\([^"]\|\\"\)*"', '\=repeat("s", len(submatch(0)))', '')
let noLineCom = substitute(noStrings, '--.*$', '', '')
" If there are no fancy block comments involved, skip some of this extra
diff --git a/indent/html.vim b/indent/html.vim
index cbd324bc..769f6318 100644
--- a/indent/html.vim
+++ b/indent/html.vim
@@ -187,6 +187,7 @@ if exists('g:html_exclude_tags')
endfor
endif
let s:html_indent_tags = join(s:tags, '\|')
+let s:html_indent_tags = s:html_indent_tags.'\|\w\+\(-\w\+\)\+'
if exists('g:html_indent_tags')
let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags
endif
@@ -281,7 +282,7 @@ fun! HtmlIndentGet(lnum)
if 0 < searchpair(js, '', jse, 'nWb')
\ && 0 < searchpair(js, '', jse, 'nW')
" we're inside javascript
- if getline(searchpair(js, '', '</script>', 'nWb')) !~ '<script [^>]*type=["'']\?text\/\(html\|template\)'
+ if getline(searchpair(js, '', '</script>', 'nWb')) !~ '<script [^>]*type=["'']\?text\/\(html\|\(ng-\)\?template\)'
\ && getline(lnum) !~ js && getline(a:lnum) !~ jse
if restore_ic == 0
setlocal noic
diff --git a/indent/rust.vim b/indent/rust.vim
index b9d6330c..300d7dac 100644
--- a/indent/rust.vim
+++ b/indent/rust.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Rust
" Author: Chris Morgan <me@chrismorgan.info>
-" Last Change: 2013 Oct 29
+" Last Change: 2014 Sep 13
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -10,7 +10,7 @@ endif
let b:did_indent = 1
setlocal cindent
-setlocal cinoptions=L0,(0,Ws,JN,j1
+setlocal cinoptions=L0,(0,Ws,J1,j1
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
" Don't think cinwords will actually do anything at all... never mind
setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
@@ -151,40 +151,42 @@ function GetRustIndent(lnum)
"
" There are probably other cases where we don't want to do this as
" well. Add them as needed.
- return GetRustIndent(a:lnum - 1)
+ return indent(prevlinenum)
endif
- " cindent doesn't do the module scope well at all; e.g.::
- "
- " static FOO : &'static [bool] = [
- " true,
- " false,
- " false,
- " true,
- " ];
- "
- " uh oh, next statement is indented further!
+ if !has("patch-7.4.355")
+ " cindent before 7.4.355 doesn't do the module scope well at all; e.g.::
+ "
+ " static FOO : &'static [bool] = [
+ " true,
+ " false,
+ " false,
+ " true,
+ " ];
+ "
+ " uh oh, next statement is indented further!
- " Note that this does *not* apply the line continuation pattern properly;
- " that's too hard to do correctly for my liking at present, so I'll just
- " start with these two main cases (square brackets and not returning to
- " column zero)
+ " Note that this does *not* apply the line continuation pattern properly;
+ " that's too hard to do correctly for my liking at present, so I'll just
+ " start with these two main cases (square brackets and not returning to
+ " column zero)
- call cursor(a:lnum, 1)
- if searchpair('{\|(', '', '}\|)', 'nbW',
- \ 's:is_string_comment(line("."), col("."))') == 0
- if searchpair('\[', '', '\]', 'nbW',
+ call cursor(a:lnum, 1)
+ if searchpair('{\|(', '', '}\|)', 'nbW',
\ 's:is_string_comment(line("."), col("."))') == 0
- " Global scope, should be zero
- return 0
- else
- " At the module scope, inside square brackets only
- "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
- if line =~ "^\\s*]"
- " It's the closing line, dedent it
+ if searchpair('\[', '', '\]', 'nbW',
+ \ 's:is_string_comment(line("."), col("."))') == 0
+ " Global scope, should be zero
return 0
else
- return &shiftwidth
+ " At the module scope, inside square brackets only
+ "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
+ if line =~ "^\\s*]"
+ " It's the closing line, dedent it
+ return 0
+ else
+ return &shiftwidth
+ endif
endif
endif
endif
diff --git a/indent/tex.vim b/indent/tex.vim
index 92866d5b..93f70ece 100644
--- a/indent/tex.vim
+++ b/indent/tex.vim
@@ -90,4 +90,35 @@ function! LatexBox_TexIndent()
endfunction
" }}}
+" Restore cursor position, window position, and last search after running a
+" command.
+function! Latexbox_CallIndent()
+ " Save the current cursor position.
+ let cursor = getpos('.')
+
+ " Save the current window position.
+ normal! H
+ let window = getpos('.')
+ call setpos('.', cursor)
+
+ " Execute the command.
+ execute 'normal! =='
+
+ " Restore the previous window position.
+ call setpos('.', window)
+ normal! zt
+
+ " Restore the previous cursor position.
+ call setpos('.', cursor)
+endfunction
+
+" autocmd to call indent after completion
+" 7.3.598
+if v:version > 703 || (v:version == 703 && has('patch598'))
+ augroup LatexBox_Completion
+ autocmd!
+ autocmd CompleteDone <buffer> call Latexbox_CallIndent()
+ augroup END
+endif
+
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4