Mercurial > vim
comparison runtime/indent/eruby.vim @ 15512:f0f06837a699
Update runtime files.
commit https://github.com/vim/vim/commit/d09091d4955c5f41de69928f2db85611ed54ed23
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 17 16:07:22 2019 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Jan 2019 16:15:08 +0100 |
parents | 63b0b7b79b25 |
children |
comparison
equal
deleted
inserted
replaced
15511:f41122780189 | 15512:f0f06837a699 |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: eRuby | 2 " Language: eRuby |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
4 " URL: https://github.com/vim-ruby/vim-ruby | 4 " URL: https://github.com/vim-ruby/vim-ruby |
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> | 5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> |
6 " Last Change: 2019 Jan 06 | |
6 | 7 |
7 if exists("b:did_indent") | 8 if exists("b:did_indent") |
8 finish | 9 finish |
9 endif | 10 endif |
10 | 11 |
11 runtime! indent/ruby.vim | 12 runtime! indent/ruby.vim |
12 unlet! b:did_indent | 13 unlet! b:did_indent |
13 setlocal indentexpr= | 14 setlocal indentexpr= |
14 | 15 |
15 if exists("b:eruby_subtype") | 16 if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby' |
16 exe "runtime! indent/".b:eruby_subtype.".vim" | 17 exe "runtime! indent/".b:eruby_subtype.".vim" |
17 else | 18 else |
18 runtime! indent/html.vim | 19 runtime! indent/html.vim |
19 endif | 20 endif |
20 unlet! b:did_indent | 21 unlet! b:did_indent |
45 let s:cpo_sav = &cpo | 46 let s:cpo_sav = &cpo |
46 set cpo&vim | 47 set cpo&vim |
47 | 48 |
48 function! GetErubyIndent(...) | 49 function! GetErubyIndent(...) |
49 " The value of a single shift-width | 50 " The value of a single shift-width |
50 let sw = shiftwidth() | 51 if exists('*shiftwidth') |
52 let sw = shiftwidth() | |
53 else | |
54 let sw = &sw | |
55 endif | |
51 | 56 |
52 if a:0 && a:1 == '.' | 57 if a:0 && a:1 == '.' |
53 let v:lnum = line('.') | 58 let v:lnum = line('.') |
54 elseif a:0 && a:1 =~ '^\d' | 59 elseif a:0 && a:1 =~ '^\d' |
55 let v:lnum = a:1 | 60 let v:lnum = a:1 |
89 endif | 94 endif |
90 if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' | 95 if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' |
91 let ind = ind + sw | 96 let ind = ind + sw |
92 endif | 97 endif |
93 if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>' | 98 if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>' |
99 \ && synID(v:lnum, match(cline, '\S') + 1, 1) != hlID('htmlEndTag') | |
94 let ind = ind - sw | 100 let ind = ind - sw |
95 endif | 101 endif |
96 if cline =~# '^\s*[-=]\=%>\s*$' | 102 if cline =~# '^\s*[-=]\=%>\s*$' |
97 let ind = ind - sw | 103 let ind = ind - sw |
98 endif | 104 endif |