summaryrefslogtreecommitdiff
path: root/runtime/indent/vim.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-03-22 17:40:10 +0100
committerBram Moolenaar <Bram@vim.org>2011-03-22 17:40:10 +0100
commitcab49dff91922dd8af0ca959968bc24cb6298485 (patch)
treec19c8af1a47a065e911523e1eae5e35752b54e44 /runtime/indent/vim.vim
parenta29a37d533744e1b8200b1d2e032d0f8d186ab98 (diff)
downloadvim-cab49dff91922dd8af0ca959968bc24cb6298485.zip
Updated runtime file. Fix Italian translations.
Diffstat (limited to 'runtime/indent/vim.vim')
-rw-r--r--runtime/indent/vim.vim14
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 0a6dbc17a..40117a007 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2005 Jul 06
+" Last Change: 2011 Mar 22
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -44,10 +44,18 @@ function GetVimIndent()
else
let ind = ind + &sw * 3
endif
- elseif getline(lnum) =~ '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>'
- let ind = ind + &sw
elseif getline(lnum) =~ '^\s*aug\%[roup]' && getline(lnum) !~ '^\s*aug\%[roup]\s*!\=\s\+END'
let ind = ind + &sw
+ else
+ let line = getline(lnum)
+ let i = match(line, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
+ if i >= 0
+ let ind += &sw
+ if strpart(line, i, 1) == '|' && has('syntax_items')
+ \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
+ let ind -= &sw
+ endif
+ endif
endif
" If the previous line contains an "end" after a pipe, but not in an ":au"