Add some test examples

This commit is contained in:
Andy K. Massimino
2017-10-31 18:05:18 -04:00
parent 16820891b2
commit e10f501b99
8 changed files with 137 additions and 0 deletions

35
ftplugin/matchuptest.vim Normal file
View File

@@ -0,0 +1,35 @@
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo-=C
" Let the matchit plugin know what items can be matched.
if exists("loaded_matchit")
let b:match_ignorecase = 0
" let b:match_words =
" \ '\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,' .
" \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
" \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' .
" \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' .
" \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' .
" \ '(:)'
" very tricky examples:
" bad: let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2'
" good:
let b:match_words = '\<\(\(foo\)\(bar\)\):\3\2:end\1'
let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
\ =~? "comment\\|string\\|vimSynReg\\|vimSet"'
endif
let &cpo = s:cpo_save
unlet s:cpo_save

10
test/augment.matchuptest Normal file
View File

@@ -0,0 +1,10 @@
foobar
barfoo
endfoobar
" \<\(\(foo\)\(bar\)\):\3\2:end\1
" vim: set ft=matchuptest

33
test/forwhile.vim Normal file
View File

@@ -0,0 +1,33 @@
if a:findstart
if exists('s:completer') | unlet s:completer | endif
let l:pos = col('.') - 1
let l:line = getline('.')[:l:pos-1]
for l:completer in s:completers
if !get(l:completer, 'enabled', 1) | continue | endif
for l:pattern in l:completer.patterns
if l:line =~# l:pattern
let s:completer = l:completer
while l:pos > 0
if l:line[l:pos - 1] =~# '{\|,\|\[\|\\'
\ || l:line[l:pos-2:l:pos-1] ==# ', '
let s:completer.context = matchstr(l:line, '\S*$')
return l:pos
else
let l:pos -= 1
endif
endwhile
return -2
endif
endfor
endfor
return -3
else
if !exists('s:completer') | return [] | endif
return g:matchup_complete_close_braces && get(s:completer, 'inside_braces', 1)
\ ? s:close_braces(s:completer.complete(a:base))
\ : s:completer.complete(a:base)
endif

14
test/minvimrc Normal file
View File

@@ -0,0 +1,14 @@
set nocompatible
" load match-up
let &rtp = '~/.vim/bundle/matchup.vim,' . &rtp
let &rtp .= ',~/.vim/bundle/matchup.vim/after'
" load other plugins, if necessary
" let &rtp = '~/path/to/other/plugin,' . &rtp
filetype plugin indent on
syntax enable
" match-up options go here

9
test/mwe.vim Normal file
View File

@@ -0,0 +1,9 @@
if l:x == 1
call one()
else
call two()
elseif
call three()
endif

18
test/parens.txt Normal file
View File

@@ -0,0 +1,18 @@
----
(
something
)
----
( (( ) ))
(
hello
)
----
( ( (( )) ) )
----

13
test/test.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Content of the document......
</body>
</html>

5
test/transmute.html Normal file
View File

@@ -0,0 +1,5 @@
<sometag>
</sometag>