File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
branches/dist-snap/src/etc/vim/indent Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/dist-snap: c20186bde5cc0129e4211fc766f117bf43a4b360
9
+ refs/heads/dist-snap: 1ad8dbe42e2c9d5aa7e8fda39794cc84ec91972f
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
12
12
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
Original file line number Diff line number Diff line change 1
1
" Vim indent file
2
2
" Language: Rust
3
3
" Author: Chris Morgan <[email protected] >
4
- " Last Change: 2013 Jul 10
4
+ " Last Change: 2013 Oct 29
5
5
6
6
" Only load this indent file when no other was loaded.
7
7
if exists (" b:did_indent" )
@@ -104,8 +104,23 @@ function GetRustIndent(lnum)
104
104
let prevline = s: get_line_trimmed (prevnonblank (a: lnum - 1 ))
105
105
if prevline[len (prevline) - 1 ] == " ,"
106
106
\ && s: get_line_trimmed (a: lnum ) !~ " ^\\ s*[\\ [\\ ]{}]"
107
+ \ && prevline !~ " ^\\ s*fn\\ s"
107
108
" Oh ho! The previous line ended in a comma! I bet cindent will try to
108
- " take this too far... For now, let's use the previous line's indent
109
+ " take this too far... For now, let's normally use the previous line's
110
+ " indent.
111
+
112
+ " One case where this doesn't work out is where *this* line contains
113
+ " square or curly brackets; then we normally *do* want to be indenting
114
+ " further.
115
+ "
116
+ " Another case where we don't want to is one like a function
117
+ " definition with arguments spread over multiple lines:
118
+ "
119
+ " fn foo(baz: Baz,
120
+ " baz: Baz) // <-- cindent gets this right by itself
121
+ "
122
+ " There are probably other cases where we don't want to do this as
123
+ " well. Add them as needed.
109
124
return GetRustIndent (a: lnum - 1 )
110
125
endif
111
126
You can’t perform that action at this time.
0 commit comments