Mercurial > vim
changeset 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 | 4ae88f9389b4 |
children | 41482b74f548 |
files | runtime/indent/rust.vim |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -132,6 +132,22 @@ function GetRustIndent(lnum) return indent(prevlinenum) + 6 endif + "match newline after struct with generic bound like + "struct SomeThing<T> + "| <-- newline indent should same as prevline + if prevline[len(prevline) - 1] == ">" + \ && prevline =~# "\s*struct.*>$" + return indent(prevlinenum) + endif + + "match newline after where like: + "struct SomeThing<T> + "where + " T: Display, + if prevline =~# '^\s*where$' + return indent(prevlinenum) + 4 + endif + if prevline[len(prevline) - 1] == "," \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' \ && prevline !~ '^\s*fn\s'