diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-07-04 19:27:46 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-04 23:01:35 +0200 |
commit | c49bcde9271a5bc22decbdf1a173207e9932fbf3 (patch) | |
tree | 1170ed96e78cf1aa9d987ae373f3f5cacd3e31c5 | |
parent | 4b3be56a03695fa14ed28d6ded4cb338cbb99249 (diff) | |
download | rneovim-c49bcde9271a5bc22decbdf1a173207e9932fbf3.tar.gz rneovim-c49bcde9271a5bc22decbdf1a173207e9932fbf3.tar.bz2 rneovim-c49bcde9271a5bc22decbdf1a173207e9932fbf3.zip |
vim-patch:11d5992: runtime(rust): use shiftwidth() in indent script
closes: vim/vim#15138
https://github.com/vim/vim/commit/11d599257310bb95a7d1a3537345ae26f36c6210
Co-authored-by: novenary <novenary@kwak.zip>
-rw-r--r-- | runtime/indent/rust.vim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim index 7c055ec739..a96650d419 100644 --- a/runtime/indent/rust.vim +++ b/runtime/indent/rust.vim @@ -2,7 +2,10 @@ " Language: Rust " Author: Chris Morgan <me@chrismorgan.info> " Last Change: 2023-09-11 +" 2024 Jul 04 by Vim Project: use shiftwidth() instead of hard-coding shifted values (#15138) + " For bugs, patches and license go to https://github.com/rust-lang/rust.vim +" Note: upstream seems umaintained: https://github.com/rust-lang/rust.vim/issues/502 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -179,7 +182,7 @@ function GetRustIndent(lnum) " A standalone 'where' adds a shift. let l:standalone_prevline_where = prevline =~# '\V\^\s\*where\s\*\$' if l:standalone_prevline_where - return indent(prevlinenum) + 4 + return indent(prevlinenum) + shiftwidth() endif " Handle where clauses nicely: subsequent values should line up nicely. @@ -197,7 +200,7 @@ function GetRustIndent(lnum) let l:scope_start = searchpair('{\|(', '', '}\|)', 'nbW', \ 's:is_string_comment(line("."), col("."))') if l:scope_start != 0 && l:scope_start < a:lnum - return indent(l:scope_start) + 4 + return indent(l:scope_start) + shiftwidth() endif endif @@ -268,7 +271,7 @@ function GetRustIndent(lnum) " It's the closing line, dedent it return 0 else - return &shiftwidth + return shiftwidth() endif endif endif |