Mercurial > vim
comparison runtime/indent/vim.vim @ 19181:94eda51ba9ba v8.2.0149
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Commit: https://github.com/vim/vim/commit/8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 26 15:56:19 2020 +0100
patch 8.2.0149: maintaining a Vim9 branch separately is more work
Problem: Maintaining a Vim9 branch separately is more work.
Solution: Merge the Vim9 script changes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 26 Jan 2020 16:00:05 +0100 |
parents | 1cd44535be32 |
children | 3a1ed539ae2a |
comparison
equal
deleted
inserted
replaced
19180:8edf0aeb71b9 | 19181:94eda51ba9ba |
---|---|
8 finish | 8 finish |
9 endif | 9 endif |
10 let b:did_indent = 1 | 10 let b:did_indent = 1 |
11 | 11 |
12 setlocal indentexpr=GetVimIndent() | 12 setlocal indentexpr=GetVimIndent() |
13 setlocal indentkeys+==end,=else,=cat,=fina,=END,0\\,0=\"\\\ | 13 setlocal indentkeys+==end,=},=else,=cat,=fina,=END,0\\,0=\"\\\ |
14 | 14 |
15 let b:undo_indent = "setl indentkeys< indentexpr<" | 15 let b:undo_indent = "setl indentkeys< indentexpr<" |
16 | 16 |
17 " Only define the function once. | 17 " Only define the function once. |
18 if exists("*GetVimIndent") | 18 if exists("*GetVimIndent") |
90 elseif prev_text =~ '^\s*aug\%[roup]\s\+' && prev_text !~ '^\s*aug\%[roup]\s\+[eE][nN][dD]\>' | 90 elseif prev_text =~ '^\s*aug\%[roup]\s\+' && prev_text !~ '^\s*aug\%[roup]\s\+[eE][nN][dD]\>' |
91 let ind = ind + shiftwidth() | 91 let ind = ind + shiftwidth() |
92 else | 92 else |
93 " A line starting with :au does not increment/decrement indent. | 93 " A line starting with :au does not increment/decrement indent. |
94 if prev_text !~ '^\s*au\%[tocmd]' | 94 if prev_text !~ '^\s*au\%[tocmd]' |
95 let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') | 95 let i = match(prev_text, '\(^\||\)\s*\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|def\|el\%[seif]\)\>\)') |
96 if i >= 0 | 96 if i >= 0 |
97 let ind += shiftwidth() | 97 let ind += shiftwidth() |
98 if strpart(prev_text, i, 1) == '|' && has('syntax_items') | 98 if strpart(prev_text, i, 1) == '|' && has('syntax_items') |
99 \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' | 99 \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' |
100 let ind -= shiftwidth() | 100 let ind -= shiftwidth() |
113 endif | 113 endif |
114 endif | 114 endif |
115 | 115 |
116 | 116 |
117 " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, | 117 " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, |
118 " :endfun, :else and :augroup END. | 118 " :endfun, :enddef, :else and :augroup END. |
119 if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' | 119 if cur_text =~ '^\s*\(ene\@!\|}\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' |
120 let ind = ind - shiftwidth() | 120 let ind = ind - shiftwidth() |
121 endif | 121 endif |
122 | 122 |
123 return ind | 123 return ind |
124 endfunction | 124 endfunction |