Update runtime files.

This commit is contained in:
Bram Moolenaar
2017-05-27 16:45:17 +02:00
parent 712598f210
commit b4d6c3ea4a
12 changed files with 298 additions and 148 deletions

View File

@ -3,10 +3,12 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2016-06-27
" Latest Revision: 2017-05-02
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
" Changelog:
" 20170502: - get rid of buffer-shiftwidth function
" 20160912: - preserve indentation of here-doc blocks
" 20160627: - detect heredocs correctly
" 20160213: - detect function definition correctly
" 20160202: - use shiftwidth() function
@ -33,15 +35,11 @@ endif
let s:cpo_save = &cpo
set cpo&vim
function s:buffer_shiftwidth()
return shiftwidth()
endfunction
let s:sh_indent_defaults = {
\ 'default': function('s:buffer_shiftwidth'),
\ 'continuation-line': function('s:buffer_shiftwidth'),
\ 'case-labels': function('s:buffer_shiftwidth'),
\ 'case-statements': function('s:buffer_shiftwidth'),
\ 'default': function('shiftwidth'),
\ 'continuation-line': function('shiftwidth'),
\ 'case-labels': function('shiftwidth'),
\ 'case-statements': function('shiftwidth'),
\ 'case-breaks': 0 }
function! s:indent_value(option)
@ -110,6 +108,9 @@ function! GetShIndent()
let ind -= s:indent_value('case-breaks')
elseif s:is_here_doc(line)
let ind = 0
" statements, executed within a here document. Keep the current indent
elseif match(map(synstack(v:lnum, 1), 'synIDattr(v:val, "name")'), '\c\mheredoc') > -1
return indent(v:lnum)
endif
return ind