comparison runtime/indent/rust.vim @ 32930:2ff007677dba

runtime(rust): fix rust indent (#12542) Commit: https://github.com/vim/vim/commit/478668013f060a75b8cd8cc6ca2cf2abb3bcc4a5 Author: Raphael <glephunter@gmail.com> Date: Mon Aug 21 02:42:39 2023 +0800 runtime(rust): fix rust indent (https://github.com/vim/vim/issues/12542)
author Christian Brabandt <cb@256bit.org>
date Sun, 20 Aug 2023 20:45:06 +0200
parents 63b0b7b79b25
children 5c220cf30f1f
comparison
equal deleted inserted replaced
32929:4ae88f9389b4 32930:2ff007677dba
130 if prevline[len(prevline) - 1] == "," 130 if prevline[len(prevline) - 1] == ","
131 \ && prevline =~# '^\s*where\s' 131 \ && prevline =~# '^\s*where\s'
132 return indent(prevlinenum) + 6 132 return indent(prevlinenum) + 6
133 endif 133 endif
134 134
135 "match newline after struct with generic bound like
136 "struct SomeThing<T>
137 "| <-- newline indent should same as prevline
138 if prevline[len(prevline) - 1] == ">"
139 \ && prevline =~# "\s*struct.*>$"
140 return indent(prevlinenum)
141 endif
142
143 "match newline after where like:
144 "struct SomeThing<T>
145 "where
146 " T: Display,
147 if prevline =~# '^\s*where$'
148 return indent(prevlinenum) + 4
149 endif
150
135 if prevline[len(prevline) - 1] == "," 151 if prevline[len(prevline) - 1] == ","
136 \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' 152 \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
137 \ && prevline !~ '^\s*fn\s' 153 \ && prevline !~ '^\s*fn\s'
138 \ && prevline !~ '([^()]\+,$' 154 \ && prevline !~ '([^()]\+,$'
139 \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>' 155 \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>'