Mercurial > vim
diff runtime/indent/sh.vim @ 11442:d183d629509e
Update runtime files.
commit https://github.com/vim/vim/commit/b4d6c3ea4a59c6d8d4e0e52120596866f0edd510
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 27 16:45:17 2017 +0200
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 May 2017 17:00:04 +0200 |
parents | 619a98a67f67 |
children | 444ad56c0cac |
line wrap: on
line diff
--- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -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