annotate runtime/indent/haml.vim @ 30837:82c3677f8af1 v9.0.0753

patch 9.0.0753: some Ex commands are not in the help index Commit: https://github.com/vim/vim/commit/b77bdce120d7e140d0d0bd535ec9febdef78993d Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Sat Oct 15 10:22:19 2022 +0100 patch 9.0.0753: some Ex commands are not in the help index Problem: Some Ex commands are not in the help index. Solution: Add the missing commands. Add a script to check all Ex commands are in the help index. (Yee Cheng Chin, closes #11371)
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Oct 2022 11:30:07 +0200
parents dce918af0c00
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
1 " Vim indent file
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
2 " Language: Haml
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
4 " Last Change: 2022 Mar 15
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
5
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
6 if exists("b:did_indent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
7 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
8 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
9 runtime! indent/ruby.vim
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
10 unlet! b:did_indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
11 let b:did_indent = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
12
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
13 setlocal autoindent
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
14 setlocal indentexpr=GetHamlIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
15 setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
16
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
17 let b:undo_indent = "setl ai< inde< indk<"
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
18
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
19 " Only define the function once.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
20 if exists("*GetHamlIndent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
21 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
22 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
23
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
24 let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
25 let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
26
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
27 if !exists('g:haml_self_closing_tags')
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2420
diff changeset
28 let g:haml_self_closing_tags = 'base|link|meta|br|hr|img|input'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
29 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
30
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
31 function! GetHamlIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
32 let lnum = prevnonblank(v:lnum-1)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
33 if lnum == 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
34 return 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
35 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
36 let line = substitute(getline(lnum),'\s\+$','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
37 let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
38 let lastcol = strlen(line)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
39 let line = substitute(line,'^\s\+','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
40 let indent = indent(lnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
41 let cindent = indent(v:lnum)
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
42 let sw = shiftwidth()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
43 if cline =~# '\v^-\s*%(elsif|else|when)>'
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
44 let indent = cindent < indent ? cindent : indent - sw
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
45 endif
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
46 let increase = indent + sw
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
47 if indent == indent(lnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
48 let indent = cindent <= indent ? -1 : increase
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
49 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
50
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
51 let group = synIDattr(synID(lnum,lastcol,1),'name')
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
52
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
53 if line =~ '^!!!'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
54 return indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
55 elseif line =~ '^/\%(\[[^]]*\]\)\=$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
56 return increase
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
57 elseif group == 'hamlFilter'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
58 return increase
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
59 elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
60 return increase
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
61 elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
62 return increase
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
63 elseif line == '-#'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
64 return increase
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
65 elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^%\v%('.g:haml_self_closing_tags.')>'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
66 return indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
67 elseif group =~? '\v^%(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
68 return increase
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
69 elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
70 return GetRubyIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
71 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
72 return indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
73 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
74 endfunction
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
75
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
76 " vim:set sw=2: