diff options
author | James McCoy <jamessan@jamessan.com> | 2017-02-01 15:30:51 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-02-01 18:34:58 -0500 |
commit | a5b875fe8677addfef2f295872eefcf217285da3 (patch) | |
tree | c8eea48d73ab8f21e910c7441bd772c389403450 /runtime/indent | |
parent | 4e47568f89c4b937077d017baddd79de012694d8 (diff) | |
download | rneovim-a5b875fe8677addfef2f295872eefcf217285da3.tar.gz rneovim-a5b875fe8677addfef2f295872eefcf217285da3.tar.bz2 rneovim-a5b875fe8677addfef2f295872eefcf217285da3.zip |
vim-patch:e18dbe8
Updated runtime files.
https://github.com/vim/vim/commit/e18dbe865d190e74fb5d43ac8bc6ac22507d0223
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/sh.vim | 22 | ||||
-rw-r--r-- | runtime/indent/vim.vim | 6 |
2 files changed, 24 insertions, 4 deletions
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index d05bb3770f..aca110f504 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,9 +3,15 @@ " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> " Original Author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2016-02-15 +" Latest Revision: 2016-06-27 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent +" Changelog: +" 20160627: - detect heredocs correctly +" 20160213: - detect function definition correctly +" 20160202: - use shiftwidth() function +" 20151215: - set b:undo_indent variable +" 20150728: - add foreach detection for zsh if exists("b:did_indent") finish @@ -102,6 +108,8 @@ function! GetShIndent() endif elseif s:is_case_break(line) let ind -= s:indent_value('case-breaks') + elseif s:is_here_doc(line) + let ind = 0 endif return ind @@ -160,6 +168,14 @@ function! s:is_case_break(line) return a:line =~ '^\s*;[;&]' endfunction +function! s:is_here_doc(line) + if a:line =~ '^\w\+$' + let here_pat = '<<-\?'. s:escape(a:line). '\$' + return search(here_pat, 'bnW') > 0 + endif + return 0 +endfunction + function! s:is_case_ended(line) return s:is_case_break(a:line) || a:line =~ ';[;&]\s*\%(#.*\)\=$' endfunction @@ -172,5 +188,9 @@ function! s:is_case_empty(line) endif endfunction +function! s:escape(pattern) + return '\V'. escape(a:pattern, '\\') +endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 7ec7df849e..8ebfa12caf 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: 2016 Apr 19 +" Last Change: 2016 Jun 27 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -60,7 +60,7 @@ function GetVimIndentIntern() else let ind = ind + shiftwidth() * 3 endif - elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+[eE][nN][dD]' + elseif prev_text =~ '^\s*aug\%[roup]\s\+' && prev_text !~ '^\s*aug\%[roup]\s\+[eE][nN][dD]\>' let ind = ind + shiftwidth() else " A line starting with :au does not increment/decrement indent. @@ -89,7 +89,7 @@ function GetVimIndentIntern() " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. - if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)' + if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' let ind = ind - shiftwidth() endif |