Skip to content

Commit 51f9a9e

Browse files
pkopriv2vim-scripts
authored andcommitted
Version b2.2
Added: Support for while() control block. Added: Support for do {} while(); control block. Added: Support for with() {} control block. Added: Skeleton support for all MULTI-LINE cntrl blocks SINGLE LINE cntrl blocks DO NOT HAVE SKELETON VERSIONS!! Added: Skeleton support for function declarations. Added: Skeleton support for basic objects. Added: Tests for skeleton code.
1 parent 8eb7313 commit 51f9a9e

File tree

4 files changed

+593
-80
lines changed

4 files changed

+593
-80
lines changed

indent/html.vim

+17-13
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
" g:html_indent_strict_table -- inhibit 'O -' elements
99

1010
" Only load this indent file when no other was loaded.
11-
if exists("b:did_indent")
12-
finish
11+
"if exists("b:did_indent")
12+
"finish
13+
"endif
14+
"let b:did_indent = 1
15+
16+
if exists("g:js_indent")
17+
so g:js_indent
18+
else
19+
ru! indent/javascript.vim
1320
endif
14-
let b:did_indent = 1
1521

22+
echo "Sourcing html indent"
1623

17-
source javascript.vim
1824

1925
" [-- local settings (must come before aborting the script) --]
2026
setlocal indentexpr=HtmlIndentGetter(v:lnum)
@@ -172,6 +178,8 @@ fun! <SID>HtmlIndentSum(lnum, style)
172178
endfun
173179

174180
fun! HtmlIndentGetter(lnum)
181+
182+
echo "Grabbing html indent for line: " . a:lnum
175183
" Find a non-empty line above the current line.
176184
let lnum = prevnonblank(a:lnum - 1)
177185

@@ -195,7 +203,7 @@ fun! HtmlIndentGetter(lnum)
195203
endif
196204

197205
" [-- special handling for <javascript>: use cindent --]
198-
let js = '<script\s*type\s*=\s*javascript'
206+
let js = '<script.*type\s*=.*javascript'
199207

200208
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
201209
" by Tye Zdrojewski <[email protected]>, 05 Jun 2006
@@ -205,19 +213,15 @@ fun! HtmlIndentGetter(lnum)
205213
" the pair will still match if we are before the beginning of the
206214
" pair.
207215
"
208-
209216
if 0 < searchpair(js, '', '</script>', 'nWb')
210217
\ && 0 < searchpair(js, '', '</script>', 'nW')
211218
" we're inside javascript
212-
if getline(lnum) !~ js && getline(a:lnum) != '</script>'
219+
220+
if getline(lnum) !~ js && getline(a:lnum) !~ '</script>'
213221
if restore_ic == 0
214222
setlocal noic
215-
endif
216-
217-
let l:ind = GetJsIndent(a:lnum)
218-
219-
echo l:ind
220-
return l:ind
223+
endif
224+
return GetJsIndent(a:lnum)
221225
endif
222226
endif
223227

0 commit comments

Comments
 (0)