diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-05-27 16:45:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-05-27 16:45:17 +0200 |
commit | b4d6c3ea4a59c6d8d4e0e52120596866f0edd510 (patch) | |
tree | 86f10ef089a2bcb8d77a7c5de3f4448422da9bde /runtime/indent/sh.vim | |
parent | 712598f210570627534246cb5dcbb4f213367997 (diff) |
Update runtime files.
Diffstat (limited to 'runtime/indent/sh.vim')
-rw-r--r-- | runtime/indent/sh.vim | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index aca110f504..ae4f4b53c4 100644 --- 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 |