Skip to content

Commit 9c72da5

Browse files
author
Julian Orth
committed
update vim indent file
1 parent 8780d9c commit 9c72da5

File tree

1 file changed

+3
-38
lines changed

1 file changed

+3
-38
lines changed

src/etc/vim/indent/rust.vim

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim indent file
22
" Language: Rust
33
" Author: Chris Morgan <[email protected]>
4-
" Last Change: 2013 Oct 29
4+
" Last Change: 2014 Sep 13
55

66
" Only load this indent file when no other was loaded.
77
if exists("b:did_indent")
@@ -10,7 +10,7 @@ endif
1010
let b:did_indent = 1
1111

1212
setlocal cindent
13-
setlocal cinoptions=L0,(0,Ws,JN,j1
13+
setlocal cinoptions=L0,(0,Ws,J1,j1
1414
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
1515
" Don't think cinwords will actually do anything at all... never mind
1616
setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
@@ -151,42 +151,7 @@ function GetRustIndent(lnum)
151151
"
152152
" There are probably other cases where we don't want to do this as
153153
" well. Add them as needed.
154-
return GetRustIndent(a:lnum - 1)
155-
endif
156-
157-
" cindent doesn't do the module scope well at all; e.g.::
158-
"
159-
" static FOO : &'static [bool] = [
160-
" true,
161-
" false,
162-
" false,
163-
" true,
164-
" ];
165-
"
166-
" uh oh, next statement is indented further!
167-
168-
" Note that this does *not* apply the line continuation pattern properly;
169-
" that's too hard to do correctly for my liking at present, so I'll just
170-
" start with these two main cases (square brackets and not returning to
171-
" column zero)
172-
173-
call cursor(a:lnum, 1)
174-
if searchpair('{\|(', '', '}\|)', 'nbW',
175-
\ 's:is_string_comment(line("."), col("."))') == 0
176-
if searchpair('\[', '', '\]', 'nbW',
177-
\ 's:is_string_comment(line("."), col("."))') == 0
178-
" Global scope, should be zero
179-
return 0
180-
else
181-
" At the module scope, inside square brackets only
182-
"if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
183-
if line =~ "^\\s*]"
184-
" It's the closing line, dedent it
185-
return 0
186-
else
187-
return &shiftwidth
188-
endif
189-
endif
154+
return indent(prevlinenum)
190155
endif
191156

192157
" Fall back on cindent, which does it mostly right

0 commit comments

Comments
 (0)