Skip to content

Commit

Permalink
Merge pull request #69 from kana/chore
Browse files Browse the repository at this point in the history
Update for Vim 9.0.0612
  • Loading branch information
kana committed Sep 28, 2022
2 parents 1923c64 + 06a8c7f commit 4438b57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vim-version
@@ -1 +1 @@
v8.2.5041
v9.0.0612
18 changes: 15 additions & 3 deletions after/indent/vim.vim
Expand Up @@ -26,7 +26,13 @@
" $VIMRUNTIME/ftplugin.vim, $VIMRUNTIME/indent.vim does not :runtime! neither
" indent/{filetype}_*.vim nor indent/{filetype}/*.vim.

let &l:indentexpr = 'GetVimVspecIndent(' . &l:indentexpr . ')'
if has('patch-9.0.0612')
import autoload $VIMRUNTIME .. '/autoload/dist/vimindent.vim'
let &l:indentexpr = 'GetVimVspecIndent(s:vimindent.Expr(v:lnum))'
else
let &l:indentexpr = 'GetVimVspecIndent(' . &l:indentexpr . ')'
endif

setlocal indentkeys+==end

if exists('*GetVimVspecIndent')
Expand All @@ -39,9 +45,15 @@ function GetVimVspecIndent(base_indent)
let prev_lnum = prevnonblank(v:lnum - 1)
let prev_line = getline(prev_lnum)
if 0 <= match(prev_line, '\(^\||\)\s*\(after\|before\|context\|describe\|it\)\>')
let indent += &l:shiftwidth
let delta = &l:shiftwidth
elseif 0 <= match(getline(v:lnum), '^\s*end')
let indent -= &l:shiftwidth
let delta = -&l:shiftwidth
else
let delta = 0
endif

if delta != 0
let indent = (indent != -1 ? indent : indent(v:lnum)) + delta
endif

return indent
Expand Down

0 comments on commit 4438b57

Please sign in to comment.