├── vimballs ├── toptions.recipe ├── livetimestamp.recipe ├── tgpg.recipe ├── pim.recipe ├── shymenu.recipe ├── scalefont.recipe ├── TortoiseSVN.recipe ├── pluginstats.recipe ├── tEchoPair.recipe ├── brep.recipe ├── concordance.recipe ├── gdocs.recipe ├── tbak.recipe ├── tmru.recipe ├── tregisters.recipe ├── ttags.recipe ├── ttoc.recipe ├── zeal.recipe ├── presets.recipe ├── tjumps.recipe ├── tmarks.recipe ├── tplugin.recipe ├── listitem.recipe ├── reader.recipe ├── rescreen.recipe ├── startup_profile.recipe ├── tstatus.recipe ├── autolinker.recipe ├── tcommand.recipe ├── tcomment.recipe ├── tsession.recipe ├── ttagecho.recipe ├── enabler.recipe ├── rer.recipe ├── setsyntax.recipe ├── trag.recipe ├── vikitasks.recipe ├── cmdlinehelp.recipe ├── glark.recipe ├── indentfolds.recipe ├── cfilehandler.recipe ├── likelycomplete.recipe ├── tselectfiles.recipe ├── tselectbuffer.recipe ├── hookcursormoved.recipe ├── localvariables.recipe ├── tlib.recipe ├── smartcasereplace.recipe ├── loremipsum.recipe ├── reclojure.recipe ├── tcalc.recipe ├── templator.recipe ├── tmboxbrowser.recipe ├── ttagcomplete.recipe ├── ttodo.recipe ├── tassert.recipe ├── tinykeymap.recipe ├── checksyntax.recipe ├── prototype.recipe ├── tbibtools.recipe ├── linglang.recipe ├── stakeholders.recipe ├── tskeleton.recipe ├── quickfixsigns.recipe ├── rcom.recipe ├── worksheet.recipe ├── viki.recipe ├── vimform.recipe ├── evalselection.recipe ├── spec.recipe └── bbcode.recipe ├── spec ├── spec │ ├── test_yield2.txt │ ├── spec.vim │ ├── test_yield1.txt │ ├── test_yield.txt │ ├── pluginkiller.vim │ ├── speckiller_vim.vim │ ├── should_throw.vim │ ├── rewrite.vim │ ├── should_yield.vim │ ├── should_finish.vim │ ├── speckiller.vim │ └── should_be.vim ├── viki │ └── test.txt ├── prototype │ └── binding.vim └── tassert │ ├── tassert.vim │ └── is.vim ├── Makefile_vimtlib ├── templator └── test.tskel │ ├── foo.txt │ └── bar │ └── foo.txt ├── plugin-info.txt ├── README ├── ruby ├── vimdedoc.txt └── vimdedoc.rb ├── tml └── tpl_cmdlinehelp_cheat.txt ├── INSTALL.TXT └── install_plugin.sh /vimballs/toptions.recipe: -------------------------------------------------------------------------------- 1 | macros/toptions.vim 2 | -------------------------------------------------------------------------------- /spec/spec/test_yield2.txt: -------------------------------------------------------------------------------- 1 | 4 4 2 | 5 5 3 | 6 6 4 | 77 5 | -------------------------------------------------------------------------------- /vimballs/livetimestamp.recipe: -------------------------------------------------------------------------------- 1 | plugin/livetimestamp.vim 2 | -------------------------------------------------------------------------------- /vimballs/tgpg.recipe: -------------------------------------------------------------------------------- 1 | doc/tgpg.txt 2 | plugin/tgpg.vim 3 | -------------------------------------------------------------------------------- /vimballs/pim.recipe: -------------------------------------------------------------------------------- 1 | plugin/pim.vim 2 | autoload/pim.vim 3 | -------------------------------------------------------------------------------- /vimballs/shymenu.recipe: -------------------------------------------------------------------------------- 1 | doc/shymenu.txt 2 | plugin/shymenu.vim 3 | -------------------------------------------------------------------------------- /vimballs/scalefont.recipe: -------------------------------------------------------------------------------- 1 | doc/scalefont.txt 2 | plugin/scalefont.vim 3 | -------------------------------------------------------------------------------- /vimballs/TortoiseSVN.recipe: -------------------------------------------------------------------------------- 1 | doc/TortoiseSVN.txt 2 | plugin/TortoiseSVN.vim 3 | -------------------------------------------------------------------------------- /vimballs/pluginstats.recipe: -------------------------------------------------------------------------------- 1 | doc/pluginstats.txt 2 | plugin/pluginstats.vim 3 | -------------------------------------------------------------------------------- /vimballs/tEchoPair.recipe: -------------------------------------------------------------------------------- 1 | autoload/tEchoPair.vim 2 | plugin/tEchoPair.vim 3 | -------------------------------------------------------------------------------- /Makefile_vimtlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomtom/vimtlib/HEAD/Makefile_vimtlib -------------------------------------------------------------------------------- /vimballs/brep.recipe: -------------------------------------------------------------------------------- 1 | doc/brep.txt 2 | plugin/brep.vim 3 | autoload/brep.vim 4 | -------------------------------------------------------------------------------- /vimballs/concordance.recipe: -------------------------------------------------------------------------------- 1 | plugin/concordance.vim 2 | autoload/concordance.vim 3 | -------------------------------------------------------------------------------- /vimballs/gdocs.recipe: -------------------------------------------------------------------------------- 1 | doc/gdocs.txt 2 | plugin/gdocs.vim 3 | autoload/gdocs.vim 4 | -------------------------------------------------------------------------------- /vimballs/tbak.recipe: -------------------------------------------------------------------------------- 1 | doc/tbak.txt 2 | plugin/tbak.vim 3 | autoload/tbak.vim 4 | -------------------------------------------------------------------------------- /vimballs/tmru.recipe: -------------------------------------------------------------------------------- 1 | doc/tmru.txt 2 | plugin/tmru.vim 3 | autoload/tmru.vim 4 | -------------------------------------------------------------------------------- /vimballs/tregisters.recipe: -------------------------------------------------------------------------------- 1 | plugin/tregisters.vim 2 | autoload/tregisters.vim 3 | -------------------------------------------------------------------------------- /vimballs/ttags.recipe: -------------------------------------------------------------------------------- 1 | plugin/ttags.vim 2 | autoload/ttags.vim 3 | doc/ttags.txt 4 | -------------------------------------------------------------------------------- /vimballs/ttoc.recipe: -------------------------------------------------------------------------------- 1 | doc/ttoc.txt 2 | plugin/ttoc.vim 3 | autoload/ttoc.vim 4 | -------------------------------------------------------------------------------- /vimballs/zeal.recipe: -------------------------------------------------------------------------------- 1 | doc/zeal.txt 2 | plugin/zeal.vim 3 | autoload/zeal.vim 4 | -------------------------------------------------------------------------------- /spec/spec/spec.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomtom/vimtlib/HEAD/spec/spec/spec.vim -------------------------------------------------------------------------------- /vimballs/presets.recipe: -------------------------------------------------------------------------------- 1 | doc/presets.txt 2 | plugin/presets.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /vimballs/tjumps.recipe: -------------------------------------------------------------------------------- 1 | doc/tjumps.txt 2 | autoload/tjumps.vim 3 | plugin/tjumps.vim 4 | -------------------------------------------------------------------------------- /vimballs/tmarks.recipe: -------------------------------------------------------------------------------- 1 | doc/tmarks.txt 2 | autoload/tmarks.vim 3 | plugin/tmarks.vim 4 | -------------------------------------------------------------------------------- /vimballs/tplugin.recipe: -------------------------------------------------------------------------------- 1 | doc/tplugin.txt 2 | macros/tplugin.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /spec/spec/test_yield1.txt: -------------------------------------------------------------------------------- 1 | 4 4 2 | 5 5 3 | 6 6 4 | 77 5 | -------------------------------------------------------------------------------- /vimballs/listitem.recipe: -------------------------------------------------------------------------------- 1 | doc/listitem.txt 2 | plugin/listitem.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /vimballs/reader.recipe: -------------------------------------------------------------------------------- 1 | autoload/reader.vim 2 | ftplugin/reader.vim 3 | plugin/reader.vim 4 | -------------------------------------------------------------------------------- /vimballs/rescreen.recipe: -------------------------------------------------------------------------------- 1 | doc/rescreen.txt 2 | plugin/rescreen.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /vimballs/startup_profile.recipe: -------------------------------------------------------------------------------- 1 | doc/startup_profile.txt 2 | macros/startup_profile.vim 3 | -------------------------------------------------------------------------------- /vimballs/tstatus.recipe: -------------------------------------------------------------------------------- 1 | doc/tstatus.txt 2 | plugin/tstatus.vim 3 | colors/tstatus.vim 4 | -------------------------------------------------------------------------------- /vimballs/autolinker.recipe: -------------------------------------------------------------------------------- 1 | doc/autolinker.txt 2 | plugin/autolinker.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /vimballs/tcommand.recipe: -------------------------------------------------------------------------------- 1 | doc/tcommand.txt 2 | autoload/tcommand.vim 3 | plugin/tcommand.vim 4 | -------------------------------------------------------------------------------- /vimballs/tcomment.recipe: -------------------------------------------------------------------------------- 1 | doc/tcomment.txt 2 | plugin/tcomment.vim 3 | autoload/tcomment.vim 4 | -------------------------------------------------------------------------------- /vimballs/tsession.recipe: -------------------------------------------------------------------------------- 1 | doc/tsession.txt 2 | plugin/tsession.vim 3 | autoload/tsession.vim 4 | -------------------------------------------------------------------------------- /vimballs/ttagecho.recipe: -------------------------------------------------------------------------------- 1 | autoload/ttagecho.vim 2 | plugin/ttagecho.vim 3 | doc/ttagecho.txt 4 | -------------------------------------------------------------------------------- /vimballs/enabler.recipe: -------------------------------------------------------------------------------- 1 | doc/enabler.txt 2 | plugin/*.vim 3 | autoload/**/*.vim 4 | enabler/**/*.vim 5 | -------------------------------------------------------------------------------- /vimballs/rer.recipe: -------------------------------------------------------------------------------- 1 | doc/rer.txt 2 | plugin/rer.vim 3 | ftplugin/r/rer.vim 4 | autoload/**/*.vim 5 | -------------------------------------------------------------------------------- /vimballs/setsyntax.recipe: -------------------------------------------------------------------------------- 1 | doc/setsyntax.txt 2 | plugin/setsyntax.vim 3 | autoload/setsyntax.vim 4 | -------------------------------------------------------------------------------- /vimballs/trag.recipe: -------------------------------------------------------------------------------- 1 | doc/trag.txt 2 | plugin/trag.vim 3 | autoload/**/*.vim 4 | ftplugin/**/*.vim 5 | -------------------------------------------------------------------------------- /vimballs/vikitasks.recipe: -------------------------------------------------------------------------------- 1 | autoload/vikitasks.vim 2 | plugin/vikitasks.vim 3 | doc/vikitasks.txt 4 | -------------------------------------------------------------------------------- /vimballs/cmdlinehelp.recipe: -------------------------------------------------------------------------------- 1 | doc/cmdlinehelp.txt 2 | plugin/cmdlinehelp.vim 3 | autoload/cmdlinehelp.vim 4 | -------------------------------------------------------------------------------- /vimballs/glark.recipe: -------------------------------------------------------------------------------- 1 | doc/glark.txt 2 | ftplugin/glark.vim 3 | plugin/glark.vim 4 | syntax/glark.vim 5 | -------------------------------------------------------------------------------- /vimballs/indentfolds.recipe: -------------------------------------------------------------------------------- 1 | doc/indentfolds.txt 2 | plugin/indentfolds.vim 3 | autoload/indentfolds.vim 4 | -------------------------------------------------------------------------------- /vimballs/cfilehandler.recipe: -------------------------------------------------------------------------------- 1 | doc/cfilehandler.txt 2 | plugin/cfilehandler.vim 3 | autoload/cfilehandler.vim 4 | -------------------------------------------------------------------------------- /vimballs/likelycomplete.recipe: -------------------------------------------------------------------------------- 1 | doc/likelycomplete.txt 2 | plugin/likelycomplete.vim 3 | autoload/**/*.vim 4 | -------------------------------------------------------------------------------- /vimballs/tselectfiles.recipe: -------------------------------------------------------------------------------- 1 | doc/tselectfiles.txt 2 | plugin/tselectfiles.vim 3 | autoload/tselectfiles.vim 4 | -------------------------------------------------------------------------------- /vimballs/tselectbuffer.recipe: -------------------------------------------------------------------------------- 1 | doc/tselectbuffer.txt 2 | plugin/tselectbuffer.vim 3 | autoload/tselectbuffer.vim 4 | -------------------------------------------------------------------------------- /vimballs/hookcursormoved.recipe: -------------------------------------------------------------------------------- 1 | autoload/hookcursormoved.vim 2 | plugin/hookcursormoved.vim 3 | doc/hookcursormoved.txt 4 | -------------------------------------------------------------------------------- /vimballs/localvariables.recipe: -------------------------------------------------------------------------------- 1 | doc/localvariables.txt 2 | plugin/localvariables.vim 3 | autoload/localvariables.vim 4 | -------------------------------------------------------------------------------- /vimballs/tlib.recipe: -------------------------------------------------------------------------------- 1 | plugin/02tlib.vim 2 | doc/tlib.txt 3 | test/tlib.vim 4 | autoload/tlib.vim 5 | autoload/tlib/*.vim 6 | -------------------------------------------------------------------------------- /vimballs/smartcasereplace.recipe: -------------------------------------------------------------------------------- 1 | doc/SmartCaseReplace.txt 2 | autoload/smartcasereplace.vim 3 | plugin/SmartCaseReplace.vim 4 | -------------------------------------------------------------------------------- /vimballs/loremipsum.recipe: -------------------------------------------------------------------------------- 1 | autoload/loremipsum.vim 2 | autoload/loremipsum.txt 3 | plugin/loremipsum.vim 4 | doc/loremipsum.txt 5 | -------------------------------------------------------------------------------- /vimballs/reclojure.recipe: -------------------------------------------------------------------------------- 1 | doc/reclojure.txt 2 | plugin/reclojure.vim 3 | ftplugin/clojure/reclojure.vim 4 | autoload/**/*.vim 5 | -------------------------------------------------------------------------------- /templator/test.tskel/foo.txt: -------------------------------------------------------------------------------- 1 | * Foo 2 | 3 | <+CURSOR+> 4 | 5 | % 2012-12-02; @Last Change: 2009-01-10. 6 | % vi: ft=viki:tw=72:ts=4 7 | -------------------------------------------------------------------------------- /templator/test.tskel/bar/foo.txt: -------------------------------------------------------------------------------- 1 | * Foo 2 | 3 | <+CURSOR+> 4 | 5 | % 2012-12-02; @Last Change: 2009-01-10. 6 | % vi: ft=viki:tw=72:ts=4 7 | -------------------------------------------------------------------------------- /vimballs/tcalc.recipe: -------------------------------------------------------------------------------- 1 | autoload/tcalc.vim 2 | syntax/tcalc.vim 3 | plugin/tcalc.vim 4 | ftplugin/tcalc.vim 5 | ruby/tcalc.rb 6 | doc/tcalc.txt 7 | -------------------------------------------------------------------------------- /vimballs/templator.recipe: -------------------------------------------------------------------------------- 1 | doc/templator.txt 2 | plugin/templator.vim 3 | autoload/templator.vim 4 | autoload/templator/*.vim 5 | templator/*.vim 6 | -------------------------------------------------------------------------------- /vimballs/tmboxbrowser.recipe: -------------------------------------------------------------------------------- 1 | autoload/tmboxbrowser.vim 2 | ftplugin/mbox/tmboxbrowser.vim 3 | plugin/tmboxbrowser.vim 4 | doc/tmboxbrowser.txt 5 | -------------------------------------------------------------------------------- /vimballs/ttagcomplete.recipe: -------------------------------------------------------------------------------- 1 | autoload/ttagcomplete/java.vim 2 | autoload/ttagcomplete.vim 3 | doc/ttagcomplete.txt 4 | plugin/ttagcomplete.vim 5 | -------------------------------------------------------------------------------- /vimballs/ttodo.recipe: -------------------------------------------------------------------------------- 1 | doc/ttodo.txt 2 | plugin/ttodo.vim 3 | autoload/**/*.vim 4 | ftplugin/**/*.vim 5 | ftdetect/**/*.vim 6 | syntax/**/*.vim 7 | -------------------------------------------------------------------------------- /vimballs/tassert.recipe: -------------------------------------------------------------------------------- 1 | autoload/tassert.vim 2 | autoload/tlog.vim 3 | doc/tassert.txt 4 | macros/tassert.vim 5 | plugin/05tlog.vim 6 | plugin/07tassert.vim 7 | -------------------------------------------------------------------------------- /vimballs/tinykeymap.recipe: -------------------------------------------------------------------------------- 1 | doc/tinykeymap.txt 2 | plugin/tinykeymap.vim 3 | autoload/tinykeymap.vim 4 | autoload/tinykeymap/*.vim 5 | autoload/tinykeymap/map/*.vim 6 | -------------------------------------------------------------------------------- /vimballs/checksyntax.recipe: -------------------------------------------------------------------------------- 1 | doc/checksyntax.txt 2 | plugin/checksyntax.vim 3 | autoload/checksyntax.vim 4 | autoload/checksyntax/**/*.vim 5 | autoload/airline/**/*.vim 6 | -------------------------------------------------------------------------------- /vimballs/prototype.recipe: -------------------------------------------------------------------------------- 1 | doc/prototype.txt 2 | autoload/prototype.vim 3 | autoload/prototype/strict.vim 4 | spec/prototype/prototype.vim 5 | spec/prototype/strict.vim 6 | -------------------------------------------------------------------------------- /spec/spec/test_yield.txt: -------------------------------------------------------------------------------- 1 | 1 1 1 2 | 2 2 3 | 3 4 | 4 4 5 | 5 5 6 | 6 6 7 | 77 8 | -------------------------------------------------------------------------------- /vimballs/tbibtools.recipe: -------------------------------------------------------------------------------- 1 | doc/tbibtools.txt 2 | ftplugin/bib/bibFindIndex.vim 3 | plugin/tbibtools.vim 4 | autoload/tbibtools.vim 5 | ruby/tbibtools.rb 6 | ruby/tvimtools.rb 7 | -------------------------------------------------------------------------------- /vimballs/linglang.recipe: -------------------------------------------------------------------------------- 1 | autoload/linglang.vim 2 | autoload/linglang/de.latin1 3 | autoload/linglang/de.utf8 4 | autoload/linglang/en.latin1 5 | plugin/linglang.vim 6 | doc/linglang.txt 7 | -------------------------------------------------------------------------------- /vimballs/stakeholders.recipe: -------------------------------------------------------------------------------- 1 | doc/stakeholders.txt 2 | plugin/stakeholders.vim 3 | autoload/stakeholders.vim 4 | autoload/stakeholders/delayed.vim 5 | autoload/stakeholders/immediate.vim 6 | -------------------------------------------------------------------------------- /vimballs/tskeleton.recipe: -------------------------------------------------------------------------------- 1 | doc/tskeleton.txt 2 | skeletons/README_tskeleton.txt 3 | plugin/tskeleton.vim 4 | autoload/tskeleton.vim 5 | autoload/tskeleton/**/*.vim 6 | syntax/tskeleton.vim 7 | -------------------------------------------------------------------------------- /vimballs/quickfixsigns.recipe: -------------------------------------------------------------------------------- 1 | doc/quickfixsigns.txt 2 | plugin/quickfixsigns.vim 3 | autoload/quickfixsigns.vim 4 | autoload/quickfixsigns/*.vim 5 | autoload/tinykeymap/map/quickfixsigns.vim 6 | -------------------------------------------------------------------------------- /vimballs/rcom.recipe: -------------------------------------------------------------------------------- 1 | doc/rcom.txt 2 | ftplugin/r/rcom.vim 3 | autoload/rcom.vim 4 | autoload/rcom/base.vim 5 | autoload/rcom/rcom.vim 6 | autoload/rcom/rcom_vim.R 7 | autoload/rcom/rserve.vim 8 | autoload/rcom/screen.vim 9 | -------------------------------------------------------------------------------- /spec/viki/test.txt: -------------------------------------------------------------------------------- 1 | Bla bla 2 | 3 | head 4 | 5 | foo head bar 6 | 7 | foo head 8 | 9 | head bar 10 | 11 | foo head bar 12 | 13 | foo head 14 | 15 | head bar 16 | 17 | 18 | Bla bla 19 | % vi: ft=viki:tw=72:ts=4 20 | -------------------------------------------------------------------------------- /vimballs/worksheet.recipe: -------------------------------------------------------------------------------- 1 | doc/worksheet.txt 2 | ftplugin/worksheet.vim 3 | autoload/worksheet.vim 4 | autoload/worksheet/rcom.vim 5 | autoload/worksheet/ruby.vim 6 | autoload/worksheet/rubymath.vim 7 | autoload/worksheet/sh.vim 8 | autoload/worksheet/vim.vim 9 | plugin/worksheet.vim 10 | -------------------------------------------------------------------------------- /vimballs/viki.recipe: -------------------------------------------------------------------------------- 1 | doc/viki.txt 2 | plugin/viki.vim 3 | autoload/viki/enc_latin1.vim 4 | autoload/viki/enc_utf-8.vim 5 | autoload/viki.vim 6 | autoload/viki_anyword.vim 7 | autoload/viki_latex.vim 8 | autoload/viki_viki.vim 9 | compiler/deplate.vim 10 | ftplugin/bib/viki.vim 11 | ftplugin/viki.vim 12 | indent/viki.vim 13 | syntax/viki.vim 14 | syntax/texmath.vim 15 | -------------------------------------------------------------------------------- /plugin-info.txt: -------------------------------------------------------------------------------- 1 | { 2 | 'name' : 'tlib', 3 | 'version' : "dev", 4 | 'author' : "Tom Link ", 5 | 'maintainer' : "Tom Link ", 6 | 'repository' : {'type': 'git', 'url': 'git://github.com/tomtom/vimtlib.git'}, 7 | 'dependencies' : {'tinymode': {}}, 8 | 'description' : 'A collection of vim plugins and miscellaneous functions' 9 | } 10 | -------------------------------------------------------------------------------- /vimballs/vimform.recipe: -------------------------------------------------------------------------------- 1 | doc/vimform.txt 2 | autoload/vimform.vim 3 | autoload/vimform/forms/substitute.vim 4 | autoload/vimform/widget.vim 5 | autoload/vimform/widgets/checkbox.vim 6 | autoload/vimform/widgets/dir.vim 7 | autoload/vimform/widgets/file.vim 8 | autoload/vimform/widgets/singlechoice.vim 9 | autoload/vimform/widgets/text.vim 10 | ftplugin/vimform.vim 11 | indent/vimform.vim 12 | plugin/vimform.vim 13 | syntax/vimform.vim 14 | -------------------------------------------------------------------------------- /spec/spec/pluginkiller.vim: -------------------------------------------------------------------------------- 1 | " @Author: Thomas Link (micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @GIT: http://github.com/tomtom/vimtlib/ 4 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 5 | " @Created: 2009-02-26. 6 | " @Last Change: 2009-03-06. 7 | " @Revision: 12 8 | 9 | let s:save_cpo = &cpo 10 | set cpo&vim 11 | 12 | " Doesn't work. 13 | finish 14 | 15 | 16 | SpecBegin 'title': 'PluginKiller Integration' 17 | 18 | 19 | Should be equal &hidden, 1 20 | 21 | 22 | let &cpo = s:save_cpo 23 | unlet s:save_cpo 24 | -------------------------------------------------------------------------------- /vimballs/evalselection.recipe: -------------------------------------------------------------------------------- 1 | doc/EvalSelection.txt 2 | autoload/evalselection/calculate.vim 3 | autoload/evalselection/lisp.vim 4 | autoload/evalselection/mzscheme.vim 5 | autoload/evalselection/ocaml.vim 6 | autoload/evalselection/perl.vim 7 | autoload/evalselection/php.vim 8 | autoload/evalselection/python.vim 9 | autoload/evalselection/r.vim 10 | autoload/evalselection/ruby.vim 11 | autoload/evalselection/scheme.vim 12 | autoload/evalselection/sh.vim 13 | autoload/evalselection/spss.vim 14 | autoload/evalselection/tcl.vim 15 | autoload/evalselection/vim.vim 16 | autoload/evalselection.vim 17 | plugin/EvalSelection.vim 18 | ruby/EvalSelection.rb 19 | syntax/EvalSelectionLog.vim 20 | -------------------------------------------------------------------------------- /vimballs/spec.recipe: -------------------------------------------------------------------------------- 1 | doc/spec.txt 2 | macros/spec.vim 3 | plugin/spec.vim 4 | autoload/should.vim 5 | autoload/should/be.vim 6 | autoload/should/finish.vim 7 | autoload/should/maintain.vim 8 | autoload/should/test.vim 9 | autoload/should/throw.vim 10 | autoload/should/yield.vim 11 | autoload/spec.vim 12 | autoload/spec/speckiller.vim 13 | spec/spec/_dont_include.vim 14 | spec/spec/_include.vim 15 | spec/spec/_included.vim 16 | spec/spec/should_be.vim 17 | spec/spec/should_finish.vim 18 | spec/spec/should_throw.vim 19 | spec/spec/should_yield.vim 20 | spec/spec/spec.vim 21 | spec/spec/speckiller.vim 22 | spec/spec/test_yield.txt 23 | spec/spec/test_yield1.txt 24 | spec/spec/test_yield2.txt 25 | -------------------------------------------------------------------------------- /spec/spec/speckiller_vim.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-14. 5 | " @Last Change: 2009-03-14. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | SpecBegin 'title': 'Option sets', 12 | \ 'sfile': 'autoload/spec.vim', 13 | \ 'options': [ 14 | \ 'vim', 15 | \ ] 16 | 17 | 18 | if spec#Val('s:spec_perm') >= 0 19 | Should be equal &cpo, 'aABceFs' 20 | endif 21 | 22 | 23 | let &cpo = s:save_cpo 24 | unlet s:save_cpo 25 | -------------------------------------------------------------------------------- /spec/spec/should_throw.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-06. 5 | " @Last Change: 2009-03-06. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | SpecBegin 'title': 'Should throw', 'sfile': 'autoload/should/throw.vim' 12 | 13 | It should test for exceptions. 14 | Should throw#Something('1 + [2]') 15 | Should not throw#Something('1 + 2') 16 | 17 | It should test for specific exceptions. 18 | Should throw#Exception('1 + [2]', ':E745:') 19 | Should not throw#Exception('1 + [2]', ':E746:') 20 | 21 | 22 | let &cpo = s:save_cpo 23 | unlet s:save_cpo 24 | -------------------------------------------------------------------------------- /vimballs/bbcode.recipe: -------------------------------------------------------------------------------- 1 | syntax/bbcode.vim 2 | skeletons/bits/bbcode/Block.[CODE 3 | skeletons/bits/bbcode/Block.[IMG 4 | skeletons/bits/bbcode/Block.[QUOTE 5 | skeletons/bits/bbcode/Inline.[EMAIL 6 | skeletons/bits/bbcode/Inline.[URL 7 | skeletons/bits/bbcode/Integration.[HTML 8 | skeletons/bits/bbcode/Integration.[PHP 9 | skeletons/bits/bbcode/Integration.[TEX 10 | skeletons/bits/bbcode/List.[%2A 11 | skeletons/bits/bbcode/List.[LIST 12 | skeletons/bits/bbcode/List.[LIST1 13 | skeletons/bits/bbcode/Paragraph.[CENTER 14 | skeletons/bits/bbcode/Paragraph.[INDENT 15 | skeletons/bits/bbcode/Paragraph.[LEFT 16 | skeletons/bits/bbcode/Paragraph.[RIGHT 17 | skeletons/bits/bbcode/Style.[B 18 | skeletons/bits/bbcode/Style.[COLOR 19 | skeletons/bits/bbcode/Style.[FONT 20 | skeletons/bits/bbcode/Style.[S 21 | skeletons/bits/bbcode/Style.[SIZE 22 | skeletons/bits/bbcode/Style.[U 23 | -------------------------------------------------------------------------------- /spec/spec/rewrite.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-07. 5 | " @Last Change: 2010-09-17. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | call spec#RewriteRule('^!\?\zsfoo \(\d\+\) bar \(\d\+\).*', '(\1 == \2)') 11 | 12 | SpecBegin 'title': 'Spec: Rewrite rules' 13 | 14 | 15 | Should be equal spec#__Rewrite('throw exception "tlib#date#Parse(''2000-14-2'')"'), 'should#throw#Exception("tlib#date#Parse(''2000-14-2'')")' 16 | 17 | Should be equal spec#__Rewrite('foo 1 bar 1'), '(1 == 1)' 18 | Should be equal spec#__Rewrite('not foo 1 bar 1'), '!(1 == 1)' 19 | 20 | Should foo 1 bar 1. 21 | Should not foo 1 bar 2. 22 | 23 | 24 | let &cpo = s:save_cpo 25 | unlet s:save_cpo 26 | -------------------------------------------------------------------------------- /spec/prototype/binding.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2010-03-01. 5 | " @Last Change: 2010-03-15. 6 | " @Revision: 29 7 | 8 | runtime autoload/prototype/binding.vim 9 | 10 | 11 | SpecBegin 'title': 'Bindings' 12 | 13 | 14 | 15 | It should define a simple binding. 16 | 17 | let x = 2 18 | let y = "foo" 19 | let z = {"bar": 10} 20 | Binding foo = x y z 21 | function! foo._(a) dict 22 | return a:a * self.x 23 | endf 24 | let x = 5 25 | let y = "x" 26 | let z = {} 27 | 28 | Should be equal foo._(10), 20 29 | 30 | 31 | 32 | It should unpack bindings. 33 | 34 | function! Bar(binding) 35 | exec prototype#AsVim(a:binding) 36 | return [x, y, z] 37 | endf 38 | 39 | Should be equal Bar(foo), [2, "foo", {"bar": 10}] 40 | 41 | 42 | -------------------------------------------------------------------------------- /spec/spec/should_yield.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-06. 5 | " @Last Change: 2009-03-06. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | let g:test_file = expand(':p:h') .'/' 12 | SpecBegin 'title': 'Should yield', 'sfile': 'autoload/should/yield.vim', 13 | \ 'scratch': [g:test_file . "test_yield.txt"] 14 | 15 | It should test buffer content. 16 | Should yield#Buffer(':silent 1,3delete', g:test_file.'test_yield1.txt') 17 | Should not yield#Buffer(':silent 1,3delete', g:test_file.'should_yield.vim') 18 | 19 | It should test squeezed buffer content. 20 | Should yield#SqueezedBuffer(':silent 1,3delete', g:test_file.'test_yield2.txt') 21 | Should not yield#SqueezedBuffer(':silent 1,3delete', g:test_file.'should_yield.vim') 22 | 23 | 24 | let &cpo = s:save_cpo 25 | unlet s:save_cpo 26 | -------------------------------------------------------------------------------- /spec/spec/should_finish.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-06. 5 | " @Last Change: 2009-03-07. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | SpecBegin 'title': 'Should finish', 12 | \ 'sfile': 'autoload/should/finish.vim', 13 | \ 'cleanup': ['TakeTime()'] 14 | 15 | function! TakeTime(n) "{{{3 16 | for i in range(a:n) 17 | endfor 18 | endf 19 | 20 | echo "Spec 'finish': The following test could take up to 5 seconds." 21 | It should measure execution time in seconds. 22 | Should finish#InSecs(':2sleep', 3) 23 | Should not finish#InSecs(':2sleep', 1) 24 | 25 | 26 | if exists('g:loaded_tlib') 27 | 28 | It should measure in microseconds but this depends on your OS so it probably doesn't. 29 | Should finish#InMicroSecs('TakeTime(10)', 40) 30 | Should not finish#InMicroSecs('TakeTime(100000)', 20) 31 | 32 | endif 33 | 34 | 35 | let &cpo = s:save_cpo 36 | unlet s:save_cpo 37 | -------------------------------------------------------------------------------- /spec/spec/speckiller.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-06. 5 | " @Last Change: 2009-03-14. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | if !exists('g:spec_foo') 12 | let g:spec_foo = "foo" 13 | endif 14 | 15 | SpecBegin 'title': 'Option sets', 16 | \ 'sfile': 'autoload/spec.vim', 17 | \ 'options': [ 18 | \ {'&l:hidden': 1, '&acd': 0, 'g:spec_foo': 'bar'}, 19 | \ {'&l:hidden': 0, '&acd': 1, 'g:spec_foo': 'bar'}, 20 | \ ] 21 | 22 | " echom "Round ". spec#Val('s:spec_perm') 23 | 24 | if spec#Val('s:spec_perm') >= 0 25 | It should test the spec against option sets (:SpecBegin). 26 | Should &hidden || &acd 27 | Should not (&hidden && &acd) 28 | Should be equal &hidden + &acd, 1 29 | 30 | Should be equal g:spec_foo, 'bar' 31 | else 32 | Should be equal g:spec_foo, 'foo' 33 | endif 34 | 35 | 36 | let &cpo = s:save_cpo 37 | unlet s:save_cpo 38 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This repository used to include several plugins many of which were moved to git repositories of their own -- please see https://github.com/tomtom for a list of plugins. The remaining parts of vimtlib include vim-related ruby-scripts, vimball recipes and other support files related to the vim plugins listed in "plugins.txt". 2 | 3 | 4 | * Install 5 | 6 | For VIM plugins see INSTALL.TXT. 7 | 8 | For vimdedoc.rb: Make sure the ruby script is executeable and put it (or an alias) into a directory that is included in ''$PATH''. On windows, I suggest to create a batch script that includes the line ''ruby.exe %DIRECTORY%\\vimtlib\\ruby\\vimdedoc.rb %*''. 9 | 10 | Skeletons: The skeletons have to be copied into ~/.vim/skeletons/... or ~/vimfiles/skeletons/... 11 | 12 | Vimball recipes: You can use VIM's ''MkVimball'' command or the ruby-based vimball.rb (https://github.com/tomtom/vimball.rb) to create vimballs from those recipes. 13 | 14 | 15 | * Scripts 16 | 17 | install_plugin.sh ... A shell script to copy files to a master .vim directory 18 | ruby/vimdedoc.rb ... The ill-conceived, casual vimscript source code documenter 19 | 20 | 21 | % vi: ft=viki:tw=0:ts=4 22 | -------------------------------------------------------------------------------- /spec/tassert/tassert.vim: -------------------------------------------------------------------------------- 1 | " tassert.vim 2 | " @Author: Thomas Link (micathom AT gmail com?subject=[vim]) 3 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 4 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 5 | " @Created: 2009-02-22. 6 | " @Last Change: 2009-03-06. 7 | " @Revision: 34 8 | 9 | let s:save_cpo = &cpo 10 | set cpo&vim 11 | 12 | 13 | 14 | SpecBegin 'title': 'TAssert', 15 | \ 'cleanup': ['Fun1()', 'Fun1type()', 'Fun2()'] 16 | 17 | 18 | 19 | function! Fun1(a) "{{{3 20 | TAssert should#be#Type(a:a, 'string') 21 | endf 22 | 23 | function! Fun1type(a) "{{{3 24 | TAssertType a:a, 'string' 25 | endf 26 | 27 | function! Fun2() "{{{3 28 | TAssert FunTakeTime() 29 | endf 30 | 31 | function! FunTakeTime() "{{{3 32 | echom "Take 2 secs time" 33 | sleep 2 34 | return 1 35 | endf 36 | 37 | let g:spec_tassert_status = g:TASSERT 38 | 39 | 40 | 41 | TAssertOn 42 | 43 | It should evaluate assertions when turned on. 44 | Should throw something 'Fun1(1)' 45 | Should not throw something 'Fun1("foo")' 46 | 47 | Should throw#Something('Fun1type(1)') 48 | Should not throw something 'Fun1type("foo")' 49 | 50 | Should not finish in 1 second 'Fun2()' 51 | 52 | 53 | 54 | TAssertOff 55 | 56 | It should not evaluate assertions when turned off. 57 | Should not throw something 'Fun1(1)' 58 | Should not throw something 'Fun1type(1)' 59 | Should finish in 1 second 'Fun2()' 60 | 61 | 62 | 63 | if g:spec_tassert_status 64 | TAssertOn 65 | endif 66 | 67 | 68 | 69 | let &cpo = s:save_cpo 70 | unlet s:save_cpo 71 | -------------------------------------------------------------------------------- /spec/tassert/is.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-07. 5 | " @Last Change: 2009-03-07. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | runtime macros/tassert.vim 12 | 13 | 14 | SpecBegin 'title': 'tassert Is* Macros' 15 | 16 | 17 | Should IsA(1, 'number') 18 | Should IsA("1", 'string') 19 | Should IsA([1,2], 'list') 20 | Should IsA({}, 'dictionary') 21 | Should IsA(function('IsA'), 'funcref') 22 | 23 | Should not IsA("1", 'number') 24 | Should not IsA(1, 'string') 25 | Should not IsA(function('IsA'), 'list') 26 | Should not IsA([1,2], 'dictionary') 27 | Should not IsA({}, 'funcref') 28 | 29 | Should IsNumber(1) 30 | Should IsString("1") 31 | Should IsList([]) 32 | Should IsDictionary({}) 33 | Should IsFuncref(function('IsA')) 34 | Should IsException('1 + [2]') 35 | Should IsError('1 + [2]', 'E745:') 36 | Should IsEqual(1, 1) 37 | Should IsNotEqual(1, 2) 38 | Should IsEmpty([]) 39 | Should IsNotEmpty([1]) 40 | Should IsMatch('123', '2') 41 | Should IsNotMatch('123', '4') 42 | Should IsExistent('*IsExistent') 43 | 44 | Should not IsNumber("1") 45 | Should not IsString(1) 46 | Should not IsList(function('IsA')) 47 | Should not IsDictionary([]) 48 | Should not IsFuncref({}) 49 | Should not IsException('1 + 2') 50 | Should not IsError('1 + [2]', 'E744:') 51 | Should not IsEqual(1, 2) 52 | Should not IsNotEqual(1, 1) 53 | Should not IsEmpty([1]) 54 | Should not IsNotEmpty([]) 55 | Should not IsMatch('123', '4') 56 | Should not IsNotMatch('123', '2') 57 | Should not IsExistent('*IsFoo') 58 | 59 | 60 | let &cpo = s:save_cpo 61 | unlet s:save_cpo 62 | -------------------------------------------------------------------------------- /ruby/vimdedoc.txt: -------------------------------------------------------------------------------- 1 | #TI: vimdedoc 2 | #AU: Tom Link 3 | 4 | In order to use vimdedoc, you need 5 | 6 | 1. a template, which actually is a format string (i.e. you have to 7 | escape percent signs (:%s/%/%%/g) and the template has to contain 8 | exactly one ''%s'' marker for the content extracted from the 9 | source files. 10 | 11 | 2. vim source files that follow a simple convention: 12 | 13 | 1. Commands and functions are defined as either 14 | - com 15 | - com! 16 | - command 17 | - command! 18 | - fun 19 | - fun! 20 | - function 21 | - function! 22 | 23 | 2. Important variables have a vim fold marker attached as in: 24 | ''let g:foo = "bar" {{{1'' 25 | 26 | 3. The documentation is embedded in documents and precedes the 27 | definition of the command, function, variable. 28 | 29 | A typical call would look like this: 30 | ''ruby/vimdedoc.rb -o doc/foo.txt -t templates/foo.txt plugin/foo.vim 31 | autoload/foo.vim syntax/foo.vim'' 32 | 33 | vimdedoc also provides a set of tags to modify the generated output. 34 | 35 | :nodoc: :: Ignore the next definition. 36 | :enddoc: :: Skip the rest of the file. 37 | :filedoc: :: Document block for the file. 38 | :doc: :: Include the following comment block in the documentation. 39 | :tagprefix PREFIX: :: Prefix tags. 40 | :tag: TAG :: Use a non-standard tag. 41 | :def: TEXT :: Use a different definition. 42 | :display: TEXT :: Use TEXT as defintion in the help file (useful for 43 | commands). 44 | :nodefault: :: Hide the default value of variables. 45 | :read: TEXT :: Read TEXT instead of the actual definition. 46 | 47 | 48 | % 2010-01-09; @Last Change: 2010-01-09. 49 | % vi: ft=viki:tw=72:ts=4 50 | -------------------------------------------------------------------------------- /tml/tpl_cmdlinehelp_cheat.txt: -------------------------------------------------------------------------------- 1 | *cmdlinehelp_cheat.txt* Cheat sheets 2 | Simple cheat sheets for use with |cmdlinehelp|. 3 | ======================================================================= 4 | 5 | *cheat::e* *cheat::edit* 6 | :e[dit][!] [++opt] [+cmd] [file] 7 | [!] Edit the current file 8 | |++opt|: ++{optname} or ++{optname}={value} 9 | ff or fileformat overrides 'fileformat' 10 | enc or encoding overrides 'fileencoding' 11 | bin or binary sets 'binary' 12 | nobin or nobinary resets 'binary' 13 | bad specifies behavior for bad characters 14 | edit for |:read|: option values as if editing a file 15 | |+cmd| 16 | + Start at the last line. 17 | +{num} Start at line {num}. 18 | +/{pat} Start at first line containing {pat}. 19 | +{command} Execute {command} after opening the new file. 20 | {command} is any Ex command. 21 | 22 | 23 | 24 | *cheat::s* *cheat::substitute* 25 | :[range]s[ubstitute]/{pattern}/{string}/[flags] [count] 26 | |sub-replace-special| 27 | &, \0 whole matched pattern | \1..\9 nth pair of () 28 | ~ previous substitute | 29 | \u next character made uppercase | \U following characters made uppercase 30 | \l next character made lowercase | \L following characters made lowercase 31 | \e, \E end of \u, \U, \l and \L | 32 | |:s_flags| 33 | [&] Must be the first one: Keep the flags from the previous substitute 34 | [c] Confirm each substitution. 35 | [e] When the search pattern fails, do not issue an error message 36 | [g] Replace all occurrences in the line 37 | [i] Ignore case for the pattern 38 | [I] Don't ignore case for the pattern 39 | [n] Report the number of matches, do not actually substitute 40 | [p] Print the line containing the last substitute. 41 | [#] Like [p] and prepend the line number. 42 | [l] Like [p] but print the text like |:list|. 43 | [r] When the search pattern is empty, use the previously used search pattern 44 | 45 | 46 | 47 | *cheat::sort* *cheat::sor* 48 | :[range]sor[t][!] [i][u][r][n][x][o] [/{pattern}/] 49 | [!] the order is reversed. 50 | [i] case is ignored. 51 | [n] sorting is done on the first decimal number 52 | [x] sorting is done on the first hexadecimal number 53 | [o] sorting is done on the first octal number 54 | [u] only keep unique lines 55 | /{pattern}/ and no [r] flag the text matched is skipped 56 | 57 | -------------------------------------------------------------------------------- /spec/spec/should_be.vim: -------------------------------------------------------------------------------- 1 | " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) 2 | " @Website: http://www.vim.org/account/profile.php?user_id=4037 3 | " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 4 | " @Created: 2009-03-06. 5 | " @Last Change: 2009-03-06. 6 | 7 | let s:save_cpo = &cpo 8 | set cpo&vim 9 | 10 | 11 | SpecBegin 'title': 'Should be', 'sfile': 'autoload/should/be.vim' 12 | 13 | It should test if the argument is a number. 14 | Should be#Number(1) 15 | Should not be#Number("foo") 16 | 17 | It should test if the argument is a string. 18 | Should be#String("foo") 19 | Should not be#String(1) 20 | 21 | It should test if the argument is a funcref. 22 | Should be#Funcref(function('should#be#Funcref')) 23 | Should not be#Funcref(1) 24 | 25 | It should test if the argument is a list. 26 | Should be#List([1,2,3]) 27 | Should not be#List(1) 28 | 29 | It should test if the argument is a dictionary. 30 | Should be#Dictionary({1:2}) 31 | Should not be#Dictionary([1,2,3]) 32 | 33 | It should test if the argument is of a specified type. 34 | Should be#A(1, 'number') 35 | Should be a {"foo": "bar"}, 'dictionary' 36 | Should not be a {"foo": "bar"}, 'list' 37 | 38 | It should test for multiple types. 39 | Should be a {"foo": "bar"}, ['list', 'dictionary'] 40 | Should not be a {"foo": "bar"}, ['number', 'string'] 41 | 42 | It should test for class equivalence. 43 | Should be a {"foo": "bar"}, {"foo": 0} 44 | Should be a {"foo": "bar"}, {"foo": 1} 45 | Should be a {"foo": "bar"}, {"x": 0} 46 | Should not be a {"foo": "bar"}, {"x": 1} 47 | 48 | It should test for equality. 49 | Should be#Equal(1, 1) 50 | Should be#Equal({1:2}, {1:2}) 51 | Should not be#Equal(1, 2) 52 | Should not be#Equal(1, "1") 53 | Should not be#Equal({1:2}, {1:3}) 54 | 55 | It should test for inequality. 56 | Should be#Unequal(1, 2) 57 | Should be#Unequal(1, "2") 58 | Should be#Unequal(1, "1") 59 | Should not be#Unequal(1, 1) 60 | 61 | It should test for <, <=, >, >=. 62 | Should be#Greater(2, 1) 63 | Should not be#Greater(2, 2) 64 | 65 | Should be#GreaterEqual(1, 1) 66 | Should be#GreaterEqual(2, 1) 67 | Should not be#GreaterEqual(2, 3) 68 | 69 | Should be#Less(1, 2) 70 | Should not be#Less(3, 2) 71 | 72 | Should be#LessEqual(1, 1) 73 | Should be#LessEqual(1, 2) 74 | Should not be#LessEqual(3, 2) 75 | 76 | It should match strings. 77 | Should be like "foo", '^f' 78 | Should not be like "foo", '^x' 79 | Should be unlike "foo", '^x' 80 | Should be like "foo", '^f', '#' 81 | Should be unlike "foo", '^F', '#' 82 | Should be unlike "Foo", '^f', '#' 83 | Should be like "Foo", '^F', '#' 84 | Should be like "foo", '^F', '?' 85 | Should be like "Foo", '^f', '?' 86 | 87 | 88 | let &cpo = s:save_cpo 89 | unlet s:save_cpo 90 | -------------------------------------------------------------------------------- /INSTALL.TXT: -------------------------------------------------------------------------------- 1 | * Install from GIT 2 | 3 | There are several ways to install plugins from source code repository 4 | (e.g. github). The easiest way is to install it as "bundle". In order to 5 | do so, clone the source code repository to 6 | ''~/.vim/bundles/PLUGIN_NAME'' -- on Windows replace ".vim" with 7 | "vimfiles". The directory structure should then look something like 8 | this: 9 | 10 | #Verb << 11 | ~/ 12 | .vim/ (or vimfiles on Windows) 13 | autoload/ 14 | bundles/ 15 | tlib_vim/ 16 | .git/ 17 | autoload/ 18 | docs/ 19 | plugins/ 20 | tcomment_vim/ 21 | .git/ 22 | autoload/ 23 | docs/ 24 | plugins/ 25 | ... 26 | docs/ 27 | plugins/ 28 | ... 29 | 30 | The ''pathogen'' plugin probably is the simplest way to make such 31 | "bundles" work. Please see also http://vim-scripts.org/vim/tools.html 32 | for additional information. 33 | 34 | Alternative solutions are described below. 35 | 36 | 37 | ** Use macros/tplugin.vim 38 | 39 | 1. Save a copy of the tplugin_vim repository 40 | (https://github.com/tomtom/tplugin_vim) under 41 | ''~/.vim/bundles''. 42 | #Verb << 43 | cd ~/.vim/bundles 44 | git clone git://github.com/tomtom/tplugin_vim.git 45 | 46 | 2. Insert the following line rather at the beginning of your 47 | ''vimrc'' file: 48 | #Verb << 49 | runtime bundles/tplugin_vim/macros/tplugin.vim 50 | 51 | 3. In VIM, run '':TPluginScan!'' 52 | 53 | 4. Restart vim. VIM should now load stub definitions for all 54 | commands defined in plugins under the ../bundels directory. 55 | 56 | See https://github.com/tomtom/tplugin_vim/doc/tplugin.txt for details. 57 | 58 | 59 | 60 | ** Use Marc Weber's vim-addon-manager 61 | 62 | See https://github.com/MarcWeber/vim-addon-manager for details. You can 63 | also use the addon manager to download the plugins from github for you. 64 | 65 | 66 | 67 | ** Modify the ''runtimepath'' (e.g. with the pathogen plugin) 68 | 69 | Add the path to the local copy to 'runtimepath': 70 | 71 | #Code << 72 | set runtimepath+={PATH TO YOU LOCAL COPY}/vimtlib 73 | 74 | 75 | 76 | ** Use symbolic links 77 | 78 | EXPERIMENTAL: You can use the file install_plugin.sh to copy files from 79 | a local copy of a repository to a master .vim directory. Example: 80 | 81 | install_plugin.sh --update vimtlib/*_vim 82 | 83 | See "install_plugin.sh --help" for details. 84 | 85 | J. Sukumaran provides a slightly simpler script at: 86 | https://gist.github.com/580276 87 | 88 | You could use tools like graft 89 | (http://peters.gormand.com.au/Home/tools/graft/graft-html) for this. 90 | 91 | 92 | 93 | ** Build vimballs 94 | 95 | Vimball recipes for the following plugins are located in the vimballs 96 | subdirectory. 97 | 98 | In the ruby subdirectory, there is a ruby-based script that helps 99 | automating this process. If you have ruby installed, type 100 | ''...vimtlib/ruby/vimball.rb -h'' to find out which command-line options 101 | to use. Re-generate all vimballs with ''make -f Makefile_vimtlib 102 | VIMTLIB=... vba''. 103 | 104 | See also: 105 | 106 | - [[http://www.vim.org/scripts/script.php?script_id=1502]\ 107 | [\VimBall plugin]] 108 | - [[http://vim.wikia.com/wiki/Using_VimBall_with_make]\ 109 | [Using \VimBall with make]] 110 | - [[http://mysite.verizon.net/astronaut/src/index.html#MKVIMBALL]\ 111 | [C-based program to handle vimballs]] 112 | 113 | 114 | 115 | % vi: ft=viki:tw=72:ts=4 116 | -------------------------------------------------------------------------------- /install_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # install.sh -- created 2010-09-15, Tom Link 3 | # @Last Change: 2010-09-26. 4 | # @Revision: 0.140 5 | 6 | if [ -e $HOME/vimfiles ]; then 7 | VIMFILES=$HOME/vimfiles 8 | else 9 | VIMFILES=$HOME/.vim 10 | fi 11 | 12 | VIM=vim 13 | PRE= 14 | CP=cp 15 | MKDIR=mkdir 16 | HELPTAGS=false 17 | VERBOSE=false 18 | 19 | if [ -e $VIMFILES/install_plugin.rc ]; then 20 | . $VIMFILES/install_plugin.rc 21 | fi 22 | 23 | 24 | function usage { 25 | echo "`basename $0` [OPTIONS] DIR1 DIR2 ..." 26 | echo "If no directories are supplied, use the directories in \$VIMPLUGINS" 27 | echo " " 28 | echo "Options:" 29 | echo " -d|--dir DIR ... Destination directory (default: $VIMFILES)" 30 | echo " -n|--dry ... Show which files would be copied" 31 | echo " -t|--helptags ... Create helptags" 32 | echo " -u|--update ... Copy only newer files" 33 | echo " --vim CMD ... VIM command (default: ${VIM})" 34 | echo " -v|--verbose ... Show messages" 35 | echo " -h|--help ... Show help" 36 | echo " " 37 | echo "Configuration file: $VIMFILES/install_plugin.rc" 38 | exit 1 39 | } 40 | 41 | 42 | function findfiles { 43 | find $1 -type f \ 44 | -not -wholename "*/.*" \ 45 | -not -wholename "*/_*" \ 46 | -not -name "Makefile" \ 47 | -not -wholename "*/doc/tags" \ 48 | -not -name README \ 49 | -print 50 | } 51 | 52 | 53 | function log { 54 | if [ "$VERBOSE" == true ]; then 55 | echo $@ 56 | fi 57 | } 58 | 59 | 60 | while [ -n $1 ]; do 61 | case $1 in 62 | -d|--dir) 63 | VIMFILES=$2 64 | shift 2 65 | ;; 66 | -n|--dry) 67 | PRE=echo 68 | shift 69 | ;; 70 | -t|--helptags) 71 | HELPTAGS=true 72 | shift 73 | ;; 74 | -u|--update) 75 | CP="$CP -u" 76 | shift 77 | ;; 78 | --vim) 79 | VIM=$2 80 | shift 2 81 | ;; 82 | -v|--verbose) 83 | CP="$CP -v" 84 | MKDIR="$MKDIR -v" 85 | VERBOSE=true 86 | shift 87 | ;; 88 | -h|--help) 89 | usage 90 | ;; 91 | *) 92 | break 93 | ;; 94 | esac 95 | done 96 | 97 | if [ ! -d "$VIMFILES" ]; then 98 | echo "Error: Destination directory does not exist: $VIMFILES" 99 | usage 100 | fi 101 | 102 | 103 | if [ -z $1 ]; then 104 | if [ -z $VIMPLUGINS ]; then 105 | echo "No directory is given and \$VIMPLUGINS is not set." 106 | read -p "Copy files from '$PWD' to '$VIMFILES'? (y/N) " yesno 107 | if [ "$yesno" != 'y' ]; then 108 | echo "Cancel!" 109 | exit 5 110 | fi 111 | fi 112 | if [ -n $VIMPLUGINS ]; then 113 | DIRS=`find $VIMPLUGINS -maxdepth 1 -type d -not -name ".*" -not -name "_*"` 114 | else 115 | echo "Error: \$VIMPLUGINS is undefined and no directories are given" 116 | usage 117 | fi 118 | else 119 | DIRS=$@ 120 | fi 121 | 122 | 123 | for DIR in $DIRS; do 124 | if [ -d $DIR ]; then 125 | log Plugin: $DIR 126 | cd $DIR 127 | FILES=`findfiles .` 128 | cd - > /dev/null 129 | for FILE in $FILES; do 130 | DDIR=`dirname ${VIMFILES}/$FILE` 131 | if [ ! -e $DDIR ]; then 132 | $PRE $MKDIR -p $DDIR 133 | fi 134 | $PRE $CP $DIR/$FILE ${VIMFILES}/$FILE 135 | done 136 | fi 137 | done 138 | 139 | 140 | if [ "$HELPTAGS" == true ]; then 141 | if [ -d $VIMFILES/doc ]; then 142 | cd $VIMFILES 143 | log Create helptags ... 144 | $VIM -u NONE -U NONE -c "helptags doc|q" 145 | cd - > /dev/null 146 | fi 147 | fi 148 | 149 | log Done! 150 | 151 | 152 | # vi: ft=sh:tw=72:ts=4 153 | -------------------------------------------------------------------------------- /ruby/vimdedoc.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # vimdedoc -- An ill-conceived casual VimL source code documenter 3 | # @Author: Tom Link (micathom at gmail com) 4 | # @License: GPL (see http://www.gnu.org/licenses/gpl.txt) 5 | # @Created: 2007-07-25. 6 | # @Last Change: 2015-11-24. 7 | # @Revision: 570 8 | 9 | 10 | require 'yaml' 11 | require 'logger' 12 | require 'optparse' 13 | require 'cgi' 14 | 15 | 16 | class VimDedoc 17 | VERSION = '1.0.0' 18 | 19 | class AppLog 20 | def initialize(output=$stdout) 21 | @output = output 22 | $logger = Logger.new(output) 23 | $logger.progname = 'vimdedoc' 24 | $logger.datetime_format = "%H:%M:%S" 25 | set_level 26 | end 27 | 28 | def set_level 29 | if $DEBUG 30 | $logger.level = Logger::DEBUG 31 | elsif $VERBOSE 32 | $logger.level = Logger::INFO 33 | else 34 | $logger.level = Logger::WARN 35 | end 36 | end 37 | end 38 | 39 | def initialize(outfile=1, sources=[]) 40 | @logger = AppLog.new 41 | @outfile = outfile 42 | @repo = nil 43 | @sources = sources 44 | @template = nil 45 | @update = false 46 | @docs = {} 47 | @config = {} 48 | @fdocs = {} 49 | @toc = [] 50 | @outformat = nil 51 | @insyntax = nil 52 | @filetypes = { 53 | :general => { 54 | :entry_rx => /^(\s*)((function|def|class)\b.*)$/, 55 | :doc_rx => /^[#%]\s+(.*)$/, 56 | :break_rx => /^\s*$/, 57 | }, 58 | [:vim, '.vim'] => { 59 | # :entry_rx => /^\s*(((com|fun|TLet)\w*)\b!?\s*[^"]+).*$/, 60 | :entry_rx => /^(\s*)((com(mand)?|fun(ction)?|TLet)\b!?\s+.+?|let\s+.*?\s"\{\{\{\d|[incvoslx]?(nore)?map\s.*)\s*$/, 61 | # :eligible => lambda {|head| head =~ /^\S+\s+s:prototype\./ || head !~ /^\S+\s+(s:|)/}, 62 | :eligible => lambda {|head| head =~ /^\S+\s+s:prototype\./ || head !~ /^\S+\s+(s:||\w+#__)/}, 63 | :doc_rx => /^(\s*)"\s?(.*)$/, 64 | :break_rx => /^\s*$/, 65 | :process_head => lambda {|text, nodefault| 66 | if text =~ /^\s*TLet!?\s*(\S*)\s*=\s*(.+?)\s*$/ 67 | if nodefault 68 | text = $1 69 | else 70 | text = '%-30s (default: %s)' % [$1, $2.strip] 71 | end 72 | elsif text =~ /^\s*com.+?\s([[:upper:]]\S*)/ 73 | text = ":#$1" 74 | elsif text =~ /^\s*fun.+?\s+s:prototype\.([[:upper:]].+?)\s*\(/ 75 | text = "prototype.#$1" 76 | elsif text =~ /^\s*fun.+?\s((\S+#)*[[:upper:]].*?\s*\(.*?\))/ 77 | text = "#$1" 78 | elsif text =~ /^\s*(([incvoslx])?(nore)?map)\s+(\s*|\s*)*(\S+)\s+(.*)\s*$/ 79 | text = %{#{$2 && "#$2_"}#{$5} ... #{$6}} 80 | elsif text =~ /^\s*let.+?(\S+)\s*=\s*(.*?)\s"\{\{\{\d\s*$/ 81 | if nodefault 82 | text = $1 83 | else 84 | text = '%-30s (default: %s)' % [$1, $2.strip] 85 | end 86 | else 87 | text = nil 88 | end 89 | text && text.gsub(/\s*\{{3}.*$/, '') 90 | }, 91 | :process_doc => lambda {|text| text.gsub(/\s*\{{3}.*$/, '')}, 92 | :tag => lambda {|head| 93 | case head[0..1] 94 | when 'co' 95 | hm = head.match(/\s([[:upper:]]\S*)/) 96 | if hm 97 | ":#{hm[1]}" 98 | else 99 | $logger.warn "Couldn't parse comand: #{head}" 100 | nil 101 | end 102 | when 'fu' 103 | if head =~ /^fun.+?\s+s:prototype\.([[:upper:]].+?)/ 104 | false 105 | elsif head =~ /^\s*fun.+?\s((\S+#)*[[:upper:]].+?)\s*\(/ 106 | $1 + '()' 107 | # head.match(/^\S+\s+([^( ]+)/)[1] + '()' 108 | end 109 | else 110 | if head =~ /^TLet/ 111 | head.match(/^\S+\s+(\S+)/)[1] 112 | elsif head =~ /^\s*let\s+(\S+)/ 113 | $1 114 | elsif head =~ /^\s*(([incvoslx])?(nore)?map)\s+(\s*|\s*)*(\S+)\s+(.*)\s*$/ 115 | "#{$2 && "#$2_"}#$5" 116 | else 117 | $logger.warn "Unknown entry type: #{head}" 118 | end 119 | end 120 | }, 121 | }, 122 | } 123 | end 124 | 125 | def parse_arguments(args) 126 | outformats = methods.delete_if {|m| m !~ /^format_entry_/}.map {|m| m.to_s.sub(/^format_entry_/, '')}.sort 127 | syntax = @filetypes.keys.flatten.delete_if {|m| !m.instance_of?(Symbol)}.map {|s| s.to_s}.sort 128 | opts = OptionParser.new do |opts| 129 | opts.banner = 'Usage: vimdedoc [OPTIONS] FILES > OUTPUT' 130 | opts.separator '' 131 | opts.separator 'vimdedoc is a free software with ABSOLUTELY NO WARRANTY under' 132 | opts.separator 'the terms of the GNU General Public License version 2 or newer.' 133 | opts.separator '' 134 | 135 | opts.separator 'General Options:' 136 | opts.on('-c', '--config YAML', String, 'Config file') do |value| 137 | read_config(value) 138 | end 139 | 140 | opts.on('-f', '--format=FORMAT', outformats, 'Output format (default: vimhelp)') do |value| 141 | @outformat = value 142 | end 143 | 144 | opts.on('-o', '--output=FILENAME', String, 'Output destination') do |value| 145 | @outfile = value 146 | end 147 | 148 | opts.on('-s', '--syntax=SYNTAX', String, 'Input syntax') do |value| 149 | @insyntax = value.intern 150 | end 151 | 152 | opts.on('-t', '--template=FILENAME', String, 'Template file') do |value| 153 | @template = value 154 | end 155 | 156 | opts.on('-u', '--[no-]update', 'Create help file only if it is outdated') do |bool| 157 | @update = bool 158 | end 159 | 160 | opts.separator '' 161 | opts.separator 'Available output formats:' 162 | opts.separator outformats.join(', ') 163 | 164 | opts.separator '' 165 | opts.separator 'Known syntax:' 166 | opts.separator syntax.join(', ') 167 | 168 | opts.separator '' 169 | opts.separator 'Other Options:' 170 | 171 | opts.on('--debug', 'Show debug messages') do |v| 172 | $DEBUG = true 173 | $VERBOSE = true 174 | @logger.set_level 175 | end 176 | 177 | opts.on('-v', '--verbose', 'Run verbosely') do |v| 178 | $VERBOSE = true 179 | @logger.set_level 180 | end 181 | 182 | opts.on_tail('-h', '--help', 'Show this message') do 183 | puts opts 184 | exit 1 185 | end 186 | end 187 | @sources += opts.parse!(args) 188 | $logger.debug "args = #{args.inspect}" 189 | $logger.debug "sources = #{@sources.inspect}" 190 | self 191 | end 192 | 193 | def read_config(file) 194 | if File.readable?(file) 195 | $logger.debug "Read configuration from #{file}" 196 | @config.merge!(YAML.load_file(file)) 197 | end 198 | end 199 | 200 | def process 201 | outfile = filename_on_disk(@outfile) 202 | if @update and File.exist?(outfile) 203 | out_mtime = File.mtime(outfile) 204 | $logger.debug "MTIME: #{outfile}: #{out_mtime}" 205 | tpl_mtime = File.mtime(@template) 206 | $logger.debug "MTIME: #{@template}: #{tpl_mtime}" 207 | if tpl_mtime <= out_mtime and @sources.all? {|filename| 208 | filename = filename.strip 209 | filename1 = filename_on_disk(filename) 210 | mtime = File.mtime(filename1) 211 | older = mtime <= out_mtime 212 | $logger.debug "MTIME: #{filename}: #{mtime} <= #{out_mtime} => #{older}" 213 | older 214 | } 215 | $logger.info "Help is up to date: #{outfile}" 216 | return 217 | end 218 | end 219 | @sources.each do |file| 220 | # puts "DEBUG file=#{file}" 221 | collect_docs(file) 222 | end 223 | write_doc(format_doc) 224 | end 225 | 226 | def collect_docs(filename, filetype=nil) 227 | filetype ||= check_filetype(File.extname(filename)) 228 | filename1 = filename_on_disk(filename) 229 | if File.directory?(filename1) 230 | $logger.warn "Is a directory: #{filename}" 231 | return 232 | elsif !File.readable?(filename1) 233 | $logger.warn "Not readable: #{filename}" 234 | return 235 | end 236 | ftdef = @filetypes[filetype] 237 | entry_rx = ftdef[:entry_rx] 238 | doc_rx = ftdef[:doc_rx] 239 | break_rx = ftdef[:break_rx] 240 | process_doc = ftdef[:process_doc] 241 | process_head = ftdef[:process_head] 242 | eligible = ftdef[:eligible] 243 | tagger = ftdef[:tag] 244 | $logger.debug "#{filetype}: #{ftdef.inspect}" 245 | @docs[filename] ||= [] 246 | @fdocs[filename] ||= [] 247 | current_doc = [] 248 | current_indent = 0 249 | filedoc = false 250 | no_doc = false 251 | no_doc_default = false 252 | use_doc = nil 253 | use_tag = nil 254 | use_head = nil 255 | use_name = nil 256 | skip_indent = false 257 | tagprefix = '' 258 | @toc << filename 259 | file = File.readlines(filename1) 260 | file.each_with_index do |line, index| 261 | line.chomp! 262 | # p "DBG", line, line =~ break_rx, line =~ doc_rx, line =~ entry_rx 263 | if line =~ /^finish\s*$/ 264 | break 265 | elsif line =~ doc_rx 266 | if skip_indent 267 | skip_indent = false 268 | else 269 | indent = $1 270 | end 271 | m = $2 272 | if m =~ /^:nodoc:\s*$/ 273 | no_doc = true 274 | current_doc = [] 275 | current_indent = 0 276 | use_tag = nil 277 | use_doc = nil 278 | use_name = nil 279 | elsif m =~ /^@TPlugin/ 280 | next 281 | elsif m =~ /^:enddoc:\s*$/ 282 | break 283 | elsif m =~ /^:filedoc:\s*$/ 284 | filedoc = true 285 | elsif m =~ /^:doc:\s*(.*)$/ 286 | use_doc = $1 287 | elsif m =~ /^:tagprefix( (.*?))?:\s*$/ 288 | tagprefix = $2 289 | elsif m =~ /^:tag:\s*(.+?)\s*$/ 290 | use_tag = $1 291 | elsif m =~ /^:def:\s*(.+?)\s*$/ 292 | use_head = $1 293 | elsif m =~ /^:display:\s*(.+?)\s*$/ 294 | use_name = $1 295 | elsif m =~ /^:nodefault:\s*$/ 296 | no_doc_default = true 297 | elsif m =~ /^:read:\s*(.+)$/ 298 | line = $1 299 | skip_indent = true 300 | redo 301 | else 302 | if current_doc.empty? 303 | current_doc << m 304 | current_indent = indent 305 | elsif current_indent == indent 306 | current_doc << m 307 | else 308 | current_doc = [m] 309 | current_indent = indent 310 | end 311 | end 312 | elsif line =~ entry_rx 313 | if skip_indent 314 | skip_indent = false 315 | else 316 | indent = $1 317 | end 318 | iline = $2 319 | if no_doc 320 | no_doc = false 321 | elsif !eligible or eligible.call(line) 322 | if use_head 323 | head = use_head 324 | use_head = nil 325 | else 326 | head = iline.strip 327 | end 328 | if use_tag 329 | tag = use_tag 330 | use_tag = nil 331 | else 332 | tag = tagger ? tagger.call(head) : entry[:head].match(/^\S+\s+([^( ]+)/)[1] 333 | end 334 | tag = tagprefix + tag unless tagprefix.empty? 335 | if process_head 336 | head = process_head.call(head, no_doc_default) 337 | no_doc_default = false 338 | end 339 | if indent == current_indent 340 | doc = compile_doc(current_doc, process_doc) 341 | else 342 | doc = compile_doc([], process_doc) 343 | end 344 | unless tag.nil? and head.nil? and doc.empty? 345 | @toc << [head, tag] unless tag.nil? || head.nil? 346 | if use_name 347 | head = use_name 348 | use_name = nil 349 | end 350 | @docs[filename] << {:type => :entry, :head => head, :line => index, :doc => doc, :tag => tag} 351 | # p "DBG", @docs[filename][-1] 352 | end 353 | end 354 | current_doc = [] 355 | current_indent = 0 356 | # elsif line =~ break_rx 357 | else 358 | if filedoc 359 | @fdocs[filename] += current_doc 360 | filedoc = false 361 | elsif !use_doc.nil? 362 | doc = compile_doc(current_doc, process_doc, :indent => 0, :nonl => use_doc =~ /\bnonl\b/) 363 | @docs[filename] << { 364 | :type => :doc, 365 | :doc => doc, 366 | :tag => use_doc =~ /\bnotag\b/ ? nil : (use_tag || '') 367 | } 368 | use_tag = nil 369 | use_doc = nil 370 | end 371 | current_doc = [] 372 | current_indent = 0 373 | end 374 | end 375 | end 376 | 377 | def compile_doc(doc, process_doc=nil, args={}) 378 | doc = doc.dup << nil unless args[:nonl] 379 | doc = format_lines(doc, args[:indent] || 4) 380 | doc = process_doc.call(doc) if process_doc 381 | doc 382 | end 383 | 384 | def format_lines(lines, indent=4) 385 | m = "format_lines_#{@outformat || 'vimhelp'}" 386 | if respond_to?(m) 387 | send(m, lines, indent) 388 | else 389 | lines.map {|l| l && ' ' + l}.join("\n") 390 | end 391 | end 392 | 393 | def format_lines_vimhelp(lines, indent=0) 394 | # indent += 12 if indent > 0 395 | idc = false 396 | doc = lines.map do |l| 397 | if l 398 | if l !~ /\S/ 399 | '' 400 | else 401 | if idc and (l =~ /^(<\s+)(.*)$/ or l =~ /^()(\S.*)$/) 402 | idc = false 403 | prefix = $1.empty? ? '< ' : $1 404 | prefix += ' ' * (indent - 2) if indent > 0 405 | # prefix += ' ' * (indent) if indent > 0 406 | l = $2 407 | else 408 | prefix = indent > 0 ? ' ' * indent : '' 409 | end 410 | if l =~ / >\s*$/ 411 | idc = true 412 | end 413 | prefix + l 414 | end 415 | end 416 | end 417 | doc.insert(doc.index(nil), '<') if idc 418 | doc.join("\n") 419 | end 420 | 421 | def format_lines_html(lines, indent=0) 422 | # indent += 12 if indent > 0 423 | idc = false 424 | doc = lines.map do |l| 425 | if l 426 | if l =~ /^<\s/ 427 | "\n#{CGI.escapeHTML(l[1..-1])}" 428 | elsif l =~ / >\s*$/ 429 | "#{CGI.escapeHTML(l.sub(/ >\s*$/, ''))}\n
}"
430 |                 else
431 |                     CGI.escapeHTML(l)
432 |                 end
433 |             end
434 |         end
435 |         doc.join("\n")
436 |     end
437 | 
438 |     def format_entry(*args)
439 |         m = "format_entry_#{@outformat || 'vimhelp'}"
440 |         if respond_to?(m)
441 |             send(m, *args)
442 |         else
443 |             $logger.fatal "Unknown output format: #{outformat}"
444 |             exit 5
445 |         end
446 |     end
447 | 
448 |     def format_entry_vimhelp(filename, doc)
449 |         body = doc.map do |entry|
450 |             rv = []
451 |             if entry[:tag]
452 |                 if entry[:tag].empty?
453 |                     rv << nil
454 |                 else
455 |                     rv << "                                                    *#{entry[:tag]}*"
456 |                 end
457 |             end
458 |             case entry[:type]
459 |             when :doc
460 |                 rv << entry[:doc]
461 |             else
462 |                 rv << entry[:head] << entry[:doc]
463 |             end
464 |             rv.join("\n")
465 |         end
466 |         fdoc = @fdocs[filename]
467 |         fdoc = format_lines(fdoc.dup << nil, 0) if fdoc
468 |         unless body.empty?
469 |             ([
470 |                 '=' * 72,
471 |                 "#{filename}~",
472 |                 fdoc
473 |              ] + body << nil
474 |             ).join("\n")
475 |         end
476 |     end
477 | 
478 |     def format_entry_minimal(filename, doc)
479 |         doc.map do |entry|
480 |             "#{entry[:head]} [[#{filename}:#{entry[:line]}]]"
481 |         end.join("\n")
482 |     end
483 | 
484 |     def format_toc(*args)
485 |         return if @toc.empty?
486 |         m = "format_toc_#{@outformat || 'vimhelp'}"
487 |         if respond_to?(m)
488 |             send(m, *args)
489 |         else
490 |             $logger.fatal "Unknown output format: #{outformat}"
491 |             exit 5
492 |         end
493 |     end
494 | 
495 |     def format_toc_vimhelp
496 |         toc = @toc.map {|h, t| [h.match(/^[^([:space:]]+/)[0], t]}
497 |         hl  = toc.map {|h, t| h.size}.max + 3
498 |         hd  = nil
499 |         ['=' * 72, 'Contents~', '', nil] +
500 |             toc.map do |h, t|
501 |                 rv = case t
502 |                      when String
503 |                         "        %s %s |%s|" % [h, '.' * (hl - h.size), t]
504 |                      when false
505 |                         "        #{h}"
506 |                      else
507 |                          # hd = "    #{h}"
508 |                          nil
509 |                      end
510 |                 if rv and hd
511 |                     rv = [hd, rv]
512 |                     hd = nil
513 |                 end
514 |                 rv
515 |             end.compact << '' << ''
516 |     end
517 | 
518 |     def format_toc_minimal
519 |     end
520 | 
521 |     def format_epilogue(*args)
522 |         m = "format_epilogue_#{@outformat || 'vimhelp'}"
523 |         if respond_to?(m)
524 |             send(m, *args)
525 |         else
526 |             nil
527 |         end
528 |     end
529 | 
530 |     def format_epilogue_vimhelp(*args)
531 |        %{\nvim:tw=78:fo=w2croql:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:}
532 |     end
533 | 
534 |     def format_doc
535 |         doc  = [
536 |             format_toc,
537 |             @sources.map do |filename|
538 |                 d = @docs[filename]
539 |                 format_entry(filename, d) if d
540 |             end
541 |         ].flatten.compact.join("\n")
542 |         if @template
543 |             tpl = File.read(@template)
544 |             begin
545 |                 doc = tpl % doc
546 |             rescue ArgumentError => e
547 |                 $stderr.puts "Input document isn't a well-formatted format string (scan for single '%' chars)"
548 |             end
549 |         end
550 |         epilogue = format_epilogue()
551 |         if epilogue
552 |             doc.concat(epilogue)
553 |         end
554 |         doc
555 |     end
556 | 
557 |     def write_doc(doc)
558 |         $logger.warn "Save documentation to: #{@outfile}"
559 |         File.open(@outfile, 'w') {|io| io.puts doc}
560 |     end
561 | 
562 |     private
563 |     def check_filetype(base)
564 |         base = @insyntax if @insyntax
565 |         @filetypes.keys.each do |ext|
566 |             rv = check_this_filetype(base, ext, ext)
567 |             return rv if rv
568 |         end
569 |         return :general
570 |     end
571 | 
572 |     def check_this_filetype(base, ext, key)
573 |         case ext
574 |         when String, Symbol
575 |             return key || ext if base == ext
576 |         when Regexp
577 |             return key || ext if base.instance_of?(String) and base =~ ext
578 |         when Array
579 |             ext.each do |e|
580 |                 rv = check_this_filetype(base, e, key)
581 |                 return rv if rv
582 |             end
583 |         else
584 |             return nil
585 |         end
586 |     end
587 | 
588 |     def filename_on_disk(filename)
589 |         if filename.is_a?(Integer) or File.exist?(filename)
590 |             return filename
591 |         else
592 |             if @repo
593 |                 return File.join(@repo, filename)
594 |             end
595 |             for root in @config['roots'] || []
596 |                 repo = File.join(root, File.basename(@outfile, '.*'))
597 |                 filename1 = File.join(repo, filename)
598 |                 if File.exist?(filename1)
599 |                     @repo = repo
600 |                     @outfile = File.join(repo, @outfile)
601 |                     return filename1
602 |                 end
603 |             end
604 |             r = @config['replacements']
605 |             if r and r[filename]
606 |                 return r[filename]
607 |             else
608 |                 g = @config['gsub']
609 |                 if g
610 |                     for rxs, rpl in g
611 |                         filename = filename.gsub(Regexp.new(rxs), rpl)
612 |                     end
613 |                 end
614 |                 return filename
615 |             end
616 |         end
617 |     end
618 | 
619 | end
620 | 
621 | 
622 | if __FILE__ == $0
623 |     VimDedoc.new.parse_arguments(ARGV).process
624 | end
625 | 
626 | 


--------------------------------------------------------------------------------