comparison runtime/indent/vim.vim @ 7742:5f6f35a3cb12

commit https://github.com/vim/vim/commit/705ada1aff27ecd9c47c690df817d043c2ceb5e2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 24 17:56:50 2016 +0100 Update a few runtime files.
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jan 2016 18:00:06 +0100
parents 0550be8fc7f6
children 0bdeaf7092bc
comparison
equal deleted inserted replaced
7741:74b54a066bff 7742:5f6f35a3cb12
1 " Vim indent file 1 " Vim indent file
2 " Language: Vim script 2 " Language: Vim script
3 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last Change: 2014 Dec 12 4 " Last Change: 2016 Jan 24
5 5
6 " Only load this indent file when no other was loaded. 6 " Only load this indent file when no other was loaded.
7 if exists("b:did_indent") 7 if exists("b:did_indent")
8 finish 8 finish
9 endif 9 endif
56 let ind = indent(lnum) 56 let ind = indent(lnum)
57 if cur_text =~ '^\s*\\' && v:lnum > 1 && prev_text !~ '^\s*\\' 57 if cur_text =~ '^\s*\\' && v:lnum > 1 && prev_text !~ '^\s*\\'
58 if exists("g:vim_indent_cont") 58 if exists("g:vim_indent_cont")
59 let ind = ind + g:vim_indent_cont 59 let ind = ind + g:vim_indent_cont
60 else 60 else
61 let ind = ind + &sw * 3 61 let ind = ind + shiftwidth() * 3
62 endif 62 endif
63 elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END' 63 elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END'
64 let ind = ind + &sw 64 let ind = ind + shiftwidth()
65 else 65 else
66 " A line starting with :au does not increment/decrement indent. 66 " A line starting with :au does not increment/decrement indent.
67 if prev_text !~ '^\s*au\%[tocmd]' 67 if prev_text !~ '^\s*au\%[tocmd]'
68 let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') 68 let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
69 if i >= 0 69 if i >= 0
70 let ind += &sw 70 let ind += shiftwidth()
71 if strpart(prev_text, i, 1) == '|' && has('syntax_items') 71 if strpart(prev_text, i, 1) == '|' && has('syntax_items')
72 \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' 72 \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
73 let ind -= &sw 73 let ind -= shiftwidth()
74 endif 74 endif
75 endif 75 endif
76 endif 76 endif
77 endif 77 endif
78 78
80 " command. And not when there is a backslash before the pipe. 80 " command. And not when there is a backslash before the pipe.
81 " And when syntax HL is enabled avoid a match inside a string. 81 " And when syntax HL is enabled avoid a match inside a string.
82 let i = match(prev_text, '[^\\]|\s*\(ene\@!\)') 82 let i = match(prev_text, '[^\\]|\s*\(ene\@!\)')
83 if i > 0 && prev_text !~ '^\s*au\%[tocmd]' 83 if i > 0 && prev_text !~ '^\s*au\%[tocmd]'
84 if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$' 84 if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$'
85 let ind = ind - &sw 85 let ind = ind - shiftwidth()
86 endif 86 endif
87 endif 87 endif
88 88
89 89
90 " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, 90 " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
91 " :endfun, :else and :augroup END. 91 " :endfun, :else and :augroup END.
92 if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)' 92 if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)'
93 let ind = ind - &sw 93 let ind = ind - shiftwidth()
94 endif 94 endif
95 95
96 return ind 96 return ind
97 endfunction 97 endfunction
98 98