From 3f1cdba79985045b80508587a346472a75d6f913 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 13 Apr 2013 14:45:21 -0300 Subject: [PATCH] Updated all plugins that are non-forked. Added some new plugins. Added update_plugins.py which can fetch new plugins from GitHub. New plugins added: zencoding, vim-indent-object, taglist, nginx.vim --- .gitignore | 4 + README.md | 4 + sources_forked/yankring/doc/tags | 40 + sources_forked/zencoding/.gitignore | 1 + sources_forked/zencoding/.gitmodules | 4 + sources_forked/zencoding/Makefile | 11 + sources_forked/zencoding/README.mkd | 103 + sources_forked/zencoding/TODO | 0 sources_forked/zencoding/TUTORIAL | 212 + .../zencoding/autoload/zencoding.vim | 1486 ++++++ .../zencoding/autoload/zencoding/lang.vim | 11 + .../zencoding/autoload/zencoding/lang/css.vim | 228 + .../autoload/zencoding/lang/haml.vim | 310 ++ .../autoload/zencoding/lang/html.vim | 692 +++ .../autoload/zencoding/lang/sass.vim | 158 + .../autoload/zencoding/lang/scss.vim | 121 + .../autoload/zencoding/lang/slim.vim | 276 + .../zencoding/autoload/zencoding/util.vim | 249 + sources_forked/zencoding/doc/zencoding.txt | 438 ++ sources_forked/zencoding/plugin/zencoding.vim | 215 + sources_forked/zencoding/unittest.vim | 794 +++ sources_forked/zencoding/zencoding.vim.vimup | 265 + sources_non_forked/ack.vim/README.md | 24 +- sources_non_forked/ack.vim/doc/ack.txt | 14 + sources_non_forked/ack.vim/plugin/ack.vim | 130 +- sources_non_forked/bufexplorer.zip/README | 20 - sources_non_forked/bufexplorer/README.md | 39 + .../doc/bufexplorer.txt | 2 +- sources_non_forked/bufexplorer/doc/tags | 24 + .../plugin/bufexplorer.vim | 2 +- .../ctrlp.vim/autoload/ctrlp.vim | 720 ++- .../ctrlp.vim/autoload/ctrlp/buffertag.vim | 46 +- .../ctrlp.vim/autoload/ctrlp/changes.vim | 5 +- .../ctrlp.vim/autoload/ctrlp/dir.vim | 7 +- .../ctrlp.vim/autoload/ctrlp/line.vim | 9 +- .../ctrlp.vim/autoload/ctrlp/mixed.vim | 7 +- .../ctrlp.vim/autoload/ctrlp/mrufiles.vim | 81 +- .../ctrlp.vim/autoload/ctrlp/quickfix.vim | 19 +- .../ctrlp.vim/autoload/ctrlp/rtscript.vim | 17 +- .../ctrlp.vim/autoload/ctrlp/tag.vim | 14 +- .../ctrlp.vim/autoload/ctrlp/utils.vim | 54 +- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 352 +- sources_non_forked/ctrlp.vim/plugin/ctrlp.vim | 8 +- sources_non_forked/ctrlp.vim/readme.md | 25 +- sources_non_forked/nerdtree/README.markdown | 4 + .../nerdtree/autoload/nerdtree.vim | 1367 +++++ sources_non_forked/nerdtree/doc/NERD_tree.txt | 31 + .../nerdtree/nerdtree_plugin/fs_menu.vim | 48 +- .../nerdtree/plugin/NERD_tree.vim | 4245 +-------------- .../nerdtree/plugin/nerdtree/bookmark.vim | 315 ++ .../nerdtree/plugin/nerdtree/creator.vim | 322 ++ .../nerdtree/plugin/nerdtree/key_map.vim | 143 + .../plugin/nerdtree/menu_controller.vim | 180 + .../nerdtree/plugin/nerdtree/menu_item.vim | 114 + .../nerdtree/plugin/nerdtree/opener.vim | 264 + .../nerdtree/plugin/nerdtree/path.vim | 724 +++ .../plugin/nerdtree/tree_dir_node.vim | 528 ++ .../plugin/nerdtree/tree_file_node.vim | 485 ++ sources_non_forked/nginx-vim/README.md | 7 + .../nginx-vim/ftdetect/nginx.vim | 2 + sources_non_forked/nginx-vim/indent/nginx.vim | 9 + sources_non_forked/nginx-vim/syntax/nginx.vim | 664 +++ sources_non_forked/nginx.vim/README | 3 + sources_non_forked/nginx.vim/syntax/nginx.vim | 664 +++ .../snipmate-snippets/.gitignore | 16 + .../snipmate-snippets/README.md | 47 - sources_non_forked/snipmate-snippets/Rakefile | 24 + .../_/date/date + time.snippet | 1 + .../snipmate-snippets/_/date/date.snippet | 1 + .../snipmate-snippets/_/lorem.snippet | 1 + .../snipmate-snippets/_/modeline.snippet | 1 + .../snipmate-snippets/ant/skel/basic.snippet | 29 + .../snipmate-snippets/c/cl.snippet | 7 + .../snipmate-snippets/c/def.snippet | 3 + .../snipmate-snippets/c/do.snippet | 3 + .../snipmate-snippets/c/el.snippet | 3 + .../snipmate-snippets/c/for.snippet | 3 + .../snipmate-snippets/c/forr.snippet | 3 + .../snipmate-snippets/c/fpf.snippet | 1 + .../snipmate-snippets/c/fun.snippet | 4 + .../snipmate-snippets/c/if.snippet | 3 + .../snipmate-snippets/c/inc/inc.snippet | 1 + .../c/inc/inc_global.snippet | 1 + .../snipmate-snippets/c/main.snippet | 5 + .../snipmate-snippets/c/map.snippet | 1 + .../snipmate-snippets/c/ns.snippet | 3 + .../snipmate-snippets/c/once.snippet | 6 + .../snipmate-snippets/c/pr.snippet | 1 + .../snipmate-snippets/c/readfile.snippet | 7 + .../snipmate-snippets/c/st.snippet | 3 + .../snipmate-snippets/c/t.snippet | 1 + .../snipmate-snippets/c/td.snippet | 1 + .../snipmate-snippets/c/tds.snippet | 3 + .../snipmate-snippets/c/vector.snippet | 1 + .../snipmate-snippets/c/wh.snippet | 3 + .../snipmate-snippets/css/#.snippet | 3 + .../css/background/all.snippet | 1 + .../css/background/attachment.snippet | 1 + .../css/background/color.snippet | 1 + .../css/background/color_name.snippet | 1 + .../css/background/color_rgb.snippet | 1 + .../css/background/color_transparent.snippet | 1 + .../css/background/image_none.snippet | 1 + .../css/background/image_url.snippet | 1 + .../css/background/position.snippet | 1 + .../css/background/repeat.snippet | 1 + .../css/border/basic.snippet | 1 + .../css/border/color.snippet | 1 + .../css/border/style.snippet | 1 + .../css/border/width.snippet | 1 + .../css/borderb/basic.snippet | 1 + .../css/borderb/color.snippet | 1 + .../css/borderb/style.snippet | 1 + .../css/borderb/width.snippet | 1 + .../css/borderl/basic.snippet | 1 + .../css/borderl/color.snippet | 1 + .../css/borderl/style.snippet | 1 + .../css/borderl/width.snippet | 1 + .../css/borderr/basic.snippet | 1 + .../css/borderr/color.snippet | 1 + .../css/borderr/style.snippet | 1 + .../css/borderr/width.snippet | 1 + .../css/bordert/basic.snippet | 1 + .../css/bordert/color.snippet | 1 + .../css/bordert/style.snippet | 1 + .../css/bordert/width.snippet | 1 + .../snipmate-snippets/css/cl.snippet | 3 + .../snipmate-snippets/css/clear.snippet | 1 + .../snipmate-snippets/css/color.snippet | 1 + .../snipmate-snippets/css/colorn.snippet | 1 + .../snipmate-snippets/css/colorr.snippet | 1 + .../snipmate-snippets/css/cursor.snippet | 1 + .../snipmate-snippets/css/cursuru.snippet | 1 + .../snipmate-snippets/css/direction.snippet | 1 + .../css/display/block.snippet | 1 + .../css/display/common.snippet | 1 + .../css/display/inline.snippet | 1 + .../css/display/table.snippet | 1 + .../snipmate-snippets/css/float.snippet | 1 + .../snipmate-snippets/css/font/all.snippet | 1 + .../snipmate-snippets/css/font/family.snippet | 1 + .../snipmate-snippets/css/font/size.snippet | 1 + .../css/font/size_font.snippet | 1 + .../snipmate-snippets/css/font/style.snippet | 1 + .../css/font/variant.snippet | 1 + .../snipmate-snippets/css/font/weight.snippet | 1 + .../snipmate-snippets/css/i.snippet | 1 + .../snipmate-snippets/css/letter.snippet | 1 + .../snipmate-snippets/css/letterem.snippet | 1 + .../snipmate-snippets/css/letterpx.snippet | 1 + .../css/list-style/image.snippet | 1 + .../css/list-style/position.snippet | 1 + .../css/list-style/type_asian.snippet | 1 + .../css/list-style/type_marker.snippet | 1 + .../css/list-style/type_numeric.snippet | 1 + .../css/list-style/type_other.snippet | 1 + .../list-style/type_position_image.snippet | 1 + .../list-style/type_roman_alpha_greek.snippet | 1 + .../snipmate-snippets/css/margin.snippet | 1 + .../snipmate-snippets/css/marginb.snippet | 1 + .../snipmate-snippets/css/marginl.snippet | 1 + .../css/margino/T_R_B_L.snippet | 1 + .../snipmate-snippets/css/margino/V_H.snippet | 1 + .../snipmate-snippets/css/margino/all.snippet | 1 + .../css/margino/bottom.snippet | 1 + .../css/margino/left.snippet | 1 + .../css/margino/right.snippet | 1 + .../snipmate-snippets/css/margino/top.snippet | 1 + .../snipmate-snippets/css/marginr.snippet | 1 + .../snipmate-snippets/css/margint.snippet | 1 + .../css/marker/offset_auto.snippet | 1 + .../css/marker/offset_length.snippet | 1 + .../snipmate-snippets/css/opacity.snippet | 3 + .../snipmate-snippets/css/overflow.snippet | 1 + .../snipmate-snippets/css/padding.snippet | 1 + .../snipmate-snippets/css/paddingb.snippet | 1 + .../snipmate-snippets/css/paddingl.snippet | 1 + .../css/paddingo/T_R_B_L.snippet | 1 + .../css/paddingo/V_H.snippet | 1 + .../css/paddingo/all.snippet | 1 + .../css/paddingo/bottom.snippet | 1 + .../css/paddingo/left.snippet | 1 + .../css/paddingo/right.snippet | 1 + .../css/paddingo/top.snippet | 1 + .../snipmate-snippets/css/paddingr.snippet | 1 + .../snipmate-snippets/css/paddingt.snippet | 1 + .../snipmate-snippets/css/position.snippet | 1 + .../snipmate-snippets/css/scrollbar.snippet | 8 + .../snipmate-snippets/css/tag.snippet | 3 + .../snipmate-snippets/css/text/align.snippet | 1 + .../css/text/decoration.snippet | 1 + .../snipmate-snippets/css/text/indent.snippet | 1 + .../css/text/shadow_hex.snippet | 1 + .../css/text/shadow_none.snippet | 1 + .../css/text/shadow_rgb.snippet | 1 + .../css/text/transform.snippet | 1 + .../css/text/transform_none.snippet | 1 + .../snipmate-snippets/css/vertical.snippet | 1 + .../snipmate-snippets/css/visibility.snippet | 1 + .../snipmate-snippets/css/white.snippet | 1 + .../css/word/spacing_length.snippet | 1 + .../css/word/spacing_normal.snippet | 1 + .../snipmate-snippets/css/z.snippet | 1 + .../eruby-rails/conf.snippet | 3 + .../snipmate-snippets/eruby-rails/cs.snippet | 1 + .../snipmate-snippets/eruby-rails/ct.snippet | 1 + .../snipmate-snippets/eruby-rails/end.snippet | 1 + .../snipmate-snippets/eruby-rails/ff.snippet | 3 + .../eruby-rails/ffcb.snippet | 1 + .../snipmate-snippets/eruby-rails/ffe.snippet | 5 + .../eruby-rails/ffff.snippet | 1 + .../eruby-rails/ffhf.snippet | 1 + .../snipmate-snippets/eruby-rails/ffl.snippet | 1 + .../eruby-rails/ffpf.snippet | 1 + .../eruby-rails/ffrb.snippet | 1 + .../snipmate-snippets/eruby-rails/ffs.snippet | 1 + .../eruby-rails/ffta.snippet | 1 + .../eruby-rails/fftf.snippet | 1 + .../eruby-rails/fields.snippet | 3 + .../snipmate-snippets/eruby-rails/for.snippet | 3 + .../snipmate-snippets/eruby-rails/ft.snippet | 3 + .../snipmate-snippets/eruby-rails/i18.snippet | 1 + .../snipmate-snippets/eruby-rails/it.snippet | 1 + .../snipmate-snippets/eruby-rails/jit.snippet | 1 + .../eruby-rails/jsit.snippet | 1 + .../snipmate-snippets/eruby-rails/lia.snippet | 1 + .../eruby-rails/liai.snippet | 1 + .../snipmate-snippets/eruby-rails/lic.snippet | 1 + .../eruby-rails/lica.snippet | 1 + .../eruby-rails/licai.snippet | 1 + .../snipmate-snippets/eruby-rails/lim.snippet | 1 + .../eruby-rails/linp.snippet | 1 + .../eruby-rails/linpp.snippet | 1 + .../snipmate-snippets/eruby-rails/lip.snippet | 1 + .../eruby-rails/lipp.snippet | 1 + .../snipmate-snippets/eruby-rails/lt.snippet | 1 + .../eruby-rails/ofcfs.snippet | 1 + .../snipmate-snippets/eruby-rails/rf.snippet | 1 + .../snipmate-snippets/eruby-rails/rp.snippet | 1 + .../snipmate-snippets/eruby-rails/rt.snippet | 1 + .../snipmate-snippets/eruby-rails/slt.snippet | 1 + .../eruby-rails/sslt.snippet | 1 + .../snipmate-snippets/eruby-rails/st.snippet | 1 + .../snipmate-snippets/eruby/if.snippet | 3 + .../snipmate-snippets/eruby/ife.snippet | 4 + .../snipmate-snippets/eruby/unless.snippet | 3 + .../snipmate-snippets/eruby/unlesse.snippet | 4 + .../snipmate-snippets/haml/conf.snippet | 3 + .../snipmate-snippets/haml/cs.snippet | 1 + .../snipmate-snippets/haml/ff.snippet | 2 + .../snipmate-snippets/haml/ffcb.snippet | 1 + .../snipmate-snippets/haml/ffe.snippet | 4 + .../snipmate-snippets/haml/ffff.snippet | 1 + .../snipmate-snippets/haml/ffhf.snippet | 1 + .../snipmate-snippets/haml/ffl.snippet | 1 + .../snipmate-snippets/haml/ffpf.snippet | 1 + .../snipmate-snippets/haml/ffrb.snippet | 1 + .../snipmate-snippets/haml/ffs.snippet | 1 + .../snipmate-snippets/haml/ffta.snippet | 1 + .../snipmate-snippets/haml/fftf.snippet | 1 + .../snipmate-snippets/haml/fields.snippet | 2 + .../snipmate-snippets/haml/for.snippet | 6 + .../snipmate-snippets/haml/ft.snippet | 2 + .../snipmate-snippets/haml/if.snippet | 2 + .../snipmate-snippets/haml/ife.snippet | 4 + .../snipmate-snippets/haml/it.snippet | 1 + .../snipmate-snippets/haml/jit.snippet | 1 + .../snipmate-snippets/haml/jsit.snippet | 1 + .../snipmate-snippets/haml/lia.snippet | 1 + .../snipmate-snippets/haml/liai.snippet | 1 + .../snipmate-snippets/haml/lic.snippet | 1 + .../snipmate-snippets/haml/lica.snippet | 1 + .../snipmate-snippets/haml/licai.snippet | 1 + .../snipmate-snippets/haml/lim.snippet | 1 + .../snipmate-snippets/haml/linp.snippet | 1 + .../snipmate-snippets/haml/linpp.snippet | 1 + .../snipmate-snippets/haml/lip.snippet | 1 + .../snipmate-snippets/haml/lipp.snippet | 1 + .../snipmate-snippets/haml/lt.snippet | 1 + .../snipmate-snippets/haml/ofcfs.snippet | 1 + .../snipmate-snippets/haml/rf.snippet | 1 + .../snipmate-snippets/haml/rp.snippet | 1 + .../snipmate-snippets/haml/rt.snippet | 1 + .../snipmate-snippets/haml/slt.snippet | 1 + .../snipmate-snippets/haml/sslt.snippet | 1 + .../snipmate-snippets/haml/st.snippet | 1 + .../snipmate-snippets/haml/unless.snippet | 3 + .../snipmate-snippets/haml/unlesse.snippet | 4 + .../snipmate-snippets/html/base.snippet | 1 + .../snipmate-snippets/html/body.snippet | 3 + .../snipmate-snippets/html/div.snippet | 3 + .../snipmate-snippets/html/doctype.snippet | 1 + .../snipmate-snippets/html/form.snippet | 5 + .../snipmate-snippets/html/h1.snippet | 1 + .../snipmate-snippets/html/head.snippet | 5 + .../snipmate-snippets/html/href.snippet | 1 + .../snipmate-snippets/html/ifie.snippet | 1 + .../snipmate-snippets/html/img.snippet | 1 + .../snipmate-snippets/html/input.snippet | 1 + .../snipmate-snippets/html/inputl.snippet | 2 + .../snipmate-snippets/html/label.snippet | 1 + .../snipmate-snippets/html/link.snippet | 1 + .../snipmate-snippets/html/mailto.snippet | 1 + .../snipmate-snippets/html/meta.snippet | 1 + .../snipmate-snippets/html/option.snippet | 1 + .../html/script/include_script.snippet | 1 + .../html/script/inline_script.snippet | 5 + .../snipmate-snippets/html/select.snippet | 3 + .../snipmate-snippets/html/skel/basic.snippet | 13 + .../html/skel/basic_with_meta.snippet | 15 + .../snipmate-snippets/html/style.snippet | 3 + .../snipmate-snippets/html/t.snippet | 3 + .../html/table/basic.snippet | 3 + .../html/table/hardcore.snippet | 9 + .../snipmate-snippets/html/textarea.snippet | 1 + .../java/class/basic+constructor+main.snippet | 17 + .../java/class/basic+constructor.snippet | 14 + .../java/class/basic.snippet | 14 + .../snipmate-snippets/java/for.snippet | 3 + .../snipmate-snippets/java/gs.snippet | 9 + .../snipmate-snippets/java/if.snippet | 3 + .../snipmate-snippets/java/ife.snippet | 4 + .../snipmate-snippets/java/log.snippet | 1 + .../snipmate-snippets/java/m.snippet | 8 + .../javascript-jquery/add.snippet | 1 + .../javascript-jquery/addClass.snippet | 1 + .../javascript-jquery/after.snippet | 1 + .../javascript-jquery/ajax.snippet | 18 + .../javascript-jquery/ajaxerror.snippet | 4 + .../javascript-jquery/ajaxget.snippet | 3 + .../javascript-jquery/ajaxgetif.snippet | 3 + .../javascript-jquery/ajaxpost.snippet | 5 + .../javascript-jquery/ajaxsend.snippet | 4 + .../javascript-jquery/ajaxsetup.snippet | 18 + .../javascript-jquery/ajaxstart.snippet | 4 + .../javascript-jquery/ajaxstop.snippet | 4 + .../javascript-jquery/ajaxsuccess.snippet | 4 + .../javascript-jquery/animate.snippet | 1 + .../javascript-jquery/append.snippet | 1 + .../javascript-jquery/appendTo.snippet | 1 + .../javascript-jquery/attr.snippet | 1 + .../javascript-jquery/attrm.snippet | 1 + .../javascript-jquery/before.snippet | 1 + .../javascript-jquery/bind.snippet | 3 + .../javascript-jquery/blur.snippet | 3 + .../javascript-jquery/change.snippet | 3 + .../javascript-jquery/children.snippet | 1 + .../javascript-jquery/click.snippet | 3 + .../javascript-jquery/clone.snippet | 1 + .../javascript-jquery/contains.snippet | 1 + .../javascript-jquery/css.snippet | 1 + .../javascript-jquery/cssm.snippet | 1 + .../javascript-jquery/dblclick.snippet | 3 + .../javascript-jquery/each.snippet | 3 + .../javascript-jquery/el.snippet | 1 + .../javascript-jquery/eltrim.snippet | 1 + .../javascript-jquery/end.snippet | 1 + .../javascript-jquery/error.snippet | 3 + .../javascript-jquery/fadein.snippet | 1 + .../javascript-jquery/fadeinc.snippet | 3 + .../javascript-jquery/fadeout.snippet | 1 + .../javascript-jquery/fadeoutc.snippet | 3 + .../javascript-jquery/fadeto.snippet | 1 + .../javascript-jquery/fadetoc.snippet | 3 + .../javascript-jquery/filter.snippet | 1 + .../javascript-jquery/find.snippet | 1 + .../javascript-jquery/focus.snippet | 3 + .../javascript-jquery/get.snippet | 1 + .../javascript-jquery/getjson.snippet | 5 + .../javascript-jquery/getscript.snippet | 3 + .../javascript-jquery/height.snippet | 1 + .../javascript-jquery/hide.snippet | 1 + .../javascript-jquery/hidec.snippet | 3 + .../javascript-jquery/hover.snippet | 5 + .../javascript-jquery/html.snippet | 1 + .../javascript-jquery/insertAfter.snippet | 1 + .../javascript-jquery/insertBefore.snippet | 1 + .../javascript-jquery/is.snippet | 1 + .../javascript-jquery/load.snippet | 3 + .../javascript-jquery/loadf.snippet | 3 + .../javascript-jquery/loadif.snippet | 3 + .../javascript-jquery/mdown.snippet | 3 + .../javascript-jquery/mmove.snippet | 3 + .../javascript-jquery/mout.snippet | 3 + .../javascript-jquery/mover.snippet | 3 + .../javascript-jquery/mup.snippet | 3 + .../javascript-jquery/next.snippet | 1 + .../javascript-jquery/not.snippet | 1 + .../javascript-jquery/one.snippet | 3 + .../javascript-jquery/parent.snippet | 1 + .../javascript-jquery/parents.snippet | 1 + .../javascript-jquery/prepend.snippet | 1 + .../javascript-jquery/prependto.snippet | 1 + .../javascript-jquery/prev.snippet | 1 + .../javascript-jquery/ready.snippet | 3 + .../javascript-jquery/remove.snippet | 1 + .../javascript-jquery/removeattr.snippet | 1 + .../javascript-jquery/removeclass.snippet | 1 + .../javascript-jquery/reset.snippet | 3 + .../javascript-jquery/resize.snippet | 3 + .../javascript-jquery/scroll.snippet | 3 + .../javascript-jquery/sdown.snippet | 1 + .../javascript-jquery/sdownc.snippet | 3 + .../javascript-jquery/sdupc.snippet | 3 + .../javascript-jquery/select.snippet | 3 + .../javascript-jquery/show.snippet | 1 + .../javascript-jquery/showc.snippet | 3 + .../javascript-jquery/sib.snippet | 1 + .../javascript-jquery/size.snippet | 1 + .../javascript-jquery/stoggle.snippet | 1 + .../javascript-jquery/submit.snippet | 3 + .../javascript-jquery/sup.snippet | 1 + .../javascript-jquery/text.snippet | 1 + .../javascript-jquery/this.snippet | 1 + .../javascript-jquery/tog.snippet | 6 + .../javascript-jquery/togclass.snippet | 1 + .../javascript-jquery/togsh.snippet | 1 + .../javascript-jquery/trig.snippet | 1 + .../javascript-jquery/unbind.snippet | 1 + .../javascript-jquery/val.snippet | 1 + .../javascript-jquery/width.snippet | 1 + .../javascript-jquery/wrap.snippet | 1 + .../snipmate-snippets/javascript/anon.snippet | 1 + .../snipmate-snippets/javascript/for.snippet | 3 + .../snipmate-snippets/javascript/fun.snippet | 3 + .../snipmate-snippets/javascript/if.snippet | 1 + .../snipmate-snippets/javascript/ife.snippet | 4 + .../snipmate-snippets/javascript/log.snippet | 1 + .../snipmate-snippets/javascript/met.snippet | 3 + .../javascript/proto.snippet | 3 + .../javascript/timeout.snippet | 1 + .../snipmate-snippets/objc/I.snippet | 6 + .../snipmate-snippets/objc/Imp.snippet | 1 + .../snipmate-snippets/objc/alloc.snippet | 1 + .../snipmate-snippets/objc/array.snippet | 1 + .../snipmate-snippets/objc/bez.snippet | 1 + .../snipmate-snippets/objc/cat.snippet | 6 + .../snipmate-snippets/objc/cati.snippet | 3 + .../snipmate-snippets/objc/cli.snippet | 5 + .../snipmate-snippets/objc/dict.snippet | 1 + .../snipmate-snippets/objc/forarray.snippet | 7 + .../snipmate-snippets/objc/log.snippet | 1 + .../objc/m/class method.snippet | 4 + .../snipmate-snippets/objc/m/method.snippet | 4 + .../snipmate-snippets/objc/objacc.snippet | 11 + .../snipmate-snippets/objc/objc.snippet | 14 + .../snipmate-snippets/objc/prop.snippet | 1 + .../snipmate-snippets/objc/rel.snippet | 1 + .../snipmate-snippets/objc/ret.snippet | 1 + .../snipmate-snippets/objc/sel.snippet | 1 + .../snipmate-snippets/objc/sm.snippet | 5 + .../snipmate-snippets/objc/syn.snippet | 1 + .../snipmate-snippets/php/array.snippet | 1 + .../snipmate-snippets/php/case.snippet | 3 + .../snipmate-snippets/php/class.snippet | 11 + .../snipmate-snippets/php/classe.snippet | 12 + .../snipmate-snippets/php/def.snippet | 1 + .../snipmate-snippets/php/defd.snippet | 1 + .../snipmate-snippets/php/do.snippet | 3 + .../snipmate-snippets/php/doc_cp.snippet | 6 + .../snipmate-snippets/php/doc_f.snippet | 8 + .../snipmate-snippets/php/doc_h.snippet | 10 + .../snipmate-snippets/php/doc_i.snippet | 8 + .../snipmate-snippets/php/ec.snippet | 1 + .../snipmate-snippets/php/else.snippet | 3 + .../snipmate-snippets/php/elseif.snippet | 3 + .../snipmate-snippets/php/for.snippet | 3 + .../snipmate-snippets/php/foreach.snippet | 3 + .../snipmate-snippets/php/foreachk.snippet | 3 + .../snipmate-snippets/php/fun.snippet | 4 + .../snipmate-snippets/php/get.snippet | 1 + .../snipmate-snippets/php/globals.snippet | 1 + .../snipmate-snippets/php/if.snippet | 3 + .../snipmate-snippets/php/ife.snippet | 4 + .../snipmate-snippets/php/inc.snippet | 1 + .../snipmate-snippets/php/inc1.snippet | 1 + .../snipmate-snippets/php/log.snippet | 1 + .../snipmate-snippets/php/php.snippet | 3 + .../snipmate-snippets/php/post.snippet | 1 + .../snipmate-snippets/php/req.snippet | 1 + .../snipmate-snippets/php/req1.snippet | 1 + .../snipmate-snippets/php/request.snippet | 1 + .../snipmate-snippets/php/session.snippet | 1 + .../snipmate-snippets/php/switch.snippet | 9 + .../snipmate-snippets/php/t.snippet | 1 + .../snipmate-snippets/php/try.snippet | 6 + .../snipmate-snippets/php/var.snippet | 1 + .../snipmate-snippets/php/wh.snippet | 3 + .../snipmate-snippets/po/msg.snippet | 2 + .../snipmate-snippets/python/class.snippet | 2 + .../snipmate-snippets/python/def.snippet | 2 + .../snipmate-snippets/python/for.snippet | 3 + .../snipmate-snippets/python/from.snippet | 2 + .../snipmate-snippets/python/get.snippet | 3 + .../snipmate-snippets/python/ifmain.snippet | 2 + .../snipmate-snippets/python/import.snippet | 2 + .../snipmate-snippets/python/init.snippet | 2 + .../snipmate-snippets/python/set.snippet | 1 + .../snipmate-snippets/python/try.snippet | 4 + .../ruby-factorygirl/fac.snippet | 1 + .../ruby-factorygirl/facb.snippet | 1 + .../ruby-factorygirl/facd.snippet | 4 + .../ruby-factorygirl/facn.snippet | 1 + .../ruby-factorygirl/facs.snippet | 4 + .../snipmate-snippets/ruby-rails/art.snippet | 1 + .../ruby-rails/artnp.snippet | 1 + .../ruby-rails/artnpp.snippet | 1 + .../snipmate-snippets/ruby-rails/artp.snippet | 1 + .../ruby-rails/artpp.snippet | 1 + .../snipmate-snippets/ruby-rails/asd.snippet | 3 + .../snipmate-snippets/ruby-rails/asnd.snippet | 3 + .../snipmate-snippets/ruby-rails/asre.snippet | 1 + .../snipmate-snippets/ruby-rails/asrj.snippet | 1 + .../snipmate-snippets/ruby-rails/ass.snippet | 1 + .../snipmate-snippets/ruby-rails/bf.snippet | 1 + .../snipmate-snippets/ruby-rails/bt.snippet | 1 + .../snipmate-snippets/ruby-rails/crw.snippet | 1 + .../ruby-rails/defcreate.snippet | 14 + .../ruby-rails/defdestroy.snippet | 9 + .../ruby-rails/defedit.snippet | 3 + .../ruby-rails/defindex.snippet | 8 + .../ruby-rails/defnew.snippet | 8 + .../ruby-rails/defshow.snippet | 8 + .../ruby-rails/defupdate.snippet | 14 + .../snipmate-snippets/ruby-rails/fina.snippet | 1 + .../snipmate-snippets/ruby-rails/finf.snippet | 1 + .../snipmate-snippets/ruby-rails/fini.snippet | 1 + .../snipmate-snippets/ruby-rails/finl.snippet | 1 + .../ruby-rails/flash.snippet | 1 + .../ruby-rails/habtm.snippet | 1 + .../snipmate-snippets/ruby-rails/hm.snippet | 1 + .../snipmate-snippets/ruby-rails/hmd.snippet | 1 + .../snipmate-snippets/ruby-rails/hmt.snippet | 1 + .../snipmate-snippets/ruby-rails/ho.snippet | 1 + .../snipmate-snippets/ruby-rails/i18.snippet | 1 + .../snipmate-snippets/ruby-rails/ist.snippet | 1 + .../snipmate-snippets/ruby-rails/log.snippet | 1 + .../snipmate-snippets/ruby-rails/logd.snippet | 1 + .../snipmate-snippets/ruby-rails/loge.snippet | 1 + .../snipmate-snippets/ruby-rails/logf.snippet | 1 + .../snipmate-snippets/ruby-rails/logi.snippet | 1 + .../snipmate-snippets/ruby-rails/logw.snippet | 1 + .../snipmate-snippets/ruby-rails/mac.snippet | 1 + .../snipmate-snippets/ruby-rails/mapc.snippet | 1 + .../ruby-rails/mapca.snippet | 1 + .../snipmate-snippets/ruby-rails/mapr.snippet | 1 + .../ruby-rails/maprs.snippet | 1 + .../ruby-rails/mapwo.snippet | 3 + .../snipmate-snippets/ruby-rails/mbs.snippet | 1 + .../snipmate-snippets/ruby-rails/mcc.snippet | 1 + .../snipmate-snippets/ruby-rails/mccc.snippet | 1 + .../snipmate-snippets/ruby-rails/mcht.snippet | 3 + .../snipmate-snippets/ruby-rails/mcol.snippet | 1 + .../snipmate-snippets/ruby-rails/mct.snippet | 3 + .../ruby-rails/migration.snippet | 8 + .../snipmate-snippets/ruby-rails/mp.snippet | 1 + .../snipmate-snippets/ruby-rails/mrc.snippet | 1 + .../snipmate-snippets/ruby-rails/mrmc.snippet | 1 + .../snipmate-snippets/ruby-rails/mrnc.snippet | 1 + .../snipmate-snippets/ruby-rails/mrw.snippet | 1 + .../snipmate-snippets/ruby-rails/nc.snippet | 1 + .../snipmate-snippets/ruby-rails/ncl.snippet | 1 + .../snipmate-snippets/ruby-rails/pa.snippet | 1 + .../snipmate-snippets/ruby-rails/ra.snippet | 1 + .../snipmate-snippets/ruby-rails/ral.snippet | 1 + .../snipmate-snippets/ruby-rails/rest.snippet | 3 + .../snipmate-snippets/ruby-rails/rf.snippet | 1 + .../snipmate-snippets/ruby-rails/rfu.snippet | 1 + .../snipmate-snippets/ruby-rails/ri.snippet | 1 + .../snipmate-snippets/ruby-rails/ril.snippet | 1 + .../snipmate-snippets/ruby-rails/rit.snippet | 1 + .../ruby-rails/rjson.snippet | 1 + .../snipmate-snippets/ruby-rails/rl.snippet | 1 + .../snipmate-snippets/ruby-rails/rn.snippet | 1 + .../snipmate-snippets/ruby-rails/rns.snippet | 1 + .../snipmate-snippets/ruby-rails/rp.snippet | 1 + .../snipmate-snippets/ruby-rails/rpc.snippet | 1 + .../snipmate-snippets/ruby-rails/rpl.snippet | 1 + .../snipmate-snippets/ruby-rails/rpo.snippet | 1 + .../snipmate-snippets/ruby-rails/rps.snippet | 1 + .../snipmate-snippets/ruby-rails/rt.snippet | 1 + .../snipmate-snippets/ruby-rails/rtl.snippet | 1 + .../snipmate-snippets/ruby-rails/rtlt.snippet | 1 + .../snipmate-snippets/ruby-rails/rts.snippet | 1 + .../snipmate-snippets/ruby-rails/ru.snippet | 3 + .../snipmate-snippets/ruby-rails/rxml.snippet | 1 + .../snipmate-snippets/ruby-rails/sha1.snippet | 1 + .../ruby-rails/sweeper.snippet | 15 + .../snipmate-snippets/ruby-rails/tcb.snippet | 2 + .../snipmate-snippets/ruby-rails/tcbi.snippet | 2 + .../snipmate-snippets/ruby-rails/tcd.snippet | 2 + .../snipmate-snippets/ruby-rails/tcda.snippet | 2 + .../snipmate-snippets/ruby-rails/tcdt.snippet | 2 + .../snipmate-snippets/ruby-rails/tcf.snippet | 2 + .../snipmate-snippets/ruby-rails/tch.snippet | 2 + .../snipmate-snippets/ruby-rails/tci.snippet | 2 + .../snipmate-snippets/ruby-rails/tcl.snippet | 2 + .../snipmate-snippets/ruby-rails/tcr.snippet | 2 + .../snipmate-snippets/ruby-rails/tcs.snippet | 2 + .../snipmate-snippets/ruby-rails/tct.snippet | 2 + .../snipmate-snippets/ruby-rails/tcti.snippet | 2 + .../snipmate-snippets/ruby-rails/tcts.snippet | 2 + .../ruby-rails/tctss.snippet | 2 + .../snipmate-snippets/ruby-rails/trc.snippet | 1 + .../snipmate-snippets/ruby-rails/tre.snippet | 2 + .../snipmate-snippets/ruby-rails/tref.snippet | 1 + .../snipmate-snippets/ruby-rails/va.snippet | 1 + .../snipmate-snippets/ruby-rails/vao.snippet | 1 + .../snipmate-snippets/ruby-rails/vc.snippet | 1 + .../snipmate-snippets/ruby-rails/ve.snippet | 1 + .../snipmate-snippets/ruby-rails/vf.snippet | 1 + .../snipmate-snippets/ruby-rails/vi.snippet | 1 + .../snipmate-snippets/ruby-rails/vl.snippet | 1 + .../snipmate-snippets/ruby-rails/vn.snippet | 1 + .../snipmate-snippets/ruby-rails/vpo.snippet | 1 + .../snipmate-snippets/ruby-rails/vu.snippet | 1 + .../ruby-rails/wants.snippet | 1 + .../ruby-rails/xdelete.snippet | 1 + .../snipmate-snippets/ruby-rails/xget.snippet | 1 + .../ruby-rails/xpost.snippet | 1 + .../snipmate-snippets/ruby-rails/xput.snippet | 1 + .../snipmate-snippets/ruby-rspec/aft.snippet | 3 + .../ruby-rspec/annot.snippet | 1 + .../snipmate-snippets/ruby-rspec/anr.snippet | 1 + .../snipmate-snippets/ruby-rspec/anra.snippet | 1 + .../snipmate-snippets/ruby-rspec/anrb.snippet | 1 + .../snipmate-snippets/ruby-rspec/ant.snippet | 1 + .../snipmate-snippets/ruby-rspec/any.snippet | 1 + .../snipmate-snippets/ruby-rspec/atl.snippet | 1 + .../snipmate-snippets/ruby-rspec/atm.snippet | 1 + .../snipmate-snippets/ruby-rspec/bef.snippet | 3 + .../snipmate-snippets/ruby-rspec/conn.snippet | 1 + .../snipmate-snippets/ruby-rspec/des.snippet | 3 + .../snipmate-snippets/ruby-rspec/desc.snippet | 5 + .../ruby-rspec/desrc.snippet | 3 + .../snipmate-snippets/ruby-rspec/dest.snippet | 3 + .../ruby-rspec/dests.snippet | 3 + .../snipmate-snippets/ruby-rspec/ex.snippet | 1 + .../snipmate-snippets/ruby-rspec/isbl.snippet | 1 + .../snipmate-snippets/ruby-rspec/it.snippet | 3 + .../snipmate-snippets/ruby-rspec/its.snippet | 1 + .../snipmate-snippets/ruby-rspec/mat.snippet | 24 + .../snipmate-snippets/ruby-rspec/mm.snippet | 1 + .../snipmate-snippets/ruby-rspec/moc.snippet | 2 + .../snipmate-snippets/ruby-rspec/mocw.snippet | 3 + .../snipmate-snippets/ruby-rspec/on.snippet | 1 + .../snipmate-snippets/ruby-rspec/resh.snippet | 1 + .../snipmate-snippets/ruby-rspec/sef.snippet | 3 + .../snipmate-snippets/ruby-rspec/sh.snippet | 2 + .../snipmate-snippets/ruby-rspec/shb.snippet | 2 + .../snipmate-snippets/ruby-rspec/shbc.snippet | 2 + .../ruby-rspec/shbio.snippet | 2 + .../ruby-rspec/shbko.snippet | 2 + .../snipmate-snippets/ruby-rspec/shbr.snippet | 2 + .../snipmate-snippets/ruby-rspec/shbs.snippet | 2 + .../snipmate-snippets/ruby-rspec/shc.snippet | 3 + .../snipmate-snippets/ruby-rspec/shdm.snippet | 2 + .../snipmate-snippets/ruby-rspec/she.snippet | 2 + .../snipmate-snippets/ruby-rspec/sheq.snippet | 2 + .../snipmate-snippets/ruby-rspec/shh.snippet | 2 + .../ruby-rspec/shhal.snippet | 2 + .../ruby-rspec/shham.snippet | 2 + .../snipmate-snippets/ruby-rspec/shhr.snippet | 2 + .../snipmate-snippets/ruby-rspec/shn.snippet | 2 + .../snipmate-snippets/ruby-rspec/shnb.snippet | 2 + .../ruby-rspec/shnbc.snippet | 2 + .../ruby-rspec/shnbio.snippet | 2 + .../ruby-rspec/shnbko.snippet | 2 + .../ruby-rspec/shnbr.snippet | 2 + .../ruby-rspec/shnbs.snippet | 2 + .../snipmate-snippets/ruby-rspec/shnc.snippet | 3 + .../snipmate-snippets/ruby-rspec/shne.snippet | 2 + .../ruby-rspec/shneq.snippet | 2 + .../snipmate-snippets/ruby-rspec/shnm.snippet | 2 + .../snipmate-snippets/ruby-rspec/shnp.snippet | 1 + .../snipmate-snippets/ruby-rspec/shnr.snippet | 2 + .../ruby-rspec/shnre.snippet | 2 + .../ruby-rspec/shnredt.snippet | 2 + .../ruby-rspec/shnrt.snippet | 2 + .../snipmate-snippets/ruby-rspec/shns.snippet | 2 + .../snipmate-snippets/ruby-rspec/shnt.snippet | 2 + .../snipmate-snippets/ruby-rspec/shp.snippet | 1 + .../snipmate-snippets/ruby-rspec/shr.snippet | 2 + .../snipmate-snippets/ruby-rspec/shre.snippet | 2 + .../ruby-rspec/shredt.snippet | 2 + .../snipmate-snippets/ruby-rspec/shrt.snippet | 2 + .../snipmate-snippets/ruby-rspec/shs.snippet | 2 + .../snipmate-snippets/ruby-rspec/sht.snippet | 2 + .../ruby-rspec/shtemp.snippet | 2 + .../snipmate-snippets/ruby-rspec/tw.snippet | 1 + .../snipmate-snippets/ruby-rspec/wia.snippet | 2 + .../ruby-shoulda/context.snippet | 5 + .../ruby-shoulda/samao.snippet | 1 + .../ruby-shoulda/savf.snippet | 1 + .../ruby-shoulda/sbt.snippet | 1 + .../ruby-shoulda/selal.snippet | 1 + .../ruby-shoulda/seli.snippet | 1 + .../ruby-shoulda/selir.snippet | 1 + .../ruby-shoulda/setup.snippet | 3 + .../ruby-shoulda/sevir.snippet | 1 + .../ruby-shoulda/shabtm.snippet | 1 + .../ruby-shoulda/shcm.snippet | 1 + .../ruby-shoulda/shdc.snippet | 1 + .../ruby-shoulda/shi.snippet | 1 + .../ruby-shoulda/shim.snippet | 1 + .../ruby-shoulda/shm.snippet | 1 + .../ruby-shoulda/sho.snippet | 1 + .../ruby-shoulda/shroa.snippet | 1 + .../ruby-shoulda/snamao.snippet | 1 + .../ruby-shoulda/snavf.snippet | 1 + .../ruby-shoulda/svao.snippet | 1 + .../ruby-shoulda/svno.snippet | 1 + .../ruby-shoulda/svpo.snippet | 1 + .../ruby-shoulda/svuo.snippet | 1 + .../snipmate-snippets/ruby/Md.snippet | 1 + .../snipmate-snippets/ruby/Ml.snippet | 1 + .../snipmate-snippets/ruby/Pn.snippet | 1 + .../snipmate-snippets/ruby/Yd.snippet | 1 + .../snipmate-snippets/ruby/Yl.snippet | 1 + .../snipmate-snippets/ruby/am.snippet | 1 + .../snipmate-snippets/ruby/as.snippet | 1 + .../snipmate-snippets/ruby/asam.snippet | 1 + .../snipmate-snippets/ruby/asb.snippet | 1 + .../snipmate-snippets/ruby/asc.snippet | 1 + .../snipmate-snippets/ruby/ascd.snippet | 1 + .../snipmate-snippets/ruby/ase.snippet | 1 + .../snipmate-snippets/ruby/asem.snippet | 1 + .../snipmate-snippets/ruby/asf.snippet | 1 + .../snipmate-snippets/ruby/asfa.snippet | 1 + .../snipmate-snippets/ruby/asi.snippet | 1 + .../snipmate-snippets/ruby/asid.snippet | 1 + .../snipmate-snippets/ruby/asie.snippet | 1 + .../snipmate-snippets/ruby/asio.snippet | 1 + .../snipmate-snippets/ruby/asko.snippet | 1 + .../snipmate-snippets/ruby/asm.snippet | 1 + .../snipmate-snippets/ruby/asn.snippet | 1 + .../snipmate-snippets/ruby/asncd.snippet | 1 + .../snipmate-snippets/ruby/asne.snippet | 1 + .../snipmate-snippets/ruby/asnem.snippet | 1 + .../snipmate-snippets/ruby/asni.snippet | 1 + .../snipmate-snippets/ruby/asnid.snippet | 1 + .../snipmate-snippets/ruby/asnie.snippet | 1 + .../snipmate-snippets/ruby/asnm.snippet | 1 + .../snipmate-snippets/ruby/asnn.snippet | 1 + .../snipmate-snippets/ruby/asnp.snippet | 1 + .../snipmate-snippets/ruby/asnr.snippet | 1 + .../snipmate-snippets/ruby/asnrt.snippet | 1 + .../snipmate-snippets/ruby/asns.snippet | 1 + .../snipmate-snippets/ruby/asnse.snippet | 1 + .../snipmate-snippets/ruby/asnt.snippet | 1 + .../snipmate-snippets/ruby/aso.snippet | 1 + .../snipmate-snippets/ruby/asp.snippet | 1 + .../snipmate-snippets/ruby/aspe.snippet | 1 + .../snipmate-snippets/ruby/aspne.snippet | 1 + .../snipmate-snippets/ruby/asr.snippet | 1 + .../snipmate-snippets/ruby/asrko.snippet | 1 + .../snipmate-snippets/ruby/asrm.snippet | 1 + .../snipmate-snippets/ruby/asrt.snippet | 1 + .../snipmate-snippets/ruby/asse.snippet | 1 + .../snipmate-snippets/ruby/ast.snippet | 1 + .../snipmate-snippets/ruby/astr.snippet | 1 + .../snipmate-snippets/ruby/bm.snippet | 4 + .../snipmate-snippets/ruby/case.snippet | 5 + .../snipmate-snippets/ruby/class.snippet | 3 + .../snipmate-snippets/ruby/classe.snippet | 1 + .../snipmate-snippets/ruby/def.snippet | 3 + .../snipmate-snippets/ruby/defi.snippet | 3 + .../snipmate-snippets/ruby/defmm.snippet | 3 + .../snipmate-snippets/ruby/defs.snippet | 3 + .../snipmate-snippets/ruby/deft.snippet | 3 + .../snipmate-snippets/ruby/detect.snippet | 1 + .../snipmate-snippets/ruby/detecto.snippet | 3 + .../snipmate-snippets/ruby/dglob.snippet | 1 + .../snipmate-snippets/ruby/do.snippet | 3 + .../snipmate-snippets/ruby/dop.snippet | 3 + .../snipmate-snippets/ruby/ea.snippet | 1 + .../snipmate-snippets/ruby/each.snippet | 1 + .../ruby/each_with_index.snippet | 1 + .../ruby/each_with_indexo.snippet | 4 + .../snipmate-snippets/ruby/eacho.snippet | 3 + .../snipmate-snippets/ruby/eado.snippet | 3 + .../snipmate-snippets/ruby/eawi.snippet | 1 + .../snipmate-snippets/ruby/eawido.snippet | 4 + .../snipmate-snippets/ruby/elsif.snippet | 2 + .../snipmate-snippets/ruby/fileeach.snippet | 1 + .../snipmate-snippets/ruby/fopen.snippet | 1 + .../snipmate-snippets/ruby/fread.snippet | 1 + .../snipmate-snippets/ruby/http_get.snippet | 2 + .../snipmate-snippets/ruby/http_post.snippet | 2 + .../snipmate-snippets/ruby/if.snippet | 3 + .../snipmate-snippets/ruby/ife.snippet | 4 + .../snipmate-snippets/ruby/inj.snippet | 1 + .../snipmate-snippets/ruby/injdo.snippet | 3 + .../snipmate-snippets/ruby/inject.snippet | 1 + .../snipmate-snippets/ruby/injecto.snippet | 3 + .../snipmate-snippets/ruby/ip.snippet | 1 + .../snipmate-snippets/ruby/map.snippet | 1 + .../snipmate-snippets/ruby/mapdo.snippet | 3 + .../snipmate-snippets/ruby/mapo.snippet | 3 + .../snipmate-snippets/ruby/mod.snippet | 3 + .../snipmate-snippets/ruby/module.snippet | 14 + .../snipmate-snippets/ruby/nam.snippet | 3 + .../snipmate-snippets/ruby/ope.snippet | 1 + .../snipmate-snippets/ruby/pathhere.snippet | 1 + .../snipmate-snippets/ruby/r.snippet | 1 + .../snipmate-snippets/ruby/reject.snippet | 1 + .../snipmate-snippets/ruby/rejecto.snippet | 3 + .../snipmate-snippets/ruby/rep.snippet | 1 + .../snipmate-snippets/ruby/rw.snippet | 1 + .../snipmate-snippets/ruby/select.snippet | 1 + .../snipmate-snippets/ruby/selecto.snippet | 3 + .../snipmate-snippets/ruby/sinc.snippet | 1 + .../snipmate-snippets/ruby/sort.snippet | 1 + .../snipmate-snippets/ruby/sorto.snippet | 3 + .../snipmate-snippets/ruby/tas.snippet | 4 + .../snipmate-snippets/ruby/task.snippet | 4 + .../snipmate-snippets/ruby/tc.snippet | 9 + .../snipmate-snippets/ruby/unless.snippet | 3 + .../snipmate-snippets/ruby/unlesse.snippet | 4 + .../snipmate-snippets/ruby/w.snippet | 1 + .../snipmate-snippets/ruby/while.snippet | 3 + .../snipmate-snippets/ruby/xmlr.snippet | 1 + .../snipmate-snippets/ruby/xpa.snippet | 3 + .../snipmate-snippets/ruby/zip.snippet | 1 + .../snipmate-snippets/sinatra/get.snippet | 3 + .../snipmate-snippets/snippets/cpp.snippets | 66 - .../snipmate-snippets/snippets/sh.snippets | 43 - .../snipmate-snippets/sshconfig/host.snippet | 3 + .../snipmate-snippets/support_functions.vim | 115 + .../snipmate-snippets/vim/au.snippet | 1 + .../snipmate-snippets/vim/com.snippet | 1 + .../snipmate-snippets/vim/func.snippet | 8 + .../snipmate-snippets/vim/if.snippet | 3 + .../snipmate-snippets/vim/ife.snippet | 4 + .../snipmate-snippets/vim/log.snippet | 1 + .../snipmate-snippets/vim/try.snippet | 4 + .../snipmate-snippets/xslt/call.snippet | 3 + .../snipmate-snippets/xslt/choose.snippet | 7 + .../snipmate-snippets/xslt/mat.snippet | 3 + .../snipmate-snippets/xslt/out.snippet | 1 + .../snipmate-snippets/xslt/param.snippet | 1 + .../snipmate-snippets/xslt/sty.snippet | 3 + .../snipmate-snippets/xslt/tem.snippet | 3 + .../snipmate-snippets/xslt/value.snippet | 1 + .../snipmate-snippets/xslt/var.snippet | 3 + .../snipmate-snippets/xslt/wparam.snippet | 1 + .../snipmate-snippets/xslt/xdec.snippet | 2 + .../snipmate-snippets/zend/assert.snippet | 1 + .../snipmate-snippets/zend/boolcol.snippet | 1 + .../snipmate-snippets/zend/clac.snippet | 20 + .../snipmate-snippets/zend/flash.snippet | 1 + .../snipmate-snippets/zend/getconf.snippet | 1 + .../snipmate-snippets/zend/input.snippet | 4 + .../snipmate-snippets/zend/inputarr.snippet | 6 + .../snipmate-snippets/zend/intcol.snippet | 1 + .../snipmate-snippets/zend/lib.snippet | 5 + .../snipmate-snippets/zend/model.snippet | 32 + .../snipmate-snippets/zend/navi.snippet | 1 + .../snipmate-snippets/zend/route.snippet | 1 + .../snipmate-snippets/zend/rp.snippet | 2 + .../snipmate-snippets/zend/strcol.snippet | 1 + sources_non_forked/taglist.vim/README | 18 + .../taglist.vim/doc/taglist.txt | 1501 ++++++ sources_non_forked/taglist.vim/doc/tags | 62 + .../taglist.vim/plugin/taglist.vim | 4546 +++++++++++++++++ sources_non_forked/taglist/doc/taglist.txt | 1501 ++++++ sources_non_forked/taglist/doc/tags | 62 + sources_non_forked/taglist/plugin/taglist.vim | 4546 +++++++++++++++++ .../tlib/autoload/tlib/Filter_cnf.vim | 23 +- .../tlib/autoload/tlib/Filter_cnfd.vim | 19 +- .../tlib/autoload/tlib/Filter_cnfx.vim | 42 + .../tlib/autoload/tlib/Filter_fuzzy.vim | 20 +- .../tlib/autoload/tlib/Filter_seq.vim | 98 - .../tlib/autoload/tlib/World.vim | 477 +- .../tlib/autoload/tlib/agent.vim | 83 +- .../tlib/autoload/tlib/buffer.vim | 5 +- .../tlib/autoload/tlib/cache.vim | 104 +- sources_non_forked/tlib/autoload/tlib/cmd.vim | 12 +- .../tlib/autoload/tlib/file.vim | 31 +- .../tlib/autoload/tlib/input.vim | 330 +- .../tlib/autoload/tlib/notify.vim | 7 +- .../tlib/autoload/tlib/persistent.vim | 47 + .../tlib/autoload/tlib/scratch.vim | 24 +- sources_non_forked/tlib/autoload/tlib/tag.vim | 5 +- sources_non_forked/tlib/autoload/tlib/vcs.vim | 155 + sources_non_forked/tlib/autoload/tlib/vim.vim | 19 +- sources_non_forked/tlib/doc/tags | 252 + sources_non_forked/tlib/doc/tlib.txt | 1941 +++---- sources_non_forked/tlib/plugin/02tlib.vim | 89 +- .../autoload/tovl/scratch_buffer.vim | 103 + .../autoload/tovl/ui/filter_list.vim | 473 ++ .../vim-coffee-script/Readme.md | 5 +- .../vim-coffee-script/compiler/coffee.vim | 22 +- .../vim-coffee-script/ftdetect/coffee.vim | 2 +- .../vim-coffee-script/syntax/coffee.vim | 0 .../vim-indent-object/.gitignore | 2 + .../vim-indent-object/doc/indent-object.txt | 120 + .../plugin/indent-object.vim | 224 + sources_non_forked/vim-less/ftplugin/less.vim | 2 + sources_non_forked/vim-less/syntax/less.vim | 28 +- .../vim-markdown/syntax/markdown.vim | 49 +- sources_non_forked/vim-powerline/.gitignore | 2 - sources_non_forked/vim-powerline/README.md | 0 sources_non_forked/vim-powerline/README.rst | 107 - .../vim-powerline/autoload/Pl.vim | 183 - .../vim-powerline/autoload/Pl/Colorscheme.vim | 145 - .../vim-powerline/autoload/Pl/Hi.vim | 140 - .../vim-powerline/autoload/Pl/Match.vim | 43 - .../vim-powerline/autoload/Pl/Mod.vim | 40 - .../vim-powerline/autoload/Pl/Parser.vim | 371 -- .../vim-powerline/autoload/Pl/Segment.vim | 188 - .../vim-powerline/autoload/Pl/Theme.vim | 100 - .../Powerline/Colorschemes/default.vim | 166 - .../autoload/Powerline/Colorschemes/skwp.vim | 192 - .../autoload/Powerline/Functions.vim | 141 - .../autoload/Powerline/Functions/ft_man.vim | 12 - .../autoload/Powerline/Functions/fugitive.vim | 7 - .../autoload/Powerline/Functions/hgrev.vim | 17 - .../Powerline/Functions/syntastic.vim | 16 - .../autoload/Powerline/Matches.vim | 13 - .../autoload/Powerline/Segments.vim | 30 - .../autoload/Powerline/Segments/ctrlp.vim | 20 - .../autoload/Powerline/Segments/ft_man.vim | 3 - .../autoload/Powerline/Segments/fugitive.vim | 5 - .../autoload/Powerline/Segments/hgrev.vim | 4 - .../autoload/Powerline/Segments/rvm.vim | 6 - .../autoload/Powerline/Segments/syntastic.vim | 5 - .../autoload/Powerline/Segments/tagbar.vim | 6 - .../Powerline/Segments/virtualenv.vim | 5 - .../autoload/Powerline/Themes/default.vim | 116 - .../autoload/Powerline/Themes/skwp.vim | 116 - .../vim-powerline/doc/Powerline.txt | 429 -- .../fontpatcher/PowerlineSymbols.sfd | 319 -- .../vim-powerline/fontpatcher/README.rst | 164 - .../vim-powerline/fontpatcher/fontpatcher | 240 - .../vim-powerline/plugin/Powerline.vim | 69 - sources_non_forked/vim-snipmate/README.rst | 139 +- .../vim-snipmate/addon-info.json | 4 +- .../vim-snipmate/after/plugin/snipMate.vim | 14 +- .../vim-snipmate/autoload/snipMate.vim | 424 +- .../vim-snipmate/doc/snipMate.txt | 9 +- .../vim-snipmate/plugin/snipMate.vim | 2 +- .../AUTHORS | 5 + .../LICENSE | 0 sources_non_forked/vim-snippets/README.md | 118 + .../vim-snippets/UltiSnips/README | 21 + .../vim-snippets/{ => UltiSnips}/all.snippets | 0 .../{ => UltiSnips}/bindzone.snippets | 0 .../vim-snippets/{ => UltiSnips}/c.snippets | 19 +- .../{ => UltiSnips}/coffee.snippets | 0 .../{ => UltiSnips}/coffee_jasmine.snippets | 0 .../vim-snippets/{ => UltiSnips}/cpp.snippets | 2 - .../vim-snippets/{ => UltiSnips}/css.snippets | 0 .../vim-snippets/UltiSnips/d.snippets | 583 +++ .../{ => UltiSnips}/django.snippets | 0 .../{ => UltiSnips}/erlang.snippets | 0 .../{ => UltiSnips}/eruby.snippets | 0 .../vim-snippets/{ => UltiSnips}/go.snippets | 0 .../{ => UltiSnips}/haskell.snippets | 0 .../{ => UltiSnips}/help.snippets | 4 +- .../{ => UltiSnips}/html.snippets | 164 +- .../{ => UltiSnips}/htmldjango.snippets | 0 .../{ => UltiSnips}/java.snippets | 0 .../{ => UltiSnips}/javascript.snippets | 0 .../javascript_jasmine.snippets | 0 .../{ => UltiSnips}/jinja2.snippets | 0 .../{ => UltiSnips}/json.snippets | 0 .../vim-snippets/{ => UltiSnips}/lua.snippets | 0 .../{ => UltiSnips}/mako.snippets | 0 .../markdown.snippets} | 4 +- .../{ => UltiSnips}/objc.snippets | 0 .../vim-snippets/UltiSnips/ocaml.snippets | 172 + .../{ => UltiSnips}/perl.snippets | 0 .../vim-snippets/UltiSnips/php.snippets | 258 + .../{ => UltiSnips}/puppet.snippets | 0 .../{ => UltiSnips}/python.snippets | 7 +- .../{ => UltiSnips}/rails.snippets | 0 .../vim-snippets/{ => UltiSnips}/rst.snippets | 0 .../{ => UltiSnips}/ruby.snippets | 0 .../vim-snippets/{ => UltiSnips}/sh.snippets | 25 +- .../{ => UltiSnips}/snippets.snippets | 0 .../vim-snippets/{ => UltiSnips}/tcl.snippets | 0 .../vim-snippets/{ => UltiSnips}/tex.snippets | 1 - .../{ => UltiSnips}/texmath.snippets | 0 .../vim-snippets/{ => UltiSnips}/vim.snippets | 0 .../vim-snippets/UltiSnips/xhtml.snippets | 0 .../vim-snippets/UltiSnips/xml.snippets | 9 + .../vim-snippets/UltiSnips/zsh.snippets | 11 + .../addon-info.json | 1 - .../vim-snippets/pascal.snippets | 122 - sources_non_forked/vim-snippets/php.snippets | 236 - .../vim-snippets/phtml.snippets | 74 - .../snippets/_.snippets | 30 +- .../snippets/actionscript.snippets | 2 +- .../snippets/apache.snippets | 0 .../snippets/autoit.snippets | 0 .../snippets/c.snippets | 172 +- .../snippets/chef.snippets | 0 .../snippets/clojure.snippets | 0 .../snippets/cmake.snippets | 0 .../snippets/coffee.snippets | 8 + .../vim-snippets/snippets/cpp.snippets | 131 + .../snippets/cs.snippets | 0 .../snippets/css.snippets | 0 .../snippets/dart.snippets | 0 .../snippets/diff.snippets | 0 .../snippets/django.snippets | 0 .../snippets/erlang.snippets | 0 .../snippets/eruby.snippets | 4 - .../snippets/falcon.snippets | 0 .../snippets/go.snippets | 34 +- .../snippets/haml.snippets | 0 .../snippets/haskell.snippets | 0 .../snippets/html.snippets | 20 +- .../snippets/htmldjango.snippets | 5 + .../snippets/htmltornado.snippets | 0 .../snippets/java.snippets | 6 +- .../snippets/javascript-jquery.snippets | 0 .../snippets/javascript.snippets | 31 +- .../snippets/javascript_jquery.snippets | 1 + .../snippets/jsp.snippets | 0 .../vim-snippets/snippets/ledger.snippets | 5 + .../snippets/lua.snippets | 0 .../snippets/make.snippets | 0 .../snippets/mako.snippets | 0 .../snippets/markdown.snippets | 0 .../snippets/objc.snippets | 0 .../vim-snippets/snippets/openfoam.snippets | 53 + .../snippets/perl.snippets | 117 +- .../snippets/php.snippets | 77 +- .../vim-snippets/snippets/plsql.snippets | 109 + .../snippets/po.snippets | 0 .../snippets/processing.snippets | 0 .../snippets/progress.snippets | 0 .../snippets/puppet.snippets | 0 .../snippets/python.snippets | 71 +- .../snippets/r.snippets | 26 + .../snippets/rst.snippets | 6 +- .../snippets/ruby.snippets | 46 +- .../vim-snippets/snippets/scala.snippets | 349 ++ .../vim-snippets/snippets/sh.snippets | 86 + .../snippets/snippets.snippets | 0 .../vim-snippets/snippets/sql.snippets | 26 + .../snippets/tcl.snippets | 0 .../snippets/tex.snippets | 26 +- .../snippets/textile.snippets | 0 .../snippets/vim.snippets | 0 .../snippets/xslt.snippets | 2 +- .../vim-snippets/snippets/yii-chtml.snippets | 248 + .../vim-snippets/snippets/yii.snippets | 300 ++ .../snippets/zsh.snippets | 0 .../vim-snippets/xhtml.snippets | 1 - .../vim-surround/doc/surround.txt | 12 +- .../vim-surround/plugin/surround.vim | 26 +- update_plugins.py | 76 + vimrcs/basic.vim | 4 + vimrcs/plugins_config.vim | 8 + 1057 files changed, 33631 insertions(+), 10806 deletions(-) create mode 100644 .gitignore create mode 100644 sources_forked/yankring/doc/tags create mode 100755 sources_forked/zencoding/.gitignore create mode 100755 sources_forked/zencoding/.gitmodules create mode 100755 sources_forked/zencoding/Makefile create mode 100755 sources_forked/zencoding/README.mkd create mode 100755 sources_forked/zencoding/TODO create mode 100755 sources_forked/zencoding/TUTORIAL create mode 100755 sources_forked/zencoding/autoload/zencoding.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/css.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/haml.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/html.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/sass.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/scss.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/lang/slim.vim create mode 100755 sources_forked/zencoding/autoload/zencoding/util.vim create mode 100755 sources_forked/zencoding/doc/zencoding.txt create mode 100755 sources_forked/zencoding/plugin/zencoding.vim create mode 100755 sources_forked/zencoding/unittest.vim create mode 100755 sources_forked/zencoding/zencoding.vim.vimup delete mode 100644 sources_non_forked/bufexplorer.zip/README create mode 100644 sources_non_forked/bufexplorer/README.md rename sources_non_forked/{bufexplorer.zip => bufexplorer}/doc/bufexplorer.txt (99%) create mode 100644 sources_non_forked/bufexplorer/doc/tags rename sources_non_forked/{bufexplorer.zip => bufexplorer}/plugin/bufexplorer.vim (99%) create mode 100644 sources_non_forked/nerdtree/autoload/nerdtree.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/bookmark.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/creator.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/key_map.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/menu_controller.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/menu_item.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/opener.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/path.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/tree_dir_node.vim create mode 100644 sources_non_forked/nerdtree/plugin/nerdtree/tree_file_node.vim create mode 100755 sources_non_forked/nginx-vim/README.md create mode 100755 sources_non_forked/nginx-vim/ftdetect/nginx.vim create mode 100755 sources_non_forked/nginx-vim/indent/nginx.vim create mode 100755 sources_non_forked/nginx-vim/syntax/nginx.vim create mode 100644 sources_non_forked/nginx.vim/README create mode 100644 sources_non_forked/nginx.vim/syntax/nginx.vim create mode 100644 sources_non_forked/snipmate-snippets/.gitignore delete mode 100644 sources_non_forked/snipmate-snippets/README.md create mode 100644 sources_non_forked/snipmate-snippets/Rakefile create mode 100644 sources_non_forked/snipmate-snippets/_/date/date + time.snippet create mode 100644 sources_non_forked/snipmate-snippets/_/date/date.snippet create mode 100644 sources_non_forked/snipmate-snippets/_/lorem.snippet create mode 100644 sources_non_forked/snipmate-snippets/_/modeline.snippet create mode 100644 sources_non_forked/snipmate-snippets/ant/skel/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/cl.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/def.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/do.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/el.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/forr.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/fpf.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/fun.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/inc/inc.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/inc/inc_global.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/main.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/map.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/ns.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/once.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/pr.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/readfile.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/st.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/t.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/td.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/tds.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/vector.snippet create mode 100644 sources_non_forked/snipmate-snippets/c/wh.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/#.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/all.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/attachment.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/color_name.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/color_rgb.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/color_transparent.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/image_none.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/image_url.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/position.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/background/repeat.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/border/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/border/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/border/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/border/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderb/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderb/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderb/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderb/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderl/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderl/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderl/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderl/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderr/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderr/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderr/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/borderr/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/bordert/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/bordert/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/bordert/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/bordert/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/cl.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/clear.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/color.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/colorn.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/colorr.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/cursor.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/cursuru.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/direction.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/display/block.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/display/common.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/display/inline.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/display/table.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/float.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/all.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/family.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/size.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/size_font.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/variant.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/font/weight.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/i.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/letter.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/letterem.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/letterpx.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/image.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/position.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_asian.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_marker.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_numeric.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_other.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_position_image.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/list-style/type_roman_alpha_greek.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margin.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/marginb.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/marginl.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/T_R_B_L.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/V_H.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/all.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/bottom.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/left.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/right.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margino/top.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/marginr.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/margint.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/marker/offset_auto.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/marker/offset_length.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/opacity.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/overflow.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/padding.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingb.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingl.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/T_R_B_L.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/V_H.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/all.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/bottom.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/left.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/right.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingo/top.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingr.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/paddingt.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/position.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/scrollbar.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/tag.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/align.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/decoration.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/indent.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/shadow_hex.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/shadow_none.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/shadow_rgb.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/transform.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/text/transform_none.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/vertical.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/visibility.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/white.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/word/spacing_length.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/word/spacing_normal.snippet create mode 100644 sources_non_forked/snipmate-snippets/css/z.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/conf.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/cs.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ct.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/end.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ff.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffcb.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffe.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffff.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffhf.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffl.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffpf.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffrb.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffs.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ffta.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/fftf.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/fields.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ft.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/i18.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/it.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/jit.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/jsit.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lia.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/liai.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lic.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lica.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/licai.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lim.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/linp.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/linpp.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lip.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lipp.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/lt.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/ofcfs.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/rf.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/rp.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/rt.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/slt.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/sslt.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby-rails/st.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby/unless.snippet create mode 100644 sources_non_forked/snipmate-snippets/eruby/unlesse.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/conf.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/cs.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ff.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffcb.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffe.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffff.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffhf.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffl.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffpf.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffrb.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffs.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ffta.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/fftf.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/fields.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ft.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/it.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/jit.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/jsit.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lia.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/liai.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lic.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lica.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/licai.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lim.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/linp.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/linpp.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lip.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lipp.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/lt.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/ofcfs.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/rf.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/rp.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/rt.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/slt.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/sslt.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/st.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/unless.snippet create mode 100644 sources_non_forked/snipmate-snippets/haml/unlesse.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/base.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/body.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/div.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/doctype.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/form.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/h1.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/head.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/href.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/ifie.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/img.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/input.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/inputl.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/label.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/link.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/mailto.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/meta.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/option.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/script/include_script.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/script/inline_script.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/select.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/skel/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/style.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/t.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/table/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/table/hardcore.snippet create mode 100644 sources_non_forked/snipmate-snippets/html/textarea.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/class/basic.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/gs.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/java/m.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/anon.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/fun.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/met.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/proto.snippet create mode 100644 sources_non_forked/snipmate-snippets/javascript/timeout.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/I.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/Imp.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/alloc.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/array.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/bez.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/cat.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/cati.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/cli.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/dict.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/forarray.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/m/class method.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/m/method.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/objacc.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/objc.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/prop.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/rel.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/ret.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/sel.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/sm.snippet create mode 100644 sources_non_forked/snipmate-snippets/objc/syn.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/array.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/case.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/class.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/classe.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/def.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/defd.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/do.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/doc_cp.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/doc_f.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/doc_h.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/doc_i.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/ec.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/else.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/elseif.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/foreach.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/foreachk.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/fun.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/get.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/globals.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/inc.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/inc1.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/php.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/post.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/req.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/req1.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/request.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/session.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/switch.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/t.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/try.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/var.snippet create mode 100644 sources_non_forked/snipmate-snippets/php/wh.snippet create mode 100644 sources_non_forked/snipmate-snippets/po/msg.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/class.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/def.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/for.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/from.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/get.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/ifmain.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/import.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/init.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/set.snippet create mode 100644 sources_non_forked/snipmate-snippets/python/try.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/art.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/va.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/Md.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/Ml.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/Pn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/Yd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/Yl.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/am.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/as.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asam.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asb.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ascd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ase.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asem.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asf.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asfa.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asid.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asie.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asio.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asko.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asncd.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asne.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnem.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asni.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnid.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnie.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnn.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnrt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asns.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnse.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asnt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/aso.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asp.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/aspe.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/aspne.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asrko.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asrm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asrt.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/asse.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ast.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/astr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/bm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/case.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/class.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/classe.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/def.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/defi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/defmm.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/defs.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/deft.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/detect.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/detecto.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/dglob.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/do.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/dop.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ea.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/each.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/eacho.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/eado.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/eawi.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/eawido.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/elsif.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/fileeach.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/fopen.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/fread.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/http_get.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/http_post.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/inj.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/injdo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/inject.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/injecto.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ip.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/map.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/mapdo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/mapo.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/mod.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/module.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/nam.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/ope.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/pathhere.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/r.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/reject.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/rejecto.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/rep.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/rw.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/select.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/selecto.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/sinc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/sort.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/sorto.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/tas.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/task.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/tc.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/unless.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/unlesse.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/w.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/while.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/xmlr.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/xpa.snippet create mode 100644 sources_non_forked/snipmate-snippets/ruby/zip.snippet create mode 100644 sources_non_forked/snipmate-snippets/sinatra/get.snippet delete mode 100644 sources_non_forked/snipmate-snippets/snippets/cpp.snippets delete mode 100644 sources_non_forked/snipmate-snippets/snippets/sh.snippets create mode 100644 sources_non_forked/snipmate-snippets/sshconfig/host.snippet create mode 100644 sources_non_forked/snipmate-snippets/support_functions.vim create mode 100644 sources_non_forked/snipmate-snippets/vim/au.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/com.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/func.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/if.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/ife.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/log.snippet create mode 100644 sources_non_forked/snipmate-snippets/vim/try.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/call.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/choose.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/mat.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/out.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/param.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/sty.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/tem.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/value.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/var.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/wparam.snippet create mode 100644 sources_non_forked/snipmate-snippets/xslt/xdec.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/assert.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/boolcol.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/clac.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/flash.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/getconf.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/input.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/inputarr.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/intcol.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/lib.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/model.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/navi.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/route.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/rp.snippet create mode 100644 sources_non_forked/snipmate-snippets/zend/strcol.snippet create mode 100644 sources_non_forked/taglist.vim/README create mode 100644 sources_non_forked/taglist.vim/doc/taglist.txt create mode 100644 sources_non_forked/taglist.vim/doc/tags create mode 100644 sources_non_forked/taglist.vim/plugin/taglist.vim create mode 100755 sources_non_forked/taglist/doc/taglist.txt create mode 100644 sources_non_forked/taglist/doc/tags create mode 100644 sources_non_forked/taglist/plugin/taglist.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim delete mode 100644 sources_non_forked/tlib/autoload/tlib/Filter_seq.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/persistent.vim create mode 100644 sources_non_forked/tlib/autoload/tlib/vcs.vim create mode 100644 sources_non_forked/tlib/doc/tags create mode 100644 sources_non_forked/vim-addon-mw-utils/autoload/tovl/scratch_buffer.vim create mode 100644 sources_non_forked/vim-addon-mw-utils/autoload/tovl/ui/filter_list.vim mode change 100755 => 100644 sources_non_forked/vim-coffee-script/syntax/coffee.vim create mode 100644 sources_non_forked/vim-indent-object/.gitignore create mode 100644 sources_non_forked/vim-indent-object/doc/indent-object.txt create mode 100644 sources_non_forked/vim-indent-object/plugin/indent-object.vim delete mode 100644 sources_non_forked/vim-powerline/.gitignore create mode 100644 sources_non_forked/vim-powerline/README.md delete mode 100644 sources_non_forked/vim-powerline/README.rst delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Colorscheme.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Hi.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Match.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Mod.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Parser.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Segment.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Pl/Theme.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Functions.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Matches.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments.vim delete mode 100755 sources_non_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Themes/default.vim delete mode 100644 sources_non_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim delete mode 100644 sources_non_forked/vim-powerline/doc/Powerline.txt delete mode 100644 sources_non_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd delete mode 100644 sources_non_forked/vim-powerline/fontpatcher/README.rst delete mode 100755 sources_non_forked/vim-powerline/fontpatcher/fontpatcher delete mode 100644 sources_non_forked/vim-powerline/plugin/Powerline.vim rename sources_non_forked/{snipmate-snippets => vim-snippets}/AUTHORS (78%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/LICENSE (100%) create mode 100644 sources_non_forked/vim-snippets/README.md create mode 100644 sources_non_forked/vim-snippets/UltiSnips/README rename sources_non_forked/vim-snippets/{ => UltiSnips}/all.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/bindzone.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/c.snippets (89%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/coffee.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/coffee_jasmine.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/cpp.snippets (99%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/css.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/d.snippets rename sources_non_forked/vim-snippets/{ => UltiSnips}/django.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/erlang.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/eruby.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/go.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/haskell.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/help.snippets (88%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/html.snippets (84%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/htmldjango.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/java.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/javascript.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/javascript_jasmine.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/jinja2.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/json.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/lua.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/mako.snippets (100%) rename sources_non_forked/vim-snippets/{mkd.snippets => UltiSnips/markdown.snippets} (92%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/objc.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets rename sources_non_forked/vim-snippets/{ => UltiSnips}/perl.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/php.snippets rename sources_non_forked/vim-snippets/{ => UltiSnips}/puppet.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/python.snippets (98%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/rails.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/rst.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/ruby.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/sh.snippets (67%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/snippets.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/tcl.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/tex.snippets (99%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/texmath.snippets (100%) rename sources_non_forked/vim-snippets/{ => UltiSnips}/vim.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/xml.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/zsh.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/addon-info.json (93%) delete mode 100644 sources_non_forked/vim-snippets/pascal.snippets delete mode 100644 sources_non_forked/vim-snippets/php.snippets delete mode 100644 sources_non_forked/vim-snippets/phtml.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/_.snippets (93%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/actionscript.snippets (99%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/apache.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/autoit.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/c.snippets (52%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/chef.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/clojure.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/cmake.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/coffee.snippets (93%) create mode 100644 sources_non_forked/vim-snippets/snippets/cpp.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/cs.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/css.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/dart.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/diff.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/django.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/erlang.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/eruby.snippets (98%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/falcon.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/go.snippets (85%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/haml.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/haskell.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/html.snippets (97%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/htmldjango.snippets (97%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/htmltornado.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/java.snippets (97%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/javascript-jquery.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/javascript.snippets (82%) create mode 100644 sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/jsp.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/snippets/ledger.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/lua.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/make.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/mako.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/markdown.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/objc.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/snippets/openfoam.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/perl.snippets (83%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/php.snippets (83%) create mode 100644 sources_non_forked/vim-snippets/snippets/plsql.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/po.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/processing.snippets (100%) mode change 100755 => 100644 rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/progress.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/puppet.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/python.snippets (66%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/r.snippets (77%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/rst.snippets (69%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/ruby.snippets (95%) create mode 100644 sources_non_forked/vim-snippets/snippets/scala.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/sh.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/snippets.snippets (100%) create mode 100644 sources_non_forked/vim-snippets/snippets/sql.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/tcl.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/tex.snippets (84%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/textile.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/vim.snippets (100%) rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/xslt.snippets (98%) create mode 100644 sources_non_forked/vim-snippets/snippets/yii-chtml.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/yii.snippets rename sources_non_forked/{snipmate-snippets => vim-snippets}/snippets/zsh.snippets (100%) delete mode 100644 sources_non_forked/vim-snippets/xhtml.snippets create mode 100644 update_plugins.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1a13e7c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +temp_dirs/undodir* +sources_non_forked/ack.vim/.netrwhist +temp_dirs/yankring_history_v2.txt +my_configs.vim diff --git a/README.md b/README.md index b518d85c..d1c16a05 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,10 @@ Bash like keys for the command line: cnoremap cnoremap +Write the file as sudo (only on Unix). [Vim tip](http://vim.wikia.com/wiki/Su-write): + + :W + ### Spell checking Pressing `ss` will toggle and untoggle spell checking diff --git a/sources_forked/yankring/doc/tags b/sources_forked/yankring/doc/tags new file mode 100644 index 00000000..36de7820 --- /dev/null +++ b/sources_forked/yankring/doc/tags @@ -0,0 +1,40 @@ +YRClear yankring.txt /*YRClear* +YRClear-example yankring.txt /*YRClear-example* +YRDeleteRange yankring.txt /*YRDeleteRange* +YRGetElem yankring.txt /*YRGetElem* +YRGetMultiple yankring.txt /*YRGetMultiple* +YRGetMultiple-example yankring.txt /*YRGetMultiple-example* +YRMapsCreate yankring.txt /*YRMapsCreate* +YRMapsDelete yankring.txt /*YRMapsDelete* +YRPaste yankring.txt /*YRPaste* +YRPop yankring.txt /*YRPop* +YRPop-example yankring.txt /*YRPop-example* +YRPush yankring.txt /*YRPush* +YRPush-example yankring.txt /*YRPush-example* +YRReplace yankring.txt /*YRReplace* +YRReplace-example yankring.txt /*YRReplace-example* +YRSearch yankring.txt /*YRSearch* +YRSearch-example yankring.txt /*YRSearch-example* +YRShow yankring.txt /*YRShow* +YRShow-example yankring.txt /*YRShow-example* +YRToggle yankring.txt /*YRToggle* +YRYankCount yankring.txt /*YRYankCount* +YRYankRange yankring.txt /*YRYankRange* +YRYankRange-example yankring.txt /*YRYankRange-example* +any-item-example yankring.txt /*any-item-example* +global-example yankring.txt /*global-example* +multiple-items-example yankring.txt /*multiple-items-example* +yankring yankring.txt /*yankring* +yankring-commands yankring.txt /*yankring-commands* +yankring-configure yankring.txt /*yankring-configure* +yankring-contents yankring.txt /*yankring-contents* +yankring-custom-maps yankring.txt /*yankring-custom-maps* +yankring-description yankring.txt /*yankring-description* +yankring-globals yankring.txt /*yankring-globals* +yankring-history yankring.txt /*yankring-history* +yankring-mappings yankring.txt /*yankring-mappings* +yankring-tutorial yankring.txt /*yankring-tutorial* +yankring-visual-example yankring.txt /*yankring-visual-example* +yankring-window yankring.txt /*yankring-window* +yankring-window-example yankring.txt /*yankring-window-example* +yankring.txt yankring.txt /*yankring.txt* diff --git a/sources_forked/zencoding/.gitignore b/sources_forked/zencoding/.gitignore new file mode 100755 index 00000000..0a56e3fc --- /dev/null +++ b/sources_forked/zencoding/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/sources_forked/zencoding/.gitmodules b/sources_forked/zencoding/.gitmodules new file mode 100755 index 00000000..8225cc06 --- /dev/null +++ b/sources_forked/zencoding/.gitmodules @@ -0,0 +1,4 @@ +[submodule "docs"] + path = docs + url = git@github.com:mattn/zencoding-vim.git + branch = gh-pages diff --git a/sources_forked/zencoding/Makefile b/sources_forked/zencoding/Makefile new file mode 100755 index 00000000..94c355a8 --- /dev/null +++ b/sources_forked/zencoding/Makefile @@ -0,0 +1,11 @@ +all : zencoding-vim.zip + +remove-zip: + -rm doc/tags + -rm zencoding-vim.zip + +zencoding-vim.zip: remove-zip + zip -r zencoding-vim.zip autoload plugin doc + +release: zencoding-vim.zip + vimup update-script zencoding.vim diff --git a/sources_forked/zencoding/README.mkd b/sources_forked/zencoding/README.mkd new file mode 100755 index 00000000..36eead34 --- /dev/null +++ b/sources_forked/zencoding/README.mkd @@ -0,0 +1,103 @@ +# ZenCoding-vim + +[zencoding-vim](http://mattn.github.com/zencoding-vim) is vim script support for expanding abbreviation like zen-coding(emmet). + +## Installation + +[Download zip file](http://www.vim.org/scripts/script.php?script_id=2981): + + cd ~/.vim + unzip zencoding-vim.zip + +If you install pathogen.vim: + + cd ~/.vim/bundle # or make directory + unzip /path/to/zencoding-vim.zip + +If you get source from repository: + + cd ~/.vim/bundle # or make directory + git clone http://github.com/mattn/zencoding-vim.git + +or: + + git clone http://github.com/mattn/zencoding-vim.git + cd zencoding-vim + cp plugin/zencoding.vim ~/.vim/plugin/ + cp autoload/zencoding.vim ~/.vim/autoload/ + cp -a autoload/zencoding ~/.vim/autoload/ + + +## Quick Tutorial + +Open or create New File: + + vim index.html + +Type ("_" is the cursor position): + + html:5_ + +Then type "," (Ctrl + y + ','), you should see: + + + + + + + + + _ + + + +[More Tutorials](https://raw.github.com/mattn/zencoding-vim/master/TUTORIAL) + + +## Enable in different mode + +If you don't want enable zencoding in all mode, +you can use set a option in `vimrc`: + + let g:user_zen_mode='n' "only enable normal mode functions. + let g:user_zen_mode='inv' "enable all functions, which is equal to + let g:user_zen_mode='a' "enable all function in all mode. + +## Project Authors + +[Yasuhiro Matsumoto](http://mattn.kaoriya.net/) + +## Links + +### zen-coding official site: + +> + +### zencoding.vim: + +> + +### development repository: + +> + +### my blog posts about zencoding-vim: + +> + +> + +### japanese blog posts about zencoding-vim: + +> + +> + +> + +> + +### tutorial traslated in chinese: + +> + diff --git a/sources_forked/zencoding/TODO b/sources_forked/zencoding/TODO new file mode 100755 index 00000000..e69de29b diff --git a/sources_forked/zencoding/TUTORIAL b/sources_forked/zencoding/TUTORIAL new file mode 100755 index 00000000..ad460418 --- /dev/null +++ b/sources_forked/zencoding/TUTORIAL @@ -0,0 +1,212 @@ +Tutorial of zencoding.vim + + mattn + +1. Expand Abbreviation + + Type abbreviation as 'div>p#foo$*3>a' and type ','. + --------------------- +
+

+ +

+

+ +

+

+ +

+
+ --------------------- + +2. Wrap with Abbreviation + + Write as below. + --------------------- + test1 + test2 + test3 + --------------------- + Then do visual select(line wize) and type ','. + If you request 'Tag:', then type 'ul>li*'. + --------------------- +
    +
  • test1
  • +
  • test2
  • +
  • test3
  • +
+ --------------------- + + If you type tag as 'blockquote', then you'll see as following. + --------------------- +
+ test1 + test2 + test3 +
+ --------------------- + +3. Balance Tag Inward + + type 'd' in insert mode. + +4. Balance Tag Outward + + type 'D' in insert mode. + +5. Go to Next Edit Point + + type 'n' in insert mode. + +6. Go to Previous Edit Point + + type 'N' in insert mode. + +7. Update Size + + Move cursor to img tag. + --------------------- + + --------------------- + Type 'i' on img tag + --------------------- + + --------------------- + +8. Merge Lines + + select the lines included '
  • ' + --------------------- +
      +
    • +
    • +
    • +
    + --------------------- + and type 'm' + --------------------- +
      +
    • +
    + --------------------- + +9. Remove Tag + + Move cursor in block + --------------------- + + --------------------- + Type 'k' in insert mode. + --------------------- +
    + +
    + --------------------- + + And type 'k' in there again. + --------------------- + + --------------------- + +10. Split/Join Tag + + Move cursor in block + --------------------- +
    + cursor is here +
    + --------------------- + Type 'j' in insert mode. + --------------------- +
    + --------------------- + + And type 'j' in there again. + --------------------- +
    +
    + --------------------- + +11. Toggle Comment + + Move cursor to block + --------------------- +
    + hello world +
    + --------------------- + Type '/' in insert mode. + --------------------- + + --------------------- + Type '/' in there again. + --------------------- +
    + hello world +
    + --------------------- + +12. Make anchor from URL + + Move cursor to URL + --------------------- + http://www.google.com/ + --------------------- + Type 'a' + --------------------- + Google + --------------------- + +13. Make quoted text from URL + + Move cursor to URL + --------------------- + http://github.com/ + --------------------- + Type 'A' + --------------------- +
    + Secure source code hosting and collaborative development - GitHub
    +

    How does it work? Get up and running in seconds by forking a project, pushing an existing repository...

    + http://github.com/ +
    + --------------------- + +14. Installing zencoding.vim for language you using. + + # cd ~/.vim + # unzip zencoding-vim.zip + + or if you install pathogen.vim: + + # cd ~/.vim/bundle # or make directory + # unzip /path/to/zencoding-vim.zip + + if you get sources from repository: + + # cd ~/.vim/bundle # or make directory + # git clone http://github.com/mattn/zencoding-vim.git + +15. Enable zencoding.vim for language you using. + + You can customize the behavior of language you using. + + --------------------- + # cat >> ~/.vimrc + let g:user_zen_settings = { + \ 'php' : { + \ 'extends' : 'html', + \ 'filters' : 'c', + \ }, + \ 'xml' : { + \ 'extends' : 'html', + \ }, + \ 'haml' : { + \ 'extends' : 'html', + \ }, + \} + --------------------- diff --git a/sources_forked/zencoding/autoload/zencoding.vim b/sources_forked/zencoding/autoload/zencoding.vim new file mode 100755 index 00000000..a6961439 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding.vim @@ -0,0 +1,1486 @@ +"============================================================================= +" zencoding.vim +" Author: Yasuhiro Matsumoto +" Last Change: 09-Apr-2013. + +let s:save_cpo = &cpo +set cpo&vim + +function! zencoding#getExpandos(type, key) + let expandos = zencoding#getResource(a:type, 'expandos', {}) + if has_key(expandos, a:key) + return expandos[a:key] + endif + return a:key +endfunction + +function! zencoding#splitFilterArg(filters) + for f in a:filters + if f =~ '^/' + return f[1:] + endif + endfor + return '' +endfunction + +function! zencoding#useFilter(filters, filter) + for f in a:filters + if a:filter == '/' && f =~ '^/' + return 1 + elseif f == a:filter + return 1 + endif + endfor + return 0 +endfunction + +function! zencoding#getIndentation(...) + if a:0 > 0 + let type = a:1 + else + let type = zencoding#getFileType() + endif + if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'indentation') + let indent = s:zen_settings[type].indentation + elseif has_key(s:zen_settings, 'indentation') + let indent = s:zen_settings.indentation + else + let indent = (&l:expandtab || &l:tabstop != &l:shiftwidth) ? repeat(' ', &l:shiftwidth) : "\t" + endif + return indent +endfunction + +function! zencoding#getBaseType(type) + if !has_key(s:zen_settings, a:type) + return '' + endif + if !has_key(s:zen_settings[a:type], 'extends') + return a:type + endif + let extends = s:zen_settings[a:type].extends + if type(extends) == 1 + let tmp = split(extends, '\s*,\s*') + let ext = tmp[0] + else + let ext = extends[0] + endif + if a:type != ext + return zencoding#getBaseType(ext) + endif + return '' +endfunction + +function! zencoding#isExtends(type, extend) + if a:type == a:extend + return 1 + endif + if !has_key(s:zen_settings, a:type) + return 0 + endif + if !has_key(s:zen_settings[a:type], 'extends') + return 0 + endif + let extends = s:zen_settings[a:type].extends + if type(extends) == 1 + let tmp = split(extends, '\s*,\s*') + unlet! extends + let extends = tmp + endif + for ext in extends + if a:extend == ext + return 1 + endif + endfor + return 0 +endfunction + +function! zencoding#parseIntoTree(abbr, type) + let abbr = a:abbr + let type = a:type + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#parseIntoTree(abbr, type) +endfunction + +function! s:mergeConfig(lhs, rhs) + if type(a:lhs) == 3 && type(a:rhs) == 3 + let a:lhs += a:rhs + if len(a:lhs) + call remove(a:lhs, 0, len(a:lhs)-1) + endif + for rhi in a:rhs + call add(a:lhs, a:rhs[rhi]) + endfor + elseif type(a:lhs) == 4 && type(a:rhs) == 4 + for key in keys(a:rhs) + if type(a:rhs[key]) == 3 + if !has_key(a:lhs, key) + let a:lhs[key] = [] + endif + let a:lhs[key] += a:rhs[key] + elseif type(a:rhs[key]) == 4 + if has_key(a:lhs, key) + call s:mergeConfig(a:lhs[key], a:rhs[key]) + else + let a:lhs[key] = a:rhs[key] + endif + else + let a:lhs[key] = a:rhs[key] + endif + endfor + endif +endfunction + +function! zencoding#toString(...) + let current = a:1 + if a:0 > 1 + let type = a:2 + else + let type = &ft + endif + if len(type) == 0 | let type = 'html' | endif + if a:0 > 2 + let inline = a:3 + else + let inline = 0 + endif + if a:0 > 3 + if type(a:4) == 1 + let filters = split(a:4, '\s*,\s*') + else + let filters = a:4 + endif + else + let filters = ['html'] + endif + if a:0 > 4 + let group_itemno = a:5 + else + let group_itemno = 0 + endif + + let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1) + let indent = zencoding#getIndentation(type) + let itemno = 0 + let str = '' + let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1) + let rtype = zencoding#lang#exists(type) ? type : 'html' + while itemno < current.multiplier + if len(current.name) + if group_itemno != 0 + let inner = zencoding#lang#{rtype}#toString(s:zen_settings, current, type, inline, filters, group_itemno, indent) + else + let inner = zencoding#lang#{rtype}#toString(s:zen_settings, current, type, inline, filters, itemno, indent) + endif + if current.multiplier > 1 + let inner = substitute(inner, '\$#', '$line'.(itemno+1).'$', 'g') + endif + let str .= inner + else + let snippet = current.snippet + if len(current.snippet) == 0 + let snippets = zencoding#getResource(type, 'snippets', {}) + if !empty(snippets) && has_key(snippets, 'zensnippet') + let snippet = snippets['zensnippet'] + endif + endif + if len(snippet) > 0 + let tmp = snippet + if use_pipe_for_cursor + let tmp = substitute(tmp, '|', '${cursor}', 'g') + endif + let tmp = substitute(tmp, '\${zenname}', current.name, 'g') + let snippet_node = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 0, 'parent': {}, 'value': '{'.tmp.'}', 'pos': 0, 'important': current.important } + let str = zencoding#lang#{rtype}#toString(s:zen_settings, snippet_node, type, inline, filters, group_itemno, indent) + else + if len(current.name) + let str .= current.name + endif + if len(current.value) + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\{$#}' + endif + if zencoding#useFilter(filters, '/') + let spl = zencoding#splitFilterArg(filters) + let fline = getline(a:firstline) + let query = substitute(query, '>\{0,1}{\$#}\s*$', '{\\$column\\$}*' . len(split(fline, spl)), '') + endif + let items = zencoding#parseIntoTree(query, type).child + for item in items + let expand .= zencoding#toString(item, type, 0, filters) + endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + let line = getline(a:firstline) + let part = substitute(line, '^\s*', '', '') + for n in range(a:firstline, a:lastline) + let lline = getline(n) + let lpart = substitute(lline, '^\s\+', '', '') + if zencoding#useFilter(filters, 't') + let lpart = substitute(lpart, '^[0-9.-]\+\s\+', '', '') + let lpart = substitute(lpart, '\s\+$', '', '') + endif + if zencoding#useFilter(filters, '/') + for column in split(lpart, spl) + let expand = substitute(expand, '\$column\$', '\=column', '') + endfor + else + let expand = substitute(expand, '\$line'.(n-a:firstline+1).'\$', '\=lpart', 'g') + endif + endfor + let expand = substitute(expand, '\$line\d*\$', '', 'g') + let expand = substitute(expand, '\$column\$', '', 'g') + let content = join(getline(a:firstline, a:lastline), "\n") + if stridx(expand, '$#') < len(expand)-2 + let expand = substitute(expand, '^\(.*\)\$#\s*$', '\1', '') + endif + let expand = substitute(expand, '\$#', '\=content', 'g') + else + let str = '' + if visualmode() ==# 'V' + let line = getline(a:firstline) + let part = substitute(line, '^\s*', '', '') + for n in range(a:firstline, a:lastline) + if len(leader) > 0 + let str .= getline(n) . "\n" + else + let lpart = substitute(getline(n), '^\s*', '', '') + let str .= lpart . "\n" + endif + endfor + let leader .= (str =~ "\n" ? ">{\n" : "{") . str . "}" + let items = zencoding#parseIntoTree(leader, type).child + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvygv + let str = @" + call setreg('"', save_regcont, save_regtype) + let items = zencoding#parseIntoTree(leader . "{".str."}", type).child + endif + for item in items + let expand .= zencoding#toString(item, type, 0, filters) + endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + endif + elseif a:mode == 4 + let line = getline('.') + let spaces = matchstr(line, '^\s*') + if line !~ '^\s*$' + put =spaces.a:abbr + else + call setline('.', spaces.a:abbr) + endif + normal! $ + call zencoding#expandAbbr(0, "") + return + else + let line = getline('.') + if col('.') < len(line) + let line = matchstr(line, '^\(.*\%'.col('.').'c.\)') + endif + if a:mode == 1 + let part = matchstr(line, '\([a-zA-Z0-9:_\-\@|]\+\)$') + else + let part = matchstr(line, '\(\S.*\)$') + let ftype = zencoding#lang#exists(type) ? type : 'html' + let part = zencoding#lang#{ftype}#findTokens(part) + endif + let rest = getline('.')[len(line):] + let str = part + let mx = '|\(\%(html\|haml\|slim\|e\|c\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$' + if str =~ mx + let filters = split(matchstr(str, mx)[1:], '\s*,\s*') + let str = substitute(str, mx, '', '') + endif + let items = zencoding#parseIntoTree(str, rtype).child + for item in items + let expand .= zencoding#toString(item, rtype, 0, filters) + endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + let expand = substitute(expand, '\$line\([0-9]\+\)\$', '\=submatch(1)', 'g') + endif + if len(expand) + if expand !~ '\${cursor}' + if a:mode == 2 | + let expand = '${cursor}' . expand + else + let expand .= '${cursor}' + endif + endif + let expand = substitute(expand, '${lang}', s:zen_settings.lang, 'g') + let expand = substitute(expand, '${charset}', s:zen_settings.charset, 'g') + if has_key(s:zen_settings, 'timezone') && len(s:zen_settings.timezone) + let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S") . s:zen_settings.timezone, 'g') + else + " TODO: on windows, %z/%Z is 'Tokyo(Standard)' + let expand = substitute(expand, '${datetime}', strftime("%Y-%m-%dT%H:%M:%S %z"), 'g') + endif + if a:mode == 2 && visualmode() ==# 'v' + if a:firstline == a:lastline + let expand = substitute(expand, '\n\s*', '', 'g') + else + let expand = substitute(expand, '\n$', '', 'g') + endif + let expand = substitute(expand, '\${cursor}', '$cursor$', '') + let expand = substitute(expand, '\${cursor}', '', 'g') + silent! normal! gv + let col = col("'<") + silent! normal! c + let line = getline('.') + let lhs = matchstr(line, '.*\%<'.col.'c.') + let rhs = matchstr(line, '\%>'.(col-1).'c.*') + let expand = lhs.expand.rhs + let lines = split(expand, '\n') + call setline(line('.'), lines[0]) + if len(lines) > 1 + call append(line('.'), lines[1:]) + endif + else + let expand = substitute(expand, '\${cursor}', '$cursor$', '') + let expand = substitute(expand, '\${cursor}', '', 'g') + if line[:-len(part)-1] =~ '^\s\+$' + let indent = line[:-len(part)-1] + else + let indent = '' + endif + let expand = substitute(expand, '\n\s*$', '', 'g') + let expand = line[:-len(part)-1] . substitute(expand, "\n", "\n" . indent, 'g') . rest + let lines = split(expand, '\n') + if a:mode == 2 + silent! exe "normal! gvc" + endif + call setline(line('.'), lines[0]) + if len(lines) > 1 + call append(line('.'), lines[1:]) + endif + endif + endif + if search('\$cursor\$', 'e') + let oldselection = &selection + let &selection = 'inclusive' + silent! foldopen + silent! exe "normal! v7h\"_s" + let &selection = oldselection + endif + if g:zencoding_debug > 1 + call getchar() + endif +endfunction + +function! zencoding#moveNextPrev(flag) + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#moveNextPrev(a:flag) +endfunction + +function! zencoding#imageSize() + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#imageSize() +endfunction + +function! zencoding#encodeImage() + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#encodeImage() +endfunction + +function! zencoding#toggleComment() + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#toggleComment() +endfunction + +function! zencoding#balanceTag(flag) range + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#balanceTag(a:flag) +endfunction + +function! zencoding#splitJoinTag() + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#splitJoinTag() +endfunction + +function! zencoding#mergeLines() range + let lines = join(map(getline(a:firstline, a:lastline), 'matchstr(v:val, "^\\s*\\zs.*\\ze\\s*$")'), '') + let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '') + silent! exe "normal! gvc" + call setline('.', indent . lines) +endfunction + +function! zencoding#removeTag() + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + return zencoding#lang#{rtype}#removeTag() +endfunction + +function! zencoding#anchorizeURL(flag) + let mx = 'https\=:\/\/[-!#$%&*+,./:;=?@0-9a-zA-Z_~]\+' + let pos1 = searchpos(mx, 'bcnW') + let url = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let block = [pos1, [pos1[0], pos1[1] + len(url) - 1]] + if !zencoding#util#cursorInRegion(block) + return + endif + + let mx = '.*]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*' + let content = zencoding#util#getContentFromURL(url) + let content = substitute(content, '\r', '', 'g') + let content = substitute(content, '[ \n]\+', ' ', 'g') + let content = substitute(content, '', '', 'g') + let title = matchstr(content, mx) + + let type = zencoding#getFileType() + let rtype = zencoding#lang#exists(type) ? type : 'html' + if a:flag == 0 + let a = zencoding#lang#html#parseTag('') + let a.attr.href = url + let a.value = '{' . title . '}' + let expand = zencoding#toString(a, rtype, 0, []) + let expand = substitute(expand, '\${cursor}', '', 'g') + else + let body = zencoding#util#getTextFromHTML(content) + let body = '{' . substitute(body, '^\(.\{0,100}\).*', '\1', '') . '...}' + + let blockquote = zencoding#lang#html#parseTag('
    ') + let a = zencoding#lang#html#parseTag('') + let a.attr.href = url + let a.value = '{' . title . '}' + call add(blockquote.child, a) + call add(blockquote.child, zencoding#lang#html#parseTag('
    ')) + let p = zencoding#lang#html#parseTag('

    ') + let p.value = body + call add(blockquote.child, p) + let cite = zencoding#lang#html#parseTag('') + let cite.value = '{' . url . '}' + call add(blockquote.child, cite) + let expand = zencoding#toString(blockquote, rtype, 0, []) + let expand = substitute(expand, '\${cursor}', '', 'g') + endif + let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '') + let expand = substitute(expand, "\n", "\n" . indent, 'g') + call zencoding#util#setContent(block, expand) +endfunction + +function! zencoding#codePretty() range + let type = input('FileType: ', &ft, 'filetype') + if len(type) == 0 + return + endif + let block = zencoding#util#getVisualBlock() + let content = zencoding#util#getContent(block) + silent! 1new + let &l:filetype = type + call setline(1, split(content, "\n")) + let old_lazyredraw = &lazyredraw + set lazyredraw + silent! TOhtml + let &lazyredraw = old_lazyredraw + let content = join(getline(1, '$'), "\n") + silent! bw! + silent! bw! + let content = matchstr(content, ']*>[\s\n]*\zs.*\ze') + call zencoding#util#setContent(block, content) +endfunction + +function! zencoding#ExpandWord(abbr, type, orig) + let mx = '|\(\%(html\|haml\|slim\|e\|c\|fc\|xsl\|t\|\/[^ ]\+\)\s*,\{0,1}\s*\)*$' + let str = a:abbr + let type = a:type + + if len(type) == 0 | let type = 'html' | endif + if str =~ mx + let filters = split(matchstr(str, mx)[1:], '\s*,\s*') + let str = substitute(str, mx, '', '') + elseif has_key(s:zen_settings[a:type], 'filters') + let filters = split(s:zen_settings[a:type].filters, '\s*,\s*') + else + let filters = ['html'] + endif + let items = zencoding#parseIntoTree(str, a:type).child + let expand = '' + for item in items + let expand .= zencoding#toString(item, a:type, 0, filters) + endfor + if zencoding#useFilter(filters, 'e') + let expand = substitute(expand, '&', '\&', 'g') + let expand = substitute(expand, '<', '\<', 'g') + let expand = substitute(expand, '>', '\>', 'g') + endif + if a:orig == 0 + let expand = substitute(expand, '\${lang}', s:zen_settings.lang, 'g') + let expand = substitute(expand, '\${charset}', s:zen_settings.charset, 'g') + let expand = substitute(expand, '\${cursor}', '', 'g') + endif + return expand +endfunction + +function! zencoding#getSnippets(type) + let type = a:type + if len(type) == 0 || !has_key(s:zen_settings, type) + let type = 'html' + endif + return zencoding#getResource(type, 'snippets', {}) +endfunction + +function! zencoding#CompleteTag(findstart, base) + if a:findstart + let line = getline('.') + let start = col('.') - 1 + while start > 0 && line[start - 1] =~ '[a-zA-Z0-9:_\@\-]' + let start -= 1 + endwhile + return start + else + let type = zencoding#getFileType() + let res = [] + + let snippets = zencoding#getResource(type, 'snippets', {}) + for item in keys(snippets) + if stridx(item, a:base) != -1 + call add(res, substitute(item, '\${cursor}\||', '', 'g')) + endif + endfor + let aliases = zencoding#getResource(type, 'aliases', {}) + for item in values(aliases) + if stridx(item, a:base) != -1 + call add(res, substitute(item, '\${cursor}\||', '', 'g')) + endif + endfor + return res + endif +endfunction + +unlet! s:zen_settings +let s:zen_settings = { +\ 'lang': "en", +\ 'charset': "UTF-8", +\ 'css': { +\ 'snippets': { +\ '@i': '@import url(|);', +\ '@m': "@media print {\n\t|\n}", +\ '@f': "@font-face {\n\tfont-family:|;\n\tsrc:url(|);\n}", +\ '!': '!important', +\ 'pos': 'position:|;', +\ 'pos:s': 'position:static;', +\ 'pos:a': 'position:absolute;', +\ 'pos:r': 'position:relative;', +\ 'pos:f': 'position:fixed;', +\ 't': 'top:|;', +\ 't:a': 'top:auto;', +\ 'r': 'right:|;', +\ 'r:a': 'right:auto;', +\ 'b': 'bottom:|;', +\ 'b:a': 'bottom:auto;', +\ 'l': 'left:|;', +\ 'l:a': 'left:auto;', +\ 'z': 'z-index:|;', +\ 'z:a': 'z-index:auto;', +\ 'fl': 'float:|;', +\ 'fl:n': 'float:none;', +\ 'fl:l': 'float:left;', +\ 'fl:r': 'float:right;', +\ 'cl': 'clear:|;', +\ 'cl:n': 'clear:none;', +\ 'cl:l': 'clear:left;', +\ 'cl:r': 'clear:right;', +\ 'cl:b': 'clear:both;', +\ 'd': 'display:|;', +\ 'd:n': 'display:none;', +\ 'd:b': 'display:block;', +\ 'd:i': 'display:inline;', +\ 'd:ib': 'display:inline-block;', +\ 'd:li': 'display:list-item;', +\ 'd:ri': 'display:run-in;', +\ 'd:cp': 'display:compact;', +\ 'd:tb': 'display:table;', +\ 'd:itb': 'display:inline-table;', +\ 'd:tbcp': 'display:table-caption;', +\ 'd:tbcl': 'display:table-column;', +\ 'd:tbclg': 'display:table-column-group;', +\ 'd:tbhg': 'display:table-header-group;', +\ 'd:tbfg': 'display:table-footer-group;', +\ 'd:tbr': 'display:table-row;', +\ 'd:tbrg': 'display:table-row-group;', +\ 'd:tbc': 'display:table-cell;', +\ 'd:rb': 'display:ruby;', +\ 'd:rbb': 'display:ruby-base;', +\ 'd:rbbg': 'display:ruby-base-group;', +\ 'd:rbt': 'display:ruby-text;', +\ 'd:rbtg': 'display:ruby-text-group;', +\ 'v': 'visibility:|;', +\ 'v:v': 'visibility:visible;', +\ 'v:h': 'visibility:hidden;', +\ 'v:c': 'visibility:collapse;', +\ 'ov': 'overflow:|;', +\ 'ov:v': 'overflow:visible;', +\ 'ov:h': 'overflow:hidden;', +\ 'ov:s': 'overflow:scroll;', +\ 'ov:a': 'overflow:auto;', +\ 'ovx': 'overflow-x:|;', +\ 'ovx:v': 'overflow-x:visible;', +\ 'ovx:h': 'overflow-x:hidden;', +\ 'ovx:s': 'overflow-x:scroll;', +\ 'ovx:a': 'overflow-x:auto;', +\ 'ovy': 'overflow-y:|;', +\ 'ovy:v': 'overflow-y:visible;', +\ 'ovy:h': 'overflow-y:hidden;', +\ 'ovy:s': 'overflow-y:scroll;', +\ 'ovy:a': 'overflow-y:auto;', +\ 'ovs': 'overflow-style:|;', +\ 'ovs:a': 'overflow-style:auto;', +\ 'ovs:s': 'overflow-style:scrollbar;', +\ 'ovs:p': 'overflow-style:panner;', +\ 'ovs:m': 'overflow-style:move;', +\ 'ovs:mq': 'overflow-style:marquee;', +\ 'zoo': 'zoom:1;', +\ 'cp': 'clip:|;', +\ 'cp:a': 'clip:auto;', +\ 'cp:r': 'clip:rect(|);', +\ 'bxz': 'box-sizing:|;', +\ 'bxz:cb': 'box-sizing:content-box;', +\ 'bxz:bb': 'box-sizing:border-box;', +\ 'bxsh': 'box-shadow:|;', +\ 'bxsh:n': 'box-shadow:none;', +\ 'bxsh:w': '-webkit-box-shadow:0 0 0 #000;', +\ 'bxsh:m': '-moz-box-shadow:0 0 0 0 #000;', +\ 'm': 'margin:|;', +\ 'm:a': 'margin:auto;', +\ 'm:0': 'margin:0;', +\ 'm:2': 'margin:0 0;', +\ 'm:3': 'margin:0 0 0;', +\ 'm:4': 'margin:0 0 0 0;', +\ 'mt': 'margin-top:|;', +\ 'mt:a': 'margin-top:auto;', +\ 'mr': 'margin-right:|;', +\ 'mr:a': 'margin-right:auto;', +\ 'mb': 'margin-bottom:|;', +\ 'mb:a': 'margin-bottom:auto;', +\ 'ml': 'margin-left:|;', +\ 'ml:a': 'margin-left:auto;', +\ 'p': 'padding:|;', +\ 'p:0': 'padding:0;', +\ 'p:2': 'padding:0 0;', +\ 'p:3': 'padding:0 0 0;', +\ 'p:4': 'padding:0 0 0 0;', +\ 'pt': 'padding-top:|;', +\ 'pr': 'padding-right:|;', +\ 'pb': 'padding-bottom:|;', +\ 'pl': 'padding-left:|;', +\ 'w': 'width:|;', +\ 'w:a': 'width:auto;', +\ 'h': 'height:|;', +\ 'h:a': 'height:auto;', +\ 'maw': 'max-width:|;', +\ 'maw:n': 'max-width:none;', +\ 'mah': 'max-height:|;', +\ 'mah:n': 'max-height:none;', +\ 'miw': 'min-width:|;', +\ 'mih': 'min-height:|;', +\ 'o': 'outline:|;', +\ 'o:n': 'outline:none;', +\ 'oo': 'outline-offset:|;', +\ 'ow': 'outline-width:|;', +\ 'os': 'outline-style:|;', +\ 'oc': 'outline-color:#000;', +\ 'oc:i': 'outline-color:invert;', +\ 'bd': 'border:|;', +\ 'bd+': 'border:1px solid #000;', +\ 'bd:n': 'border:none;', +\ 'bdbk': 'border-break:|;', +\ 'bdbk:c': 'border-break:close;', +\ 'bdcl': 'border-collapse:|;', +\ 'bdcl:c': 'border-collapse:collapse;', +\ 'bdcl:s': 'border-collapse:separate;', +\ 'bdc': 'border-color:#000;', +\ 'bdi': 'border-image:url(|);', +\ 'bdi:n': 'border-image:none;', +\ 'bdi:w': '-webkit-border-image:url(|) 0 0 0 0 stretch stretch;', +\ 'bdi:m': '-moz-border-image:url(|) 0 0 0 0 stretch stretch;', +\ 'bdti': 'border-top-image:url(|);', +\ 'bdti:n': 'border-top-image:none;', +\ 'bdri': 'border-right-image:url(|);', +\ 'bdri:n': 'border-right-image:none;', +\ 'bdbi': 'border-bottom-image:url(|);', +\ 'bdbi:n': 'border-bottom-image:none;', +\ 'bdli': 'border-left-image:url(|);', +\ 'bdli:n': 'border-left-image:none;', +\ 'bdci': 'border-corner-image:url(|);', +\ 'bdci:n': 'border-corner-image:none;', +\ 'bdci:c': 'border-corner-image:continue;', +\ 'bdtli': 'border-top-left-image:url(|);', +\ 'bdtli:n': 'border-top-left-image:none;', +\ 'bdtli:c': 'border-top-left-image:continue;', +\ 'bdtri': 'border-top-right-image:url(|);', +\ 'bdtri:n': 'border-top-right-image:none;', +\ 'bdtri:c': 'border-top-right-image:continue;', +\ 'bdbri': 'border-bottom-right-image:url(|);', +\ 'bdbri:n': 'border-bottom-right-image:none;', +\ 'bdbri:c': 'border-bottom-right-image:continue;', +\ 'bdbli': 'border-bottom-left-image:url(|);', +\ 'bdbli:n': 'border-bottom-left-image:none;', +\ 'bdbli:c': 'border-bottom-left-image:continue;', +\ 'bdf': 'border-fit:|;', +\ 'bdf:c': 'border-fit:clip;', +\ 'bdf:r': 'border-fit:repeat;', +\ 'bdf:sc': 'border-fit:scale;', +\ 'bdf:st': 'border-fit:stretch;', +\ 'bdf:ow': 'border-fit:overwrite;', +\ 'bdf:of': 'border-fit:overflow;', +\ 'bdf:sp': 'border-fit:space;', +\ 'bdl': 'border-left:|;', +\ 'bdl:a': 'border-length:auto;', +\ 'bdsp': 'border-spacing:|;', +\ 'bds': 'border-style:|;', +\ 'bds:n': 'border-style:none;', +\ 'bds:h': 'border-style:hidden;', +\ 'bds:dt': 'border-style:dotted;', +\ 'bds:ds': 'border-style:dashed;', +\ 'bds:s': 'border-style:solid;', +\ 'bds:db': 'border-style:double;', +\ 'bds:dtds': 'border-style:dot-dash;', +\ 'bds:dtdtds': 'border-style:dot-dot-dash;', +\ 'bds:w': 'border-style:wave;', +\ 'bds:g': 'border-style:groove;', +\ 'bds:r': 'border-style:ridge;', +\ 'bds:i': 'border-style:inset;', +\ 'bds:o': 'border-style:outset;', +\ 'bdw': 'border-width:|;', +\ 'bdt': 'border-top:|;', +\ 'bdt+': 'border-top:1px solid #000;', +\ 'bdt:n': 'border-top:none;', +\ 'bdtw': 'border-top-width:|;', +\ 'bdts': 'border-top-style:|;', +\ 'bdts:n': 'border-top-style:none;', +\ 'bdtc': 'border-top-color:#000;', +\ 'bdr': 'border-right:|;', +\ 'bdr+': 'border-right:1px solid #000;', +\ 'bdr:n': 'border-right:none;', +\ 'bdrw': 'border-right-width:|;', +\ 'bdrt': 'border-right-style:|;', +\ 'bdrs:n': 'border-right-style:none;', +\ 'bdrc': 'border-right-color:#000;', +\ 'bdb': 'border-bottom:|;', +\ 'bdb+': 'border-bottom:1px solid #000;', +\ 'bdb:n': 'border-bottom:none;', +\ 'bdbw': 'border-bottom-width:|;', +\ 'bdbs': 'border-bottom-style:|;', +\ 'bdbs:n': 'border-bottom-style:none;', +\ 'bdbc': 'border-bottom-color:#000;', +\ 'bdln': 'border-length:|;', +\ 'bdl+': 'border-left:1px solid #000;', +\ 'bdl:n': 'border-left:none;', +\ 'bdlw': 'border-left-width:|;', +\ 'bdls': 'border-left-style:|;', +\ 'bdls:n': 'border-left-style:none;', +\ 'bdlc': 'border-left-color:#000;', +\ 'bdrs': 'border-radius:|;', +\ 'bdtrrz': 'border-top-right-radius:|;', +\ 'bdtlrz': 'border-top-left-radius:|;', +\ 'bdbrrz': 'border-bottom-right-radius:|;', +\ 'bdblrz': 'border-bottom-left-radius:|;', +\ 'bdrz:w': '-webkit-border-radius:|;', +\ 'bdrz:m': '-moz-border-radius:|;', +\ 'bg': 'background:|;', +\ 'bg+': 'background:#FFF url(|) 0 0 no-repeat;', +\ 'bg:n': 'background:none;', +\ 'bg:ie': 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=''|x.png'');', +\ 'bgc': 'background-color:#FFF;', +\ 'bgi': 'background-image:url(|);', +\ 'bgi:n': 'background-image:none;', +\ 'bgr': 'background-repeat:|;', +\ 'bgr:n': 'background-repeat:no-repeat;', +\ 'bgr:x': 'background-repeat:repeat-x;', +\ 'bgr:y': 'background-repeat:repeat-y;', +\ 'bga': 'background-attachment:|;', +\ 'bga:f': 'background-attachment:fixed;', +\ 'bga:s': 'background-attachment:scroll;', +\ 'bgp': 'background-position:0 0;', +\ 'bgpx': 'background-position-x:|;', +\ 'bgpy': 'background-position-y:|;', +\ 'bgbk': 'background-break:|;', +\ 'bgbk:bb': 'background-break:bounding-box;', +\ 'bgbk:eb': 'background-break:each-box;', +\ 'bgbk:c': 'background-break:continuous;', +\ 'bgcp': 'background-clip:|;', +\ 'bgcp:bb': 'background-clip:border-box;', +\ 'bgcp:pb': 'background-clip:padding-box;', +\ 'bgcp:cb': 'background-clip:content-box;', +\ 'bgcp:nc': 'background-clip:no-clip;', +\ 'bgo': 'background-origin:|;', +\ 'bgo:pb': 'background-origin:padding-box;', +\ 'bgo:bb': 'background-origin:border-box;', +\ 'bgo:cb': 'background-origin:content-box;', +\ 'bgz': 'background-size:|;', +\ 'bgz:a': 'background-size:auto;', +\ 'bgz:ct': 'background-size:contain;', +\ 'bgz:cv': 'background-size:cover;', +\ 'c': 'color:#000;', +\ 'tbl': 'table-layout:|;', +\ 'tbl:a': 'table-layout:auto;', +\ 'tbl:f': 'table-layout:fixed;', +\ 'cps': 'caption-side:|;', +\ 'cps:t': 'caption-side:top;', +\ 'cps:b': 'caption-side:bottom;', +\ 'ec': 'empty-cells:|;', +\ 'ec:s': 'empty-cells:show;', +\ 'ec:h': 'empty-cells:hide;', +\ 'lis': 'list-style:|;', +\ 'lis:n': 'list-style:none;', +\ 'lisp': 'list-style-position:|;', +\ 'lisp:i': 'list-style-position:inside;', +\ 'lisp:o': 'list-style-position:outside;', +\ 'list': 'list-style-type:|;', +\ 'list:n': 'list-style-type:none;', +\ 'list:d': 'list-style-type:disc;', +\ 'list:c': 'list-style-type:circle;', +\ 'list:s': 'list-style-type:square;', +\ 'list:dc': 'list-style-type:decimal;', +\ 'list:dclz': 'list-style-type:decimal-leading-zero;', +\ 'list:lr': 'list-style-type:lower-roman;', +\ 'list:ur': 'list-style-type:upper-roman;', +\ 'lisi': 'list-style-image:|;', +\ 'lisi:n': 'list-style-image:none;', +\ 'q': 'quotes:|;', +\ 'q:n': 'quotes:none;', +\ 'q:ru': 'quotes:''\00AB'' ''\00BB'' ''\201E'' ''\201C'';', +\ 'q:en': 'quotes:''\201C'' ''\201D'' ''\2018'' ''\2019'';', +\ 'ct': 'content:|;', +\ 'ct:n': 'content:normal;', +\ 'ct:oq': 'content:open-quote;', +\ 'ct:noq': 'content:no-open-quote;', +\ 'ct:cq': 'content:close-quote;', +\ 'ct:ncq': 'content:no-close-quote;', +\ 'ct:a': 'content:attr(|);', +\ 'ct:c': 'content:counter(|);', +\ 'ct:cs': 'content:counters(|);', +\ 'coi': 'counter-increment:|;', +\ 'cor': 'counter-reset:|;', +\ 'va': 'vertical-align:|;', +\ 'va:sup': 'vertical-align:super;', +\ 'va:t': 'vertical-align:top;', +\ 'va:tt': 'vertical-align:text-top;', +\ 'va:m': 'vertical-align:middle;', +\ 'va:bl': 'vertical-align:baseline;', +\ 'va:b': 'vertical-align:bottom;', +\ 'va:tb': 'vertical-align:text-bottom;', +\ 'va:sub': 'vertical-align:sub;', +\ 'ta': 'text-align:|;', +\ 'ta:l': 'text-align:left;', +\ 'ta:c': 'text-align:center;', +\ 'ta:r': 'text-align:right;', +\ 'tal': 'text-align-last:|;', +\ 'tal:a': 'text-align-last:auto;', +\ 'tal:l': 'text-align-last:left;', +\ 'tal:c': 'text-align-last:center;', +\ 'tal:r': 'text-align-last:right;', +\ 'td': 'text-decoration:|;', +\ 'td:n': 'text-decoration:none;', +\ 'td:u': 'text-decoration:underline;', +\ 'td:o': 'text-decoration:overline;', +\ 'td:l': 'text-decoration:line-through;', +\ 'te': 'text-emphasis:|;', +\ 'te:n': 'text-emphasis:none;', +\ 'te:ac': 'text-emphasis:accent;', +\ 'te:dt': 'text-emphasis:dot;', +\ 'te:c': 'text-emphasis:circle;', +\ 'te:ds': 'text-emphasis:disc;', +\ 'te:b': 'text-emphasis:before;', +\ 'te:a': 'text-emphasis:after;', +\ 'th': 'text-height:|;', +\ 'th:a': 'text-height:auto;', +\ 'th:f': 'text-height:font-size;', +\ 'th:t': 'text-height:text-size;', +\ 'th:m': 'text-height:max-size;', +\ 'ti': 'text-indent:|;', +\ 'ti:-': 'text-indent:-9999px;', +\ 'tj': 'text-justify:|;', +\ 'tj:a': 'text-justify:auto;', +\ 'tj:iw': 'text-justify:inter-word;', +\ 'tj:ii': 'text-justify:inter-ideograph;', +\ 'tj:ic': 'text-justify:inter-cluster;', +\ 'tj:d': 'text-justify:distribute;', +\ 'tj:k': 'text-justify:kashida;', +\ 'tj:t': 'text-justify:tibetan;', +\ 'to': 'text-outline:|;', +\ 'to+': 'text-outline:0 0 #000;', +\ 'to:n': 'text-outline:none;', +\ 'tr': 'text-replace:|;', +\ 'tr:n': 'text-replace:none;', +\ 'tt': 'text-transform:|;', +\ 'tt:n': 'text-transform:none;', +\ 'tt:c': 'text-transform:capitalize;', +\ 'tt:u': 'text-transform:uppercase;', +\ 'tt:l': 'text-transform:lowercase;', +\ 'tw': 'text-wrap:|;', +\ 'tw:n': 'text-wrap:normal;', +\ 'tw:no': 'text-wrap:none;', +\ 'tw:u': 'text-wrap:unrestricted;', +\ 'tw:s': 'text-wrap:suppress;', +\ 'tsh': 'text-shadow:|;', +\ 'tsh+': 'text-shadow:0 0 0 #000;', +\ 'tsh:n': 'text-shadow:none;', +\ 'lh': 'line-height:|;', +\ 'whs': 'white-space:|;', +\ 'whs:n': 'white-space:normal;', +\ 'whs:p': 'white-space:pre;', +\ 'whs:nw': 'white-space:nowrap;', +\ 'whs:pw': 'white-space:pre-wrap;', +\ 'whs:pl': 'white-space:pre-line;', +\ 'whsc': 'white-space-collapse:|;', +\ 'whsc:n': 'white-space-collapse:normal;', +\ 'whsc:k': 'white-space-collapse:keep-all;', +\ 'whsc:l': 'white-space-collapse:loose;', +\ 'whsc:bs': 'white-space-collapse:break-strict;', +\ 'whsc:ba': 'white-space-collapse:break-all;', +\ 'wob': 'word-break:|;', +\ 'wob:n': 'word-break:normal;', +\ 'wob:k': 'word-break:keep-all;', +\ 'wob:l': 'word-break:loose;', +\ 'wob:bs': 'word-break:break-strict;', +\ 'wob:ba': 'word-break:break-all;', +\ 'wos': 'word-spacing:|;', +\ 'wow': 'word-wrap:|;', +\ 'wow:nm': 'word-wrap:normal;', +\ 'wow:n': 'word-wrap:none;', +\ 'wow:u': 'word-wrap:unrestricted;', +\ 'wow:s': 'word-wrap:suppress;', +\ 'lts': 'letter-spacing:|;', +\ 'f': 'font:|;', +\ 'f+': 'font:1em Arial,sans-serif;', +\ 'fw': 'font-weight:|;', +\ 'fw:n': 'font-weight:normal;', +\ 'fw:b': 'font-weight:bold;', +\ 'fw:br': 'font-weight:bolder;', +\ 'fw:lr': 'font-weight:lighter;', +\ 'fs': 'font-style:|;', +\ 'fs:n': 'font-style:normal;', +\ 'fs:i': 'font-style:italic;', +\ 'fs:o': 'font-style:oblique;', +\ 'fv': 'font-variant:|;', +\ 'fv:n': 'font-variant:normal;', +\ 'fv:sc': 'font-variant:small-caps;', +\ 'fz': 'font-size:|;', +\ 'fza': 'font-size-adjust:|;', +\ 'fza:n': 'font-size-adjust:none;', +\ 'ff': 'font-family:|;', +\ 'ff:s': 'font-family:serif;', +\ 'ff:ss': 'font-family:sans-serif;', +\ 'ff:c': 'font-family:cursive;', +\ 'ff:f': 'font-family:fantasy;', +\ 'ff:m': 'font-family:monospace;', +\ 'fef': 'font-effect:|;', +\ 'fef:n': 'font-effect:none;', +\ 'fef:eg': 'font-effect:engrave;', +\ 'fef:eb': 'font-effect:emboss;', +\ 'fef:o': 'font-effect:outline;', +\ 'fem': 'font-emphasize:|;', +\ 'femp': 'font-emphasize-position:|;', +\ 'femp:b': 'font-emphasize-position:before;', +\ 'femp:a': 'font-emphasize-position:after;', +\ 'fems': 'font-emphasize-style:|;', +\ 'fems:n': 'font-emphasize-style:none;', +\ 'fems:ac': 'font-emphasize-style:accent;', +\ 'fems:dt': 'font-emphasize-style:dot;', +\ 'fems:c': 'font-emphasize-style:circle;', +\ 'fems:ds': 'font-emphasize-style:disc;', +\ 'fsm': 'font-smooth:|;', +\ 'fsm:a': 'font-smooth:auto;', +\ 'fsm:n': 'font-smooth:never;', +\ 'fsm:aw': 'font-smooth:always;', +\ 'fst': 'font-stretch:|;', +\ 'fst:n': 'font-stretch:normal;', +\ 'fst:uc': 'font-stretch:ultra-condensed;', +\ 'fst:ec': 'font-stretch:extra-condensed;', +\ 'fst:c': 'font-stretch:condensed;', +\ 'fst:sc': 'font-stretch:semi-condensed;', +\ 'fst:se': 'font-stretch:semi-expanded;', +\ 'fst:e': 'font-stretch:expanded;', +\ 'fst:ee': 'font-stretch:extra-expanded;', +\ 'fst:ue': 'font-stretch:ultra-expanded;', +\ 'op': 'opacity:|;', +\ 'op:ie': 'filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);', +\ 'op:ms': '-ms-filter:''progid:DXImageTransform.Microsoft.Alpha(Opacity=100)'';', +\ 'rz': 'resize:|;', +\ 'rz:n': 'resize:none;', +\ 'rz:b': 'resize:both;', +\ 'rz:h': 'resize:horizontal;', +\ 'rz:v': 'resize:vertical;', +\ 'cur': 'cursor:|;', +\ 'cur:a': 'cursor:auto;', +\ 'cur:d': 'cursor:default;', +\ 'cur:c': 'cursor:crosshair;', +\ 'cur:ha': 'cursor:hand;', +\ 'cur:he': 'cursor:help;', +\ 'cur:m': 'cursor:move;', +\ 'cur:p': 'cursor:pointer;', +\ 'cur:t': 'cursor:text;', +\ 'pgbb': 'page-break-before:|;', +\ 'pgbb:au': 'page-break-before:auto;', +\ 'pgbb:al': 'page-break-before:always;', +\ 'pgbb:l': 'page-break-before:left;', +\ 'pgbb:r': 'page-break-before:right;', +\ 'pgbi': 'page-break-inside:|;', +\ 'pgbi:au': 'page-break-inside:auto;', +\ 'pgbi:av': 'page-break-inside:avoid;', +\ 'pgba': 'page-break-after:|;', +\ 'pgba:au': 'page-break-after:auto;', +\ 'pgba:al': 'page-break-after:always;', +\ 'pgba:l': 'page-break-after:left;', +\ 'pgba:r': 'page-break-after:right;', +\ 'orp': 'orphans:|;', +\ 'wid': 'widows:|;' +\ }, +\ 'filters': 'fc' +\ }, +\ 'sass': { +\ 'extends': 'css', +\ 'snippets': { +\ '@if': "@if {\n\t|\n}", +\ '@e': "@else {\n\t|\n}", +\ '@in': "@include |", +\ '@ex': "@extend |", +\ '@mx': "@mixin {\n\t|\n}", +\ '@fn': "@function {\n\t|\n}", +\ '@r': "@return |", +\ }, +\ }, +\ 'scss': { +\ 'extends': 'css', +\ }, +\ 'less': { +\ 'extends': 'css', +\ }, +\ 'css.drupal': { +\ 'extends': 'css', +\ }, +\ 'html': { +\ 'snippets': { +\ 'cc:ie6': "", +\ 'cc:ie': "", +\ 'cc:noie': "\n\t${child}|\n", +\ 'html:4t': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:4s': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xt': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xs': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:xxs': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."", +\ 'html:5': "\n" +\ ."\n" +\ ."\n" +\ ."\t\n" +\ ."\t\n" +\ ."\n" +\ ."\n\t${child}|\n\n" +\ ."" +\ }, +\ 'default_attributes': { +\ 'a': {'href': ''}, +\ 'a:link': {'href': 'http://|'}, +\ 'a:mail': {'href': 'mailto:|'}, +\ 'abbr': {'title': ''}, +\ 'acronym': {'title': ''}, +\ 'base': {'href': ''}, +\ 'bdo': {'dir': ''}, +\ 'bdo:r': {'dir': 'rtl'}, +\ 'bdo:l': {'dir': 'ltr'}, +\ 'del': {'datetime': '${datetime}'}, +\ 'ins': {'datetime': '${datetime}'}, +\ 'link:css': [{'rel': 'stylesheet'}, {'type': 'text/css'}, {'href': '|style.css'}, {'media': 'all'}], +\ 'link:print': [{'rel': 'stylesheet'}, {'type': 'text/css'}, {'href': '|print.css'}, {'media': 'print'}], +\ 'link:favicon': [{'rel': 'shortcut icon'}, {'type': 'image/x-icon'}, {'href': '|favicon.ico'}], +\ 'link:touch': [{'rel': 'apple-touch-icon'}, {'href': '|favicon.png'}], +\ 'link:rss': [{'rel': 'alternate'}, {'type': 'application/rss+xml'}, {'title': 'RSS'}, {'href': '|rss.xml'}], +\ 'link:atom': [{'rel': 'alternate'}, {'type': 'application/atom+xml'}, {'title': 'Atom'}, {'href': 'atom.xml'}], +\ 'meta:utf': [{'http-equiv': 'Content-Type'}, {'content': 'text/html;charset=UTF-8'}], +\ 'meta:win': [{'http-equiv': 'Content-Type'}, {'content': 'text/html;charset=Win-1251'}], +\ 'meta:compat': [{'http-equiv': 'X-UA-Compatible'}, {'content': 'IE=7'}], +\ 'style': {'type': 'text/css'}, +\ 'script': {'type': 'text/javascript'}, +\ 'script:src': [{'type': 'text/javascript'}, {'src': ''}], +\ 'img': [{'src': ''}, {'alt': ''}], +\ 'iframe': [{'src': ''}, {'frameborder': '0'}], +\ 'embed': [{'src': ''}, {'type': ''}], +\ 'object': [{'data': ''}, {'type': ''}], +\ 'param': [{'name': ''}, {'value': ''}], +\ 'map': {'name': ''}, +\ 'area': [{'shape': ''}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:d': [{'shape': 'default'}, {'href': ''}, {'alt': ''}], +\ 'area:c': [{'shape': 'circle'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:r': [{'shape': 'rect'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'area:p': [{'shape': 'poly'}, {'coords': ''}, {'href': ''}, {'alt': ''}], +\ 'link': [{'rel': 'stylesheet'}, {'href': ''}], +\ 'form': {'action': ''}, +\ 'form:get': {'action': '', 'method': 'get'}, +\ 'form:post': {'action': '', 'method': 'post'}, +\ 'form:upload': {'action': '', 'method': 'post', 'enctype': 'multipart/form-data'}, +\ 'label': {'for': ''}, +\ 'input': {'type': ''}, +\ 'input:hidden': [{'type': 'hidden'}, {'name': ''}], +\ 'input:h': [{'type': 'hidden'}, {'name': ''}], +\ 'input:text': [{'type': 'text'}, {'name': ''}, {'id': ''}], +\ 'input:t': [{'type': 'text'}, {'name': ''}, {'id': ''}], +\ 'input:search': [{'type': 'search'}, {'name': ''}, {'id': ''}], +\ 'input:email': [{'type': 'email'}, {'name': ''}, {'id': ''}], +\ 'input:url': [{'type': 'url'}, {'name': ''}, {'id': ''}], +\ 'input:password': [{'type': 'password'}, {'name': ''}, {'id': ''}], +\ 'input:p': [{'type': 'password'}, {'name': ''}, {'id': ''}], +\ 'input:datetime': [{'type': 'datetime'}, {'name': ''}, {'id': ''}], +\ 'input:date': [{'type': 'date'}, {'name': ''}, {'id': ''}], +\ 'input:datetime-local': [{'type': 'datetime-local'}, {'name': ''}, {'id': ''}], +\ 'input:month': [{'type': 'month'}, {'name': ''}, {'id': ''}], +\ 'input:week': [{'type': 'week'}, {'name': ''}, {'id': ''}], +\ 'input:time': [{'type': 'time'}, {'name': ''}, {'id': ''}], +\ 'input:number': [{'type': 'number'}, {'name': ''}, {'id': ''}], +\ 'input:color': [{'type': 'color'}, {'name': ''}, {'id': ''}], +\ 'input:checkbox': [{'type': 'checkbox'}, {'name': ''}, {'id': ''}], +\ 'input:c': [{'type': 'checkbox'}, {'name': ''}, {'id': ''}], +\ 'input:radio': [{'type': 'radio'}, {'name': ''}, {'id': ''}], +\ 'input:r': [{'type': 'radio'}, {'name': ''}, {'id': ''}], +\ 'input:range': [{'type': 'range'}, {'name': ''}, {'id': ''}], +\ 'input:file': [{'type': 'file'}, {'name': ''}, {'id': ''}], +\ 'input:f': [{'type': 'file'}, {'name': ''}, {'id': ''}], +\ 'input:submit': [{'type': 'submit'}, {'value': ''}], +\ 'input:s': [{'type': 'submit'}, {'value': ''}], +\ 'input:image': [{'type': 'image'}, {'src': ''}, {'alt': ''}], +\ 'input:i': [{'type': 'image'}, {'src': ''}, {'alt': ''}], +\ 'input:reset': [{'type': 'reset'}, {'value': ''}], +\ 'input:button': [{'type': 'button'}, {'value': ''}], +\ 'input:b': [{'type': 'button'}, {'value': ''}], +\ 'select': [{'name': ''}, {'id': ''}], +\ 'option': {'value': ''}, +\ 'textarea': [{'name': ''}, {'id': ''}, {'cols': '30'}, {'rows': '10'}], +\ 'menu:context': {'type': 'context'}, +\ 'menu:c': {'type': 'context'}, +\ 'menu:toolbar': {'type': 'toolbar'}, +\ 'menu:t': {'type': 'toolbar'}, +\ 'video': {'src': ''}, +\ 'audio': {'src': ''}, +\ 'html:xml': [{'xmlns': 'http://www.w3.org/1999/xhtml'}, {'xml:lang': '${lang}'}] +\ }, +\ 'aliases': { +\ 'link:*': 'link', +\ 'meta:*': 'meta', +\ 'area:*': 'area', +\ 'bdo:*': 'bdo', +\ 'form:*': 'form', +\ 'input:*': 'input', +\ 'script:*': 'script', +\ 'html:*': 'html', +\ 'a:*': 'a', +\ 'menu:*': 'menu', +\ 'bq': 'blockquote', +\ 'acr': 'acronym', +\ 'fig': 'figure', +\ 'ifr': 'iframe', +\ 'emb': 'embed', +\ 'obj': 'object', +\ 'src': 'source', +\ 'cap': 'caption', +\ 'colg': 'colgroup', +\ 'fst': 'fieldset', +\ 'btn': 'button', +\ 'optg': 'optgroup', +\ 'opt': 'option', +\ 'tarea': 'textarea', +\ 'leg': 'legend', +\ 'sect': 'section', +\ 'art': 'article', +\ 'hdr': 'header', +\ 'ftr': 'footer', +\ 'adr': 'address', +\ 'dlg': 'dialog', +\ 'str': 'strong', +\ 'sty': 'style', +\ 'prog': 'progress', +\ 'fset': 'fieldset', +\ 'datag': 'datagrid', +\ 'datal': 'datalist', +\ 'kg': 'keygen', +\ 'out': 'output', +\ 'det': 'details', +\ 'cmd': 'command' +\ }, +\ 'expandos': { +\ 'ol': 'ol>li', +\ 'ul': 'ul>li', +\ 'dl': 'dl>dt+dd', +\ 'map': 'map>area', +\ 'table': 'table>tr>td', +\ 'colgroup': 'colgroup>col', +\ 'colg': 'colgroup>col', +\ 'tr': 'tr>td', +\ 'select': 'select>option', +\ 'optgroup': 'optgroup>option', +\ 'optg': 'optgroup>option' +\ }, +\ 'empty_elements': 'area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,keygen,command', +\ 'block_elements': 'address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,link,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul,h1,h2,h3,h4,h5,h6', +\ 'inline_elements': 'a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var', +\ 'empty_element_suffix': ' />' +\ }, +\ 'htmldjango': { +\ 'extends': 'html', +\ }, +\ 'html.django_template': { +\ 'extends': 'html', +\ }, +\ 'xsl': { +\ 'extends': 'html', +\ 'default_attributes': { +\ 'tmatch': [{'match': ''}, {'mode': ''}], +\ 'tname': [{'name': ''}], +\ 'xsl:when': {'test': ''}, +\ 'var': [{'name': ''}, {'select': ''}], +\ 'vari': {'name': ''}, +\ 'if': {'test': ''}, +\ 'call': {'name': ''}, +\ 'attr': {'name': ''}, +\ 'wp': [{'name': ''}, {'select': ''}], +\ 'par': [{'name': ''}, {'select': ''}], +\ 'val': {'select': ''}, +\ 'co': {'select': ''}, +\ 'each': {'select': ''}, +\ 'ap': [{'select': ''}, {'mode': ''}] +\ }, +\ 'aliases': { +\ 'tmatch': 'xsl:template', +\ 'tname': 'xsl:template', +\ 'var': 'xsl:variable', +\ 'vari': 'xsl:variable', +\ 'if': 'xsl:if', +\ 'choose': 'xsl:choose', +\ 'call': 'xsl:call-template', +\ 'wp': 'xsl:with-param', +\ 'par': 'xsl:param', +\ 'val': 'xsl:value-of', +\ 'attr': 'xsl:attribute', +\ 'co' : 'xsl:copy-of', +\ 'each' : 'xsl:for-each', +\ 'ap' : 'xsl:apply-templates' +\ }, +\ 'expandos': { +\ 'choose': 'xsl:choose>xsl:when+xsl:otherwise' +\ } +\ }, +\ 'xslt': { +\ 'extends': 'xsl', +\ }, +\ 'haml': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ 'snippets': { +\ 'html:5': "!!! 5\n" +\ ."%html{:lang => \"${lang}\"}\n" +\ ."\t%head\n" +\ ."\t\t%meta{:charset => \"${charset}\"}\n" +\ ."\t\t%title\n" +\ ."\t%body\n" +\ ."\t\t${child}|\n" +\ }, +\ }, +\ 'slim': { +\ 'indentation': ' ', +\ 'extends': 'html', +\ 'snippets': { +\ 'html:5': "doctype 5\n" +\ ."html lang=\"${lang}\"\n" +\ ."\thead\n" +\ ."\t\tmeta charset=\"${charset}\"\n" +\ ."\t\ttitle\n" +\ ."\tbody\n" +\ ."\t\t${child}|\n" +\ }, +\ }, +\ 'xhtml': { +\ 'extends': 'html' +\ }, +\ 'mustache': { +\ 'extends': 'html' +\ }, +\ 'xsd': { +\ 'extends': 'html', +\ 'snippets': { +\ 'xsd:w3c': "\n" +\ ."\n" +\ ."\t\n" +\ ."\n" +\ } +\ } +\} + +if exists('g:user_zen_settings') + call s:mergeConfig(s:zen_settings, g:user_zen_settings) +endif + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:set et: diff --git a/sources_forked/zencoding/autoload/zencoding/lang.vim b/sources_forked/zencoding/autoload/zencoding/lang.vim new file mode 100755 index 00000000..a9735991 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang.vim @@ -0,0 +1,11 @@ +let s:exists = {} +function zencoding#lang#exists(type) + if len(a:type) == 0 + return 0 + elseif has_key(s:exists, a:type) + return s:exists[a:type] + endif + let s:exists[a:type] = len(globpath(&rtp, 'autoload/zencoding/lang/'.a:type.'.vim')) > 0 + return s:exists[a:type] +endfunction + diff --git a/sources_forked/zencoding/autoload/zencoding/lang/css.vim b/sources_forked/zencoding/autoload/zencoding/lang/css.vim new file mode 100755 index 00000000..5b1c1182 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/css.vim @@ -0,0 +1,228 @@ +function! zencoding#lang#css#findTokens(str) + return substitute(a:str, '^.*[;{]\s*', '', '') +endfunction + +function! zencoding#lang#css#parseIntoTree(abbr, type) + let abbr = a:abbr + let type = a:type + let prefix = 0 + let value = '' + + let settings = zencoding#getSettings() + let indent = zencoding#getIndentation(type) + + let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0 } + + " emmet + let tokens = split(abbr, '+\ze[^)!]') + for n in range(len(tokens)) + let token = tokens[n] + let prop = matchlist(token, '^\(-\{0,1}[a-zA-Z]\+\|[a-zA-Z0-9]\++\{0,1}\|([a-zA-Z0-9]\++\{0,1})\)\(\%([0-9.-]\+[pe]\{0,1}-\{0,1}\|-auto\)*\)$') + if len(prop) + let token = substitute(prop[1], '^(\(.*\))', '\1', '') + if token =~ '^-' + let prefix = 1 + let token = token[1:] + endif + let value = '' + for v in split(prop[2], '\d\zs-') + if len(value) > 0 + let value .= ' ' + endif + if token =~ '^[z]' + " TODO + let value .= substitute(v, '[^0-9.]*$', '', '') + elseif v =~ 'p$' + let value .= substitute(v, 'p$', '%', '') + elseif v =~ 'e$' + let value .= substitute(v, 'e$', 'em', '') + elseif v =~ '\.' + let value .= v . 'em' + elseif v == 'auto' + let value .= v + else + let value .= v . 'px' + endif + endfor + endif + + let tag_name = token + if tag_name =~ '.!$' + let tag_name = tag_name[:-2] + let important = 1 + else + let important = 0 + endif + " make default node + let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': important } + let current.name = tag_name + + " aliases + let aliases = zencoding#getResource(type, 'aliases', {}) + if has_key(aliases, tag_name) + let current.name = aliases[tag_name] + endif + let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1) + + " snippets + let snippets = zencoding#getResource(type, 'snippets', {}) + if !empty(snippets) && has_key(snippets, tag_name) + let snippet = snippets[tag_name] + if use_pipe_for_cursor + let snippet = substitute(snippet, '|', '${cursor}', 'g') + endif + let lines = split(snippet, "\n") + call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")') + let current.snippet = join(lines, "\n") + let current.name = '' + let current.snippet = substitute(current.snippet, ';', value . ';', '') + if use_pipe_for_cursor && len(value) > 0 && stridx(value, '${cursor}') == -1 + let current.snippet = substitute(current.snippet, '${cursor}', '', 'g') . '${cursor}' + endif + if n < len(tokens) - 1 + let current.snippet .= "\n" + endif + endif + + let current.pos = 0 + let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\w\+\)\s*,\s*\([^,]\+\)\s*,\s*\([^)]\+\)\s*)$') + if len(lg) + let current.name = '' + let current.snippet = printf("background-image: -webkit-gradient(%s, 0 0, 0 100%, from(%s), to(%s));\n", lg[1], lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image: -webkit-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image: -moz-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image: -o-linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + let current.snippet = printf("background-image: linear-gradient(%s, %s);\n", lg[2], lg[3]) + call add(root.child, deepcopy(current)) + elseif prefix + let snippet = current.snippet + let current.snippet = '-webkit-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = '-moz-' . snippet . "\n" + call add(root.child, deepcopy(current)) + let current.snippet = snippet + call add(root.child, current) + else + call add(root.child, current) + endif + endfor + return root +endfunction + +function! zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent) + let current = a:current + let value = current.value[1:-2] + if zencoding#useFilter(a:filters, 'fc') + let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1: \2', 'g') + else + let value = substitute(value, '\([^:]\+\):\([^;]*;\)', '\1:\2', 'g') + endif + if current.important + let value = substitute(value, ';', ' !important;', '') + endif + return value +endfunction + +function! zencoding#lang#css#imageSize() +endfunction + +function! zencoding#lang#css#encodeImage() +endfunction + +function! zencoding#lang#css#parseTag(tag) + return {} +endfunction + +function! zencoding#lang#css#toggleComment() + let line = getline('.') + let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$' + if line =~ '{\s*$' + let block = zencoding#util#searchRegion('/\*', '\*/\zs') + if zencoding#util#regionIsValid(block) + let content = zencoding#util#getContent(block) + let content = substitute(content, '/\*\s\(.*\)\s\*/', '\1', '') + call zencoding#util#setContent(block, content) + else + let node = expand('') + if len(node) + exe "normal ciw\='/* '.node.' */'\" + endif + endif + else + if line =~ mx + let space = substitute(matchstr(line, mx), mx, '\1', '') + let line = substitute(matchstr(line, mx), mx, '\2', '') + let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g') + else + let mx = '^\(\s*\)\(.*\)\s*$' + let line = substitute(line, mx, '\1/* \2 */', '') + endif + call setline('.', line) + endif +endfunction + +function! zencoding#lang#css#balanceTag(flag) range + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = getpos('.') + endif + let block = zencoding#util#getVisualBlock() + if !zencoding#util#regionIsValid(block) + if a:flag > 0 + let block = zencoding#util#searchRegion('^', ';') + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endif + else + if a:flag > 0 + let content = zencoding#util#getContent(block) + if content !~ '^{.*}$' + let block = zencoding#util#searchRegion('{', '}') + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endif + else + let pos = searchpos('.*;', 'nW') + if pos[0] != 0 + call setpos('.', [0, pos[0], pos[1], 0]) + let block = zencoding#util#searchRegion('^', ';') + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endif + endif + endif + if a:flag == -2 || a:flag == 2 + silent! exe "normal! gv" + else + call setpos('.', curpos) + endif +endfunction + +function! zencoding#lang#css#moveNextPrev(flag) + let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp') + if pos == 2 + startinsert! + else + silent! normal! l + startinsert + endif +endfunction + +function! zencoding#lang#css#splitJoinTag() + " nothing to do +endfunction + +function! zencoding#lang#css#removeTag() + " nothing to do +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/lang/haml.vim b/sources_forked/zencoding/autoload/zencoding/lang/haml.vim new file mode 100755 index 00000000..be421c1c --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/haml.vim @@ -0,0 +1,310 @@ +function! zencoding#lang#haml#findTokens(str) + return zencoding#lang#html#findTokens(a:str) +endfunction + +function! zencoding#lang#haml#parseIntoTree(abbr, type) + return zencoding#lang#html#parseIntoTree(a:abbr, a:type) +endfunction + +function! zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent) + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1) + let str = "" + + let comment_indent = '' + let comment = '' + let current_name = current.name + if dollar_expr + let current_name = substitute(current.name, '\$$', itemno+1, '') + endif + if len(current.name) > 0 + let str .= '%' . current_name + let tmp = '' + for attr in current.attrs_order + if !has_key(current.attr, attr) + continue + endif + let val = current.attr[attr] + if dollar_expr + while val =~ '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + let valtmp = substitute(val, '\${cursor}', '', '') + if attr == 'id' && len(valtmp) > 0 + let str .= '#' . val + elseif attr == 'class' && len(valtmp) > 0 + let str .= '.' . substitute(val, ' ', '.', 'g') + else + if len(tmp) > 0 | let tmp .= ',' | endif + let val = substitute(val, '\${cursor}', '', '') + let tmp .= ' :' . attr . ' => "' . val . '"' + endif + endfor + if len(tmp) + let str .= '{' . tmp . ' }' + endif + if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0 + let str .= "/" + endif + + let inner = '' + if len(current.value) > 0 + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for child in current.child + let inner .= zencoding#toString(child, type, inline, filters, itemno) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g') + let str .= "\n" . indent . inner + endif + else + let str = current.value[1:-2] + if dollar_expr + let str = substitute(str, '\%(\\\)\@\\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' + while len(attrs) > 0 + let match = matchstr(attrs, mx) + if len(match) == 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! zencoding#lang#haml#toggleComment() + let line = getline('.') + let space = matchstr(line, '^\s*') + if line =~ '^\s*-#' + call setline('.', space . matchstr(line[len(space)+2:], '^\s*\zs.*')) + elseif line =~ '^\s*%[a-z]' + call setline('.', space . '-# ' . line[len(space):]) + endif +endfunction + +function! zencoding#lang#haml#balanceTag(flag) range + let block = zencoding#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = getpos('.') + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !zencoding#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze%[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! zencoding#lang#haml#moveNextPrev(flag) + let pos = search('""', a:flag ? 'Wb' : 'W') + if pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! zencoding#lang#haml#splitJoinTag() + let n = line('.') + let sml = len(matchstr(getline(n), '^\s*%[a-z]')) + while n > 0 + if getline(n) =~ '^\s*\ze%[a-z]' + if len(matchstr(getline(n), '^\s*%[a-z]')) < sml + break + endif + let line = getline(n) + call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', '')) + let sn = n + let n += 1 + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + if len(matchstr(getline(n), '^\s*')) > ml + while n <= line('$') + let l = len(matchstr(getline(n), '^\s*')) + if l <= ml + break + endif + exe n "delete" + endwhile + call setpos('.', [0, sn, 1, 0]) + else + let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)') + let spaces = matchstr(getline(sn), '^\s*') + let settings = zencoding#getSettings() + if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1 + call append(sn, spaces . ' ') + call setpos('.', [0, sn+1, 1, 0]) + else + call setpos('.', [0, sn, 1, 0]) + endif + startinsert! + endif + break + endif + let n -= 1 + endwhile +endfunction + +function! zencoding#lang#haml#removeTag() + let n = line('.') + let ml = 0 + while n > 0 + if getline(n) =~ '^\s*\ze[a-z]' + let ml = len(matchstr(getline(n), '^\s*%[a-z]')) + break + endif + let n -= 1 + endwhile + let sn = n + while n < line('$') + let l = len(matchstr(getline(n), '^\s*%[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + if sn == n + exe "delete" + else + exe sn "," (n-1) "delete" + endif +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/lang/html.vim b/sources_forked/zencoding/autoload/zencoding/lang/html.vim new file mode 100755 index 00000000..d7a1e634 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/html.vim @@ -0,0 +1,692 @@ +let s:mx = '\([+>]\|[<^]\+\)\{-}\s*' +\ .'\((*\)\{-}\s*' +\ .'\([@#.]\{-}[a-zA-Z\!][a-zA-Z0-9:_\!\-$]*\|{\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}[ \t\r\n}]*\)' +\ .'\(' +\ .'\%(' +\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)' +\ .'\|\%(\[[^\]]\+\]\)' +\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)' +\ .'\)*' +\ .'\)' +\ .'\%(\({\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}\)\)\{0,1}' +\ .'\%(\*\([0-9]\+\)\)\{0,1}' +\ .'\(\%()\%(\*[0-9]\+\)\{0,1}\)*\)' + +function! zencoding#lang#html#findTokens(str) + let str = a:str + let [pos, last_pos] = [0, 0] + while 1 + let tag = matchstr(str, '<[a-zA-Z].\{-}>', pos) + if len(tag) == 0 + break + endif + let pos = stridx(str, tag, pos) + len(tag) + endwhile + let last_pos = pos + while len(str) > 0 + let token = matchstr(str, s:mx, pos) + if token == '' + break + endif + if token =~ '^\s' + let token = matchstr(token, '^\s*\zs.*') + let last_pos = stridx(str, token, pos) + endif + let pos = stridx(str, token, pos) + len(token) + endwhile + return a:str[last_pos :-1] +endfunction + +function! zencoding#lang#html#parseIntoTree(abbr, type) + let abbr = a:abbr + let type = a:type + + let settings = zencoding#getSettings() + if !has_key(settings, type) + let type = 'html' + endif + if len(type) == 0 | let type = 'html' | endif + + let settings = zencoding#getSettings() + let indent = zencoding#getIndentation(type) + + " try 'foo' to (foo-x) + let rabbr = zencoding#getExpandos(type, abbr) + if rabbr == abbr + " try 'foo+(' to (foo-x) + let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".zencoding#getExpandos(type, submatch(1)).")".submatch(2)', 'i') + endif + let abbr = rabbr + + let root = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0, 'attrs_order': ['id', 'class'] } + let parent = root + let last = root + let pos = [] + while len(abbr) + " parse line + let match = matchstr(abbr, s:mx) + let str = substitute(match, s:mx, '\0', 'ig') + let operator = substitute(match, s:mx, '\1', 'ig') + let block_start = substitute(match, s:mx, '\2', 'ig') + let tag_name = substitute(match, s:mx, '\3', 'ig') + let attributes = substitute(match, s:mx, '\4', 'ig') + let value = substitute(match, s:mx, '\5', 'ig') + let multiplier = 0 + substitute(match, s:mx, '\6', 'ig') + let block_end = substitute(match, s:mx, '\7', 'ig') + let important = 0 + if len(str) == 0 + break + endif + if tag_name =~ '^#' + let attributes = tag_name . attributes + let tag_name = 'div' + endif + if tag_name =~ '.!$' + let tag_name = tag_name[:-2] + let important = 1 + endif + if tag_name =~ '^\.' + let attributes = tag_name . attributes + let tag_name = 'div' + endif + if multiplier <= 0 | let multiplier = 1 | endif + + " make default node + let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'important': 0, 'attrs_order': ['id', 'class'] } + let current.name = tag_name + + let current.important = important + + " aliases + let aliases = zencoding#getResource(type, 'aliases', {}) + if has_key(aliases, tag_name) + let current.name = aliases[tag_name] + endif + + let use_pipe_for_cursor = zencoding#getResource(type, 'use_pipe_for_cursor', 1) + + " snippets + let snippets = zencoding#getResource(type, 'snippets', {}) + if !empty(snippets) && has_key(snippets, tag_name) + let snippet = snippets[tag_name] + if use_pipe_for_cursor + let snippet = substitute(snippet, '|', '${cursor}', 'g') + endif + let lines = split(snippet, "\n") + call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")') + let current.snippet = join(lines, "\n") + let current.name = '' + endif + + " default_attributes + let default_attributes = zencoding#getResource(type, 'default_attributes', {}) + if !empty(default_attributes) + for pat in [current.name, tag_name] + if has_key(default_attributes, pat) + if type(default_attributes[pat]) == 4 + let a = default_attributes[pat] + let current.attrs_order += keys(a) + if use_pipe_for_cursor + for k in keys(a) + let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}' + endfor + else + for k in keys(a) + let current.attr[k] = a[k] + endfor + endif + else + for a in default_attributes[pat] + let current.attrs_order += keys(a) + if use_pipe_for_cursor + for k in keys(a) + let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}' + endfor + else + for k in keys(a) + let current.attr[k] = a[k] + endfor + endif + endfor + endif + if has_key(settings.html.default_attributes, current.name) + let current.name = substitute(current.name, ':.*$', '', '') + endif + break + endif + endfor + endif + + " parse attributes + if len(attributes) + let attr = attributes + while len(attr) + let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[[^\]]\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)') + if len(item) == 0 + break + endif + if item[0] == '#' + let current.attr.id = item[1:] + endif + if item[0] == '.' + let current.attr.class = substitute(item[1:], '\.', ' ', 'g') + endif + if item[0] == '[' + let atts = item[1:-2] + while len(atts) + let amat = matchstr(atts, '\(\w\+\%(="[^"]*"\|=''[^'']*''\|[^ ''"\]]*\)\{0,1}\)') + if len(amat) == 0 + break + endif + let key = split(amat, '=')[0] + let val = amat[len(key)+1:] + if val =~ '^["'']' + let val = val[1:-2] + endif + let current.attr[key] = val + if index(current.attrs_order, key) == -1 + let current.attrs_order += [key] + endif + let atts = atts[stridx(atts, amat) + len(amat):] + endwhile + endif + let attr = substitute(strpart(attr, len(item)), '^\s*', '', '') + endwhile + endif + + " parse text + if tag_name =~ '^{.*}$' + let current.name = '' + let current.value = tag_name + else + let current.value = value + endif + let current.multiplier = multiplier + + " parse step inside/outside + if !empty(last) + if operator =~ '>' + unlet! parent + let parent = last + let current.parent = last + let current.pos = last.pos + 1 + else + let current.parent = parent + let current.pos = last.pos + endif + else + let current.parent = parent + let current.pos = 1 + endif + if operator =~ '[<^]' + for c in range(len(operator)) + let tmp = parent.parent + if empty(tmp) + break + endif + let parent = tmp + let current.parent = tmp + endfor + endif + + call add(parent.child, current) + let last = current + + " parse block + if block_start =~ '(' + if operator =~ '>' + let last.pos += 1 + endif + for n in range(len(block_start)) + let pos += [last.pos] + endfor + endif + if block_end =~ ')' + for n in split(substitute(substitute(block_end, ' ', '', 'g'), ')', ',),', 'g'), ',') + if n == ')' + if len(pos) > 0 && last.pos >= pos[-1] + for c in range(last.pos - pos[-1]) + let tmp = parent.parent + if !has_key(tmp, 'parent') + break + endif + let parent = tmp + endfor + if len(pos) > 0 + call remove(pos, -1) + endif + let last = parent + let last.pos += 1 + endif + elseif len(n) + let cl = last.child + let cls = [] + for c in range(n[1:]) + let cls += cl + endfor + let last.child = cls + endif + endfor + endif + let abbr = abbr[stridx(abbr, match) + len(match):] + + if g:zencoding_debug > 1 + echomsg "str=".str + echomsg "block_start=".block_start + echomsg "tag_name=".tag_name + echomsg "operator=".operator + echomsg "attributes=".attributes + echomsg "value=".value + echomsg "multiplier=".multiplier + echomsg "block_end=".block_end + echomsg "abbr=".abbr + echomsg "pos=".string(pos) + echomsg "---" + endif + endwhile + return root +endfunction + +function! zencoding#lang#html#toString(settings, current, type, inline, filters, itemno, indent) + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1) + + if zencoding#useFilter(filters, 'haml') + return zencoding#lang#haml#toString(settings, current, type, inline, filters, itemno, indent) + endif + if zencoding#useFilter(filters, 'slim') + return zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent) + endif + + let comment = '' + let current_name = current.name + if dollar_expr + let current_name = substitute(current_name, '\$$', itemno+1, '') + endif + + let str = '' + if len(current_name) == 0 + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + let str .= '<' . current_name + for attr in current.attrs_order + if !has_key(current.attr, attr) + continue + endif + let val = current.attr[attr] + if dollar_expr + while val =~ '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + endif + let str .= ' ' . attr . '="' . val . '"' + if zencoding#useFilter(filters, 'c') + if attr == 'id' | let comment .= '#' . val | endif + if attr == 'class' | let comment .= '.' . val | endif + endif + endfor + if len(comment) > 0 + let str = "\n" . str + endif + if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 + let str .= settings.html.empty_element_suffix + else + let str .= ">" + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for n in range(nc) + let child = current.child[n] + if child.multiplier > 1 + let str .= "\n" . indent + let dr = 1 + elseif len(current_name) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1 + if nc > 1 || (len(child.name) > 0 && stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1) + let str .= "\n" . indent + let dr = 1 + elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0 + let str .= "\n" . indent + let dr = 1 + endif + endif + let inner = zencoding#toString(child, type, 0, filters, itemno) + let inner = substitute(inner, "^\n", "", 'g') + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g') + let str .= inner + endfor + else + let str .= '${cursor}' + endif + if dr + let str .= "\n" + endif + let str .= "" + endif + if len(comment) > 0 + let str .= "\n" + endif + if len(current_name) > 0 && current.multiplier > 0 || stridx(','.settings.html.block_elements.',', ','.current_name.',') != -1 + let str .= "\n" + endif + return str +endfunction + +function! zencoding#lang#html#imageSize() + let img_region = zencoding#util#searchRegion('') + if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region) + return + endif + let content = zencoding#util#getContent(img_region) + if content !~ '^<]\+>$' + return + endif + let current = zencoding#lang#html#parseTag(content) + if empty(current) || !has_key(current.attr, 'src') + return + endif + let fn = current.attr.src + if fn =~ '^\s*$' + return + elseif fn !~ '^\(/\|http\)' + let fn = simplify(expand('%:h') . '/' . fn) + endif + + let [width, height] = zencoding#util#getImageSize(fn) + if width == -1 && height == -1 + return + endif + let current.attr.width = width + let current.attr.height = height + let current.attrs_order += ['width', 'height'] + let html = substitute(zencoding#toString(current, 'html', 1), '\n', '', '') + let html = substitute(html, '\${cursor}', '', '') + call zencoding#util#setContent(img_region, html) +endfunction + +function! zencoding#lang#html#encodeImage() + let img_region = zencoding#util#searchRegion('') + if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region) + return + endif + let content = zencoding#util#getContent(img_region) + if content !~ '^<]\+>$' + return + endif + let current = zencoding#lang#html#parseTag(content) + if empty(current) || !has_key(current.attr, 'src') + return + endif + let fn = current.attr.src + if fn !~ '^\(/\|http\)' + let fn = simplify(expand('%:h') . '/' . fn) + endif + + let [width, height] = zencoding#util#getImageSize(fn) + if width == -1 && height == -1 + return + endif + let current.attr.width = width + let current.attr.height = height + let html = zencoding#toString(current, 'html', 1) + call zencoding#util#setContent(img_region, html) +endfunction + +function! zencoding#lang#html#parseTag(tag) + let current = { 'name': '', 'attr': {}, 'child': [], 'snippet': '', 'multiplier': 1, 'parent': {}, 'value': '', 'pos': 0, 'attrs_order': [] } + let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>' + let match = matchstr(a:tag, mx) + let current.name = substitute(match, mx, '\1', 'i') + let attrs = substitute(match, mx, '\2', 'i') + let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' + while len(attrs) > 0 + let match = matchstr(attrs, mx) + if len(match) == 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! zencoding#lang#html#toggleComment() + let orgpos = getpos('.') + let curpos = getpos('.') + let mx = '<\%#[^>]*>' + while 1 + let block = zencoding#util#searchRegion('') + if zencoding#util#regionIsValid(block) + let block[1][1] += 2 + let content = zencoding#util#getContent(block) + let content = substitute(content, '^$', '\1', '') + call zencoding#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + let block = zencoding#util#searchRegion('<[^>]', '>') + if !zencoding#util#regionIsValid(block) + let pos1 = searchpos('<', 'bcW') + if pos1[0] == 0 && pos1[1] == 0 + return + endif + let curpos = getpos('.') + continue + endif + let pos1 = block[0] + let pos2 = block[1] + let content = zencoding#util#getContent(block) + let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+') + if tag_name[0] == '/' + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpairpos('<'. tag_name[1:] . '>', '', '', 'bnW') + let pos1 = searchpos('>', 'cneW') + let block = [pos2, pos1] + elseif tag_name =~ '/$' + if !zencoding#util#pointInRegion(orgpos[1:2], block) + " it's broken tree + call setpos('.', orgpos) + let block = zencoding#util#searchRegion('>', '<') + let content = '><' + call zencoding#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + else + call setpos('.', [0, pos2[0], pos2[1], 0]) + let pos2 = searchpairpos('<'. tag_name . '>', '', '', 'nW') + call setpos('.', [0, pos2[0], pos2[1], 0]) + let pos2 = searchpos('>', 'neW') + let block = [pos1, pos2] + endif + if !zencoding#util#regionIsValid(block) + silent! call setpos('.', orgpos) + return + endif + if zencoding#util#pointInRegion(curpos[1:2], block) + let content = '' + call zencoding#util#setContent(block, content) + silent! call setpos('.', orgpos) + return + endif + endwhile +endfunction + +function! zencoding#lang#html#balanceTag(flag) range + let vblock = zencoding#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = getpos('.') + endif + let settings = zencoding#getSettings() + + if a:flag > 0 + let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + while 1 + let pos1 = searchpos(mx, 'bW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze') + if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1 + let pos2 = searchpos('>', 'nW') + else + let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '\zs', 'nW') + endif + let block = [pos1, pos2] + if pos1[0] == 0 && pos1[1] == 0 + break + endif + if zencoding#util#pointInRegion(curpos[1:2], block) && zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endwhile + else + let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + while 1 + let pos1 = searchpos(mx, 'W') + if pos1 == curpos[1:2] + let pos1 = searchpos(mx . '\zs', 'W') + let pos2 = searchpos('.\ze<', 'W') + let block = [pos1, pos2] + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endif + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze') + if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1 + let pos2 = searchpos('>', 'nW') + else + let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '\zs', 'nW') + endif + let block = [pos1, pos2] + if pos1[0] == 0 && pos1[1] == 0 + break + endif + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endwhile + endif + call setpos('.', curpos) + if a:flag == -2 || a:flag == 2 + silent! exe "normal! gv" + endif +endfunction + +function! zencoding#lang#html#moveNextPrev(flag) + let pos = search('\%(<\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp') + if pos == 3 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! zencoding#lang#html#splitJoinTag() + let curpos = getpos('.') + while 1 + let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + let pos1 = searchpos(mx, 'bcnW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '') + let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]] + if content[-2:] == '/>' && zencoding#util#cursorInRegion(block) + let content = content[:-3] . ">' + call zencoding#util#setContent(block, content) + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if tag_name[0] == '/' + let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW') + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpos('', 'cneW') + else + let pos2 = searchpos('', 'cneW') + endif + let block = [pos1, pos2] + let content = zencoding#util#getContent(block) + if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>' + let content = matchstr(content, mx)[:-2] . '/>' + call zencoding#util#setContent(block, content) + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if block[0][0] > 0 + call setpos('.', [0, block[0][0]-1, block[0][1], 0]) + else + call setpos('.', curpos) + return + endif + endif + endif + endwhile +endfunction + +function! zencoding#lang#html#removeTag() + let curpos = getpos('.') + while 1 + let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>' + let pos1 = searchpos(mx, 'bcnW') + let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx) + let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '') + let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]] + if content[-2:] == '/>' && zencoding#util#cursorInRegion(block) + call zencoding#util#setContent(block, '') + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if tag_name[0] == '/' + let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW') + call setpos('.', [0, pos1[0], pos1[1], 0]) + let pos2 = searchpos('', 'cneW') + else + let pos2 = searchpos('', 'cneW') + endif + let block = [pos1, pos2] + let content = zencoding#util#getContent(block) + if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>' + call zencoding#util#setContent(block, '') + call setpos('.', [0, block[0][0], block[0][1], 0]) + return + else + if block[0][0] > 0 + call setpos('.', [0, block[0][0]-1, block[0][1], 0]) + else + call setpos('.', curpos) + return + endif + endif + endif + endwhile +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/lang/sass.vim b/sources_forked/zencoding/autoload/zencoding/lang/sass.vim new file mode 100755 index 00000000..6b89b893 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/sass.vim @@ -0,0 +1,158 @@ +function! zencoding#lang#sass#findTokens(str) + return zencoding#lang#html#findTokens(a:str) +endfunction + +function! zencoding#lang#sass#parseIntoTree(abbr, type) + if a:abbr =~ '>' + return zencoding#lang#html#parseIntoTree(a:abbr, a:type) + else + return zencoding#lang#css#parseIntoTree(a:abbr, a:type) + endif +endfunction + +function! zencoding#lang#sass#toString(settings, current, type, inline, filters, itemno, indent) + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let str = "" + + let current_name = current.name + let current_name = substitute(current.name, '\$$', itemno+1, '') + if len(current.name) > 0 + let str .= current_name + let tmp = '' + for attr in keys(current.attr) + let val = current.attr[attr] + while val =~ '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + if attr == 'id' + let str .= '#' . val + elseif attr == 'class' + let str .= '.' . val + else + let tmp .= attr . ': ' . val + endif + endfor + if len(tmp) > 0 + let str .= "\n" + for line in split(tmp, "\n") + let str .= indent . line . "\n" + endfor + else + let str .= "\n" + endif + + let inner = '' + for child in current.child + let inner .= zencoding#toString(child, type, inline, filters, itemno) + endfor + let inner = substitute(inner, "\n", "\n" . indent, 'g') + let inner = substitute(inner, "\n" . indent . "$", "", 'g') + let str .= indent . inner + else + let text = zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent) + let text = substitute(text, '\${cursor}', '', 'g') + let text = substitute(text, '\s*;$', '', '') + return text + endif + return str +endfunction + +function! zencoding#lang#sass#imageSize() +endfunction + +function! zencoding#lang#sass#encodeImage() +endfunction + +function! zencoding#lang#sass#parseTag(tag) +endfunction + +function! zencoding#lang#sass#toggleComment() +endfunction + +function! zencoding#lang#sass#balanceTag(flag) range + let block = zencoding#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = getpos('.') + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !zencoding#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! zencoding#lang#sass#moveNextPrev(flag) + let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp') + if pos == 2 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! zencoding#lang#sass#splitJoinTag() +endfunction + +function! zencoding#lang#sass#removeTag() +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/lang/scss.vim b/sources_forked/zencoding/autoload/zencoding/lang/scss.vim new file mode 100755 index 00000000..39890af2 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/scss.vim @@ -0,0 +1,121 @@ +function! zencoding#lang#scss#findTokens(str) + return zencoding#lang#html#findTokens(a:str) +endfunction + +function! zencoding#lang#scss#parseIntoTree(abbr, type) + if a:abbr =~ '>' + return zencoding#lang#html#parseIntoTree(a:abbr, a:type) + else + return zencoding#lang#css#parseIntoTree(a:abbr, a:type) + endif +endfunction + +function! zencoding#lang#scss#toString(settings, current, type, inline, filters, itemno, indent) + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let str = "" + + let current_name = substitute(current.name, '\$$', itemno+1, '') + if len(current.name) > 0 + let str .= current_name + let tmp = '' + for attr in keys(current.attr) + let val = current.attr[attr] + while val =~ '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + let attr = substitute(attr, '\$$', itemno+1, '') + if attr == 'id' + let str .= '#' . val + elseif attr == 'class' + let str .= '.' . val + else + let tmp .= attr . ': ' . val . ';' + endif + endfor + if len(tmp) > 0 + let str .= " {\n" + for line in split(tmp, "\n") + let str .= indent . line . "\n" + endfor + else + let str .= " {\n" + endif + + let inner = '' + for child in current.child + let inner .= zencoding#toString(child, type, inline, filters, itemno) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g') + let str .= indent . inner . "\n}\n" + else + return zencoding#lang#css#toString(settings, current, type, inline, filters, itemno, indent) + endif + return str +endfunction + +function! zencoding#lang#scss#imageSize() + call zencoding#lang#css#imageSize() +endfunction + +function! zencoding#lang#scss#encodeImage() + return zencoding#lang#css#encodeImage() +endfunction + +function! zencoding#lang#scss#parseTag(tag) + return zencoding#lang#css#parseTag(a:tag) +endfunction + +function! zencoding#lang#scss#toggleComment() + call zencoding#lang#css#toggleComment() +endfunction + +function! zencoding#lang#scss#balanceTag(flag) range + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + call setpos('.', curpos) + else + let curpos = getpos('.') + endif + if a:flag < 0 + let ret = searchpair('}', '', '.\zs{') + else + let ret = searchpair('{', '', '}', 'bW') + endif + if ret > 0 + let pos1 = getpos('.')[1:2] + if a:flag < 0 + let pos2 = searchpairpos('{', '', '}') + else + let pos2 = searchpairpos('{', '', '}') + endif + let block = [pos1, pos2] + if zencoding#util#regionIsValid(block) + call zencoding#util#selectRegion(block) + return + endif + endif + if a:flag == -2 || a:flag == 2 + silent! exe "normal! gv" + else + call setpos('.', curpos) + endif +endfunction + +function! zencoding#lang#scss#moveNextPrev(flag) + call zencoding#lang#css#moveNextPrev(a:flag) +endfunction + +function! zencoding#lang#scss#splitJoinTag() + call zencoding#lang#css#splitJoinTag() +endfunction + +function! zencoding#lang#scss#removeTag() + call zencoding#lang#ss#removeTag() +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/lang/slim.vim b/sources_forked/zencoding/autoload/zencoding/lang/slim.vim new file mode 100755 index 00000000..15bc968c --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/lang/slim.vim @@ -0,0 +1,276 @@ +function! zencoding#lang#slim#findTokens(str) + return zencoding#lang#html#findTokens(a:str) +endfunction + +function! zencoding#lang#slim#parseIntoTree(abbr, type) + return zencoding#lang#html#parseIntoTree(a:abbr, a:type) +endfunction + +function! zencoding#lang#slim#toString(settings, current, type, inline, filters, itemno, indent) + let settings = a:settings + let current = a:current + let type = a:type + let inline = a:inline + let filters = a:filters + let itemno = a:itemno + let indent = a:indent + let dollar_expr = zencoding#getResource(type, 'dollar_expr', 1) + let str = "" + + let comment_indent = '' + let comment = '' + let current_name = current.name + if dollar_expr + let current_name = substitute(current.name, '\$$', itemno+1, '') + endif + if len(current.name) > 0 + let str .= current_name + for attr in current.attrs_order + if !has_key(current.attr, attr) + continue + endif + let val = current.attr[attr] + if dollar_expr + while val =~ '\$\([^#{]\|$\)' + let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g') + endwhile + endif + let attr = substitute(attr, '\$$', itemno+1, '') + let str .= ' ' . attr . '="' . val . '"' + endfor + + let inner = '' + if len(current.value) > 0 + let str .= "\n" + let text = current.value[1:-2] + if dollar_expr + let text = substitute(text, '\%(\\\)\@\ 0 + for child in current.child + let inner .= zencoding#toString(child, type, inline, filters, itemno) + endfor + let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g') + let inner = substitute(inner, "\n" . escape(indent, '\') . "$", "", 'g') + let str .= "\n" . indent . inner + endif + else + let str = current.value[1:-2] + if dollar_expr + let str = substitute(str, '\%(\\\)\@\ 0 + let match = matchstr(attrs, mx) + if len(match) == 0 + break + endif + let attr_match = matchlist(match, mx) + let name = attr_match[1] + let value = len(attr_match[2]) ? attr_match[2] : attr_match[3] + let current.attr[name] = value + let current.attrs_order += [name] + let attrs = attrs[stridx(attrs, match) + len(match):] + endwhile + return current +endfunction + +function! zencoding#lang#slim#toggleComment() + let line = getline('.') + let space = matchstr(line, '^\s*') + if line =~ '^\s*/' + call setline('.', space . line[len(space)+1:]) + elseif line =~ '^\s*[a-z]' + call setline('.', space . '/' . line[len(space):]) + endif +endfunction + +function! zencoding#lang#slim#balanceTag(flag) range + let block = zencoding#util#getVisualBlock() + if a:flag == -2 || a:flag == 2 + let curpos = [0, line("'<"), col("'<"), 0] + else + let curpos = getpos('.') + endif + let n = curpos[1] + let ml = len(matchstr(getline(n), '^\s*')) + + if a:flag > 0 + if a:flag == 1 || !zencoding#util#regionIsValid(block) + let n = line('.') + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l < ml + let ml = l + break + endif + let n -= 1 + endwhile + endif + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + else + while n > 0 + let l = len(matchstr(getline(n), '^\s*\ze[a-z]')) + if l > 0 && l > ml + let ml = l + break + endif + let n += 1 + endwhile + let sn = n + if n == 0 + let ml = 0 + endif + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + call setpos('.', [0, n, 1, 0]) + normal! V + call setpos('.', [0, sn, 1, 0]) + endif +endfunction + +function! zencoding#lang#slim#moveNextPrev(flag) + let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp') + if pos == 2 + startinsert! + elseif pos != 0 + silent! normal! l + startinsert + endif +endfunction + +function! zencoding#lang#slim#splitJoinTag() + let n = line('.') + while n > 0 + if getline(n) =~ '^\s*\ze[a-z]' + let sn = n + let n += 1 + if getline(n) =~ '^\s*|' + while n <= line('$') + if getline(n) !~ '^\s*|' + break + endif + exe n "delete" + endwhile + call setpos('.', [0, sn, 1, 0]) + else + let spaces = matchstr(getline(sn), '^\s*') + call append(sn, spaces . ' | ') + call setpos('.', [0, sn+1, 1, 0]) + startinsert! + endif + break + endif + let n -= 1 + endwhile +endfunction + +function! zencoding#lang#slim#removeTag() + let n = line('.') + let ml = 0 + while n > 0 + if getline(n) =~ '^\s*\ze[a-z]' + let ml = len(matchstr(getline(n), '^\s*[a-z]')) + break + endif + let n -= 1 + endwhile + let sn = n + while n < line('$') + let l = len(matchstr(getline(n), '^\s*[a-z]')) + if l > 0 && l <= ml + let n -= 1 + break + endif + let n += 1 + endwhile + if sn == n + exe "delete" + else + exe sn "," (n-1) "delete" + endif +endfunction diff --git a/sources_forked/zencoding/autoload/zencoding/util.vim b/sources_forked/zencoding/autoload/zencoding/util.vim new file mode 100755 index 00000000..5a028c97 --- /dev/null +++ b/sources_forked/zencoding/autoload/zencoding/util.vim @@ -0,0 +1,249 @@ +"============================================================================== +" region utils +"============================================================================== +" deleteContent : delete content in region +" if region make from between '' and '' +" -------------------- +" begin: +" :end +" -------------------- +" this function make the content as following +" -------------------- +" begin::end +" -------------------- +function! zencoding#util#deleteContent(region) + let lines = getline(a:region[0][0], a:region[1][0]) + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) + silent! exe "delete ".(a:region[1][0] - a:region[0][0]) + call setline(line('.'), lines[0][:a:region[0][1]-2] . lines[-1][a:region[1][1]]) +endfunction + +" change_content : change content in region +" if region make from between '' and '' +" -------------------- +" begin: +" :end +" -------------------- +" and content is +" -------------------- +" foo +" bar +" baz +" -------------------- +" this function make the content as following +" -------------------- +" begin:foo +" bar +" baz:end +" -------------------- +function! zencoding#util#setContent(region, content) + let newlines = split(a:content, '\n', 1) + let oldlines = getline(a:region[0][0], a:region[1][0]) + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) + silent! exe "delete ".(a:region[1][0] - a:region[0][0]) + if len(newlines) == 0 + let tmp = '' + if a:region[0][1] > 1 + let tmp = oldlines[0][:a:region[0][1]-2] + endif + if a:region[1][1] >= 1 + let tmp .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), tmp) + elseif len(newlines) == 1 + if a:region[0][1] > 1 + let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0] + endif + if a:region[1][1] >= 1 + let newlines[0] .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), newlines[0]) + else + if a:region[0][1] > 1 + let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0] + endif + if a:region[1][1] >= 1 + let newlines[-1] .= oldlines[-1][a:region[1][1]:] + endif + call setline(line('.'), newlines[0]) + call append(line('.'), newlines[1:]) + endif +endfunction + +" select_region : select region +" this function make a selection of region +function! zencoding#util#selectRegion(region) + call setpos('.', [0, a:region[1][0], a:region[1][1], 0]) + normal! v + call setpos('.', [0, a:region[0][0], a:region[0][1], 0]) +endfunction + +" point_in_region : check point is in the region +" this function return 0 or 1 +function! zencoding#util#pointInRegion(point, region) + if !zencoding#util#regionIsValid(a:region) | return 0 | endif + if a:region[0][0] > a:point[0] | return 0 | endif + if a:region[1][0] < a:point[0] | return 0 | endif + if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif + if a:region[1][0] == a:point[0] && a:region[1][1] < a:point[1] | return 0 | endif + return 1 +endfunction + +" cursor_in_region : check cursor is in the region +" this function return 0 or 1 +function! zencoding#util#cursorInRegion(region) + if !zencoding#util#regionIsValid(a:region) | return 0 | endif + let cur = getpos('.')[1:2] + return zencoding#util#pointInRegion(cur, a:region) +endfunction + +" region_is_valid : check region is valid +" this function return 0 or 1 +function! zencoding#util#regionIsValid(region) + if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif + return 1 +endfunction + +" search_region : make region from pattern which is composing start/end +" this function return array of position +function! zencoding#util#searchRegion(start, end) + return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')] +endfunction + +" get_content : get content in region +" this function return string in region +function! zencoding#util#getContent(region) + if !zencoding#util#regionIsValid(a:region) + return '' + endif + let lines = getline(a:region[0][0], a:region[1][0]) + if a:region[0][0] == a:region[1][0] + let lines[0] = lines[0][a:region[0][1]-1:a:region[1][1]-1] + else + let lines[0] = lines[0][a:region[0][1]-1:] + let lines[-1] = lines[-1][:a:region[1][1]-1] + endif + return join(lines, "\n") +endfunction + +" region_in_region : check region is in the region +" this function return 0 or 1 +function! zencoding#util#regionInRegion(outer, inner) + if !zencoding#util#regionIsValid(a:inner) || !zencoding#util#regionIsValid(a:outer) + return 0 + endif + return zencoding#util#pointInRegion(a:inner[0], a:outer) && zencoding#util#pointInRegion(a:inner[1], a:outer) +endfunction + +" get_visualblock : get region of visual block +" this function return region of visual block +function! zencoding#util#getVisualBlock() + return [[line("'<"), col("'<")], [line("'>"), col("'>")]] +endfunction + +"============================================================================== +" html utils +"============================================================================== +function! zencoding#util#getContentFromURL(url) + let res = system(printf("%s %s", g:zencoding_curl_command, shellescape(substitute(a:url, '#.*', '', '')))) + let s1 = len(split(res, '?')) + let utf8 = iconv(res, 'utf-8', &encoding) + let s2 = len(split(utf8, '?')) + return (s2 == s1 || s2 >= s1 * 2) ? utf8 : res +endfunction + +function! zencoding#util#getTextFromHTML(buf) + let threshold_len = 100 + let threshold_per = 0.1 + let buf = a:buf + + let buf = strpart(buf, stridx(buf, '')) + let buf = substitute(buf, ']*>.\{-}', '', 'g') + let buf = substitute(buf, ']*>.\{-}', '', 'g') + let res = '' + let max = 0 + let mx = '\(]\{-}>\)\|\(<\/td>\)\|\(]\{-}>\)\|\(<\/div>\)' + let m = split(buf, mx) + for str in m + let c = split(str, '<[^>]*?>') + let str = substitute(str, '<[^>]\{-}>', ' ', 'g') + let str = substitute(str, '>', '>', 'g') + let str = substitute(str, '<', '<', 'g') + let str = substitute(str, '"', '"', 'g') + let str = substitute(str, ''', "'", 'g') + let str = substitute(str, ' ', ' ', 'g') + let str = substitute(str, '¥', '\¥', 'g') + let str = substitute(str, '&', '\&', 'g') + let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '') + let str = substitute(str, '\s\+', ' ', 'g') + let l = len(str) + if l > threshold_len + let per = (l+0.0) / len(c) + if max < l && per > threshold_per + let max = l + let res = str + endif + endif + endfor + let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g') + return res +endfunction + +function! zencoding#util#getImageSize(fn) + let fn = a:fn + + if zencoding#util#isImageMagickInstalled() + return zencoding#util#imageSizeWithImageMagick(fn) + endif + + if filereadable(fn) + let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g') + else + let hex = substitute(system(g:zencoding_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g') + endif + + let [width, height] = [-1, -1] + if hex =~ '^89504e470d0a1a0a' + let width = eval('0x'.hex[32:39]) + let height = eval('0x'.hex[40:47]) + endif + if hex =~ '^ffd8' + let pos = 4 + while pos < len(hex) + let bs = hex[pos+0:pos+3] + let pos += 4 + if bs == 'ffc0' || bs == 'ffc2' + let pos += 6 + let height = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) + let pos += 4 + let width = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) + break + elseif bs =~ 'ffd[9a]' + break + elseif bs =~ 'ff\(e[0-9a-e]\|fe\|db\|dd\|c4\)' + let pos += (eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])) * 2 + endif + endwhile + endif + if hex =~ '^47494638' + let width = eval('0x'.hex[14:15].hex[12:13]) + let height = eval('0x'.hex[18:19].hex[16:17]) + endif + + return [width, height] +endfunction + +function! zencoding#util#imageSizeWithImageMagick(fn) + let img_info = system('identify -format "%wx%h" "'.a:fn.'"') + let img_size = split(substitute(img_info, '\n', '', ''), 'x') + let width = img_size[0] + let height = img_size[1] + return [width, height] +endfunction + +function! zencoding#util#isImageMagickInstalled() + if !get(s:, 'zencoding_use_identify', 1) + return 0 + endif + return executable('identify') +endfunction diff --git a/sources_forked/zencoding/doc/zencoding.txt b/sources_forked/zencoding/doc/zencoding.txt new file mode 100755 index 00000000..ee453283 --- /dev/null +++ b/sources_forked/zencoding/doc/zencoding.txt @@ -0,0 +1,438 @@ +*zencoding.txt* ZenCoding for Vim + + ------------------------------------------------------- + ZenCoding: vim plugins for HTML and CSS hi-speed coding + ------------------------------------------------------- + +Author: Yasuhiro Matsumoto +WebSite: http://mattn.kaoriya.net/ +Repository: http://github.com/mattn/zencoding-vim +Site: http://mattn.github.com/zencoding-vim +License: BSD style license + +============================================================================== +CONTENTS *zencoding-contents* + +Introduction |zencoding-introduction| +Install |zencoding-install| +Tutorial |zencoding-tutorial| + 1. Expand Abbreviation |zencoding-expandabbr| + 2. Wrap with Abbreviation |zencoding-wrap-wtih-abbreviation| + 3. Balance Tag Inward |zencoding-balance-tag-inward| + 4. Balance Tag Outward |zencoding-balance-tag-outward| + 5. Go to Next Edit Point |zencoding-goto-next-point| |n| + 6. Go to Previous Edit Point |zencoding-goto-previous-point| + 7. Update Size |zencoding-update-image-size| + 8. Merge Lines |zencoding-merge-lines| + 9. Remove Tag |zencoding-remove-tag| + 10. Split/Join Tag |zencoding-split-join-tag| + 11. Toggle Comment |zencoding-toggle-comment| + 12. Make anchor from URL |zencoding-make-anchor-url| + 13. Make quoted text from URL |zencoding-quoted-text-url| + 14. Code Pretty |zencoding-code-pretty| +Customize |zencoding-customize| + 1. Key Mappings |zencoding-customize-keymappings| + 2. Indent Size |zencoding-indent-size| + 3. Define Tag's Behavior |zencoding-define-tags-behavior| + 4. Complete Tag |zencoding-complete-tag| +Links |zencoding-links| +ToDo |zencoding-todo| + +============================================================================== +INTRODUCTION *zencoding-introduction* *zencoding* + +|ZenCoding| is an editor plugin for high-speed HTML, XML, XSL (or any other +structured code format) coding and editing. The core of this plugin is a +powerful abbreviation engine which allows you to expand expressions?similar to +CSS selectors?into HTML code: +> + div#page>div.logo+ul#navigation>li*5>a +< +...can be expanded into: +> +

    + + +
    +< +Read more about current Zen Coding syntax + http://code.google.com/p/zen-coding/wiki/ZenHTMLSelectorsEn + +Abbreviation engine has a modular structure which allows you to expand +abbreviations into different languages. Zen Coding currently supports CSS, +HTML, XML/XSL and HAML, Slim languages via filters. + +============================================================================== +INSTALL *zencoding-install* + +Install the distributed files into Vim runtime directory which is usually +~/.vim/, or $HOME/vimfiles on Windows. + +If you install pathogen that provided from Tim Pope, you should extract the +file into 'bundle' directory. + +============================================================================== +TUTORIAL *zencoding-tutorial* + +If you are seeing this file as :help, then you can't edit this file. +You should copy this section and create new buffer, paste and write as +'zencoding-tutor.txt'. Formally, open the file to start tutorial. + +1. Expand Abbreviation *zencoding-expandabbr* *,* + + Type abbreviation as 'div>p#foo$*3>a' and type |,|. +> +
    +

    + +

    +

    + +

    +

    + +

    +
    +< +2. Wrap with Abbreviation *zencoding-wrap-wtih-abbreviation* *v_,* + + Write as below. +> + test1 + test2 + test3 +< + Then do visual select(line wize) and type |,|. + If you request 'Tag:', then type 'ul>li*'. +> +
      +
    • test1
    • +
    • test2
    • +
    • test3
    • +
    +< + If you type tag as 'blockquote', then you'll see as following. +> +
    + test1 + test2 + test3 +
    +< +3. Balance Tag Inward *zencoding-balance-tag-inward* *d* + + To select inward of ul tag, type |d| in insert mode. +> +
      + *
    • +
    • +
    • +
    +< + If cursor is at '*', |d| select from begin of
      to end of
    . + If cursor is at first of
  • , it select
  • . + +4. Balance Tag Outward *zencoding-balance-tag-outward* *D* + + To select outward of ul tag, insert mode, type D in insert mode. +> +
      + *
    • +
    • +
    • +
    +< + If cursor is at '*', |D| select from next letter of
      to previous + letter of
    . + If cursor is at first of
  • , it select
  • . + +5. Go to Next Edit Point *zencoding-goto-next-point* *n* + + To jump next point that need to edit, type |n| in insert mode. +> + *
    foo
    +
  • +< + If cursor is at '*', |n| move a cursor into attribute value of div + specified id as 'foo'. And type again |n| move a cursor into inner of + div specified id as 'bar'. + +6. Go to Previous Edit Point *zencoding-goto-previous-point* *N* + + To jump previous point that need to edit, type |N| in insert mode. +> +
    foo
    +
    * +< + If cursor is at '*', |N| move a cursor into div specified id as 'bar'. + And type again |N| move a cursor into attribute value of 'foo'. + +7. Update Size *zencoding-update-image-size* *i* + + To expand or update size of image, type |i| on img tag +> + +< + Type 'i' on img tag +> + +< + If you change image, then type it again. it will be following. +> + +< +8. Merge Lines *zencoding-merge-lines* + + To join multi line text like following, type |J|. +> +
      +
    • +
    • +
    • +
    +< + If you select part of line include
  • and type |m|, it will be + following. +> +
      +
    • +
    +< +9. Remove Tag *zencoding-remove-tag* *k* + + To remove tag in the block, type |k|. +> + +< + Type |k| in insert mode, then +> +
    + +
    +< + And type |k| in there again, then div will be removed. + +10. Split/Join Tag *zencoding-split-join-tag* *j* + + To join block, type |j|. +> +
    + cursor is here +
    +< + Type |j| in insert mode. then, +> +
    +< + And type |j| in there again. +> +
    +
    +< +11. Toggle Comment *zencoding-toggle-comment* */* + + Move cursor to block +> +
    + hello world +
    +< + Type '/' in insert mode. +> + +< + Type '/' in there again. +> +
    + hello world +
    +< +12. Make anchor from URL *zencoding-make-anchor-url* *a* + + Move cursor to URL +> + http://www.google.com/ +< + Type |a| +> + Google +< +13. Make quoted text from URL *zencoding-quoted-text-url* *A* + + Move cursor to URL +> + http://github.com/ +< + Type |A| +> +
    + Secure source code hosting and collaborative development - GitHub
    +

    How does it work? Get up and running in seconds by forking a project, pushing an existing repository...

    + http://github.com/ +
    +< +14. Code Pretty *zencoding-code-pretty* *c* + + Select code block, for example select following code from "int main()". +> +

    Writing in C language

    + + int main() { + puts("hello world"); + } +< + Type |c| +> +

    Writing in C language

    + + int main() {
    +   puts("hello world");
    + }
    +< +============================================================================== +CUSTOMIZE *zencoding-customize* + +1. Key Mapping *zencoding-customize-keymappings* + + To specify leading key for expanding or balance tag, or for all, + Add this line in your vimrc: > +> + let g:user_zen_leader_key = '' +< + Or if you prefer to map for each actions, then you set each variables. + + 'user_zen_expandabbr_key' + 'user_zen_expandword_key' + 'user_zen_balancetaginward_key' + 'user_zen_balancetagoutward_key' + 'user_zen_next_key' + 'user_zen_prev_key' + 'user_zen_imagesize_key' + 'user_zen_togglecomment_key' + 'user_zen_splitjointag_key' + 'user_zen_removetag_key' + 'user_zen_anchorizeurl_key' + 'user_zen_anchorizesummary_key' + +2. Indent Size *zencoding-indent-size* + + To change indent size of html, add this code in your vimrc. +> + let g:user_zen_settings = { + \ 'html' : { + \ 'indentation' : ' ' + \ }, + \} +< + If you prefer to change global indent size then add this. +> + let g:user_zen_settings = { + \ 'indentation' : ' ' + \} +< +3. Define Tag's Behavior *zencoding-define-tags-behavior* + + zencoding.vim can change behavior of expanding abbreviation for each + filetypes as |Dictionary|. for details, see official site of zencoding. + for example, vimmer can add following. +> + let g:user_zen_settings = { + \ 'lang' : 'ja', + \ 'html' : { + \ 'filters' : 'html', + \ 'indentation' : ' ' + \ }, + \ 'perl' : { + \ 'indentation' : ' ', + \ 'aliases' : { + \ 'req' : "require '|'" + \ }, + \ 'snippets' : { + \ 'use' : "use strict\nuse warnings\n\n", + \ 'w' : "warn \"${cursor}\";", + \ }, + \ }, + \ 'php' : { + \ 'extends' : 'html', + \ 'filters' : 'html,c', + \ }, + \ 'css' : { + \ 'filters' : 'fc', + \ }, + \ 'javascript' : { + \ 'snippets' : { + \ 'jq' : "$(function() {\n\t${cursor}${child}\n});", + \ 'jq:each' : "$.each(arr, function(index, item)\n\t${child}\n});", + \ 'fn' : "(function() {\n\t${cursor}\n})();", + \ 'tm' : "setTimeout(function() {\n\t${cursor}\n}, 100);", + \ }, + \ }, + \ 'java' : { + \ 'indentation' : ' ', + \ 'snippets' : { + \ 'main': "public static void main(String[] args) {\n\t|\n}", + \ 'println': "System.out.println(\"|\");", + \ 'class': "public class | {\n}\n", + \ }, + \ }, + \} +< +4. Complete Tag *zencoding-complete-tag* + + If you want to complete tags using |omnifunc| then add this. +> + let g:use_zen_complete_tag = 1 +< + +5. Enable functions in different mode + + If you want to use zencoding only in some modes, set an mode option: + + let g:user_zen_mode='n' "only enable normal mode functions, or + let g:user_zen_mode='inv' "enable all functions, which is equal to + let g:user_zen_mode='a' "enable all function in all mode. + +============================================================================== +LINKS *zencoding-links* + +zen-coding official site: + http://code.google.com/p/zen-coding/ + +zencoding.vim: + http://mattn.github.com/zencoding-vim + +development repository: + https://github.com/mattn/zencoding-vim + +my blog posts about zencoding-vim: + http://mattn.kaoriya.net/software/vim/20100222103327.htm + http://mattn.kaoriya.net/software/vim/20100306021632.htm + +japanese blog posts about zencoding-vim: + http://d.hatena.ne.jp/idesaku/20100424/1272092255 + http://d.hatena.ne.jp/griefworker/20110118/vim_zen_coding + http://d.hatena.ne.jp/sakurako_s/20110126/1295988873 + http://looxu.blogspot.jp/2010/02/zencodingvimhtml.html + +tutorial traslated in chinese: + http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html + +============================================================================== +TODO *zencoding-todo* + * wrapping inline selected. + * more documents. + * more contributor. + * more time to improve zencodig.vim. + +============================================================================== +vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0: diff --git a/sources_forked/zencoding/plugin/zencoding.vim b/sources_forked/zencoding/plugin/zencoding.vim new file mode 100755 index 00000000..e627653d --- /dev/null +++ b/sources_forked/zencoding/plugin/zencoding.vim @@ -0,0 +1,215 @@ +"============================================================================= +" File: zencoding.vim +" Author: Yasuhiro Matsumoto +" Last Change: 13-Feb-2013. +" Version: 0.75 +" WebPage: http://github.com/mattn/zencoding-vim +" Description: vim plugins for HTML and CSS hi-speed coding. +" SeeAlso: http://code.google.com/p/zen-coding/ +" Usage: +" +" This is vim script support expanding abbreviation like zen-coding. +" ref: http://code.google.com/p/zen-coding/ +" +" Type abbreviation +" +------------------------------------- +" | html:5_ +" +------------------------------------- +" "_" is a cursor position. and type "," (Ctrl+y and Comma) +" NOTE: Don't worry about key map. you can change it easily. +" +------------------------------------- +" | +" | +" | +" | +" | +" | +" | +" | _ +" | +" | +" +------------------------------------- +" Type following +" +------------------------------------- +" | div#foo$*2>div.bar +" +------------------------------------- +" And type "," +" +------------------------------------- +" |
    +" |
    _
    +" |
    +" |
    +" |
    +" |
    +" +------------------------------------- +" +" Tips: +" +" You can customize behavior of expanding with overriding config. +" This configuration will be marged at loading plugin. +" +" let g:user_zen_settings = { +" \ 'indentation' : ' ', +" \ 'perl' : { +" \ 'aliases' : { +" \ 'req' : 'require ' +" \ }, +" \ 'snippets' : { +" \ 'use' : "use strict\nuse warnings\n\n", +" \ 'warn' : "warn \"|\";", +" \ } +" \ } +" \} +" +" You can set language attribute in html using 'zen_settings.lang'. +" +" GetLatestVimScripts: 2981 1 :AutoInstall: zencoding.vim +" script type: plugin + +if &cp || (exists('g:loaded_zencoding_vim') && g:loaded_zencoding_vim) + finish +endif +let g:loaded_zencoding_vim = 1 + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:zencoding_debug') + let g:zencoding_debug = 0 +endif + +if !exists('g:zencoding_curl_command') + let g:zencoding_curl_command = 'curl -s -L -A Mozilla/5.0' +endif + +if exists('g:use_zen_complete_tag') && g:use_zen_complete_tag + setlocal omnifunc=zencoding#CompleteTag +endif + +if !exists('g:user_zen_leader_key') + let g:user_zen_leader_key = '' +endif + +function! s:install_plugin_i() + for item in [ + \ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': 'u:call zencoding#expandAbbr(0,"")a'}, + \ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': 'u:call zencoding#expandAbbr(1,"")a'}, + \ {'mode': 'i', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardInsert', 'func': ':call zencoding#balanceTag(1)'}, + \ {'mode': 'i', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardInsert', 'func': ':call zencoding#balanceTag(-1)'}, + \ {'mode': 'i', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zencoding#moveNextPrev(0)'}, + \ {'mode': 'i', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': ':call zencoding#moveNextPrev(1)'}, + \ {'mode': 'i', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()a'}, + \ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()a'}, + \ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': ':call zencoding#splitJoinTag()'}, + \ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()a'}, + \ {'mode': 'i', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)a'}, + \ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)a'}, + \] + + if !hasmapto(''.item.plug, item.mode) + exe item.mode . 'noremap ' . item.plug . ' ' . item.func + endif + if !exists('g:' . item.var) + endif + if exists('g:' . item.var) + let key = eval('g:' . item.var) + else + let key = g:user_zen_leader_key . item.key + endif + if len(maparg(key, item.mode)) == 0 + exe item.mode . 'map ' . key . ' ' . item.plug + endif + endfor +endfunction + +function! s:install_plugin_n() + for item in [ + \ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3,"")'}, + \ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1,"")'}, + \ {'mode': 'n', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardNormal', 'func': ':call zencoding#balanceTag(1)'}, + \ {'mode': 'n', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardNormal', 'func': ':call zencoding#balanceTag(-1)'}, + \ {'mode': 'n', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zencoding#moveNextPrev(0)'}, + \ {'mode': 'n', 'var': 'user_zen_prev_key', 'key': 'N', 'plug': 'ZenCodingPrev', 'func': ':call zencoding#moveNextPrev(1)'}, + \ {'mode': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()'}, + \ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()'}, + \ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()'}, + \ {'mode': 'n', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()'}, + \ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)'}, + \ {'mode': 'n', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)'}, + \] + + if !hasmapto(''.item.plug, item.mode) + exe item.mode . 'noremap ' . item.plug . ' ' . item.func + endif + if !exists('g:' . item.var) + endif + if exists('g:' . item.var) + let key = eval('g:' . item.var) + else + let key = g:user_zen_leader_key . item.key + endif + if len(maparg(key, item.mode)) == 0 + exe item.mode . 'map ' . key . ' ' . item.plug + endif + endfor +endfunction + +function! s:install_plugin_v() + for item in [ + \ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2,"")'}, + \ {'mode': 'v', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardVisual', 'func': ':call zencoding#balanceTag(2)'}, + \ {'mode': 'v', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardVisual', 'func': ':call zencoding#balanceTag(-2)'}, + \ {'mode': 'v', 'var': 'user_zen_mergelines_key', 'key': 'm', 'plug': 'ZenCodingMergeLines', 'func': ':call zencoding#mergeLines()'}, + \ {'mode': 'v', 'var': 'user_zen_codepretty_key', 'key': 'c', 'plug': 'ZenCodingCodePretty', 'func': ':call zencoding#codePretty()'}, + \] + + if !hasmapto(''.item.plug, item.mode) + exe item.mode . 'noremap ' . item.plug . ' ' . item.func + endif + if !exists('g:' . item.var) + endif + if exists('g:' . item.var) + let key = eval('g:' . item.var) + else + let key = g:user_zen_leader_key . item.key + endif + if len(maparg(key, item.mode)) == 0 + exe item.mode . 'map ' . key . ' ' . item.plug + endif + endfor +endfunction + + +if exists('g:user_zen_mode') + let imode = matchstr(g:user_zen_mode, '[ai]') + let nmode = matchstr(g:user_zen_mode, '[an]') + let vmode = matchstr(g:user_zen_mode, '[av]') + + if !empty(imode) + call s:install_plugin_i() + endif + + if !empty(nmode) + call s:install_plugin_n() + endif + + if !empty(vmode) + call s:install_plugin_v() + endif +else + call s:install_plugin_i() + call s:install_plugin_n() + call s:install_plugin_v() +endif + + +delfunction s:install_plugin_i +delfunction s:install_plugin_n +delfunction s:install_plugin_v + +command! -nargs=1 Zen call zencoding#expandAbbr(4, ) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:set et: diff --git a/sources_forked/zencoding/unittest.vim b/sources_forked/zencoding/unittest.vim new file mode 100755 index 00000000..c4fcc3d2 --- /dev/null +++ b/sources_forked/zencoding/unittest.vim @@ -0,0 +1,794 @@ +let s:sfile = expand('') + +function! s:reload(d) + exe "so" a:d."/plugin/zencoding.vim" + for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n") + silent! exe "so" f + endfor +endfunction + +function! s:show_type(type) + echohl Search | echon "[" a:type "]\n" | echohl None + echo "\r" +endfunction + +function! s:show_category(category) + echohl MatchParen | echon "[" a:category "]\n" | echohl None + echo "\r" +endfunction + +function! s:show_pass(pass) + echohl Title | echo "pass".a:pass."\n" | echohl None +endfunction + +function! s:show_done() + echohl IncSearch | echo "done" | echohl None +endfunction + +function! s:escape(str) + let str = a:str + let str = substitute(str, "\n", '\\n', 'g') + let str = substitute(str, "\t", '\\t', 'g') + return str +endfunction + +function! s:show_title(no, title) + let title = s:escape(a:title) + let width = &columns - 23 + echohl MoreMsg | echon "\rtesting #".printf("%03d", a:no) + echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... ' +endfunction + +function! s:show_skip(no, title) + let title = s:escape(a:title) + let width = &columns - 23 + echohl WarningMsg | echon "\rskipped #".printf("%03d", a:no) + echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... ' + echo "" +endfunction + +function! s:show_ok() + echohl Title | echon "ok\n" | echohl None + echo "" +endfunction + +function! s:show_ng(no, expect, got) + echohl WarningMsg | echon "ng\n" | echohl None + echohl ErrorMsg | echo "failed test #".a:no | echohl None + set more + echohl WarningMsg | echo printf("expect(%d):", len(a:expect)) | echohl None + echo join(split(a:expect, "\n", 1), "|\n") + echohl WarningMsg | echo printf("got(%d):", len(a:got)) | echohl None + echo join(split(a:got, "\n", 1), "|\n") + let cs = split(a:expect, '\zs') + for c in range(len(cs)) + if c < len(a:got) + if a:expect[c] != a:got[c] + echohl WarningMsg | echo "differ at:" | echohl None + echo a:expect[c :-1] + break + endif + endif + endfor + echo "" + throw "stop" +endfunction + +function! s:test(...) + let type = get(a:000, 0, '') + let name = get(a:000, 1, '') + let index = get(a:000, 2, '') + + let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'"))) + for testgroup in testgroups + if len(type) > 0 && testgroup.type != type | continue | endif + call s:show_type(testgroup.type) + for category in testgroup.categories + if len(name) > 0 && substitute(category.name,' ','_','g') != name | continue | endif + call s:show_category(category.name) + let tests = category.tests + let start = reltime() + for n in range(len(tests)) + if len(index) > 0 && n != index | continue | endif + let query = tests[n].query + let result = tests[n].result + if has_key(tests[n], 'skip') && tests[n].skip != 0 + call s:show_skip(n+1, query) + continue + endif + if stridx(query, '$$$$') != -1 + silent! 1new + silent! exe "setlocal ft=".testgroup.type + silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$') + if len(key) > 0 + exe printf('let key = "%s"', key) + else + let key = "\," + endif + silent! let query = substitute(query, '\$\$\$\$.*\$\$\$\$', '$$$$', '') + silent! call setline(1, split(query, "\n")) + let cmd = "normal gg0/\\$\\$\\$\\$\ri\\\\".key + if stridx(result, '$$$$') != -1 + let cmd .= '$$$$' + endif + silent! exe cmd + unlet! res | let res = join(getline(1, line('$')), "\n") + silent! bw! + call s:show_title(n+1, query) + else + call s:show_title(n+1, query) + unlet! res | let res = zencoding#ExpandWord(query, testgroup.type, 0) + endif + if stridx(result, '$$$$') != -1 + if res ==# result + call s:show_ok() + else + call s:show_ng(n+1, result, res) + endif + else + if res ==# result + call s:show_ok() + else + call s:show_ng(n+1, result, res) + endif + endif + endfor + call s:show_pass(reltimestr(reltime(start))) + endfor + endfor +endfunction + +function! s:do_tests(...) + try + if exists('g:user_zen_settings') + let s:old_user_zen_settings = g:user_zen_settings + let g:user_zen_settings = { 'indentation': "\t" } + endif + let oldmore = &more + call s:reload(fnamemodify(s:sfile, ':h')) + let &more = 0 + call call('s:test', a:000) + call s:show_done() + catch + echohl ErrorMsg | echomsg v:exception | echohl None + finally + let &more=oldmore + if exists('g:user_zen_settings') + let g:user_zen_settings = s:old_user_zen_settings + endif + endtry +endfunction + +function! g:zencoding_unittest_complete(arglead, cmdline, cmdpos) + let args = split(a:cmdline, '\s\+', 1) + let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'"))) + try + if len(args) == 2 + return filter(map(testgroups, 'v:val.type'), 'stridx(v:val,args[1])!=-1') + elseif len(args) == 3 + return map(filter(testgroups, 'v:val.type==args[1]')[0].categories, 'substitute(v:val.name," ","_","g")') + endif + catch + endtry + return [] +endfunction + +command! -nargs=* -complete=customlist,g:zencoding_unittest_complete ZenCodingUnitTest call s:do_tests() +if s:sfile == expand('%:p') + ZenCodingUnitTest +endif + +finish +[ +{ + 'type': "html", + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div", + 'result': "
    \n", + }, + { + 'query': "div#wrapper", + 'result': "
    \n", + }, + { + 'query': "div.box", + 'result': "
    \n", + }, + { + 'query': "a[title=TITLE]", + 'result': "\n", + }, + { + 'query': "div#wrapper.box", + 'result': "
    \n", + }, + { + 'query': "div#wrapper.box.current", + 'result': "
    \n", + }, + { + 'query': "div#wrapper.box.current[title=TITLE rel]", + 'result': "
    \n", + }, + { + 'query': "div#main+div#sub", + 'result': "
    \n
    \n", + }, + { + 'query': "div#main>div#sub", + 'result': "
    \n\t
    \n
    \n", + }, + { + 'query': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a", + 'result': "\n\n\n\t\n\t\n\n\n\t
    \n\t\t
    \n\t\t
      \n\t\t\t
    • \n\t\t\t
    • \n\t\t\t
    • \n\t\t\t
    • \n\t\t\t
    • \n\t\t
    \n\t
    \n\t\n\n", + }, + { + 'query': "ol>li*2", + 'result': "
      \n\t
    1. \n\t
    2. \n
    \n", + }, + { + 'query': "a", + 'result': "\n", + }, + { + 'query': "obj", + 'result': "\n", + }, + { + 'query': "cc:ie6>p+blockquote#sample$.so.many.classes*2", + 'result': "", + }, + { + 'query': "html:4t>div#wrapper>div#header+div#contents+div#footer", + 'result': "\n\n\n\t\n\t\n\n\n\t
    \n\t\t
    \n\t\t
    \n\t\t
    \n\t
    \n\t\n\n", + }, + { + 'query': "a[href=http://www.google.com/].foo#hoge", + 'result': "\n", + }, + { + 'query': "a[href=http://www.google.com/]{Google}", + 'result': "Google\n", + }, + { + 'query': "{ZenCoding}", + 'result': "ZenCoding", + }, + { + 'query': "a+b", + 'result': "\n\n", + }, + { + 'query': "a>b>i\n", + }, + { + 'query': "a>b>i^b", + 'result': "\n", + }, + { + 'query': "a>b>i<\n\n", + }, + { + 'query': "a>b>i^^b", + 'result': "\n\n", + }, + { + 'query': "blockquote>b>i<\n\n", + }, + { + 'query': "blockquote>b>i^^b", + 'result': "
    \n\n", + }, + { + 'query': "a[href=foo][class=bar]", + 'result': "\n", + }, + { + 'query': "a[a=b][b=c=d][e]{foo}*2", + 'result': "foo\nfoo\n", + }, + { + 'query': "a[a=b][b=c=d][e]*2{foo}", + 'result': "\n\nfoo", + }, + { + 'query': "a*2{foo}a", + 'result': "\n\nfoo\n", + }, + { + 'query': "a{foo}*2>b", + 'result': "foo\nfoo\n", + }, + { + 'query': "a*2{foo}>b", + 'result': "\n\nfoo", + }, + { + 'query': "table>tr>td.name#foo+td*3", + 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n
    \n", + }, + { + 'query': "div#header + div#footer", + 'result': "
    \n
    \n", + }, + { + 'query': "#header + div#footer", + 'result': "
    \n
    \n", + }, + { + 'query': "#header > ul > li < p{Footer}", + 'result': "
    \n\t
      \n\t\t
    • \n\t
    \n\t

    Footer

    \n
    \n", + }, + { + 'query': "#header > ul > li ^ p{Footer}", + 'result': "
    \n\t
      \n\t\t
    • \n\t
    \n\t

    Footer

    \n
    \n", + }, + { + 'query': "a#foo$$$*3", + 'result': "\n\n\n", + }, + { + 'query': "ul+", + 'result': "
      \n\t
    • \n
    \n", + }, + { + 'query': "table+", + 'result': "\n\t\n\t\t\n\t\n
    \n", + }, + { + 'query': "#header>li<#content", + 'result': "
    \n\t
  • \n
    \n
    \n", + }, + { + 'query': "#header>li^#content", + 'result': "
    \n\t
  • \n
    \n
    \n", + }, + { + 'query': "(#header>li)<#content", + 'result': "
    \n\t
  • \n
    \n
    \n", + }, + { + 'query': "(#header>li)^#content", + 'result': "
    \n\t
  • \n
    \n
    \n", + }, + { + 'query': "a>b>i<\n
    \n", + }, + { + 'query': "a>b>i^^div", + 'result': "\n
    \n", + }, + { + 'query': "(#header>h1)+#content+#footer", + 'result': "
    \n\t

    \n
    \n
    \n
    \n", + }, + { + 'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)", + 'result': "
    \n\t

    \n
    \n
    \n\t
    \n\t\t

    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t
    \n\t
    \n
    \n
    \n\t
    \n
    \n", + }, + { + 'query': "(div>(ul*2)*2)+(#utilities)", + 'result': "
    \n\t
      \n\t
        \n\t
          \n\t
            \n
            \n
            \n", + }, + { + 'query': "table>(tr>td*3)*4", + 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n
            \n", + }, + { + 'query': "(((a#foo+a#bar)*2)*3)", + 'result': "\n\n\n\n\n\n\n\n\n\n\n\n", + }, + { + 'query': "div#box$*3>h3+p*2", + 'result': "
            \n\t

            \n\t

            \n\t

            \n
            \n
            \n\t

            \n\t

            \n\t

            \n
            \n
            \n\t

            \n\t

            \n\t

            \n
            \n" + }, + { + 'query': "div#box.foo$$$.bar$$$*3", + 'result': "
            \n
            \n
            \n", + }, + { + 'query': "div#box$*3>h3+p.bar*2|e", + 'result': "<div id=\"box1\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box2\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box3\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n", + }, + { + 'query': "div>div#page>p.title+p|c", + 'result': "
            \n\t\n\t
            \n\t\t\n\t\t

            \n\t\t\n\t\t

            \n\t
            \n\t\n
            \n", + }, + { + 'query': "link:css", + 'result': "\n", + }, + { + 'query': "a[title=\"Hello', world\" rel]", + 'result': "\n", + }, + { + 'query': "div>a#foo{bar}", + 'result': "\n", + }, + { + 'query': ".content{Hello!}", + 'result': "
            Hello!
            \n", + }, + { + 'query': "div.logo+(div#navigation)+(div#links)", + 'result': "
            \n
            \n
            \n", + }, + { + 'query': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}", + 'result': "

            header

            \nTextlinktext\nagain some textclick me!\nsome final text", + }, + { + 'query': "a{&}+div{&&}", + 'result': "&\n
            &&
            \n", + }, + { + 'query': "span$$$$\\,$$$$", + 'result': "", + }, + { + 'query': "foo span$$$$\\,$$$$", + 'result': "foo ", + }, + { + 'query': "foo span$$$$\\,$$$$ bar", + 'result': "foo bar", + }, + { + 'query': "foo $$$$\\ve\\,p\\$$$$bar baz", + 'result': "foo

            bar

            baz", + }, + { + 'query': "foo $$$$\\vee\\,p\\$$$$bar baz", + 'result': "foo

            bar baz

            ", + }, + { + 'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$", + 'result': "f
            \n\t
            \n\t\t
            \n\t\t\t
            \n\t\t\t\t

            aaa

            \n\t\t\t\t

            bbb

            \n\t\t\t
            \n\t\t\t

            ccc

            \n\t\t
            \n\t
            \n
            ", + }, + { + 'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})", + 'result': "
            \n\t
            \n\t\t
            \n\t\t\t

            a

            \n\t\t\t

            b

            \n\t\t
            \n\t
            \n\t
            \n\t\t
            \n\t\t\t

            c

            \n\t\t\t

            d

            \n\t\t\t

            e

            \n\t\t\t
            \n\t\t\t\t

            f

            \n\t\t\t\t

            g

            \n\t\t\t
            \n\t\t\t

            h

            \n\t\t
            \n\t
            \n
            \n", + }, + { + 'query': "(div>(label+input))+div", + 'result': "
            \n\t\n\t\n
            \n
            \n", + }, + { + 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,ul>li>span*>a\\$$$$", + 'result': "", + }, + { + 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,input[type=input value=$#]*\\$$$$", + 'result': "\n\n", + }, + { + 'query': "div#id-$*5>div#id2-$", + 'result': "
            \n\t
            \n
            \n
            \n\t
            \n
            \n
            \n\t
            \n
            \n
            \n\t
            \n
            \n
            \n\t
            \n
            \n", + }, + { + 'query': "{test case $ }*3", + 'result': "test case 1 test case 2 test case 3 ", + }, + { + 'query': "{test case $${nr}}*3", + 'result': "test case 1\ntest case 2\ntest case 3\n", + }, + { + 'query': "{test case \\$ }*3", + 'result': "test case $ test case $ test case $ ", + }, + { + 'query': "{test case $$$ }*3", + 'result': "test case 001 test case 002 test case 003 ", + }, + { + 'query': "a[title=$#]{foo}", + 'result': "foo\n", + }, + ], + }, + { + 'name': 'split join tag', + 'tests': [ + { + 'query': "
            \n\t$$$$\\j$$$$\n
            ", + 'result': "
            \n\t\n
            ", + }, + { + 'query': "
            \n\tj$$$$/>\n
            ", + 'result': "
            \n\t\n
            ", + }, + ], + }, + { + 'name': 'toggle comment', + 'tests': [ + { + 'query': "
            \n\t$$$$\\/$$$$\n
            ", + 'result': "
            \n\t\n
            ", + }, + { + 'query': "
            \n\t\n
            ", + 'result': "
            \n\t\n
            ", + }, + ], + }, + { + 'name': 'image size', + 'tests': [ + { + 'query': "img[src=http://mattn.kaoriya.net/images/logo.png]$$$$\\,\\i$$$$", + 'result': "\"\"", + }, + { + 'query': "img[src=/logo.png]$$$$\\,\\i$$$$", + 'result': "\"\"", + }, + ], + }, + { + 'name': 'move next prev', + 'tests': [ + { + 'query': "foo+bar+baz[dankogai=\"\"]$$$$\\,\\gg0\\n\\n\\n\\Byw:%d _\\p$$$$", + 'result': "dankogai", + }, + ], + }, + ], +}, +{ + 'type': 'css', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "@i", + 'result': "@import url();", + }, + { + 'query': "fs:n", + 'result': "font-style: normal;", + }, + { + 'query': "fl:l|fc", + 'result': "float: left;", + }, + { + 'query': "bg+$$$$", + 'result': "background: #FFF url($$$$) 0 0 no-repeat;", + }, + { + 'query': "bg+!$$$$", + 'result': "background: #FFF url($$$$) 0 0 no-repeat !important;", + }, + { + 'query': "m$$$$", + 'result': "margin: $$$$;", + }, + { + 'query': "m0.1p$$$$", + 'result': "margin: 0.1%;", + }, + { + 'query': "m1.0$$$$", + 'result': "margin: 1.0em;", + }, + { + 'query': "m2$$$$", + 'result': "margin: 2px;", + }, + { + 'query': "bdrs10$$$$", + 'result': "border-radius: 10px;", + }, + { + 'query': "-bdrs20$$$$", + 'result': "-webkit-border-radius: 20px;\n-moz-border-radius: 20px;\nborder-radius: 20px;", + }, + { + 'query': "lg(top,#fff,#000)$$$$", + 'result': "background-image: -webkit-gradient(top, 0 0, 0 100, from(#fff), to(#000));\nbackground-image: -webkit-linear-gradient(#fff, #000);\nbackground-image: -moz-linear-gradient(#fff, #000);\nbackground-image: -o-linear-gradient(#fff, #000);\nbackground-image: linear-gradient(#fff, #000);\n", + }, + { + 'query': "m10-5-0$$$$", + 'result': "margin: 10px 5px 0px;", + }, + { + 'query': "m-10--5$$$$", + 'result': "margin: -10px -5px;", + }, + { + 'query': "m10-auto$$$$", + 'result': "margin: 10px auto;", + }, + { + 'query': "w100p$$$$", + 'result': "width: 100%;", + }, + { + 'query': "h50e$$$$", + 'result': "height: 50em;", + }, + { + 'query': "(bg+)+c$$$$", + 'result': "background: #FFF url($$$$) 0 0 no-repeat;\ncolor: #000;", + }, + ], + }, + ], +}, +{ + 'type': 'haml', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", + 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + }, + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml", + 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + }, + { + 'query': "a*3|haml", + 'result': "%a{ :href => \"\" }\n%a{ :href => \"\" }\n%a{ :href => \"\" }\n", + }, + { + 'query': ".content{Hello!}|haml", + 'result': "%div.content Hello!\n", + }, + { + 'query': "a[title=$#]{foo}", + 'result': "%a{ :href => \"\", :title => \"foo\" } foo\n", + }, + ], + }, + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "%a foo\n bar$$$$\\j$$$$", + 'result': "%a ", + }, + { + 'query': "$$$$\\j$$$$%a ", + 'result': "%a $$$$", + }, + ], + }, + { + 'name': 'toggle comment', + 'tests': [ + { + 'query': "%a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", + 'result': "-# %a{ :href => \"http://www.google.com\" } hello", + }, + { + 'query': "-# %a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", + 'result': "%a{ :href => \"http://www.google.com\" } hello", + }, + ], + }, + ], +}, +{ + 'type': 'slim', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", + 'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n", + }, + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim", + 'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n", + }, + { + 'query': "a*3|slim", + 'result': "a href=\"\"\na href=\"\"\na href=\"\"\n", + }, + { + 'query': ".content{Hello!}|slim", + 'result': "div class=\"content\"\n | Hello!\n", + }, + { + 'query': "a[title=$#]{foo}", + 'result': "a href=\"\" title=\"foo\"\n | foo\n", + }, + ], + }, + { + 'name': 'split join tag', + 'tests': [ + { + 'query': "a\n | foo$$$$\\j$$$$", + 'result': "a", + }, + { + 'query': "a$$$$\\j$$$$", + 'result': "a\n | $$$$", + }, + ], + }, + { + 'name': 'toggle comment', + 'tests': [ + { + 'query': "a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", + 'result': "/a href=\"http://www.google.com\"\n | hello", + }, + { + 'query': "/a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", + 'result': "a href=\"http://www.google.com\"\n | hello", + }, + ], + }, + ], +}, +{ + 'type': 'xsl', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "vari", + 'result': "\n", + }, + { + 'query': "ap>wp", + 'result': "\n\t\n\n", + }, + ], + }, + ], +}, +{ + 'type': 'xsd', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "xsd:w3c", + 'result': "\n\n\t\n", + }, + ], + }, + ], +}, +{ + 'type': 'mustache', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div#{{foo}}", + 'result': "
            \n", + }, + { + 'query': "div.{{foo}}", + 'result': "
            \n", + }, + ], + }, + ], +}, +] +" vim:set et: diff --git a/sources_forked/zencoding/zencoding.vim.vimup b/sources_forked/zencoding/zencoding.vim.vimup new file mode 100755 index 00000000..72608e48 --- /dev/null +++ b/sources_forked/zencoding/zencoding.vim.vimup @@ -0,0 +1,265 @@ +script_name: ZenCoding.vim +script_id: '2981' +script_type: utility +script_package: zencoding-vim.zip +script_version: '0.80' +required_vim_version: '7.0' +summary: vim plugins for HTML and CSS hi-speed coding. + +detailed_description: | + + This is vim script support expanding abbreviation like zen-coding. + ref: http://code.google.com/p/zen-coding/ + + There is a movie using zencoding.vim + ref: http://mattn.github.com/zencoding-vim + + Source Repository. + ref: http://github.com/mattn/zencoding-vim + + Type abbreviation + +------------------------------------- + | html:5_ + +------------------------------------- + "_" is a cursor position. and type "," (Ctrl + y and Comma) + NOTE: Don't worry about key map. you can change it easily. + +------------------------------------- + | + | + | + | + | + | + | + | _ + | + | + +------------------------------------- + Type following + +------------------------------------- + | div#foo$*2>div.bar + +------------------------------------- + And type "," + +------------------------------------- + |
            + |
            _
            + |
            + |
            + |
            + |
            + | _ + +------------------------------------- + + Tutorial: + + http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL + + How work this: + + http://mattn.github.com/zencoding-vim + + Tips: + + You can customize behavior of expanding with overriding config. + This configuration will be marged at loading plugin. + + let g:user_zen_settings = { + \ 'indentation' : ' ', + \ 'perl' : { + \ 'aliases' : { + \ 'req' : 'require ' + \ }, + \ 'snippets' : { + \ 'use' : "use strict\nuse warnings\n\n", + \ 'warn' : "warn \"|\";", + \ } + \ } + \} + + let g:user_zen_expandabbr_key = '' + + let g:use_zen_complete_tag = 1 + + You can set language attribute in html using zen_settings['lang']. + +install_details: | + + # cd ~/.vim + # unzip zencoding-vim.zip + + or if you install pathogen.vim: + + # cd ~/.vim/bundle # or make directory + # unzip /path/to/zencoding-vim.zip + + if you get sources from repository: + + # cd ~/.vim/bundle # or make directory + # git clone http://github.com/mattn/zencoding-vim.git + +versions: +- '0.80': | + This is an upgrade for ZenCoding.vim: add emmet features. +- '0.74': | + This is an upgrade for ZenCoding.vim: many bug fixes. +- '0.73': | + This is an upgrade for ZenCoding.vim: many bug fixes. and support slim format (experimental). +- '0.72': | + This is an upgrade for ZenCoding.vim: + [fix] fix finding tokens. +- '0.71': | + This is an upgrade for ZenCoding.vim: + [fix] fix finding begin of tokens. +- '0.70': | + This is an upgrade for ZenCoding.vim: + [mod] Changed behavior of expanding. "div div>a|" should keep first div element. + [add] Supported slim formatter. +- '0.60': | + This is an upgrade for ZenCoding.vim: + [fix] fixed expanding {{}}. +- '0.59': | + This is an upgrade for ZenCoding.vim: + [fix] fixed toggleComment and mny bugs. +- '0.58': | + This is an upgrade for ZenCoding.vim: + [fix] fixed 'foo+' style expandos. +- '0.57': | + This is an upgrade for ZenCoding.vim: + [fix] fixed expandos that don't work 'choose' in xsl. +- '0.56': | + This is an upgrade for ZenCoding.vim: + [fix] fixed contents parser. +- '0.55': | + uploaded again: sorry, files was old. +- '0.54': | + [add] support sass, xsd. + [fix] expanding with html tag. + uploaded again: sorry, fileformat was DOS. +- '0.53': | + [fix] gif width/height was swapped. +- '0.52': | + [fix] broken wrap expanding. +- '0.51': | + This is an upgrade for ZenCoding.vim: + [fix] wrap expanding with '&'. + [fix] expand .content to class="content". + [fix] haml expanding. + [fix] bg+ snippet +- '0.50': | + This is an upgrade for ZenCoding.vim: + [fix] fixed parsing '#{{foo}}' and '.{{bar}}'. +- '0.49': | + This is an upgrade for ZenCoding.vim: + [doc] add help manual. +- '0.48': | + This is an upgrade for ZenCoding.vim: + [fix] install mappings to global. +- '0.47': | + This is an upgrade for ZenCoding.vim: + [drastic changes] enable autoload. you should whole replace older files. + package was empty. upload again. +- '0.46': | + This is an upgrade for ZenCoding.vim: + [drastic changes] enable autoload. you should whole replace older files. +- '0.45': | + This is an upgrade for ZenCoding.vim: + fixed attribute parsing like: a[href="hello', world" rel]. +- '0.44': | + This is an upgrade for ZenCoding.vim: + fixed checking whether have mapping using maparg() / hasmapto(). +- '0.43': | + This is an upgrade for ZenCoding.vim: + fixed behavior for nested block. like "html:5>#page>(header#globalHeader>(hgroup>h1+h2)+(nav>ul>li*3>a)+(form>p.siteSearch>input+input[type=button]))+(#contents>(#main>(section>h2+p*5)+p.pagetop>a[href=#page])+(#sub>p+(nav>ul>li>a)))+(footer#globalFoooter>(ul>li>a)+(p.copyright>small))" +- '0.42': | + This is an upgrade for ZenCoding.vim: + fixed select/option indent. +- '0.41': | + This is an upgrade for ZenCoding.vim: + fixed default filter. when using 'e' filter, output become empty. +- '0.40': | + This is an upgrade for ZenCoding.vim: + add the pure vimscript code for 'get image size'. you can use it without perl interface just now. + change key assign of ZenCodingExpandWord from ',' to ';'. it don't effect to most users. +- '0.39': | + This is an upgrade for ZenCoding.vim: fixed problem about 'selection'. see http://github.com/mattn/zencoding-vim/issues/#issue/2 +- '0.38': | + This is an upgrade for ZenCoding.vim: use v7h"_s instead of v7hs for backspace. +- '0.37': | + This is an upgrade for ZenCoding.vim: fixed problem that won't working with some 'backspace' options. +- '0.36': | + This is an upgrade for ZenCoding.vim: fixed problem that filter does not work. +- '0.35': | + This is an upgrade for ZenCoding.vim: enable zencoding for other languages. (meaning php also) +- '0.34': | + This is an upgrade for ZenCoding.vim: enable zencoding for xsl. (you should add ~/.vim/ftplugin/xslt/zencoding.vim) +- '0.33': | + This is an upgrade for ZenCoding.vim: fixed problem breaking multibyte when cursor is in a part of line. enabled zencoding for javascript in html. +- '0.32': | + This is an upgrade for ZenCoding.vim: fixed indentation. supported extends so that you can enable zencoding for php/xhtml/haml other's section 14 in http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL +- '0.31': | + This is an upgrade for ZenCoding.vim: fixed indentation and $$$ problem. fixed about missing support multiple classes. +- '0.30': | + This is an upgrade for ZenCoding.vim: Fixed key assign. +- '0.29': | + This is an upgrade for ZenCoding.vim: Changed leading key to '' from ''. +- '0.28': | + This is an upgrade for ZenCoding.vim: supported 'Balance Tag Inward/Outward', 'Go to Next/Previous Edit Point', 'Update Size', 'Remove Tag', 'Split/Join Tag', 'Toggle Comment' +- '0.27': | + This is an upgrade for ZenCoding.vim: fixed problem that can't work on the part of multibyte characters. fixed inline elements behavior. +- '0.26': | + This is an upgrade for ZenCoding.vim: The count of '(((a#foo + a#bar)*2)*3)' should be 12. +- '0.25': | + This is an upgrade for ZenCoding.vim: store undo before working. good luck about 'table>(tr>td*3)*4'. +- '0.24': | + This is an upgrade for ZenCoding.vim: fixed behavior of parsing area of visual selection. +- '0.23': | + This is an upgrade for ZenCoding.vim: pre-expand '#header>li<#content' to 'div#header>lili'. fix undo ring. support visual selection. when type trigger key on visual select, it request you leader like 'ul>li'. if you give 'ul>li*' as leader, you'll get each separate 'ul>li' tags. and when you give 'blockquote' as leader, you'll get blocked text. +- '0.21': | + This is an upgrade for ZenCoding.vim: treat xhtml as html. +- '0.20': | + This is an upgrade for ZenCoding.vim: add option use_zen_complete_tag for complete abbr. +- '0.19': | + This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly. +- '0.18': | + This is an upgrade for ZenCoding.vim: ignore duplicate key map. +- '0.17': | + This is an upgrade for ZenCoding.vim: fixed key map. +- '0.16': | + This is an upgrade for ZenCoding.vim: fixed problem 'endless loop'. +- '0.15': | + This is an upgrade for ZenCoding.vim: set default filetype to 'html'. +- '0.14': | + This is an upgrade for ZenCoding.vim: fixed tag name like 'fs:n' in 'css'. +- '0.14': | + This is an upgrade for ZenCoding.vim: indentation for each languages. +- '0.13': | + This is an upgrade for ZenCoding.vim: user key map. +- '0.12': | + This is an upgrade for ZenCoding.vim: few extensive notation. +- '0.11': | + This is an upgrade for ZenCoding.vim: fixed indent. +- '0.10': | + This is an upgrade for ZenCoding.vim: fixed behavior of '+' operator +- '0.9': | + This is an upgrade for ZenCoding.vim: fixed single line behavior +- '0.8': | + This is an upgrade for ZenCoding.vim: support 'a[href=http://www.google.com]{Google}' +- '0.7': | + This is an upgrade for ZenCoding.vim: fixed behavior in 'a+b'. +- '0.6': | + This is an upgrade for ZenCoding.vim: fixed strange behavior about 'b_'. +- '0.5': | + This is an upgrade for ZenCoding.vim: recover rest part in line. +- '0.4': | + This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement. +- '0.3': | + This is an upgrade for ZenCoding.vim: fixed line expanding. +- '0.2': | + This is an upgrade for ZenCoding.vim: fixed problem that moving cursor with expanding. +- '0.1': | + Initial upload + +# __END__ +# vim: filetype=yaml diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index 50d23686..e7182452 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -18,9 +18,13 @@ Install on Debian / Ubuntu with: sudo apt-get install ack-grep -For Debian / Ubuntu you can add this line into your .vimrc: +Install on Fedora with: - let g:ackprg="ack-grep -H --nocolor --nogroup --column" + su -l -c 'yum install ack' + +Install on openSUSE with: + + sudo zypper install ack Install on Gentoo with: @@ -34,10 +38,18 @@ Install with MacPorts: sudo port install p5-app-ack -Install with Gentoo Prefix +Install with Gentoo Prefix: emerge ack +Install on FreeBSD with: + + cd /usr/ports/textproc/p5-ack/ && make install clean + +You can specify a custom ack name and path in your .vimrc like so: + + let g:ackprg=" -H --nocolor --nogroup --column" + Otherwise, you are on your own. ### The Plugin @@ -75,6 +87,10 @@ Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ac See ack --help=types for a list of valid types. +### Gotchas ### + +Some characters have special meaning, and need to be escaped your search pattern. For instance, '#'. You have to escape it like this `:Ack '\\\#define foo'` to search for `#define foo`. (From [blueyed in issue #5](https://github.com/mileszs/ack.vim/issues/5).) + ### Keyboard Shortcuts ### In the quickfix window, you can use: @@ -83,6 +99,8 @@ In the quickfix window, you can use: go to preview file (open but maintain focus on ack.vim results) t to open in new tab T to open in new tab silently + h to open in horizontal split + H to open in horizontal split silently v to open in vertical split gv to open in vertical split silently q to close the quickfix window diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt index 683ef8d0..ec06da3a 100644 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -43,6 +43,16 @@ shows the results in a split window. directory) for filenames matching the {pattern}. Behaves just like the |:grep| command, but will open the |Quickfix| window for you. +:AckHelp[!] [options] {pattern} *:AckHelp* + + Search vim documentation files for the {pattern}. Behaves just like the + |:Ack| command, but searches only vim documentation .txt files + +:LAckHelp [options] {pattern} *:LAckHelp* + + Just like |:AckHelp| but instead of the |quickfix| list, matches are placed + in the current |location-list|. + Files containing the search term will be listed in the split window, along with the line number of the occurrence, once for each occurrence. on a line in this window will open the file, and place the cursor on the matching @@ -63,6 +73,10 @@ t open in a new tab. T open in new tab silently. +h open in horizontal split. + +H open in horizontal split silently. + v open in vertical split. gv open in vertical split silently. diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim index 55326182..ccd46861 100644 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -2,74 +2,112 @@ " in your path. " On Debian / Ubuntu: " sudo apt-get install ack-grep -" On your vimrc: -" let g:ackprg="ack-grep -H --nocolor --nogroup --column" -" " With MacPorts: " sudo port install p5-app-ack +" With Homebrew: +" brew install ack " Location of the ack utility if !exists("g:ackprg") - let g:ackprg="ack -H --nocolor --nogroup --column" + let s:ackcommand = executable('ack-grep') ? 'ack-grep' : 'ack' + let g:ackprg=s:ackcommand." -H --nocolor --nogroup --column" +endif + +if !exists("g:ack_apply_qmappings") + let g:ack_apply_qmappings = !exists("g:ack_qhandler") +endif + +if !exists("g:ack_apply_lmappings") + let g:ack_apply_lmappings = !exists("g:ack_lhandler") +endif + +if !exists("g:ack_qhandler") + let g:ack_qhandler="botright copen" +endif + +if !exists("g:ack_lhandler") + let g:ack_lhandler="botright lopen" endif function! s:Ack(cmd, args) - redraw - echo "Searching ..." + redraw + echo "Searching ..." - " If no pattern is provided, search for the word under the cursor - if empty(a:args) - let l:grepargs = expand("") - else - let l:grepargs = a:args - end + " If no pattern is provided, search for the word under the cursor + if empty(a:args) + let l:grepargs = expand("") + else + let l:grepargs = a:args . join(a:000, ' ') + end - " Format, used to manage column jump - if a:cmd =~# '-g$' - let g:ackformat="%f" - else - let g:ackformat="%f:%l:%c:%m" - end + " Format, used to manage column jump + if a:cmd =~# '-g$' + let g:ackformat="%f" + else + let g:ackformat="%f:%l:%c:%m" + end - let grepprg_bak=&grepprg - let grepformat_bak=&grepformat - try - let &grepprg=g:ackprg - let &grepformat=g:ackformat - silent execute a:cmd . " " . l:grepargs - finally - let &grepprg=grepprg_bak - let &grepformat=grepformat_bak - endtry + let grepprg_bak=&grepprg + let grepformat_bak=&grepformat + try + let &grepprg=g:ackprg + let &grepformat=g:ackformat + silent execute a:cmd . " " . escape(l:grepargs, '|') + finally + let &grepprg=grepprg_bak + let &grepformat=grepformat_bak + endtry - if a:cmd =~# '^l' - botright lopen - else - botright copen - endif + if a:cmd =~# '^l' + exe g:ack_lhandler + let l:apply_mappings = g:ack_apply_lmappings + else + exe g:ack_qhandler + let l:apply_mappings = g:ack_apply_qmappings + endif + if l:apply_mappings exec "nnoremap q :ccl" exec "nnoremap t T" exec "nnoremap T TgT" exec "nnoremap o " exec "nnoremap go " - exec "nnoremap v v" - exec "nnoremap gv v" + exec "nnoremap h K" + exec "nnoremap H Kb" + exec "nnoremap v HbJt" + exec "nnoremap gv HbJ" + endif - " If highlighting is on, highlight the search keyword. - if exists("g:ackhighlight") - let @/=a:args - set hlsearch - end + " If highlighting is on, highlight the search keyword. + if exists("g:ackhighlight") + let @/=a:args + set hlsearch + end - redraw! + redraw! endfunction function! s:AckFromSearch(cmd, args) - let search = getreg('/') - " translate vim regular expression to perl regular expression. - let search = substitute(search,'\(\\<\|\\>\)','\\b','g') - call s:Ack(a:cmd, '"' . search .'" '. a:args) + let search = getreg('/') + " translate vim regular expression to perl regular expression. + let search = substitute(search,'\(\\<\|\\>\)','\\b','g') + call s:Ack(a:cmd, '"' . search .'" '. a:args) +endfunction + +function! s:GetDocLocations() + let dp = '' + for p in split(&rtp,',') + let p = p.'/doc/' + if isdirectory(p) + let dp = p.'*.txt '.dp + endif + endfor + return dp +endfunction + +function! s:AckHelp(cmd,args) + let args = a:args.' '.s:GetDocLocations() + call s:Ack(a:cmd,args) endfunction command! -bang -nargs=* -complete=file Ack call s:Ack('grep',) @@ -78,3 +116,5 @@ command! -bang -nargs=* -complete=file AckFromSearch call s:AckFromSearch('grep< command! -bang -nargs=* -complete=file LAck call s:Ack('lgrep', ) command! -bang -nargs=* -complete=file LAckAdd call s:Ack('lgrepadd', ) command! -bang -nargs=* -complete=file AckFile call s:Ack('grep -g', ) +command! -bang -nargs=* -complete=help AckHelp call s:AckHelp('grep',) +command! -bang -nargs=* -complete=help LAckHelp call s:AckHelp('lgrep',) diff --git a/sources_non_forked/bufexplorer.zip/README b/sources_non_forked/bufexplorer.zip/README deleted file mode 100644 index 0975ab13..00000000 --- a/sources_non_forked/bufexplorer.zip/README +++ /dev/null @@ -1,20 +0,0 @@ -This is a mirror of http://www.vim.org/scripts/script.php?script_id=42 - -With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: - - '\be' (normal open) or - '\bs' (force horizontal split open) or - '\bv' (force vertical split open) - -Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. - -Bufexplorer also offers various options including: -- Display the list of buffers in various sort orders including: - - Most Recently Used (MRU) which is the default - - Buffer number - - File name - - File extension - - Full file path name -- Delete buffer from list - -For more about options, sort orders, configuration options, etc. please see the supplied VIM help. diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md new file mode 100644 index 00000000..f34dab5e --- /dev/null +++ b/sources_non_forked/bufexplorer/README.md @@ -0,0 +1,39 @@ +created by +--------- +[jeff lanzarotta](http://www.vim.org/account/profile.php?user_id=97) + +script type +---------- +utility + +description +----------- +With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: + + '\be' (normal open) or + '\bs' (force horizontal split open) or + '\bv' (force vertical split open) + +Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. + +Bufexplorer also offers various options including: + +* Display the list of buffers in various sort orders including: + * Most Recently Used (MRU) which is the default + * Buffer number + * File name + * File extension + * Full file path name +* Delete buffer from list + +For more about options, sort orders, configuration options, etc. please see the supplied VIM help. + +install details +--------------- +Simply unzip bufexplorer.zip into a directory in your 'runtimepath', usually ~/.vim or c:\vimfiles, and restart Vim. This zip file contains plugin\bufexplorer.vim, and doc\bufexplorer.txt. See ':help add-local-help' on how to add bufexplorer.txt to vim's help system. + +NOTE +---- +Version 7.0.12 and above will ONLY work with 7.0 and above of Vim. + +**IMPORTANT**: If you have a version prior to 7.1.2 that contains an autoload\bufexplorer.vim file, please REMOVE the autoload\bufexlorer.vim AND the plugin\bufexplorer.vim files before installing a new version. diff --git a/sources_non_forked/bufexplorer.zip/doc/bufexplorer.txt b/sources_non_forked/bufexplorer/doc/bufexplorer.txt similarity index 99% rename from sources_non_forked/bufexplorer.zip/doc/bufexplorer.txt rename to sources_non_forked/bufexplorer/doc/bufexplorer.txt index 3864a312..06e92237 100644 --- a/sources_non_forked/bufexplorer.zip/doc/bufexplorer.txt +++ b/sources_non_forked/bufexplorer/doc/bufexplorer.txt @@ -1,4 +1,4 @@ -*bufexplorer.txt* Buffer Explorer Last Change: 16 Feb 2010 +*bufexplorer.txt* Buffer Explorer Last Change: 22 Oct 2010 Buffer Explorer *buffer-explorer* *bufexplorer* Version 7.2.8 diff --git a/sources_non_forked/bufexplorer/doc/tags b/sources_non_forked/bufexplorer/doc/tags new file mode 100644 index 00000000..5432bc98 --- /dev/null +++ b/sources_non_forked/bufexplorer/doc/tags @@ -0,0 +1,24 @@ +bufexplorer bufexplorer.txt /*bufexplorer* +bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog* +bufexplorer-credits bufexplorer.txt /*bufexplorer-credits* +bufexplorer-customization bufexplorer.txt /*bufexplorer-customization* +bufexplorer-installation bufexplorer.txt /*bufexplorer-installation* +bufexplorer-todo bufexplorer.txt /*bufexplorer-todo* +bufexplorer-usage bufexplorer.txt /*bufexplorer-usage* +bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout* +bufexplorer.txt bufexplorer.txt /*bufexplorer.txt* +buffer-explorer bufexplorer.txt /*buffer-explorer* +g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin* +g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp* +g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp* +g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive* +g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef* +g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort* +g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories* +g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath* +g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer* +g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted* +g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy* +g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow* +g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName* +g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight* diff --git a/sources_non_forked/bufexplorer.zip/plugin/bufexplorer.vim b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim similarity index 99% rename from sources_non_forked/bufexplorer.zip/plugin/bufexplorer.vim rename to sources_non_forked/bufexplorer/plugin/bufexplorer.vim index 9224dbda..87913639 100644 --- a/sources_non_forked/bufexplorer.zip/plugin/bufexplorer.vim +++ b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim @@ -10,7 +10,7 @@ " Name Of File: bufexplorer.vim " Description: Buffer Explorer Vim Plugin " Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com) -" Last Changed: Tuesday, 16 Feb 2010 +" Last Changed: Friday, 22 October 2010 " Version: See g:bufexplorer_version for version number. " Usage: This file should reside in the plugin directory and be " automatically sourced. diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 09237b30..f233c197 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -2,32 +2,33 @@ " File: autoload/ctrlp.vim " Description: Fuzzy file, buffer, mru, tag, etc finder. " Author: Kien Nguyen -" Version: 1.78 +" Version: 1.79 " ============================================================================= " ** Static variables {{{1 -fu! s:ignore() "{{{2 +" s:ignore() {{{2 +fu! s:ignore() let igdirs = [ - \ '\.git$', - \ '\.hg$', - \ '\.svn$', - \ '_darcs$', - \ '\.bzr$', - \ '\.cdv$', - \ '\~\.dep$', - \ '\~\.dot$', - \ '\~\.nib$', - \ '\~\.plst$', - \ '\.pc$', - \ '_MTN$', - \ ' ', { \ 'PrtExit()': ['', '', ''], \ }] -if !has('gui_running') && ( has('win32') || has('win64') ) +if !has('gui_running') cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0)) en -let s:lash = ctrlp#utils#lash() - let s:compare_lim = 3000 let s:ficounts = {} +let s:ccex = s:pref.'clear_cache_on_exit' + " Regexp let s:fpats = { \ '^\(\\|\)\|\(\\|\)$': '\\|', @@ -152,22 +161,6 @@ let s:fpats = { \ '^\S\\?$': '\\?', \ } -" Specials -let s:prtunmaps = [ - \ 'PrtBS()', - \ 'PrtDelete()', - \ 'PrtDeleteWord()', - \ 'PrtClear()', - \ 'PrtCurStart()', - \ 'PrtCurEnd()', - \ 'PrtCurLeft()', - \ 'PrtCurRight()', - \ 'PrtHistory(-1)', - \ 'PrtHistory(1)', - \ 'PrtInsert("c")', - \ 'PrtInsert()', - \ ] - " Keypad let s:kprange = { \ 'Plus': '+', @@ -188,9 +181,8 @@ let s:hlgrps = { \ 'PrtText': 'Normal', \ 'PrtCursor': 'Constant', \ } - -fu! s:opts() "{{{2 - " Options +" s:opts() {{{2 +fu! s:opts(...) unl! s:usrign s:usrcmd s:urprtmaps for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) let {each} = s:{each} @@ -202,14 +194,36 @@ fu! s:opts() "{{{2 for [ke, va] in items(s:new_opts) let {va} = {exists(s:pref.ke) ? s:pref.ke : va} endfo + unl va + for [ke, va] in items(s:lc_opts) + if exists(s:bpref.ke) + unl {va} + let {va} = {s:bpref.ke} + en + endfo + if a:0 && a:1 != {} + unl va + for [ke, va] in items(a:1) + let opke = substitute(ke, '\(\w:\)\?ctrlp_', '', '') + if has_key(s:lc_opts, opke) + let sva = s:lc_opts[opke] + unl {sva} + let {sva} = va + en + endfo + en for each in ['byfname', 'regexp'] | if exists(each) let s:{each} = {each} en | endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) let s:mxheight = max([s:mxheight, 1]) - let s:glob = s:dotfiles ? '.*\|*' : '*' + let s:glob = s:showhidden ? '.*\|*' : '*' let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) + let s:lash = ctrlp#utils#lash() + if s:keyloop + let [s:lazy, s:glbs['imd']] = [0, 0] + en if s:lazy cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) en @@ -227,13 +241,13 @@ endf "}}}1 " * Open & Close {{{1 fu! s:Open() - let s:ermsg = v:errmsg cal s:log(1) cal s:getenv() cal s:execextvar('enter') sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' cal s:buffunc(1) - let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)] + let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)] + let [s:focus, s:prompt] = [1, ['', '', '']] abc if !exists('s:hstry') let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : [''] @@ -250,19 +264,23 @@ endf fu! s:Close() cal s:buffunc(0) - try | bun! - cat | clo! | endt - cal s:unmarksigns() + if winnr('$') == 1 + bw! + el + try | bun! + cat | clo! | endt + cal s:unmarksigns() + en for key in keys(s:glbs) | if exists('+'.key) sil! exe 'let &'.key.' = s:glb_'.key en | endfo if exists('s:glb_acd') | let &acd = s:glb_acd | en let g:ctrlp_lines = [] if s:winres[1] >= &lines && s:winres[2] == winnr('$') - exe s:winres[0] + exe s:winres[0].s:winres[0] en unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr - \ s:mrbs + \ s:mrbs s:did_exp cal ctrlp#recordhist() cal s:execextvar('exit') cal s:log(0) @@ -275,18 +293,18 @@ fu! ctrlp#clr(...) endf fu! ctrlp#clra() - let cache_dir = ctrlp#utils#cachedir() - if isdirectory(cache_dir) - let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n") - let eval = '!isdirectory(v:val) && fnamemodify(v:val, ":t") !~' - \ . ' ''\v^[.a-z]+$|\.log$''' - sil! cal map(filter(cache_files, eval), 'delete(v:val)') + let cadir = ctrlp#utils#cachedir() + if isdirectory(cadir) + let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n") + let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$''' + sil! cal map(filter(cafiles, eval), 'delete(v:val)') en cal ctrlp#clr() endf -fu! ctrlp#reset() - cal s:opts() +fu! s:Reset(args) + let opts = has_key(a:args, 'opts') ? [a:args['opts']] : [] + cal call('s:opts', opts) cal s:autocmds() cal ctrlp#utils#opts() cal s:execextvar('opts') @@ -294,11 +312,13 @@ endf " * Files {{{1 fu! ctrlp#files() let cafile = ctrlp#utils#cachefile() - if g:ctrlp_newcache || !filereadable(cafile) || s:nocache() + if g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile) let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] " Get the list of files if empty(lscmd) - cal s:GlobPath(s:dyncwd, 0) + if !ctrlp#igncwd(s:dyncwd) + cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) + en el sil! cal ctrlp#progress('Indexing...') try | cal s:UserCmd(lscmd) @@ -310,13 +330,16 @@ fu! ctrlp#files() cal sort(g:ctrlp_allfiles, 'ctrlp#complen') en cal s:writecache(cafile) + let catime = getftime(cafile) el + let catime = getftime(cafile) if !( exists('s:initcwd') && s:initcwd == s:dyncwd ) + \ || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime let s:initcwd = s:dyncwd let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) en en - cal extend(s:ficounts, { s:dyncwd : len(g:ctrlp_allfiles) }) + cal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] }) retu g:ctrlp_allfiles endf @@ -326,12 +349,15 @@ fu! s:GlobPath(dirs, depth) cal extend(g:ctrlp_allfiles, dnf[1]) if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) - cal s:GlobPath(join(dnf[0], ','), depth) + cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) en endf fu! s:UserCmd(lscmd) let [path, lscmd] = [s:dyncwd, a:lscmd] + let do_ign = + \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] + if do_ign && ctrlp#igncwd(s:cwd) | retu | en if exists('+ssl') && &ssl let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] en @@ -347,6 +373,14 @@ fu! s:UserCmd(lscmd) if exists('s:vcscmd') && s:vcscmd cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")') en + if do_ign + if !empty(s:usrign) + let g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1] + en + if &wig != '' + cal filter(g:ctrlp_allfiles, 'glob(v:val) != ""') + en + en endf fu! s:lsCmd() @@ -357,35 +391,50 @@ fu! s:lsCmd() if s:findroot(s:dyncwd, cmd[0], 0, 1) == [] retu len(cmd) == 3 ? cmd[2] : '' en - let s:vcscmd = s:lash == '\' ? 1 : 0 + let s:vcscmd = s:lash == '\' retu cmd[1] - elsei type(cmd) == 4 && has_key(cmd, 'types') - let [markrs, cmdtypes] = [[], values(cmd['types'])] - for pair in cmdtypes - cal add(markrs, pair[0]) - endfo - let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) + elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') ) + let fndroot = [] + if has_key(cmd, 'types') && cmd['types'] != {} + let [markrs, cmdtypes] = [[], values(cmd['types'])] + for pair in cmdtypes + cal add(markrs, pair[0]) + endfo + let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) + en if fndroot == [] retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' en for pair in cmdtypes if pair[0] == fndroot[0] | brea | en endfo - let s:vcscmd = s:lash == '\' ? 1 : 0 + let s:vcscmd = s:lash == '\' retu pair[1] en endf " - Buffers {{{1 fu! ctrlp#buffers(...) let ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' - \ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), 's:compmreb') - retu a:0 && a:1 == 'id' ? ids : map(ids, 'fnamemodify(bufname(v:val), ":.")') + \ .' && getbufvar(v:val, "&bl")'), 's:compmreb') + if a:0 && a:1 == 'id' + retu ids + el + let bufs = [[], []] + for id in ids + let bname = bufname(id) + let ebname = bname == '' + let fname = fnamemodify(ebname ? '['.id.'*No Name]' : bname, ':.') + cal add(bufs[ebname], fname) + endfo + retu bufs[0] + bufs[1] + en endf " * MatchedItems() {{{1 fu! s:MatchIt(items, pat, limit, exc) let [lines, id] = [[], 0] - let pat = s:byfname ? - \ map(split(a:pat, '^[^;]\+\zs;', 1), 's:martcs.v:val') : s:martcs.a:pat + let pat = + \ s:byfname ? map(split(a:pat, '^[^;]\+\\\@= 0 @@ -402,11 +451,12 @@ fu! s:MatchedItems(items, pat, limit) let items = s:narrowable() ? s:matched + s:mdata[3] : a:items if s:matcher != {} let argms = [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] - let lines = call(s:matcher['match'], argms) + let lines = call(s:matcher['match'], argms, s:matcher) el let lines = s:MatchIt(items, a:pat, a:limit, exc) en let s:matches = len(lines) + unl! s:did_exp retu lines endf @@ -445,7 +495,7 @@ endf " * BuildPrompt() {{{1 fu! s:Render(lines, pat) let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])] - let pat = s:byfname ? split(a:pat, '^[^;]\+\zs;', 1)[0] : a:pat + let pat = s:byfname ? split(a:pat, '^[^;]\+\\\@' ).( s:byfname ? 'd' : '>' ).'> ' - let [estr, prt] = ['"\', copy(s:prompt)] - cal map(prt, 'escape(v:val, estr)') - let str = join(prt, '') - let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy - if a:upd && !lazy && ( s:matches || s:regexp + let str = escape(s:getinput(), '\') + let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy + if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp') \ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' ) sil! cal s:Update(str) en sil! cal ctrlp#statusline() " Toggling - let [hiactive, hicursor, base] = a:0 && !a:1 - \ ? ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] - \ : ['CtrlPPrtText', 'CtrlPPrtCursor', base] + let [hiactive, hicursor, base] = s:focus + \ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base] + \ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] let hibase = 'CtrlPPrtBase' " Build it redr + let prt = copy(s:prompt) + cal map(prt, 'escape(v:val, ''"\'')') exe 'echoh' hibase '| echon "'.base.'" \ | echoh' hiactive '| echon "'.prt[0].'" \ | echoh' hicursor '| echon "'.prt[1].'" \ | echoh' hiactive '| echon "'.prt[2].'" | echoh None' " Append the cursor at the end - if empty(prt[1]) && !( a:0 && !a:1 ) + if empty(prt[1]) && s:focus exe 'echoh' hibase '| echon "_" | echoh None' en endf @@ -544,6 +592,7 @@ endf " ** Prt Actions {{{1 " Editing {{{2 fu! s:PrtClear() + if !s:focus | retu | en unl! s:hstgot let [s:prompt, s:matches] = [['', '', ''], 1] cal s:BuildPrompt(1) @@ -558,12 +607,14 @@ fu! s:PrtAdd(char) endf fu! s:PrtBS() + if !s:focus | retu | en unl! s:hstgot let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1] cal s:BuildPrompt(1) endf fu! s:PrtDelete() + if !s:focus | retu | en unl! s:hstgot let [prt, s:matches] = [s:prompt, 1] let prt[1] = matchstr(prt[2], '^.') @@ -572,6 +623,7 @@ fu! s:PrtDelete() endf fu! s:PrtDeleteWord() + if !s:focus | retu | en unl! s:hstgot let [str, s:matches] = [s:prompt[0], 1] let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$') @@ -583,6 +635,7 @@ fu! s:PrtDeleteWord() endf fu! s:PrtInsert(...) + if !s:focus | retu | en let type = !a:0 ? '' : a:1 if !a:0 let type = s:insertstr() @@ -605,15 +658,31 @@ fu! s:PrtInsert(...) endf fu! s:PrtExpandDir() - let str = s:prompt[0] + if !s:focus | retu | en + let str = s:getinput('c') if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs') let str = get(hasat, 1, '') + if str =~# '\v^[~$]\i{-}[\/]?|^#(\):(p|h|8|\~|\.|g?s+)' + let spc = str =~# '^%' ? s:crfile + \ : str =~# '^' ? s:crgfile + \ : str =~# '^' ? s:crword + \ : str =~# '^' ? s:crnbword : '' + let pat = '(:(p|h|8|\~|\.|g?s(.)[^\3]*\3[^\3]*\3))+' + let mdr = matchstr(str, '\v^[^:]+\zs'.pat) + let nmd = matchstr(str, '\v^[^:]+'.pat.'\zs.{-}$') + let str = fnamemodify(s:fnesc(spc, 'g'), mdr).nmd + en en if str == '' | retu | en unl! s:hstgot let s:act_add = 1 let [base, seed] = s:headntail(str) + if str =~# '^[\/]' + let base = expand('/').base + en let dirs = s:dircompl(base, seed) if len(dirs) == 1 let str = dirs[0] @@ -626,6 +695,7 @@ fu! s:PrtExpandDir() endf " Movement {{{2 fu! s:PrtCurLeft() + if !s:focus | retu | en let prt = s:prompt if !empty(prt[0]) let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'), @@ -635,6 +705,7 @@ fu! s:PrtCurLeft() endf fu! s:PrtCurRight() + if !s:focus | retu | en let prt = s:prompt let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'), \ substitute(prt[2], '^.', '', '')] @@ -642,12 +713,14 @@ fu! s:PrtCurRight() endf fu! s:PrtCurStart() + if !s:focus | retu | en let str = join(s:prompt, '') let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')] cal s:BuildPrompt(0) endf fu! s:PrtCurEnd() + if !s:focus | retu | en let s:prompt = [join(s:prompt, ''), '', ''] cal s:BuildPrompt(0) endf @@ -657,33 +730,38 @@ fu! s:PrtSelectMove(dir) let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} exe 'keepj norm!' dirs[a:dir] if s:nolim != 1 | let s:cline = line('.') | en - if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en + if line('$') > winheight(0) | cal s:BuildPrompt(0) | en endf -fu! s:PrtSelectJump(char, ...) +fu! s:PrtSelectJump(char) let lines = copy(s:lines) - if a:0 + if s:byfname cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]') en " Cycle through matches, use s:jmpchr to store last jump - let chr = escape(a:char, '.~') - if match(lines, '\c^'.chr) >= 0 + let chr = escape(matchstr(a:char, '^.'), '.~') + let smartcs = &scs && chr =~ '\u' ? '\C' : '' + if match(lines, smartcs.'^'.chr) >= 0 " If not exists or does but not for the same char - let pos = match(lines, '\c^'.chr) + let pos = match(lines, smartcs.'^'.chr) if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr ) let [jmpln, s:jmpchr] = [pos, [chr, pos]] elsei exists('s:jmpchr') && s:jmpchr[0] == chr " Start of lines if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en - let npos = match(lines, '\c^'.chr, s:jmpchr[1] + 1) + let npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1) let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] en - keepj exe jmpln + 1 + exe 'keepj norm!' ( jmpln + 1 ).'G' if s:nolim != 1 | let s:cline = line('.') | en - if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en + if line('$') > winheight(0) | cal s:BuildPrompt(0) | en en endf " Misc {{{2 +fu! s:PrtFocusMap(char) + cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char]) +endf + fu! s:PrtClearCache() if s:itemtype == 0 cal ctrlp#clr() @@ -715,12 +793,14 @@ fu! s:PrtDeleteMRU() endf fu! s:PrtExit() - if !has('autocmd') | cal s:Close() | en - exe ( winnr('$') == 1 ? 'bw!' : 'winc p' ) + if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' + noa cal s:Close() + noa winc p + en endf fu! s:PrtHistory(...) - if !s:maxhst | retu | en + if !s:focus || !s:maxhst | retu | en let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1] " Save to history if not saved before let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)] @@ -733,67 +813,72 @@ fu! s:PrtHistory(...) unl s:force endf "}}}1 -" * MapKeys() {{{1 -fu! s:MapKeys(...) - " Normal keys - let pfunc = a:0 && !a:1 ? 'PrtSelectJump' : 'PrtAdd' - let dojmp = s:byfname && a:0 && !a:1 ? ', 1' : '' - let pcmd = "nn \ \ \ :\cal \%s(\"%s\"%s)\" +" * Mappings {{{1 +fu! s:MapNorms() + if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en + let pcmd = "nn \ \ \ :\cal \%s(\"%s\")\" let cmd = substitute(pcmd, 'k%s', 'char-%d', '') - for each in range(32, 126) - exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp) + let pfunc = 'PrtFocusMap' + let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123) + for each in [34, 92, 124] + exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\')) + endfo + for each in ranges + exe printf(cmd, each, pfunc, nr2char(each)) endfo for each in range(0, 9) - exe printf(pcmd, each, pfunc, each, dojmp) + exe printf(pcmd, each, pfunc, each) endfo for [ke, va] in items(s:kprange) - exe printf(pcmd, ke, pfunc, va, dojmp) + exe printf(pcmd, ke, pfunc, va) endfo - " Special keys - if a:0 < 2 - cal call('s:MapSpecs', a:0 && !a:1 ? [1] : []) - en + let s:nmapped = s:bufnr endf -fu! s:MapSpecs(...) - " Correct arrow keys in terminal - if ( has('termresponse') && v:termresponse =~ "\" ) - \ || &term =~? '\vxterm|','\B ','\C ','\D '] - exe s:lcmap.' ['.each - endfo - en - if a:0 - for ke in s:prtunmaps | for kp in s:prtmaps[ke] - exe s:lcmap kp '' - endfo | endfo - el - for [ke, va] in items(s:prtmaps) | for kp in va - exe s:lcmap kp ':cal '.ke.'' - endfo | endfo +fu! s:MapSpecs() + if !( exists('s:smapped') && s:smapped == s:bufnr ) + " Correct arrow keys in terminal + if ( has('termresponse') && v:termresponse =~ "\" ) + \ || &term =~? '\vxterm|','\B ','\C ','\D '] + exe s:lcmap.' ['.each + endfo + en en + for [ke, va] in items(s:prtmaps) | for kp in va + exe s:lcmap kp ':cal '.ke.'' + endfo | endfo + let s:smapped = s:bufnr +endf + +fu! s:KeyLoop() + wh exists('s:init') && s:keyloop + redr + let nr = getchar() + let chr = !type(nr) ? nr2char(nr) : nr + if nr >=# 0x20 + cal s:PrtFocusMap(chr) + el + let cmd = matchstr(maparg(chr), ':\zs.\+\ze$') + exe ( cmd != '' ? cmd : 'norm '.chr ) + en + endw endf " * Toggling {{{1 -fu! s:Focus() - retu !exists('s:focus') ? 1 : s:focus -endf - fu! s:ToggleFocus() - let s:focus = !exists('s:focus') || s:focus ? 0 : 1 - cal s:MapKeys(s:focus) - cal s:BuildPrompt(0, s:focus) + let s:focus = !s:focus + cal s:BuildPrompt(0) endf fu! s:ToggleRegex() - let s:regexp = s:regexp ? 0 : 1 + let s:regexp = !s:regexp cal s:PrtSwitcher() endf fu! s:ToggleByFname() if s:ispath - let s:byfname = s:byfname ? 0 : 1 + let s:byfname = !s:byfname let s:mfunc = s:mfunc() - cal s:MapKeys(s:Focus(), 1) cal s:PrtSwitcher() en endf @@ -806,20 +891,38 @@ fu! s:ToggleType(dir) cal s:PrtSwitcher() endf +fu! s:ToggleKeyLoop() + let s:keyloop = !s:keyloop + if exists('+imd') + let &imd = !s:keyloop + en + if s:keyloop + let [&ut, s:lazy] = [0, 0] + cal s:KeyLoop() + elsei has_key(s:glbs, 'ut') + let [&ut, s:lazy] = [s:glbs['ut'], 1] + en +endf + fu! s:PrtSwitcher() let [s:force, s:matches] = [1, 1] - cal s:BuildPrompt(1, s:Focus()) + cal s:BuildPrompt(1) unl s:force endf " - SetWD() {{{1 fu! s:SetWD(args) - let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] - let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode + if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0 + \ && exists('s:dyncwd') + cal ctrlp#setdir(s:dyncwd) | retu + en if has_key(a:args, 'dir') && a:args['dir'] != '' cal ctrlp#setdir(a:args['dir']) | retu en + let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode + let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] if s:crfile =~ '^.\+://' | retu | en - if pmode =~ 'c' || ( !type(pmode) && pmode ) + if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 ) + \ || ( !type(pmode) && pmode ) if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en cal ctrlp#setdir(s:crfpath) en @@ -835,26 +938,40 @@ fu! s:SetWD(args) endf " * AcceptSelection() {{{1 fu! ctrlp#acceptfile(mode, line, ...) - let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')] + let [md, useb] = [a:mode, 0] + if !type(a:line) + let [filpath, bufnr, useb] = [a:line, a:line, 1] + el + let filpath = fnamemodify(a:line, ':p') + if s:nonamecond(a:line, filpath) + let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + let [filpath, useb] = [bufnr, 1] + el + let bufnr = bufnr('^'.filpath.'$') + en + en cal s:PrtExit() - let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()] - let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*')) - if s:jmptobuf && bufnr > 0 && md =~ 'e\|t' + let tail = s:tail() + let j2l = a:0 ? a:1 : matchstr(tail, '^ +\zs\d\+$') + if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0 \ && !( md == 'e' && bufnr == bufnr('%') ) let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)] - let buftab = s:jmptobuf > 1 ? s:buftab(bufnr, md) : [0, 0] + let buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 ) + \ ? s:buftab(bufnr, md) : [0, 0] en " Switch to existing buffer or open new one - if exists('jmpb') && bufwinnr > 0 && md != 't' + if exists('jmpb') && bufwinnr > 0 + \ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) ) exe bufwinnr.'winc w' if j2l | cal ctrlp#j2l(j2l) | en elsei exists('jmpb') && buftab[0] + \ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) ) exe 'tabn' buftab[0] exe buftab[1].'winc w' if j2l | cal ctrlp#j2l(j2l) | en el " Determine the command to use - let useb = bufnr > 0 && buflisted(bufnr) && empty(tail) + let useb = bufnr > 0 && buflisted(bufnr) && ( empty(tail) || useb ) let cmd = \ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) : \ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) : @@ -863,7 +980,8 @@ fu! ctrlp#acceptfile(mode, line, ...) " Reset &switchbuf option let [swb, &swb] = [&swb, ''] " Open new window/buffer - let args = [cmd, useb ? bufnr : filpath, a:0 ? ' +'.a:1 : tail, useb, j2l] + let [fid, tail] = [( useb ? bufnr : filpath ), ( a:0 ? ' +'.a:1 : tail )] + let args = [cmd, fid, tail, 1, [useb, j2l]] cal call('s:openfile', args) let &swb = swb en @@ -895,10 +1013,10 @@ endf fu! s:AcceptSelection(mode) if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en - let str = join(s:prompt, '') + let str = s:getinput() if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en " Get the selected line - let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' + let line = ctrlp#getcline() if a:mode != 'e' && !s:itemtype && line == '' \ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$' cal s:CreateNewFile(a:mode) | retu @@ -914,7 +1032,7 @@ fu! s:AcceptSelection(mode) endf " - CreateNewFile() {{{1 fu! s:CreateNewFile(...) - let [md, str] = ['', join(s:prompt, '')] + let [md, str] = ['', s:getinput('n')] if empty(str) | retu | en if s:argmap && !a:0 " Get the extra argument @@ -942,7 +1060,7 @@ fu! s:CreateNewFile(...) \ s:newfop =~ '2\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' : \ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' : \ ctrlp#normcmd('e') - cal s:openfile(cmd, filpath, tail) + cal s:openfile(cmd, filpath, tail, 1) endf " * OpenMulti() {{{1 fu! s:MarkToOpen() @@ -950,7 +1068,7 @@ fu! s:MarkToOpen() \ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) retu en - let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' + let line = ctrlp#getcline() if empty(line) | retu | en let filpath = s:ispath ? fnamemodify(line, ':p') : line if exists('s:marked') && s:dictindex(s:marked, filpath) > 0 @@ -989,7 +1107,7 @@ fu! s:OpenMulti(...) let md = a:0 ? a:1 : ( md == '' ? 'v' : md ) let nopt = exists('g:ctrlp_open_multiple_files') if !has_marked - let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' + let line = ctrlp#getcline() if line == '' | retu | en let marked = { 1 : fnamemodify(line, ':p') } let [nr, ur, jf, nopt] = ['1', 0, 0, 1] @@ -1000,16 +1118,8 @@ fu! s:OpenMulti(...) cal s:unmarksigns() unl! s:marked cal s:BuildPrompt(0) - elsei !has_marked && md == 'a' - let [s:marked, key] = [{}, 1] - for line in s:lines - let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') }) - let key += 1 - endfo - cal s:remarksigns() - retu s:BuildPrompt(0) - elsei !has_marked && md == 'x' - retu call(s:openfunc[s:ctype], [md, line]) + elsei !has_marked && md =~ '[axd]' + retu s:OpenNoMarks(md, line) en if md =~ '\v^c(ancel)?$' | retu | en let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr @@ -1019,9 +1129,9 @@ fu! s:OpenMulti(...) cal s:sanstail(join(s:prompt, '')) cal s:PrtExit() if nr == '0' || md == 'i' - retu map(mkd, "s:openfile('bad', fnamemodify(v:val, ':.'), '')") + retu map(mkd, "s:openfile('bad', v:val, '', 0)") en - let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701] + let tail = s:tail() let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')] let useb = bufnr > 0 && buflisted(bufnr) && emptytail " Move to a replaceable window @@ -1048,19 +1158,16 @@ fu! s:OpenMulti(...) let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ), \ nr != '' && nr < ic] if conds[nopt] - if bufnr <= 0 | if fnesc - cal s:openfile('bad', fnamemodify(va, ':.'), '') - el - cal s:openfile(cmd, va, tail) | sil! hid clo! - en | en + if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en el - cal s:openfile(cmd, useb ? bufnr : va, tail) | let ic += 1 - if jf | if ic == 2 + cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1) + if jf | if ic == 1 let crpos = [tabpagenr(), winnr()] el let crpos[0] += tabpagenr() <= crpos[0] - let crpos[1] += winnr() == crpos[1] + let crpos[1] += winnr() <= crpos[1] en | en + let ic += 1 en endfo if jf && exists('crpos') && ic > 2 @@ -1069,6 +1176,28 @@ fu! s:OpenMulti(...) let &swb = swb unl! s:tabct endf + +fu! s:OpenNoMarks(md, line) + if a:md == 'a' + let [s:marked, key] = [{}, 1] + for line in s:lines + let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') }) + let key += 1 + endfo + cal s:remarksigns() + cal s:BuildPrompt(0) + elsei a:md == 'x' + cal call(s:openfunc[s:ctype], [a:md, a:line], s:openfunc) + elsei a:md == 'd' + let dir = fnamemodify(a:line, ':h') + if isdirectory(dir) + cal ctrlp#setdir(dir) + cal ctrlp#switchtype(0) + cal ctrlp#recordhist() + cal s:PrtClear() + en + en +endf " ** Helper functions {{{1 " Sorting {{{2 fu! ctrlp#complen(...) @@ -1140,6 +1269,12 @@ fu! s:shortest(lens) endf fu! s:mixedsort(...) + if s:itemtype == 1 + let pat = '[\/]\?\[\d\+\*No Name\]$' + if a:1 =~# pat && a:2 =~# pat | retu 0 + elsei a:1 =~# pat | retu 1 + elsei a:2 =~# pat | retu -1 | en + en let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] if s:ispath let ms = [] @@ -1188,13 +1323,13 @@ fu! ctrlp#statusline() let nxt = tps[s:walker(max, s:itemtype, 1)][1] let prv = tps[s:walker(max, s:itemtype, -1)][1] let s:ctype = tps[s:itemtype][0] - let focus = s:Focus() ? 'prt' : 'win' + let focus = s:focus ? 'prt' : 'win' let byfname = s:byfname ? 'file' : 'path' let marked = s:opmul != '0' ? \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' if s:status != {} let args = [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] - let &l:stl = call(s:status['main'], args) + let &l:stl = call(s:status['main'], args, s:status) el let item = '%#CtrlPMode1# '.s:ctype.' %*' let focus = '%#CtrlPMode2# '.focus.' %*' @@ -1214,15 +1349,27 @@ endf fu! ctrlp#progress(enum, ...) if has('macunix') || has('mac') | sl 1m | en let txt = a:0 ? '(press ctrl-c to abort)' : '' - let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum]) + let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum], s:status) \ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' redraws endf " *** Paths {{{2 " Line formatting {{{3 fu! s:formatline(str) - let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str) - retu '> '.( cond ? s:pathshorten(a:str) : a:str ) + let str = a:str + if s:itemtype == 1 + let filpath = fnamemodify(str, ':p') + let bufnr = s:nonamecond(str, filpath) + \ ? str2nr(matchstr(str, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) + \ : bufnr('^'.filpath.'$') + let idc = ( bufnr == bufnr('#') ? '#' : '' ) + \ . ( getbufvar(bufnr, '&ma') ? '' : '-' ) + \ . ( getbufvar(bufnr, '&ro') ? '=' : '' ) + \ . ( getbufvar(bufnr, '&mod') ? '+' : '' ) + let str .= idc != '' ? ' '.idc : '' + en + let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str) + retu '> '.( cond ? s:pathshorten(str) : str ) endf fu! s:pathshorten(str) @@ -1232,8 +1379,16 @@ endf " Directory completion {{{3 fu! s:dircompl(be, sd) if a:sd == '' | retu [] | en - let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd] - let dirs = ctrlp#rmbasedir(split(globpath(be, a:sd.'*/'), "\n")) + if a:be == '' + let [be, sd] = [s:dyncwd, a:sd] + el + let be = a:be.s:lash(a:be) + let sd = be.a:sd + en + let dirs = split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), "\n") + if a:be == '' + let dirs = ctrlp#rmbasedir(dirs) + en cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))' \ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''') retu dirs @@ -1266,13 +1421,18 @@ fu! s:ispathitem() retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) endf +fu! ctrlp#igncwd(cwd) + retu ctrlp#utils#glob(a:cwd, 0) == '' || + \ ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) ) +endf + fu! ctrlp#dirnfile(entries) let [items, cwd] = [[[], []], s:dyncwd.s:lash()] for each in a:entries let etype = getftype(each) if s:igntype >= 0 && s:usrign(each, etype) | con | en if etype == 'dir' - if s:dotfiles | if each !~ '[\/]\.\{1,2}$' + if s:showhidden | if each !~ '[\/]\.\{1,2}$' cal add(items[0], each) en | el cal add(items[0], each) @@ -1304,8 +1464,9 @@ fu! s:samerootsyml(each, isfile, cwd) endf fu! ctrlp#rmbasedir(items) - if a:items != [] && !stridx(a:items[0], s:dyncwd) - let idx = strlen(s:dyncwd) + ( s:dyncwd !~ '[\/]$' ) + let cwd = s:dyncwd.( s:dyncwd !~ '[\/]$' ? s:lash : '' ) + if a:items != [] && !stridx(a:items[0], cwd) + let idx = strlen(cwd) retu map(a:items, 'strpart(v:val, idx)') en retu a:items @@ -1322,10 +1483,13 @@ endf fu! s:findroot(curr, mark, depth, type) let [depth, fnd] = [a:depth + 1, 0] if type(a:mark) == 1 - let fnd = s:glbpath(a:curr, a:mark, 1) != '' + let fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != '' elsei type(a:mark) == 3 for markr in a:mark - if s:glbpath(a:curr, markr, 1) != '' | let fnd = 1 | brea | en + if s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != '' + let fnd = 1 + brea + en endfo en if fnd @@ -1344,17 +1508,16 @@ endf fu! ctrlp#setdir(path, ...) let cmd = a:0 ? a:1 : 'lc!' - sil! exe cmd ctrlp#fnesc(a:path) + sil! exe cmd s:fnesc(a:path, 'c') let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] endf " Fallbacks {{{3 fu! s:glbpath(...) - let cond = v:version > 702 || ( v:version == 702 && has('patch051') ) - retu call('globpath', cond ? a:000 : a:000[:1]) + retu call('ctrlp#utils#globpath', a:000) endf -fu! ctrlp#fnesc(path) - retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n") +fu! s:fnesc(...) + retu call('ctrlp#utils#fnesc', a:000) endf fu! ctrlp#setlcdir() @@ -1473,6 +1636,19 @@ fu! s:buftab(bufnr, md) retu [0, 0] endf +fu! s:bufwins(bufnr) + let winns = 0 + for tabnr in range(1, tabpagenr('$')) + let winns += count(tabpagebuflist(tabnr), a:bufnr) + endfo + retu winns +endf + +fu! s:nonamecond(str, filpath) + retu a:str =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(a:filpath) + \ && bufnr('^'.a:filpath.'$') < 1 +endf + fu! ctrlp#normcmd(cmd, ...) if a:0 < 2 && s:nosplit() | retu a:cmd | en let norwins = filter(range(1, winnr('$')), @@ -1493,6 +1669,11 @@ fu! ctrlp#normcmd(cmd, ...) retu a:0 ? a:1 : 'bo vne' endf +fu! ctrlp#modfilecond(w) + retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf && + \ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 ) +endf + fu! s:nosplit() retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0 endf @@ -1507,7 +1688,7 @@ endf fu! s:leavepre() if exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en - if !( exists('g:ctrlp_clear_cache_on_exit') && !g:ctrlp_clear_cache_on_exit ) + if !( exists(s:ccex) && !{s:ccex} ) \ && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) cal ctrlp#clra() en @@ -1570,11 +1751,17 @@ fu! s:argmaps(md, i) let roh = [ \ ['Open Multiple Files', '/h[i]dden/[c]lear', ['i', 'c']], \ ['Create a New File', '/[r]eplace', ['r']], - \ ['Open Selected', '/[r]eplace/h[i]dden? Mark [a]ll', ['r', 'i', 'a']], + \ ['Open Selected', '/[r]eplace', ['r', 'd', 'a']], \ ] - if a:i == 2 && s:openfunc != {} && has_key(s:openfunc, s:ctype) - let roh[2][1] = '/[r]eplace/h[i]dden/e[x]ternal? Mark [a]ll' - let roh[2][2] = ['r', 'i', 'x', 'a'] + if a:i == 2 + if !buflisted(bufnr('^'.fnamemodify(ctrlp#getcline(), ':p').'$')) + let roh[2][1] .= '/h[i]dden' + let roh[2][2] += ['i'] + en + if s:openfunc != {} && has_key(s:openfunc, s:ctype) + let roh[2][1] .= '/e[x]ternal' + let roh[2][2] += ['x'] + en en let str = roh[a:i][0].': [t]ab/[v]ertical/[h]orizontal'.roh[a:i][1].'? ' retu s:choices(str, ['t', 'v', 'h'] + roh[a:i][2], 's:argmaps', [a:md, a:i]) @@ -1636,14 +1823,40 @@ endf fu! s:narrowable() retu exists('s:act_add') && exists('s:matched') && s:matched != [] \ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp] - \ && s:matcher == {} + \ && s:matcher == {} && !exists('s:did_exp') +endf + +fu! s:getinput(...) + let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )] + if s:abbrev != {} + let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : '' + let str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '') + if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k' + retu join(prt, '') + en + let [pf, rz] = [( s:byfname ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )] + for dict in s:abbrev['abbrevs'] + let dmd = has_key(dict, 'mode') ? dict['mode'] : '' + let pat = escape(dict['pattern'], '~') + if ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 ) + \ || dmd =~ '['.spi.']' ) && str =~ pat + let [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1] + en + endfo + if gmd =~ 't' && !a:0 + let prt[0] = str + el + retu str + en + en + retu spi == 'c' ? prt[0] : join(prt, '') endf fu! s:migemo(str) - let str = a:str - let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &enc), 1) + let [str, rtp] = [a:str, s:fnesc(&rtp, 'g')] + let dict = s:glbpath(rtp, printf("dict/%s/migemo-dict", &enc), 1) if !len(dict) - let dict = s:glbpath(&rtp, "dict/migemo-dict", 1) + let dict = s:glbpath(rtp, "dict/migemo-dict", 1) en if len(dict) let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s'] @@ -1660,12 +1873,12 @@ fu! s:strwidth(str) endf fu! ctrlp#j2l(nr) - exe a:nr + exe 'norm!' a:nr.'G' sil! norm! zvzz endf fu! s:maxf(len) - retu s:maxfiles && a:len > s:maxfiles ? 1 : 0 + retu s:maxfiles && a:len > s:maxfiles endf fu! s:regexfilter(str) @@ -1677,7 +1890,7 @@ fu! s:regexfilter(str) endf fu! s:walker(m, p, d) - retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m + retu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m endf fu! s:delent(rfunc) @@ -1701,13 +1914,14 @@ endf " Entering & Exiting {{{2 fu! s:getenv() let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] - let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)] - let [s:crword, s:crline] = [expand('', 1), getline('.')] + let [s:crword, s:crnbword] = [expand('', 1), expand('', 1)] + let [s:crgfile, s:crline] = [expand('', 1), getline('.')] let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')] let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] - let s:wpmode = exists('b:ctrlp_working_path_mode') - \ ? b:ctrlp_working_path_mode : s:pathmode - let [s:mrbs, s:crgfile] = [ctrlp#mrufiles#bufs(), expand('', 1)] + let s:crfile = bufname('%') == '' + \ ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1) + let s:crfpath = expand('%:p:h', 1) + let s:mrbs = ctrlp#mrufiles#bufs() endf fu! s:lastvisual() @@ -1733,21 +1947,24 @@ endf fu! s:buffunc(e) if a:e && has_key(s:buffunc, 'enter') - cal call(s:buffunc['enter'], []) + cal call(s:buffunc['enter'], [], s:buffunc) elsei !a:e && has_key(s:buffunc, 'exit') - cal call(s:buffunc['exit'], []) + cal call(s:buffunc['exit'], [], s:buffunc) en endf -fu! s:openfile(cmd, fid, tail, ...) - let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd - let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd - let j2l = a:0 && a:1 ? a:2 : 0 - exe cmd.( a:0 && a:1 ? '' : a:tail ) ctrlp#fnesc(a:fid) - if j2l - exe j2l +fu! s:openfile(cmd, fid, tail, chkmod, ...) + let cmd = a:cmd + if a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw )) + let cmd = cmd == 'b' ? 'sb' : 'sp' en - if !empty(a:tail) || j2l + let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd + let j2l = a:0 && a:1[0] ? a:1[1] : 0 + exe cmd.( a:0 && a:1[0] ? '' : a:tail ) s:fnesc(a:fid, 'f') + if j2l + cal ctrlp#j2l(j2l) + en + if !empty(a:tail) sil! norm! zvzz en if cmd != 'bad' @@ -1827,20 +2044,30 @@ fu! s:mmode() retu matchmodes[s:mfunc] endf " Cache {{{2 -fu! s:writecache(cache_file) - if ( g:ctrlp_newcache || !filereadable(a:cache_file) ) && !s:nocache() +fu! s:writecache(cafile) + if ( g:ctrlp_newcache || !filereadable(a:cafile) ) && !s:nocache() cal ctrlp#utils#writecache(g:ctrlp_allfiles) let g:ctrlp_newcache = 0 en endf -fu! s:nocache() - retu !s:caching || ( s:caching > 1 && get(s:ficounts, s:dyncwd) < s:caching ) +fu! s:nocache(...) + if !s:caching + retu 1 + elsei s:caching > 1 + if !( exists(s:ccex) && !{s:ccex} ) || has_key(s:ficounts, s:dyncwd) + retu get(s:ficounts, s:dyncwd, [0, 0])[0] < s:caching + elsei a:0 && filereadable(a:1) + retu len(ctrlp#utils#readfile(a:1)) < s:caching + en + retu 1 + en + retu 0 endf fu! s:insertcache(str) let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str] - if strlen(str) <= strlen(data[0]) + if data == [] || strlen(str) <= strlen(data[0]) let pos = 0 elsei strlen(str) >= strlen(data[-1]) let pos = len(data) - 1 @@ -1874,6 +2101,14 @@ fu! s:getextvar(key) retu -1 endf +fu! ctrlp#getcline() + retu !empty(s:lines) ? s:lines[line('.') - 1] : '' +endf + +fu! ctrlp#getmarkedlist() + retu exists('s:marked') ? values(s:marked) : [] +endf + fu! ctrlp#exit() cal s:PrtExit() endf @@ -1897,7 +2132,7 @@ fu! ctrlp#hicheck(grp, defgrp) endf fu! ctrlp#call(func, ...) - cal call(a:func, a:000) + retu call(a:func, a:000) endf "}}}1 " * Initialization {{{1 @@ -1913,15 +2148,18 @@ endf fu! ctrlp#init(type, ...) if exists('s:init') || s:iscmdwin() | retu | en + let [s:ermsg, v:errmsg] = [v:errmsg, ''] let [s:matches, s:init] = [1, 1] - cal ctrlp#reset() + cal s:Reset(a:0 ? a:1 : {}) noa cal s:Open() cal s:SetWD(a:0 ? a:1 : {}) - cal s:MapKeys() + cal s:MapNorms() + cal s:MapSpecs() cal ctrlp#syntax() cal ctrlp#setlines(s:settype(a:type)) cal s:SetDefTxt() cal s:BuildPrompt(1) + if s:keyloop | cal s:KeyLoop() | en endf " - Autocmds {{{1 if has('autocmd') diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim index 09e18bea..aa67afa6 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim @@ -149,13 +149,16 @@ fu! s:esctagscmd(bin, args, ...) if exists('+ssl') let [ssl, &ssl] = [&ssl, 0] en - let fname = a:0 == 1 ? shellescape(a:1) : '' + let fname = a:0 ? shellescape(a:1) : '' let cmd = shellescape(a:bin).' '.a:args.' '.fname + if &sh =~ 'cmd\.exe' + let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g') + en if exists('+ssl') let &ssl = ssl en if has('iconv') - let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc + let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc let cmd = iconv(cmd, &enc, last) en retu cmd @@ -170,12 +173,14 @@ fu! s:process(fname, ftype) el let data = s:exectagsonfile(a:fname, a:ftype) let [raw, lines] = [split(data, '\n\+'), []] - for line in raw | if len(split(line, ';"')) == 2 - let parsed_line = s:parseline(line) - if parsed_line != '' - cal add(lines, parsed_line) + for line in raw + if line !~# '^!_TAG_' && len(split(line, ';"')) == 2 + let parsed_line = s:parseline(line) + if parsed_line != '' + cal add(lines, parsed_line) + en en - en | endfo + endfo let cache = { a:fname : { 'time': ftime, 'lines': lines } } cal extend(g:ctrlp_buftags, cache) en @@ -183,8 +188,8 @@ fu! s:process(fname, ftype) endf fu! s:parseline(line) - let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)' - let vals = matchlist(a:line, eval) + let vals = matchlist(a:line, + \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)') if vals == [] | retu '' | en let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] @@ -200,6 +205,19 @@ fu! s:syntax() sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind en endf + +fu! s:chknearby(pat) + if match(getline('.'), a:pat) < 0 + let [int, forw, maxl] = [1, 1, line('$')] + wh !search(a:pat, 'W'.( forw ? '' : 'b' )) + if !forw + if int > maxl | brea | en + let int += int + en + let forw = !forw + endw + en +endf " Public {{{1 fu! ctrlp#buffertag#init(fname) let bufs = exists('s:btmode') && s:btmode @@ -208,7 +226,7 @@ fu! ctrlp#buffertag#init(fname) let lines = [] for each in bufs let bname = fnamemodify(each, ':p') - let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '') + let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '') cal extend(lines, s:process(bname, tftype)) endfo cal s:syntax() @@ -216,10 +234,14 @@ fu! ctrlp#buffertag#init(fname) endf fu! ctrlp#buffertag#accept(mode, str) - let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|') + let vals = matchlist(a:str, + \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$') let bufnr = str2nr(get(vals, 1)) if bufnr - cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2)) + cal ctrlp#acceptfile(a:mode, bufnr) + exe 'norm!' str2nr(get(vals, 2, line('.'))).'G' + cal s:chknearby('\V\C'.get(vals, 3, '')) + sil! norm! zvzz en endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim index c391aad9..67a299c6 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/changes.vim @@ -59,7 +59,8 @@ fu! ctrlp#changes#init(original_bufnr, bufnr) let [swb, &swb] = [&swb, ''] let lines = [] for each in bufs - let fnamet = fnamemodify(bufname(each), ':t') + let bname = bufname(each) + let fnamet = fnamemodify(bname == '' ? '[No Name]' : bname, ':t') cal extend(lines, s:process(s:changelist(each), each, fnamet)) endfo sil! exe 'noa hid b' a:original_bufnr @@ -73,7 +74,7 @@ fu! ctrlp#changes#accept(mode, str) let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') let bufnr = str2nr(get(info, 1)) if bufnr - cal ctrlp#acceptfile(a:mode, bufname(bufnr)) + cal ctrlp#acceptfile(a:mode, bufnr) cal cursor(get(info, 2), get(info, 3)) sil! norm! zvzz en diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim index e9a6c1ca..091e66c2 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/dir.vim @@ -32,12 +32,13 @@ fu! s:globdirs(dirs, depth) let nr = len(g:ctrlp_alldirs) if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth sil! cal ctrlp#progress(nr) + cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")') cal s:globdirs(join(dirs, ','), depth) en endf fu! s:max(len, max) - retu a:max && a:len > a:max ? 1 : 0 + retu a:max && a:len > a:max endf fu! s:nocache() @@ -53,7 +54,9 @@ fu! ctrlp#dir#init(...) let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir') if g:ctrlp_newdir || s:nocache() || !filereadable(cafile) let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []] - cal s:globdirs(s:cwd, 0) + if !ctrlp#igncwd(s:cwd) + cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0) + en cal ctrlp#rmbasedir(g:ctrlp_alldirs) if len(g:ctrlp_alldirs) <= s:compare_lim cal sort(g:ctrlp_alldirs, 'ctrlp#complen') diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim index a2e0ddeb..e82bf1b5 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim @@ -33,9 +33,12 @@ fu! ctrlp#line#init() let [bufs, lines] = [ctrlp#buffers('id'), []] for bufnr in bufs let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] - let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb + if lfb == [] && bufn != '' + let lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p')) + en cal map(lfb, 'tr(v:val, '' '', '' '')') - let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')] + let [linenr, len_lfb] = [1, len(lfb)] + let buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t') wh linenr <= len_lfb let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|' let linenr += 1 @@ -50,7 +53,7 @@ fu! ctrlp#line#accept(mode, str) let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') let bufnr = str2nr(get(info, 1)) if bufnr - cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2)) + cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2)) en endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mixed.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mixed.vim index cf01d107..74d904d8 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mixed.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mixed.vim @@ -41,7 +41,11 @@ fu! s:getnewmix(cwd, clim) if exists('+ssl') && &ssl cal map(mrufs, 'tr(v:val, "\\", "/")') en - let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")') + let allbufs = map(ctrlp#buffers(), 'fnamemodify(v:val, ":p")') + let [bufs, ubufs] = [[], []] + for each in allbufs + cal add(filereadable(each) ? bufs : ubufs, each) + endfo let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0') if len(mrufs) > len(g:ctrlp_lines) cal filter(mrufs, 'stridx(v:val, a:cwd)') @@ -53,6 +57,7 @@ fu! s:getnewmix(cwd, clim) if id >= 0 | cal remove(g:ctrlp_lines, id) | en endfo en + let mrufs += ubufs cal map(mrufs, 'fnamemodify(v:val, ":.")') let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines) \ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim index 161df2da..e34f4504 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/mrufiles.vim @@ -14,6 +14,7 @@ fu! ctrlp#mrufiles#opts() \ 'exclude': ['s:ex', ''], \ 'case_sensitive': ['s:cseno', 1], \ 'relative': ['s:re', 0], + \ 'save_on_update': ['s:soup', 1], \ }] for [ke, va] in items(opts) let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]] @@ -37,29 +38,47 @@ fu! s:chop(mrufs) retu a:mrufs endf -fu! s:reformat(mrufs) +fu! s:reformat(mrufs, ...) + let cwd = getcwd() + let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : '' if {s:re} - let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd() + let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd cal filter(a:mrufs, '!stridx(v:val, cwd)') en - retu map(a:mrufs, 'fnamemodify(v:val, ":.")') + if a:0 && a:1 == 'raw' | retu a:mrufs | en + let idx = strlen(cwd) + if exists('+ssl') && &ssl + let cwd = tr(cwd, '\', '/') + cal map(a:mrufs, 'tr(v:val, "\\", "/")') + en + retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val') endf fu! s:record(bufnr) if s:locked | retu | en let bufnr = a:bufnr + 0 - if bufnr <= 0 | retu | en let bufname = bufname(bufnr) - if empty(bufname) | retu | en - let fn = fnamemodify(bufname, ':p') - let fn = exists('+ssl') ? tr(fn, '/', '\') : fn - cal filter(s:mrbs, 'v:val != bufnr') - cal insert(s:mrbs, bufnr) - if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} ) - \ || !empty(&bt) || !filereadable(fn) | retu + if bufnr > 0 && !empty(bufname) + cal filter(s:mrbs, 'v:val != bufnr') + cal insert(s:mrbs, bufnr) + cal s:addtomrufs(bufname) + en +endf + +fu! s:addtomrufs(fname) + let fn = fnamemodify(a:fname, ':p') + let fn = exists('+ssl') ? tr(fn, '/', '\') : fn + if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} ) + \ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu + en + let idx = index(s:mrufs, fn, 0, !{s:cseno}) + if idx + cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn') + cal insert(s:mrufs, fn) + if {s:soup} && idx < 0 + cal s:savetofile(s:mergelists()) + en en - cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn') - cal insert(s:mrufs, fn) endf fu! s:savetofile(mrufs) @@ -67,28 +86,40 @@ fu! s:savetofile(mrufs) endf " Public {{{1 fu! ctrlp#mrufiles#refresh(...) - let s:mrufs = s:mergelists() - cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') + let mrufs = s:mergelists() + cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') if exists('+ssl') + cal map(mrufs, 'tr(v:val, "/", "\\")') cal map(s:mrufs, 'tr(v:val, "/", "\\")') - cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1') + let cond = 'count(mrufs, v:val, !{s:cseno}) == 1' + cal filter(mrufs, cond) + cal filter(s:mrufs, cond) en - cal s:savetofile(s:mrufs) - retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs)) + cal s:savetofile(mrufs) + retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs) endf fu! ctrlp#mrufiles#remove(files) - let s:mrufs = [] + let mrufs = [] if a:files != [] - let s:mrufs = s:mergelists() - cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0') + let mrufs = s:mergelists() + let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0' + cal filter(mrufs, cond) + cal filter(s:mrufs, cond) + en + cal s:savetofile(mrufs) + retu s:reformat(mrufs) +endf + +fu! ctrlp#mrufiles#add(fn) + if !empty(a:fn) + cal s:addtomrufs(a:fn) en - cal s:savetofile(s:mrufs) - retu s:reformat(copy(s:mrufs)) endf fu! ctrlp#mrufiles#list(...) - retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists()) + retu a:0 ? a:1 == 'raw' ? s:reformat(s:mergelists(), a:1) : 0 + \ : s:reformat(s:mergelists()) endf fu! ctrlp#mrufiles#bufs() @@ -108,7 +139,7 @@ fu! ctrlp#mrufiles#init() let s:locked = 0 aug CtrlPMRUF au! - au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('', 1)) + au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('', 1)) au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPost *vimgrep* let s:locked = 0 au VimLeavePre * cal s:savetofile(s:mergelists()) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/quickfix.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/quickfix.vim index 144851de..03ab9210 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/quickfix.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/quickfix.vim @@ -40,18 +40,15 @@ fu! ctrlp#quickfix#init() endf fu! ctrlp#quickfix#accept(mode, str) - let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|') - if items == [] | retu | en - let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')] - if empty(filpath) | retu | en - cal ctrlp#exit() - let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne' - \ : ctrlp#normcmd('e') - let cmd = cmd == 'e' && &modified ? 'hid e' : cmd - exe cmd ctrlp#fnesc(filpath) - cal cursor(items[2], items[3]) + let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|') + if vals == [] || vals[1] == '' | retu | en + cal ctrlp#acceptfile(a:mode, vals[1]) + let cur_pos = getpos('.')[1:2] + if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)') + mark ' + en + cal cursor(vals[2], vals[3]) sil! norm! zvzz - cal ctrlp#setlcdir() endf fu! ctrlp#quickfix#id() diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/rtscript.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/rtscript.vim index cdae9a19..eed21c61 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/rtscript.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/rtscript.vim @@ -24,23 +24,26 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:filecounts = {} " Utilities {{{1 fu! s:nocache() - retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching ) + retu g:ctrlp_newrts || + \ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching ) endf " Public {{{1 fu! ctrlp#rtscript#init(caching) let [s:caching, s:cwd] = [a:caching, getcwd()] - if g:ctrlp_newrts || s:nocache() - \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) + if s:nocache() || + \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) sil! cal ctrlp#progress('Indexing...') - let entries = split(globpath(&rtp, '**/*.*'), "\n") + let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n") cal filter(entries, 'count(entries, v:val) == 1') let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1] el let [entries, results] = g:ctrlp_rtscache[2:3] en - if g:ctrlp_newrts || s:nocache() - \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] ) - if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en + if s:nocache() || + \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] ) + if !exists('echoed') + sil! cal ctrlp#progress('Processing...') + en let results = map(copy(entries), 'fnamemodify(v:val, '':.'')') en let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0] diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim index 53b5d612..cd4d9097 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/tag.vim @@ -54,11 +54,11 @@ fu! s:filter(tags) let nr = 0 wh 0 < 1 if a:tags == [] | brea | en - if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_' + if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_' let nr += 1 con en - if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr + if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr cal remove(a:tags, nr) el brea @@ -97,15 +97,19 @@ fu! ctrlp#tag#accept(mode, str) \ 'e': ['', 'tj'], \ } let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1] - let cmd = cmd == 'tj' && &mod ? 'hid '.cmd : cmd + let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw) + \ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd if fnd[0] == 1 if cmd != '' exe cmd en - exe fnd[1].'ta' tg + let save_cst = &cst + set cst& + cal feedkeys(":".fnd[1]."ta ".tg."\r", 'nt') + let &cst = save_cst el - exe cmd tg + cal feedkeys(":".cmd." ".tg."\r", 'nt') en cal ctrlp#setlcdir() endf diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim index f2aa9050..91b9f24e 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim @@ -8,25 +8,28 @@ fu! ctrlp#utils#lash() retu &ssl || !exists('+ssl') ? '/' : '\' endf -let s:lash = ctrlp#utils#lash() fu! s:lash(...) retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : '' endf fu! ctrlp#utils#opts() - let usrhome = $HOME.s:lash($HOME) + let s:lash = ctrlp#utils#lash() + let usrhome = $HOME . s:lash( $HOME ) let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache' - let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache') + let cadir = isdirectory(usrhome.'.ctrlp_cache') \ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp' if exists('g:ctrlp_cache_dir') - let s:cache_dir = expand(g:ctrlp_cache_dir, 1) - if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache') - let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache' + let cadir = expand(g:ctrlp_cache_dir, 1) + if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache') + let cadir = cadir.s:lash(cadir).'.ctrlp_cache' en en + let s:cache_dir = cadir endf cal ctrlp#utils#opts() + +let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') ) " Files and Directories {{{1 fu! ctrlp#utils#cachedir() retu s:cache_dir @@ -64,8 +67,43 @@ fu! ctrlp#utils#writecache(lines, ...) endf fu! ctrlp#utils#glob(...) - let cond = v:version > 702 || ( v:version == 702 && has('patch051') ) - retu call('glob', cond ? a:000 : [a:1]) + let path = ctrlp#utils#fnesc(a:1, 'g') + retu s:wig_cond ? glob(path, a:2) : glob(path) +endf + +fu! ctrlp#utils#globpath(...) + retu call('globpath', s:wig_cond ? a:000 : a:000[:1]) +endf + +fu! ctrlp#utils#fnesc(path, type, ...) + if exists('*fnameescape') + if exists('+ssl') + if a:type == 'c' + let path = escape(a:path, '%#') + elsei a:type == 'f' + let path = fnameescape(a:path) + elsei a:type == 'g' + let path = escape(a:path, '?*') + en + let path = substitute(path, '[', '[[]', 'g') + el + let path = fnameescape(a:path) + en + el + if exists('+ssl') + if a:type == 'c' + let path = escape(a:path, '%#') + elsei a:type == 'f' + let path = escape(a:path, " \t\n%#*?|<\"") + elsei a:type == 'g' + let path = escape(a:path, '?*') + en + let path = substitute(path, '[', '[[]', 'g') + el + let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<") + en + en + retu a:0 ? escape(path, a:1) : path endf "}}} diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index 82633a47..cf3e23a4 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -1,4 +1,4 @@ -*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.78 +*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.79 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* =============================================================================== # # @@ -35,50 +35,53 @@ OPTIONS *ctrlp-options* Overview:~ - |loaded_ctrlp| Disable the plugin. - |ctrlp_map| Default mapping. - |ctrlp_cmd| Default command used for the default mapping. - |ctrlp_by_filename| Default to filename mode or not. - |ctrlp_regexp| Default to regexp mode or not. - |ctrlp_match_window_bottom| Where to show the match window. - |ctrlp_match_window_reversed| Sort order in the match window. - |ctrlp_max_height| Max height of the match window. - |ctrlp_switch_buffer| Jump to an open buffer if already opened. - |ctrlp_reuse_window| Reuse special windows (help, quickfix, etc). - |ctrlp_tabpage_position| Where to put the new tab page. - |ctrlp_working_path_mode| How to set CtrlP's local working directory. - |ctrlp_root_markers| Additional, high priority root markers. - |ctrlp_use_caching| Use per-session caching or not. - |ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not. - |ctrlp_cache_dir| Location of the cache directory. - |ctrlp_dotfiles| Ignore dotfiles and dotdirs or not. - |ctrlp_custom_ignore| Hide stuff when using |globpath()|. - |ctrlp_max_files| Number of files to scan initially. - |ctrlp_max_depth| Directory depth to recurse into when scanning. - |ctrlp_user_command| Use an external scanner. - |ctrlp_max_history| Number of entries saved in the prompt history. - |ctrlp_open_new_file| How to open a file created by . - |ctrlp_open_multiple_files| How to open files selected by . - |ctrlp_arg_map| Intercept and or not. - |ctrlp_follow_symlinks| Follow symbolic links or not. - |ctrlp_lazy_update| Only update when typing has stopped. - |ctrlp_default_input| Seed the prompt with an initial string. - |ctrlp_use_migemo| Use Migemo patterns for Japanese filenames. - |ctrlp_prompt_mappings| Change the mappings in the prompt. + |loaded_ctrlp|................Disable the plugin. + |ctrlp_map|...................Default mapping. + |ctrlp_cmd|...................Default command used for the default mapping. + |ctrlp_by_filename|...........Default to filename mode or not. + |ctrlp_regexp|................Default to regexp mode or not. + |ctrlp_match_window_bottom|...Where to show the match window. + |ctrlp_match_window_reversed|.Sort order in the match window. + |ctrlp_max_height|............Max height of the match window. + |ctrlp_switch_buffer|.........Jump to an open buffer if already opened. + |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc). + |ctrlp_tabpage_position|......Where to put the new tab page. + |ctrlp_working_path_mode|.....How to set CtrlP's local working directory. + |ctrlp_root_markers|..........Additional, high priority root markers. + |ctrlp_use_caching|...........Use per-session caching or not. + |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not. + |ctrlp_cache_dir|.............Location of the cache directory. + |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not. + |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|. + |ctrlp_max_files|.............Number of files to scan initially. + |ctrlp_max_depth|.............Directory depth to recurse into when scanning. + |ctrlp_user_command|..........Use an external scanner. + |ctrlp_max_history|...........Number of entries saved in the prompt history. + |ctrlp_open_new_file|.........How to open a file created by . + |ctrlp_open_multiple_files|...How to open files selected by . + |ctrlp_arg_map|...............Intercept and or not. + |ctrlp_follow_symlinks|.......Follow symbolic links or not. + |ctrlp_lazy_update|...........Only update when typing has stopped. + |ctrlp_default_input|.........Seed the prompt with an initial string. + |ctrlp_abbrev|................Input abbreviations. + |ctrlp_key_loop|..............Use input looping for multi-byte input. + |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames. + |ctrlp_prompt_mappings|.......Change the mappings inside the prompt. MRU mode: - |ctrlp_mruf_max| Max MRU entries to remember. - |ctrlp_mruf_exclude| Files that shouldn't be remembered. - |ctrlp_mruf_include| Files to be remembered. - |ctrlp_mruf_relative| Show only MRU files in the working directory. - |ctrlp_mruf_default_order| Disable sorting. - |ctrlp_mruf_case_sensitive| MRU files are case sensitive or not. + |ctrlp_mruf_max|..............Max MRU entries to remember. + |ctrlp_mruf_exclude|..........Files that shouldn't be remembered. + |ctrlp_mruf_include|..........Files to be remembered. + |ctrlp_mruf_relative|.........Show only MRU files in the working directory. + |ctrlp_mruf_default_order|....Disable sorting. + |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not. + |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added. Advanced options: - |ctrlp_open_func| Use custom file opening functions. - |ctrlp_status_func| Change CtrlP's two statuslines. - |ctrlp_buffer_func| Call custom functions in the CtrlP buffer. - |ctrlp_match_func| Replace the built-in matching algorithm. + |ctrlp_open_func|.............Use custom file opening functions. + |ctrlp_status_func|...........Change CtrlP's two statuslines. + |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer. + |ctrlp_match_func|............Replace the built-in matching algorithm. ------------------------------------------------------------------------------- Detailed descriptions and default values:~ @@ -128,13 +131,16 @@ Set the maximum height of the match window: > < *'g:ctrlp_switch_buffer'* -When opening a file with or , if the file's already opened somewhere -CtrlP will try to jump to it instead of opening a new instance: > - let g:ctrlp_switch_buffer = 2 +When opening a file, if it's already open in a window somewhere, CtrlP will try +to jump to it instead of opening a new instance: > + let g:ctrlp_switch_buffer = 'Et' < - 1 - only jump to the buffer if it's opened in the current tab. - 2 - jump tab as well if the buffer's opened in another tab. - 0 - disable this feature. + e - jump when is pressed, but only to windows in the current tab. + t - jump when is pressed, but only to windows in another tab. + v - like "e", but jump when is pressed. + h - like "e", but jump when is pressed. + E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere. + 0 or - disable this feature. *'g:ctrlp_reuse_window'* When opening a file with , CtrlP avoids opening it in windows created by @@ -160,24 +166,29 @@ Where to put the new tab page when opening one: > *'g:ctrlp_working_path_mode'* When starting up, CtrlP sets its local working directory according to this variable: > - let g:ctrlp_working_path_mode = 'rc' + let g:ctrlp_working_path_mode = 'ra' < c - the directory of the current file. + a - like "c", but only applies when the current working directory outside of + CtrlP isn't a direct ancestor of the directory of the current file. r - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr _darcs - {empty-string} - don't manage working directory. + w - begin finding a root from the current working directory outside of CtrlP + instead of from the directory of the current file (default). Only applies + when "r" is also present. + 0 or - disable this feature. -Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option -on a per buffer basis. +Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as +a fallback) when a root can't be found. -Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the -directory of the current file. +Note #2: you can use a |b:var| to set this option on a per buffer basis. *'g:ctrlp_root_markers'* Use this to set your own root markers in addition to the default ones (.git, .hg, .svn, .bzr, and _darcs). Your markers will take precedence: > let g:ctrlp_root_markers = [''] < +Note: you can use a |b:var| to set this option on a per buffer basis. *'g:ctrlp_use_caching'* Enable/Disable per-session caching: > @@ -187,6 +198,7 @@ Enable/Disable per-session caching: > 1 - Enable caching. n - When bigger than 1, disable caching and use the number as the limit to enable caching again. + Note: you can quickly purge the cache by pressing while inside CtrlP. *'g:ctrlp_clear_cache_on_exit'* @@ -200,18 +212,20 @@ Set the directory to store the cache files: > let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp' < - *'g:ctrlp_dotfiles'* -Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: > - let g:ctrlp_dotfiles = 1 + *'g:ctrlp_show_hidden'* +Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: > + let g:ctrlp_show_hidden = 0 < +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. *'ctrlp-wildignore'* You can use Vim's |'wildignore'| to exclude files and directories from the results. Examples: > " Excluding version control directories - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=.git\*,.hg\*,.svn\* " Windows + set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX + set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') < Note #1: the `*/` in front of each directory glob is required. @@ -226,25 +240,36 @@ CtrlP to not show. Use regexp to specify the patterns: > let g:ctrlp_custom_ignore = '' < Examples: > - let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' + let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' let g:ctrlp_custom_ignore = { - \ 'dir': '\.git$\|\.hg$\|\.svn$', - \ 'file': '\.exe$\|\.so$\|\.dll$', + \ 'dir': '\v[\/]\.(git|hg|svn)$', + \ 'file': '\v\.(exe|so|dll)$', \ 'link': 'SOME_BAD_SYMBOLIC_LINKS', \ } + let g:ctrlp_custom_ignore = { + \ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@ let g:ctrlp_max_files = 10000 < +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. *'g:ctrlp_max_depth'* The maximum depth of a directory tree to recurse into: > let g:ctrlp_max_depth = 40 < -Note: the larger these values, the more memory Vim uses. +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. *'g:ctrlp_user_command'* Specify an external tool to use for listing files instead of using Vim's @@ -257,8 +282,10 @@ Examples: > < You can also use 'grep', 'findstr' or something else to filter the results. Examples: > - let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)' - let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$' + let g:ctrlp_user_command = + \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux + let g:ctrlp_user_command = + \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows < Use a version control listing command when inside a repository, this is faster when scanning large projects: > @@ -268,12 +295,16 @@ when scanning large projects: > \ 1: [root_marker_1, listing_command_1], \ n: [root_marker_n, listing_command_n], \ }, - \ 'fallback': fallback_command + \ 'fallback': fallback_command, + \ 'ignore': 0 or 1 \ } < -Examples: > +Some examples: > + " Single VCS, listing command does not list untracked files: let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files'] let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .'] + + " Multiple VCS's: let g:ctrlp_user_command = { \ 'types': { \ 1: ['.git', 'cd %s && git ls-files'], @@ -281,9 +312,29 @@ Examples: > \ }, \ 'fallback': 'find %s -type f' \ } + + " Single VCS, listing command lists untracked files (slower): + let g:ctrlp_user_command = + \ ['.git', 'cd %s && git ls-files . -co --exclude-standard'] + + let g:ctrlp_user_command = + \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux + + let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') ' + \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows < -If the fallback_command is empty or not defined, |globpath()| will then be used -when searching outside a repo. +Note #1: if the fallback_command is empty or the 'fallback' key is not defined, +|globpath()| will then be used when scanning outside of a repository. + +Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set +to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when +these custom commands are being used. When not present, 'ignore' is set to 0 by +default to retain the performance advantage of using external commands. + +Note #3: when changing the option's variable type, remember to |:unlet| it +first or restart Vim to avoid the "E706: Variable type mismatch" error. + +Note #4: you can use a |b:var| to set this option on a per buffer basis. *'g:ctrlp_max_history'* The maximum number of input strings you want CtrlP to remember. The default @@ -294,14 +345,13 @@ Set to 0 to disable prompt's history. Browse the history with and . *'g:ctrlp_open_new_file'* Use this option to specify how the newly created file is to be opened when -pressing : - t - in a new tab - h - in a new horizontal split - v - in a new vertical split - r - in the current window -> +pressing : > let g:ctrlp_open_new_file = 'v' < + t - in a new tab. + h - in a new horizontal split. + v - in a new vertical split. + r - in the current window. *'g:ctrlp_open_multiple_files'* If non-zero, this will enable opening multiple files with and : > @@ -322,7 +372,8 @@ For the letters: i - all files as hidden buffers. j - after opening, jump to the first opened tab or window. r - open the first file in the current window, then the remaining files in - new splits or new tabs depending on which of h, v and t is also present. + new splits or new tabs depending on which of "h", "v" and "t" is also + present. *'g:ctrlp_arg_map'* When this is set to 1, the and mappings will accept one extra key @@ -348,6 +399,9 @@ If non-zero, CtrlP will follow symbolic links when listing files: > 1 - follow but ignore looped internal symlinks to avoid duplicates. 2 - follow all symlinks indiscriminately. +Note: does not apply when a command defined with |g:ctrlp_user_command| is +being used. + *'g:ctrlp_lazy_update'* Set this to 1 to enable the lazy-update feature: only update the match window after typing's been stopped for a certain amount of time: > @@ -366,6 +420,68 @@ as the default input: > let g:ctrlp_default_input = 'anystring' < + *'g:ctrlp_abbrev'* +Define input abbreviations that can be expanded (either internally or visibly) +in the prompt: > + let g:ctrlp_abbrev = {} +< +Examples: > + let g:ctrlp_abbrev = { + \ 'gmode': 'i', + \ 'abbrevs': [ + \ { + \ 'pattern': '^cd b', + \ 'expanded': '@cd ~/.vim/bundle', + \ 'mode': 'pfrz', + \ }, + \ { + \ 'pattern': '\(^@.\+\|\\\@ (use the expanded string in the + new filename). + c - only when auto-completing directory names with (expand the pattern + immediately before doing the auto-completion). + or not defined - always enable. + +Note: the abbrev entries are evaluated in sequence, so a later entry can be +evaluated against the expanded result of a previous entry; this includes itself +when 'gmode' is "t". + + *'g:ctrlp_key_loop'* +An experimental feature. Set this to 1 to enable input looping for the typing +of multi-byte characters: > + let g:ctrlp_key_loop = 0 +< +Note #1: when set, this option resets the |g:ctrlp_lazy_update| option. + +Note #2: you can toggle this feature inside the prompt with a custom mapping: > + let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': [''] } +< + *'g:ctrlp_use_migemo'* Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only works in regexp mode. To split the pattern, separate words with space: > @@ -412,9 +528,8 @@ only need to keep the lines that you've changed the values (inside []): > \ 'PrtExit()': ['', '', ''], \ } < -Note: In some terminals, it's not possible to remap without also changing - (|keycodes|). So if pressing moves the cursor to the left instead of -deleting a char for you, add this to your |.vimrc| to disable the plugin's +Note: if pressing moves the cursor one character to the left instead of +deleting a character for you, add this to your |.vimrc| to disable the plugin's default mapping: > let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['', ''] } < @@ -460,6 +575,12 @@ MRU entries: > let g:ctrlp_mruf_case_sensitive = 1 < + *'g:ctrlp_mruf_save_on_update'* +Set this to 0 to disable saving of the MRU list to hard drive whenever a new +entry is added, saving will then only occur when exiting Vim: > + let g:ctrlp_mruf_save_on_update = 1 +< + ---------------------------------------- Advanced options:~ @@ -634,12 +755,13 @@ COMMANDS *ctrlp-commands* Open CtrlP in find Most-Recently-Used file mode. *:CtrlPLastMode* -:CtrlPLastMode - Open CtrlP in the last mode used. +:CtrlPLastMode [--dir] + Open CtrlP in the last mode used. When having the "--dir" argument, also + reuse the last working directory. *:CtrlPRoot* :CtrlPRoot - This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores + This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores the variable's current value. *:CtrlPClearCache* @@ -768,7 +890,22 @@ Opening multiple files:~ - Mark/unmark a file to create a new file in its directory using . - Open files marked by . + - Open files marked by . + - When no file has been marked by , open a console dialog with the + following options: + + Open the selected file: + t - in a tab page. + v - in a vertical split. + h - in a horizontal split. + r - in the current window. + i - as a hidden buffer. + x - (optional) with the function defined in |g:ctrlp_open_func|. + + Other options (not shown): + a - mark all files in the match window. + d - change CtrlP's local working directory to the selected file's + directory and switch to find file mode. Function keys:~ @@ -891,7 +1028,7 @@ Available extensions:~ *:CtrlPTag* * Tag mode:~ - Name: 'tag' - - Command: ':CtrlPTag' + - Command: ":CtrlPTag" - Search for a tag within a generated central tags file, and jump to the definition. Use the Vim's option |'tags'| to specify the names and the locations of the tags file(s). @@ -901,21 +1038,21 @@ Available extensions:~ *:CtrlPBufTagAll* * Buffer Tag mode:~ - Name: 'buffertag' - - Commands: ':CtrlPBufTag [buffer]', - ':CtrlPBufTagAll'. + - Commands: ":CtrlPBufTag [buffer]", + ":CtrlPBufTagAll". - Search for a tag within the current buffer or all listed buffers and jump to the definition. Requires |exuberant_ctags| or compatible programs. *:CtrlPQuickfix* * Quickfix mode:~ - Name: 'quickfix' - - Command: ':CtrlPQuickfix' + - Command: ":CtrlPQuickfix" - Search for an entry in the current quickfix errors and jump to it. *:CtrlPDir* * Directory mode:~ - Name: 'dir' - - Command: ':CtrlPDir [starting-directory]' + - Command: ":CtrlPDir [starting-directory]" - Search for a directory and change the working directory to it. - Mappings: + change the local working directory for CtrlP and keep it open. @@ -927,42 +1064,42 @@ Available extensions:~ *:CtrlPRTS* * Runtime script mode:~ - Name: 'rtscript' - - Command: ':CtrlPRTS' + - Command: ":CtrlPRTS" - Search for files (vimscripts, docs, snippets...) in runtimepath. *:CtrlPUndo* * Undo mode:~ - Name: 'undo' - - Command: ':CtrlPUndo' + - Command: ":CtrlPUndo" - Browse undo history. *:CtrlPLine* * Line mode:~ - Name: 'line' - - Command: ':CtrlPLine' + - Command: ":CtrlPLine" - Search for a line in all listed buffers. *:CtrlPChange* *:CtrlPChangeAll* * Change list mode:~ - Name: 'changes' - - Commands: ':CtrlPChange [buffer]', - ':CtrlPChangeAll'. + - Commands: ":CtrlPChange [buffer]", + ":CtrlPChangeAll". - Search for and jump to a recent change in the current buffer or in all listed buffers. *:CtrlPMixed* * Mixed mode:~ - Name: 'mixed' - - Command: ':CtrlPMixed' + - Command: ":CtrlPMixed" - Search in files, buffers and MRU files at the same time. *:CtrlPBookmarkDir* *:CtrlPBookmarkDirAdd* * BookmarkDir mode:~ - Name: 'bookmarkdir' - - Commands: ':CtrlPBookmarkDir', - ':CtrlPBookmarkDirAdd [directory]'. + - Commands: ":CtrlPBookmarkDir", + ":CtrlPBookmarkDirAdd [directory]". - Search for a bookmarked directory and change the working directory to it. - Mappings: + change the local working directory for CtrlP, keep it open and @@ -1027,8 +1164,8 @@ Highlighting:~ Statuslines:~ * Highlight groups: - CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character) - CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|) + CtrlPMode1 : 'file' or 'path', and the current mode (Character) + CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|) CtrlPStats : the scanning status (Function) For rebuilding the statuslines, see |g:ctrlp_status_func|. @@ -1083,7 +1220,7 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* =============================================================================== CREDITS *ctrlp-credits* -Developed by Kien Nguyen . +Developed by Kien Nguyen . Distributed under Vim's |license|. Project's homepage: http://kien.github.com/ctrlp.vim Git repository: https://github.com/kien/ctrlp.vim @@ -1109,12 +1246,25 @@ Special thanks:~ * Luca Pette * Seth Fowler * Lowe Thiderman + * Christopher Fredén + * Zahary Karadjov + * Jo De Boeck =============================================================================== CHANGELOG *ctrlp-changelog* - + New options: |g:ctrlp_open_func|. - |g:ctrlp_tabpage_position|. +Before 2012/11/30~ + + + New options: |g:ctrlp_abbrev|, + |g:ctrlp_key_loop|, + |g:ctrlp_open_func|, + |g:ctrlp_tabpage_position|, + |g:ctrlp_mruf_save_on_update| + + Rename: + *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|. + + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type + (old values still work). + + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'. Before 2012/06/15~ diff --git a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim index f7d1b133..b6f9a27e 100644 --- a/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/plugin/ctrlp.vim @@ -21,19 +21,17 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': }) com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': }) com! -bar CtrlPBuffer cal ctrlp#init(1) -com! -bar CtrlPLastMode cal ctrlp#init(-1) +com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': }) com! -bar CtrlPClearCache cal ctrlp#clr() com! -bar CtrlPClearAllCaches cal ctrlp#clra() -com! -bar CtrlPReload cal ctrlp#reset() com! -bar ClearCtrlPCache cal ctrlp#clr() com! -bar ClearAllCtrlPCaches cal ctrlp#clra() -com! -bar ResetCtrlP cal ctrlp#reset() com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' }) com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' }) -com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' }) +com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' }) if g:ctrlp_map != '' && !hasmapto(':'.g:ctrlp_cmd.'', 'n') exe 'nn ' g:ctrlp_map ':'.g:ctrlp_cmd.'' @@ -64,3 +62,5 @@ com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id()) com! -n=? -com=dir CtrlPBookmarkDirAdd \ cal ctrlp#call('ctrlp#bookmarkdir#add', ) + +" vim:ts=2:sw=2:sts=2 diff --git a/sources_non_forked/ctrlp.vim/readme.md b/sources_non_forked/ctrlp.vim/readme.md index 90d6e6f9..bcd07c7f 100644 --- a/sources_non_forked/ctrlp.vim/readme.md +++ b/sources_non_forked/ctrlp.vim/readme.md @@ -23,6 +23,8 @@ Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands. * Press `` and `` to cycle between modes. * Press `` to switch to filename only search instead of full path. * Press `` to switch to regexp mode. +* Use ``, `` or the arrow keys to navigate the result list. +* Use `` or ``, `` to open the selected entry in a new tab or in a new split. * Use ``, `` to select the next/previous string in the prompt's history. * Use `` to create a new file and its parent directories. * Use `` to mark/unmark multiple files and `` to open them. @@ -32,8 +34,7 @@ Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help. * Submit two or more dots `..` to go up the directory tree by one or multiple levels. * End the input string with a colon `:` followed by a command to execute it on the opening file(s): Use `:25` to jump to line 25. -Use `:/any\:\ string` to jump to the first instance of `any: string`. -Use `:difft` when opening multiple files to run `:difft` on the first 4 files. +Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files. ## Basic Options * Change the default mapping and the default command to invoke CtrlP: @@ -46,26 +47,26 @@ Use `:difft` when opening multiple files to run `:difft` on the first 4 files. * When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable: ```vim - let g:ctrlp_working_path_mode = 'rc' + let g:ctrlp_working_path_mode = 'ra' ``` - `{empty-string}` - don't manage working directory. - `c` - the directory of the current file. - `r` - the nearest ancestor that contains one of these directories or files: - `.git` `.hg` `.svn` `.bzr` `_darcs` + `'c'` - the directory of the current file. + `'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs` + `'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file. + `0` or `''` (empty string) - disable this feature. Define additional root markers with the `g:ctrlp_root_markers` option. * Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`: ```vim - set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux - set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows + set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux + set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows - let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' + let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' let g:ctrlp_custom_ignore = { - \ 'dir': '\.git$\|\.hg$\|\.svn$', - \ 'file': '\.exe$\|\.so$\|\.dll$', + \ 'dir': '\v[\/]\.(git|hg|svn)$', + \ 'file': '\v\.(exe|so|dll)$', \ 'link': 'some_bad_symbolic_links', \ } ``` diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 19217ba4..60869dea 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -82,6 +82,10 @@ __Q. How can I open a NERDTree automatically when vim starts up if no files were A. Stick this in your vimrc `autocmd vimenter * if !argc() | NERDTree | endif` +__Q. How can I map a specific key or shortcut to open NERDTree?__ + +A. Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): `map :NERDTreeToggle` + __Q. How can I close vim if the only window left open is a NERDTree?__ A. Stick this in your vimrc: diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim new file mode 100644 index 00000000..3da55662 --- /dev/null +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -0,0 +1,1367 @@ +if exists("g:loaded_nerdtree_autoload") + finish +endif +let g:loaded_nerdtree_autoload = 1 + +function! nerdtree#version() + return '4.2.0' +endfunction + +" SECTION: General Functions {{{1 +"============================================================ +"FUNCTION: nerdtree#bufInWindows(bnum){{{2 +"[[STOLEN FROM VTREEEXPLORER.VIM]] +"Determine the number of windows open to this buffer number. +"Care of Yegappan Lakshman. Thanks! +" +"Args: +"bnum: the subject buffers buffer number +function! nerdtree#bufInWindows(bnum) + let cnt = 0 + let winnum = 1 + while 1 + let bufnum = winbufnr(winnum) + if bufnum < 0 + break + endif + if bufnum ==# a:bnum + let cnt = cnt + 1 + endif + let winnum = winnum + 1 + endwhile + + return cnt +endfunction + +"FUNCTION: nerdtree#checkForBrowse(dir) {{{2 +"inits a secondary nerd tree in the current buffer if appropriate +function! nerdtree#checkForBrowse(dir) + if a:dir != '' && isdirectory(a:dir) + call g:NERDTreeCreator.CreateSecondary(a:dir) + endif +endfunction + +" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2 +" completion function for the bookmark commands +function! nerdtree#completeBookmarks(A,L,P) + return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') +endfunction + +"FUNCTION: nerdtree#compareBookmarks(dir) {{{2 +function! nerdtree#compareBookmarks(first, second) + return a:first.compareTo(a:second) +endfunction + +"FUNCTION: nerdtree#compareNodes(dir) {{{2 +function! nerdtree#compareNodes(n1, n2) + return a:n1.path.compareTo(a:n2.path) +endfunction + +" FUNCTION: nerdtree#createDefaultBindings() {{{2 +function! nerdtree#createDefaultBindings() + let s = '' . s:SID() . '_' + + call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleMiddleMouse" }) + call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) + + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Bookmark", 'callback': s."openHSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Bookmark", 'callback': s."openVSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewNodeCurrent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Bookmark", 'callback': s."previewNodeVSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Bookmark", 'callback': s."previewNodeHSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': "all", 'callback': s."upDirCurrentRootClosed" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': "all", 'callback': s."upDirCurrentRootOpen" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': "Node", 'callback': s."chRoot" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#chRootCwd" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" }) +endfunction + +" FUNCTION: nerdtree#deprecated(func, [msg]) {{{2 +" Issue a deprecation warning for a:func. If a second arg is given, use this +" as the deprecation message +function! nerdtree#deprecated(func, ...) + let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated' + + if !exists('s:deprecationWarnings') + let s:deprecationWarnings = {} + endif + if !has_key(s:deprecationWarnings, a:func) + let s:deprecationWarnings[a:func] = 1 + echomsg msg + endif +endfunction + +"FUNCTION: nerdtree#escChars(dir) {{{2 +function! nerdtree#escChars() + if nerdtree#runningWindows() + return " `\|\"#%&,?()\*^<>" + endif + + return " \\`\|\"#%&,?()\*^<>[]" +endfunction + +" FUNCTION: nerdtree#exec(cmd) {{{2 +" same as :exec cmd but eventignore=all is set for the duration +function! nerdtree#exec(cmd) + let old_ei = &ei + set ei=all + exec a:cmd + let &ei = old_ei +endfunction + +" FUNCTION: nerdtree#findAndRevealPath() {{{2 +function! nerdtree#findAndRevealPath() + try + let p = g:NERDTreePath.New(expand("%:p")) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("no file for the current buffer") + return + endtry + + if p.isUnixHiddenPath() + let showhidden=g:NERDTreeShowHidden + let g:NERDTreeShowHidden = 1 + endif + + if !nerdtree#treeExistsForTab() + try + let cwd = g:NERDTreePath.New(getcwd()) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("current directory does not exist.") + let cwd = p.getParent() + endtry + + if p.isUnder(cwd) + call g:NERDTreeCreator.CreatePrimary(cwd.str()) + else + call g:NERDTreeCreator.CreatePrimary(p.getParent().str()) + endif + else + if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path) + if !nerdtree#isTreeOpen() + call g:NERDTreeCreator.TogglePrimary('') + else + call nerdtree#putCursorInTreeWin() + endif + let b:NERDTreeShowHidden = g:NERDTreeShowHidden + call nerdtree#chRoot(g:NERDTreeDirNode.New(p.getParent())) + else + if !nerdtree#isTreeOpen() + call g:NERDTreeCreator.TogglePrimary("") + endif + endif + endif + call nerdtree#putCursorInTreeWin() + call b:NERDTreeRoot.reveal(p) + + if p.isUnixHiddenFile() + let g:NERDTreeShowHidden = showhidden + endif +endfunction + +" FUNCTION: nerdtree#has_opt(options, name) {{{2 +function! nerdtree#has_opt(options, name) + return has_key(a:options, a:name) && a:options[a:name] == 1 +endfunction + +" FUNCTION: nerdtree#invokeKeyMap(key) {{{2 +"this is needed since I cant figure out how to invoke dict functions from a +"key map +function! nerdtree#invokeKeyMap(key) + call g:NERDTreeKeyMap.Invoke(a:key) +endfunction + +" FUNCTION: nerdtree#postSourceActions() {{{2 +function! nerdtree#postSourceActions() + call g:NERDTreeBookmark.CacheBookmarks(0) + call nerdtree#createDefaultBindings() + + "load all nerdtree plugins + runtime! nerdtree_plugin/**/*.vim +endfunction + +"FUNCTION: nerdtree#runningWindows(dir) {{{2 +function! nerdtree#runningWindows() + return has("win16") || has("win32") || has("win64") +endfunction + +" Function: s:SID() {{{2 +function s:SID() + if !exists("s:sid") + let s:sid = matchstr(expand(''), '\zs\d\+\ze_SID$') + endif + return s:sid +endfun + +" FUNCTION: nerdtree#tabpagevar(tabnr, var) {{{2 +function! nerdtree#tabpagevar(tabnr, var) + let currentTab = tabpagenr() + let old_ei = &ei + set ei=all + + exec "tabnext " . a:tabnr + let v = -1 + if exists('t:' . a:var) + exec 'let v = t:' . a:var + endif + exec "tabnext " . currentTab + + let &ei = old_ei + + return v +endfunction + +" Function: nerdtree#treeExistsForBuffer() {{{2 +" Returns 1 if a nerd tree root exists in the current buffer +function! nerdtree#treeExistsForBuf() + return exists("b:NERDTreeRoot") +endfunction + +" Function: nerdtree#treeExistsForTab() {{{2 +" Returns 1 if a nerd tree root exists in the current tab +function! nerdtree#treeExistsForTab() + return exists("t:NERDTreeBufName") +endfunction + +"FUNCTION: nerdtree#treeMarkupReg(dir) {{{2 +function! nerdtree#treeMarkupReg() + if g:NERDTreeDirArrows + return '^\([▾▸] \| \+[▾▸] \| \+\)' + endif + + return '^[ `|]*[\-+~]' +endfunction + +"FUNCTION: nerdtree#treeUpDirLine(dir) {{{2 +function! nerdtree#treeUpDirLine() + return '.. (up a dir)' +endfunction + +"FUNCTION: nerdtree#treeWid(dir) {{{2 +function! nerdtree#treeWid() + return 2 +endfunction + +"FUNCTION: nerdtree#upDir(keepState) {{{2 +"moves the tree up a level +" +"Args: +"keepState: 1 if the current root should be left open when the tree is +"re-rendered +function! nerdtree#upDir(keepState) + let cwd = b:NERDTreeRoot.path.str({'format': 'UI'}) + if cwd ==# "/" || cwd =~# '^[^/]..$' + call nerdtree#echo("already at top dir") + else + if !a:keepState + call b:NERDTreeRoot.close() + endif + + let oldRoot = b:NERDTreeRoot + + if empty(b:NERDTreeRoot.parent) + let path = b:NERDTreeRoot.path.getParent() + let newRoot = g:NERDTreeDirNode.New(path) + call newRoot.open() + call newRoot.transplantChild(b:NERDTreeRoot) + let b:NERDTreeRoot = newRoot + else + let b:NERDTreeRoot = b:NERDTreeRoot.parent + endif + + if g:NERDTreeChDirMode ==# 2 + call b:NERDTreeRoot.path.changeToDir() + endif + + call nerdtree#renderView() + call oldRoot.putCursorHere(0, 0) + endif +endfunction + +" Function: nerdtree#unique(list) {{{2 +" returns a:list without duplicates +function! nerdtree#unique(list) + let uniqlist = [] + for elem in a:list + if index(uniqlist, elem) ==# -1 + let uniqlist += [elem] + endif + endfor + return uniqlist +endfunction + +" SECTION: View Functions {{{1 +"============================================================ +" +"FUNCTION: nerdtree#centerView() {{{2 +"centers the nerd tree window around the cursor (provided the nerd tree +"options permit) +function! nerdtree#centerView() + if g:NERDTreeAutoCenter + let current_line = winline() + let lines_to_top = current_line + let lines_to_bottom = winheight(nerdtree#getTreeWinNum()) - current_line + if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold + normal! zz + endif + endif +endfunction + +" FUNCTION: nerdtree#chRoot(node) {{{2 +" changes the current root to the selected one +function! nerdtree#chRoot(node) + call s:chRoot(a:node) +endfunction +"FUNCTION: nerdtree#closeTree() {{{2 +"Closes the primary NERD tree window for this tab +function! nerdtree#closeTree() + if !nerdtree#isTreeOpen() + throw "NERDTree.NoTreeFoundError: no NERDTree is open" + endif + + if winnr("$") != 1 + if winnr() == nerdtree#getTreeWinNum() + call nerdtree#exec("wincmd p") + let bufnr = bufnr("") + call nerdtree#exec("wincmd p") + else + let bufnr = bufnr("") + endif + + call nerdtree#exec(nerdtree#getTreeWinNum() . " wincmd w") + close + call nerdtree#exec(bufwinnr(bufnr) . " wincmd w") + else + close + endif +endfunction + +"FUNCTION: nerdtree#closeTreeIfOpen() {{{2 +"Closes the NERD tree window if it is open +function! nerdtree#closeTreeIfOpen() + if nerdtree#isTreeOpen() + call nerdtree#closeTree() + endif +endfunction + +"FUNCTION: nerdtree#closeTreeIfQuitOnOpen() {{{2 +"Closes the NERD tree window if the close on open option is set +function! nerdtree#closeTreeIfQuitOnOpen() + if g:NERDTreeQuitOnOpen && nerdtree#isTreeOpen() + call nerdtree#closeTree() + endif +endfunction + +"FUNCTION: nerdtree#dumpHelp {{{2 +"prints out the quick help +function! nerdtree#dumpHelp() + let old_h = @h + if b:treeShowHelp ==# 1 + let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n" + let @h=@h."\" ============================\n" + let @h=@h."\" File node mappings~\n" + let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" + let @h=@h."\" ,\n" + if b:NERDTreeType ==# "primary" + let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n" + else + let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n" + endif + if b:NERDTreeType ==# "primary" + let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n" + endif + let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let @h=@h."\" middle-click,\n" + let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n" + let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n" + let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" + let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Directory node mappings~\n" + let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" + let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n" + let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" + let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n" + let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" + let @h=@h."\" current node recursively\n" + let @h=@h."\" middle-click,\n" + let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Bookmark table mappings~\n" + let @h=@h."\" double-click,\n" + let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n" + let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" + let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Tree navigation mappings~\n" + let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n" + let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n" + let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" + let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" + let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" + let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Filesystem mappings~\n" + let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" + let @h=@h."\" selected dir\n" + let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" + let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" + let @h=@h."\" but leave old root open\n" + let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" + let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" + let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n" + let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n" + let @h=@h."\" selected dir\n" + let @h=@h."\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Tree filtering mappings~\n" + let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (b:NERDTreeShowHidden ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (b:NERDTreeIgnoreEnabled ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (b:NERDTreeShowFiles ? "on" : "off") . ")\n" + let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (b:NERDTreeShowBookmarks ? "on" : "off") . ")\n" + + "add quickhelp entries for each custom key map + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Custom mappings~\n" + for i in g:NERDTreeKeyMap.All() + if !empty(i.quickhelpText) + let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n" + endif + endfor + + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Other mappings~\n" + let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" + let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" + let @h=@h."\" the NERDTree window\n" + let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n" + let @h=@h."\"\n\" ----------------------------\n" + let @h=@h."\" Bookmark commands~\n" + let @h=@h."\" :Bookmark \n" + let @h=@h."\" :BookmarkToRoot \n" + let @h=@h."\" :RevealBookmark \n" + let @h=@h."\" :OpenBookmark \n" + let @h=@h."\" :ClearBookmarks []\n" + let @h=@h."\" :ClearAllBookmarks\n" + silent! put h + elseif g:NERDTreeMinimalUI == 0 + let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" + silent! put h + endif + + let @h = old_h +endfunction + +"FUNCTION: nerdtree#echo {{{2 +"A wrapper for :echo. Appends 'NERDTree:' on the front of all messages +" +"Args: +"msg: the message to echo +function! nerdtree#echo(msg) + redraw + echomsg "NERDTree: " . a:msg +endfunction + +"FUNCTION: nerdtree#echoError {{{2 +"Wrapper for nerdtree#echo, sets the message type to errormsg for this message +"Args: +"msg: the message to echo +function! nerdtree#echoError(msg) + echohl errormsg + call nerdtree#echo(a:msg) + echohl normal +endfunction + +"FUNCTION: nerdtree#echoWarning {{{2 +"Wrapper for nerdtree#echo, sets the message type to warningmsg for this message +"Args: +"msg: the message to echo +function! nerdtree#echoWarning(msg) + echohl warningmsg + call nerdtree#echo(a:msg) + echohl normal +endfunction + +"FUNCTION: nerdtree#firstUsableWindow(){{{2 +"find the window number of the first normal window +function! nerdtree#firstUsableWindow() + let i = 1 + while i <= winnr("$") + let bnum = winbufnr(i) + if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' + \ && !getwinvar(i, '&previewwindow') + \ && (!getbufvar(bnum, '&modified') || &hidden) + return i + endif + + let i += 1 + endwhile + return -1 +endfunction + +"FUNCTION: nerdtree#getPath(ln) {{{2 +"Gets the full path to the node that is rendered on the given line number +" +"Args: +"ln: the line number to get the path for +" +"Return: +"A path if a node was selected, {} if nothing is selected. +"If the 'up a dir' line was selected then the path to the parent of the +"current root is returned +function! nerdtree#getPath(ln) + let line = getline(a:ln) + + let rootLine = g:NERDTreeFileNode.GetRootLineNum() + + "check to see if we have the root node + if a:ln == rootLine + return b:NERDTreeRoot.path + endif + + if !g:NERDTreeDirArrows + " in case called from outside the tree + if line !~# '^ *[|`▸▾ ]' || line =~# '^$' + return {} + endif + endif + + if line ==# nerdtree#treeUpDirLine() + return b:NERDTreeRoot.path.getParent() + endif + + let indent = nerdtree#indentLevelFor(line) + + "remove the tree parts and the leading space + let curFile = nerdtree#stripMarkupFromLine(line, 0) + + let wasdir = 0 + if curFile =~# '/$' + let wasdir = 1 + let curFile = substitute(curFile, '/\?$', '/', "") + endif + + let dir = "" + let lnum = a:ln + while lnum > 0 + let lnum = lnum - 1 + let curLine = getline(lnum) + let curLineStripped = nerdtree#stripMarkupFromLine(curLine, 1) + + "have we reached the top of the tree? + if lnum == rootLine + let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir + break + endif + if curLineStripped =~# '/$' + let lpindent = nerdtree#indentLevelFor(curLine) + if lpindent < indent + let indent = indent - 1 + + let dir = substitute (curLineStripped,'^\\', "", "") . dir + continue + endif + endif + endwhile + let curFile = b:NERDTreeRoot.path.drive . dir . curFile + let toReturn = g:NERDTreePath.New(curFile) + return toReturn +endfunction + +"FUNCTION: nerdtree#getTreeWinNum() {{{2 +"gets the nerd tree window number for this tab +function! nerdtree#getTreeWinNum() + if exists("t:NERDTreeBufName") + return bufwinnr(t:NERDTreeBufName) + else + return -1 + endif +endfunction + +"FUNCTION: nerdtree#indentLevelFor(line) {{{2 +function! nerdtree#indentLevelFor(line) + let level = match(a:line, '[^ \-+~▸▾`|]') / nerdtree#treeWid() + " check if line includes arrows + if match(a:line, '[▸▾]') > -1 + " decrement level as arrow uses 3 ascii chars + let level = level - 1 + endif + return level +endfunction + +"FUNCTION: nerdtree#isTreeOpen() {{{2 +function! nerdtree#isTreeOpen() + return nerdtree#getTreeWinNum() != -1 +endfunction + +"FUNCTION: nerdtree#isWindowUsable(winnumber) {{{2 +"Returns 0 if opening a file from the tree in the given window requires it to +"be split, 1 otherwise +" +"Args: +"winnumber: the number of the window in question +function! nerdtree#isWindowUsable(winnumber) + "gotta split if theres only one window (i.e. the NERD tree) + if winnr("$") ==# 1 + return 0 + endif + + let oldwinnr = winnr() + call nerdtree#exec(a:winnumber . "wincmd p") + let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') + let modified = &modified + call nerdtree#exec(oldwinnr . "wincmd p") + + "if its a special window e.g. quickfix or another explorer plugin then we + "have to split + if specialWindow + return 0 + endif + + if &hidden + return 1 + endif + + return !modified || nerdtree#bufInWindows(winbufnr(a:winnumber)) >= 2 +endfunction + +" FUNCTION: nerdtree#jumpToChild(direction) {{{2 +" Args: +" direction: 0 if going to first child, 1 if going to last +function! nerdtree#jumpToChild(currentNode, direction) + if a:currentNode.isRoot() + return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") . " child") + end + let dirNode = a:currentNode.parent + let childNodes = dirNode.getVisibleChildren() + + let targetNode = childNodes[0] + if a:direction + let targetNode = childNodes[len(childNodes) - 1] + endif + + if targetNode.equals(a:currentNode) + let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction) + if siblingDir != {} + let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0 + let targetNode = siblingDir.getChildByIndex(indx, 1) + endif + endif + + call targetNode.putCursorHere(1, 0) + + call nerdtree#centerView() +endfunction + +" FUNCTION: nerdtree#jumpToSibling(currentNode, forward) {{{2 +" moves the cursor to the sibling of the current node in the given direction +" +" Args: +" forward: 1 if the cursor should move to the next sibling, 0 if it should +" move back to the previous sibling +function! nerdtree#jumpToSibling(currentNode, forward) + let sibling = a:currentNode.findSibling(a:forward) + + if !empty(sibling) + call sibling.putCursorHere(1, 0) + call nerdtree#centerView() + endif +endfunction + +"FUNCTION: nerdtree#promptToDelBuffer(bufnum, msg){{{2 +"prints out the given msg and, if the user responds by pushing 'y' then the +"buffer with the given bufnum is deleted +" +"Args: +"bufnum: the buffer that may be deleted +"msg: a message that will be echoed to the user asking them if they wish to +" del the buffer +function! nerdtree#promptToDelBuffer(bufnum, msg) + echo a:msg + if nr2char(getchar()) ==# 'y' + exec "silent bdelete! " . a:bufnum + endif +endfunction + +"FUNCTION: nerdtree#putCursorOnBookmarkTable(){{{2 +"Places the cursor at the top of the bookmarks table +function! nerdtree#putCursorOnBookmarkTable() + if !b:NERDTreeShowBookmarks + throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active" + endif + + if g:NERDTreeMinimalUI + return cursor(1, 2) + endif + + let rootNodeLine = g:NERDTreeFileNode.GetRootLineNum() + + let line = 1 + while getline(line) !~# '^>-\+Bookmarks-\+$' + let line = line + 1 + if line >= rootNodeLine + throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table" + endif + endwhile + call cursor(line, 2) +endfunction + +"FUNCTION: nerdtree#putCursorInTreeWin(){{{2 +"Places the cursor in the nerd tree window +function! nerdtree#putCursorInTreeWin() + if !nerdtree#isTreeOpen() + throw "NERDTree.InvalidOperationError: cant put cursor in NERD tree window, no window exists" + endif + + call nerdtree#exec(nerdtree#getTreeWinNum() . "wincmd w") +endfunction + +"FUNCTION: nerdtree#renderBookmarks {{{2 +function! nerdtree#renderBookmarks() + + if g:NERDTreeMinimalUI == 0 + call setline(line(".")+1, ">----------Bookmarks----------") + call cursor(line(".")+1, col(".")) + endif + + for i in g:NERDTreeBookmark.Bookmarks() + call setline(line(".")+1, i.str()) + call cursor(line(".")+1, col(".")) + endfor + + call setline(line(".")+1, '') + call cursor(line(".")+1, col(".")) +endfunction + +"FUNCTION: nerdtree#renderView {{{2 +"The entry function for rendering the tree +function! nerdtree#renderView() + setlocal modifiable + + "remember the top line of the buffer and the current line so we can + "restore the view exactly how it was + let curLine = line(".") + let curCol = col(".") + let topLine = line("w0") + + "delete all lines in the buffer (being careful not to clobber a register) + silent 1,$delete _ + + call nerdtree#dumpHelp() + + "delete the blank line before the help and add one after it + if g:NERDTreeMinimalUI == 0 + call setline(line(".")+1, "") + call cursor(line(".")+1, col(".")) + endif + + if b:NERDTreeShowBookmarks + call nerdtree#renderBookmarks() + endif + + "add the 'up a dir' line + if !g:NERDTreeMinimalUI + call setline(line(".")+1, nerdtree#treeUpDirLine()) + call cursor(line(".")+1, col(".")) + endif + + "draw the header line + let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) + call setline(line(".")+1, header) + call cursor(line(".")+1, col(".")) + + "draw the tree + let old_o = @o + let @o = b:NERDTreeRoot.renderToString() + silent put o + let @o = old_o + + "delete the blank line at the top of the buffer + silent 1,1delete _ + + "restore the view + let old_scrolloff=&scrolloff + let &scrolloff=0 + call cursor(topLine, 1) + normal! zt + call cursor(curLine, curCol) + let &scrolloff = old_scrolloff + + setlocal nomodifiable +endfunction + +"FUNCTION: nerdtree#renderViewSavingPosition {{{2 +"Renders the tree and ensures the cursor stays on the current node or the +"current nodes parent if it is no longer available upon re-rendering +function! nerdtree#renderViewSavingPosition() + let currentNode = g:NERDTreeFileNode.GetSelected() + + "go up the tree till we find a node that will be visible or till we run + "out of nodes + while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot() + let currentNode = currentNode.parent + endwhile + + call nerdtree#renderView() + + if currentNode != {} + call currentNode.putCursorHere(0, 0) + endif +endfunction +" +"FUNCTION: nerdtree#restoreScreenState() {{{2 +" +"Sets the screen state back to what it was when nerdtree#saveScreenState was last +"called. +" +"Assumes the cursor is in the NERDTree window +function! nerdtree#restoreScreenState() + if !exists("b:NERDTreeOldTopLine") || !exists("b:NERDTreeOldPos") || !exists("b:NERDTreeOldWindowSize") + return + endif + exec("silent vertical resize ".b:NERDTreeOldWindowSize) + + let old_scrolloff=&scrolloff + let &scrolloff=0 + call cursor(b:NERDTreeOldTopLine, 0) + normal! zt + call setpos(".", b:NERDTreeOldPos) + let &scrolloff=old_scrolloff +endfunction + +"FUNCTION: nerdtree#saveScreenState() {{{2 +"Saves the current cursor position in the current buffer and the window +"scroll position +function! nerdtree#saveScreenState() + let win = winnr() + try + call nerdtree#putCursorInTreeWin() + let b:NERDTreeOldPos = getpos(".") + let b:NERDTreeOldTopLine = line("w0") + let b:NERDTreeOldWindowSize = winwidth("") + call nerdtree#exec(win . "wincmd w") + catch /^NERDTree.InvalidOperationError/ + endtry +endfunction + +"FUNCTION: nerdtree#stripMarkupFromLine(line, removeLeadingSpaces){{{2 +"returns the given line with all the tree parts stripped off +" +"Args: +"line: the subject line +"removeLeadingSpaces: 1 if leading spaces are to be removed (leading spaces = +"any spaces before the actual text of the node) +function! nerdtree#stripMarkupFromLine(line, removeLeadingSpaces) + let line = a:line + "remove the tree parts and the leading space + let line = substitute (line, nerdtree#treeMarkupReg(),"","") + + "strip off any read only flag + let line = substitute (line, ' \[RO\]', "","") + + "strip off any bookmark flags + let line = substitute (line, ' {[^}]*}', "","") + + "strip off any executable flags + let line = substitute (line, '*\ze\($\| \)', "","") + + let wasdir = 0 + if line =~# '/$' + let wasdir = 1 + endif + let line = substitute (line,' -> .*',"","") " remove link to + if wasdir ==# 1 + let line = substitute (line, '/\?$', '/', "") + endif + + if a:removeLeadingSpaces + let line = substitute (line, '^ *', '', '') + endif + + return line +endfunction + +"SECTION: Interface bindings {{{1 +"============================================================ + +"FUNCTION: s:activateAll() {{{2 +"handle the user activating the updir line +function! s:activateAll() + if getline(".") ==# nerdtree#treeUpDirLine() + return nerdtree#upDir(0) + endif +endfunction +"FUNCTION: s:activateDirNode() {{{2 +"handle the user activating a tree node +function! s:activateDirNode(node) + call a:node.activate({'reuse': 1}) +endfunction + +"FUNCTION: s:activateFileNode() {{{2 +"handle the user activating a tree node +function! s:activateFileNode(node) + call a:node.activate({'reuse': 1, 'where': 'p'}) +endfunction + +"FUNCTION: s:activateBookmark() {{{2 +"handle the user activating a bookmark +function! s:activateBookmark(bm) + call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {}) +endfunction + +" FUNCTION: nerdtree#bookmarkNode(name) {{{2 +" Associate the current node with the given name +function! nerdtree#bookmarkNode(...) + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + let name = a:1 + if empty(name) + let name = currentNode.path.getLastPathComponent(0) + endif + try + call currentNode.bookmark(name) + call nerdtree#renderView() + catch /^NERDTree.IllegalBookmarkNameError/ + call nerdtree#echo("bookmark names must not contain spaces") + endtry + else + call nerdtree#echo("select a node first") + endif +endfunction + +" FUNCTION: s:chCwd(node) {{{2 +function! s:chCwd(node) + try + call a:node.path.changeToDir() + catch /^NERDTree.PathChangeError/ + call nerdtree#echoWarning("could not change cwd") + endtry +endfunction + +" FUNCTION: s:chRoot(node) {{{2 +" changes the current root to the selected one +function! s:chRoot(node) + call a:node.makeRoot() + call nerdtree#renderView() + call b:NERDTreeRoot.putCursorHere(0, 0) +endfunction + +" FUNCTION: s:chRootCwd() {{{2 +" changes the current root to CWD +function! nerdtree#chRootCwd() + try + let cwd = g:NERDTreePath.New(getcwd()) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("current directory does not exist.") + return + endtry + if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str() + return + endif + call nerdtree#chRoot(g:NERDTreeDirNode.New(cwd)) +endfunction + +" FUNCTION: nerdtree#clearBookmarks(bookmarks) {{{2 +function! nerdtree#clearBookmarks(bookmarks) + if a:bookmarks ==# '' + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + call currentNode.clearBookmarks() + endif + else + for name in split(a:bookmarks, ' ') + let bookmark = g:NERDTreeBookmark.BookmarkFor(name) + call bookmark.delete() + endfor + endif + call nerdtree#renderView() +endfunction + +" FUNCTION: s:closeChildren(node) {{{2 +" closes all childnodes of the current node +function! s:closeChildren(node) + call a:node.closeChildren() + call nerdtree#renderView() + call a:node.putCursorHere(0, 0) +endfunction + +" FUNCTION: s:closeCurrentDir(node) {{{2 +" closes the parent dir of the current node +function! s:closeCurrentDir(node) + let parent = a:node.parent + if parent ==# {} || parent.isRoot() + call nerdtree#echo("cannot close tree root") + else + call a:node.parent.close() + call nerdtree#renderView() + call a:node.parent.putCursorHere(0, 0) + endif +endfunction + +" FUNCTION: s:closeTreeWindow() {{{2 +" close the tree window +function! s:closeTreeWindow() + if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1 + exec "buffer " . b:NERDTreePreviousBuf + else + if winnr("$") > 1 + call nerdtree#closeTree() + else + call nerdtree#echo("Cannot close last window") + endif + endif +endfunction + +" FUNCTION: s:deleteBookmark(bm) {{{2 +" if the cursor is on a bookmark, prompt to delete +function! s:deleteBookmark(bm) + echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):" + + if nr2char(getchar()) ==# 'y' + try + call a:bm.delete() + call nerdtree#renderView() + redraw + catch /^NERDTree/ + call nerdtree#echoWarning("Could not remove bookmark") + endtry + else + call nerdtree#echo("delete aborted" ) + endif + +endfunction + +" FUNCTION: s:displayHelp() {{{2 +" toggles the help display +function! s:displayHelp() + let b:treeShowHelp = b:treeShowHelp ? 0 : 1 + call nerdtree#renderView() + call nerdtree#centerView() +endfunction + +"FUNCTION: s:handleLeftClick() {{{2 +"Checks if the click should open the current node +function! s:handleLeftClick() + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + + "the dir arrows are multibyte chars, and vim's string functions only + "deal with single bytes - so split the line up with the hack below and + "take the line substring manually + let line = split(getline(line(".")), '\zs') + let startToCur = "" + for i in range(0,len(line)-1) + let startToCur .= line[i] + endfor + + if currentNode.path.isDirectory + if startToCur =~# nerdtree#treeMarkupReg() && startToCur =~# '[+~▾▸] \?$' + call currentNode.activate() + return + endif + endif + + if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3 + let char = strpart(startToCur, strlen(startToCur)-1, 1) + if char !~# nerdtree#treeMarkupReg() + if currentNode.path.isDirectory + call currentNode.activate() + else + call currentNode.activate({'reuse': 1, 'where': 'p'}) + endif + return + endif + endif + endif +endfunction + +" FUNCTION: s:handleMiddleMouse() {{{2 +function! s:handleMiddleMouse() + let curNode = g:NERDTreeFileNode.GetSelected() + if curNode ==# {} + call nerdtree#echo("Put the cursor on a node first" ) + return + endif + + if curNode.path.isDirectory + call nerdtree#openExplorer(curNode) + else + call curNode.open({'where': 'h'}) + endif +endfunction + +" FUNCTION: s:jumpToFirstChild() {{{2 +" wrapper for the jump to child method +function! s:jumpToFirstChild(node) + call nerdtree#jumpToChild(a:node, 0) +endfunction + +" FUNCTION: s:jumpToLastChild() {{{2 +" wrapper for the jump to child method +function! s:jumpToLastChild(node) + call nerdtree#jumpToChild(a:node, 1) +endfunction + +" FUNCTION: s:jumpToParent(node) {{{2 +" moves the cursor to the parent of the current node +function! s:jumpToParent(node) + if !empty(a:node.parent) + call a:node.parent.putCursorHere(1, 0) + call nerdtree#centerView() + else + call nerdtree#echo("cannot jump to parent") + endif +endfunction + +" FUNCTION: s:jumpToRoot() {{{2 +" moves the cursor to the root node +function! s:jumpToRoot() + call b:NERDTreeRoot.putCursorHere(1, 0) + call nerdtree#centerView() +endfunction + +" FUNCTION: s:jumpToNextSibling(node) {{{2 +function! s:jumpToNextSibling(node) + call nerdtree#jumpToSibling(a:node, 1) +endfunction + +" FUNCTION: s:jumpToPrevSibling(node) {{{2 +function! s:jumpToPrevSibling(node) + call nerdtree#jumpToSibling(a:node, 0) +endfunction + +" FUNCTION: nerdtree#openBookmark(name) {{{2 +" put the cursor on the given bookmark and, if its a file, open it +function! nerdtree#openBookmark(name) + try + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + call targetNode.putCursorHere(0, 1) + redraw! + catch /^NERDTree.BookmarkedNodeNotFoundError/ + call nerdtree#echo("note - target node is not cached") + let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) + let targetNode = g:NERDTreeFileNode.New(bookmark.path) + endtry + if targetNode.path.isDirectory + call targetNode.openExplorer() + else + call targetNode.open({'where': 'p'}) + endif +endfunction + +" FUNCTION: s:openHSplit(target) {{{2 +function! s:openHSplit(target) + call a:target.activate({'where': 'h'}) +endfunction + +" FUNCTION: s:openVSplit(target) {{{2 +function! s:openVSplit(target) + call a:target.activate({'where': 'v'}) +endfunction + +" FUNCTION: s:openExplorer(node) {{{2 +function! s:openExplorer(node) + call a:node.openExplorer() +endfunction + +" FUNCTION: s:openInNewTab(target) {{{2 +function! s:openInNewTab(target) + call a:target.activate({'where': 't'}) +endfunction + +" FUNCTION: s:openInNewTabSilent(target) {{{2 +function! s:openInNewTabSilent(target) + call a:target.activate({'where': 't', 'stay': 1}) +endfunction + +" FUNCTION: s:openNodeRecursively(node) {{{2 +function! s:openNodeRecursively(node) + call nerdtree#echo("Recursively opening node. Please wait...") + call a:node.openRecursively() + call nerdtree#renderView() + redraw + call nerdtree#echo("Recursively opening node. Please wait... DONE") +endfunction + +"FUNCTION: s:previewNodeCurrent(node) {{{2 +function! s:previewNodeCurrent(node) + call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) +endfunction + +"FUNCTION: s:previewNodeHSplit(node) {{{2 +function! s:previewNodeHSplit(node) + call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) +endfunction + +"FUNCTION: s:previewNodeVSplit(node) {{{2 +function! s:previewNodeVSplit(node) + call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) +endfunction + +" FUNCTION: nerdtree#revealBookmark(name) {{{2 +" put the cursor on the node associate with the given name +function! nerdtree#revealBookmark(name) + try + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + call targetNode.putCursorHere(0, 1) + catch /^NERDTree.BookmarkNotFoundError/ + call nerdtree#echo("Bookmark isnt cached under the current root") + endtry +endfunction + +" FUNCTION: s:refreshRoot() {{{2 +" Reloads the current root. All nodes below this will be lost and the root dir +" will be reloaded. +function! s:refreshRoot() + call nerdtree#echo("Refreshing the root node. This could take a while...") + call b:NERDTreeRoot.refresh() + call nerdtree#renderView() + redraw + call nerdtree#echo("Refreshing the root node. This could take a while... DONE") +endfunction + +" FUNCTION: s:refreshCurrent(node) {{{2 +" refreshes the root for the current node +function! s:refreshCurrent(node) + let node = a:node + if !node.path.isDirectory + let node = node.parent + endif + + call nerdtree#echo("Refreshing node. This could take a while...") + call node.refresh() + call nerdtree#renderView() + redraw + call nerdtree#echo("Refreshing node. This could take a while... DONE") +endfunction + +" FUNCTION: s:showMenu(node) {{{2 +function! s:showMenu(node) + let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) + call mc.showMenu() +endfunction + +" FUNCTION: s:toggleIgnoreFilter() {{{2 +" toggles the use of the NERDTreeIgnore option +function! s:toggleIgnoreFilter() + let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled + call nerdtree#renderViewSavingPosition() + call nerdtree#centerView() +endfunction + +" FUNCTION: s:toggleShowBookmarks() {{{2 +" toggles the display of bookmarks +function! s:toggleShowBookmarks() + let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks + if b:NERDTreeShowBookmarks + call nerdtree#renderView() + call nerdtree#putCursorOnBookmarkTable() + else + call nerdtree#renderViewSavingPosition() + endif + call nerdtree#centerView() +endfunction + +" FUNCTION: s:toggleShowFiles() {{{2 +" toggles the display of hidden files +function! s:toggleShowFiles() + let b:NERDTreeShowFiles = !b:NERDTreeShowFiles + call nerdtree#renderViewSavingPosition() + call nerdtree#centerView() +endfunction + +" FUNCTION: s:toggleShowHidden() {{{2 +" toggles the display of hidden files +function! s:toggleShowHidden() + let b:NERDTreeShowHidden = !b:NERDTreeShowHidden + call nerdtree#renderViewSavingPosition() + call nerdtree#centerView() +endfunction + +" FUNCTION: s:toggleZoom() {{{2 +" zoom (maximize/minimize) the NERDTree window +function! s:toggleZoom() + if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed + let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize + exec "silent vertical resize ". size + let b:NERDTreeZoomed = 0 + else + exec "vertical resize" + let b:NERDTreeZoomed = 1 + endif +endfunction + +" FUNCTION: s:upDirCurrentRootOpen() {{{2 +function! s:upDirCurrentRootOpen() + call nerdtree#upDir(1) +endfunction + +" FUNCTION: s:upDirCurrentRootClosed() {{{2 +function! s:upDirCurrentRootClosed() + call nerdtree#upDir(0) +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/doc/NERD_tree.txt b/sources_non_forked/nerdtree/doc/NERD_tree.txt index adcf5a54..47f34726 100644 --- a/sources_non_forked/nerdtree/doc/NERD_tree.txt +++ b/sources_non_forked/nerdtree/doc/NERD_tree.txt @@ -137,6 +137,10 @@ The following features and functionality are provided by the NERD tree: In any case, the current file is revealed and the cursor is placed on it. +:NERDTreeCWD *:NERDTreeCWD* + Change tree root to current directory. If no NERD tree exists for this + tab, a new tree will be opened. + ------------------------------------------------------------------------------ 2.2. Bookmarks *NERDTreeBookmarks* @@ -247,6 +251,7 @@ r.......Recursively refresh the current directory................|NERDTree-r| R.......Recursively refresh the current root.....................|NERDTree-R| m.......Display the NERD tree menu...............................|NERDTree-m| cd......Change the CWD to the dir of the selected node...........|NERDTree-cd| +CD......Change tree root to the CWD..............................|NERDTree-CD| I.......Toggle whether hidden files displayed....................|NERDTree-I| f.......Toggle whether the file filters are used.................|NERDTree-f| @@ -514,6 +519,14 @@ Applies to: files and directories. Change vims current working directory to that of the selected node. +------------------------------------------------------------------------------ + *NERDTree-CD* +Default key: CD +Map option: NERDTreeMapCWD +Applies to: no restrictions. + +Change tree root to vims current working directory. + ------------------------------------------------------------------------------ *NERDTree-I* Default key: I @@ -658,6 +671,10 @@ NERD tree. These options should be set in your vimrc. Casade open while selected directory has only one child that also is a directory. +|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove + a buffer when a file is being deleted or renamed + via a context menu command. + ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeOptionDetails* @@ -982,6 +999,20 @@ for Java projects. Use one of the follow lines to set this option: > let NERDTreeCasadeOpenSingleChildDir=1 < +------------------------------------------------------------------------------ + *'NERDTreeAutoDeleteBuffer'* +Values: 0 or 1 +Default: 0. + +When using a context menu to delete or rename a file you may also want to delete +the buffer which is no more valid. If the option is not set you will see a +confirmation if you really want to delete an old buffer. If you always press 'y' +then it worths to set this option to 1. Use one of the follow lines to set this +option: > + let NERDTreeAutoDeleteBuffer=0 + let NERDTreeAutoDeleteBuffer=1 +< + ============================================================================== 4. The NERD tree API *NERDTreeAPI* diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 0e2f7287..9b81ed37 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -15,6 +15,11 @@ if exists("g:loaded_nerdtree_fs_menu") endif let g:loaded_nerdtree_fs_menu = 1 +"Automatically delete the buffer after deleting or renaming a file +if !exists("g:NERDTreeAutoDeleteBuffer") + let g:NERDTreeAutoDeleteBuffer = 0 +endif + call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'}) call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) @@ -26,7 +31,7 @@ if has("gui_mac") || has("gui_macvim") endif if g:NERDTreePath.CopyingSupported() - call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) + call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) endif "FUNCTION: s:echo(msg){{{1 @@ -52,11 +57,44 @@ endfunction " del the buffer function! s:promptToDelBuffer(bufnum, msg) echo a:msg - if nr2char(getchar()) ==# 'y' - exec "silent bdelete! " . a:bufnum + if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y' + " 1. ensure that all windows which display the just deleted filename + " now display an empty buffer (so a layout is preserved). + " Is not it better to close single tabs with this file only ? + let s:originalTabNumber = tabpagenr() + let s:originalWindowNumber = winnr() + exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif" + exec "tabnext " . s:originalTabNumber + exec s:originalWindowNumber . "wincmd w" + " 3. We don't need a previous buffer anymore + exec "bwipeout! " . a:bufnum endif endfunction +"FUNCTION: s:promptToRenameBuffer(bufnum, msg){{{1 +"prints out the given msg and, if the user responds by pushing 'y' then the +"buffer with the given bufnum is replaced with a new one +" +"Args: +"bufnum: the buffer that may be deleted +"msg: a message that will be echoed to the user asking them if they wish to +" del the buffer +function! s:promptToRenameBuffer(bufnum, msg, newFileName) + echo a:msg + if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y' + " 1. ensure that a new buffer is loaded + exec "badd " . a:newFileName + " 2. ensure that all windows which display the just deleted filename + " display a buffer for a new filename. + let s:originalTabNumber = tabpagenr() + let s:originalWindowNumber = winnr() + exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . a:newFileName . "' | endif" + exec "tabnext " . s:originalTabNumber + exec s:originalWindowNumber . "wincmd w" + " 3. We don't need a previous buffer anymore + exec "bwipeout! " . a:bufnum + endif +endfunction "FUNCTION: NERDTreeAddNode(){{{1 function! NERDTreeAddNode() let curDirNode = g:NERDTreeDirNode.GetSelected() @@ -108,8 +146,8 @@ function! NERDTreeMoveNode() "if the node is open in a buffer, ask the user if they want to "close that buffer if bufnum != -1 - let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)" - call s:promptToDelBuffer(bufnum, prompt) + let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Replace this buffer with a new file? (yN)" + call s:promptToRenameBuffer(bufnum, prompt, newNodePath) endif call curNode.putCursorHere(1, 0) diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 60460251..6c19a3fa 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -10,8 +10,7 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " " ============================================================================ -let s:NERD_tree_version = '4.2.0' - +" " SECTION: Script init stuff {{{1 "============================================================ if exists("loaded_nerd_tree") @@ -27,8 +26,6 @@ let loaded_nerd_tree = 1 let s:old_cpo = &cpo set cpo&vim -let s:running_windows = has("win16") || has("win32") || has("win64") - "Function: s:initVariable() function {{{2 "This function is used to initialise a given variable to a given value. The "variable is only initialised if it does not exist prior @@ -68,7 +65,7 @@ call s:initVariable("g:NERDTreeShowFiles", 1) call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeSortDirs", 1) -call s:initVariable("g:NERDTreeDirArrows", !s:running_windows) +call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows()) call s:initVariable("g:NERDTreeCasadeOpenSingleChildDir", 1) if !exists("g:NERDTreeSortOrder") @@ -80,10 +77,6 @@ else endif endif -"we need to use this number many times for sorting... so we calculate it only -"once here -let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*') - if !exists('g:NERDTreeStatusline') "the exists() crap here is a hack to stop vim spazzing out when @@ -98,7 +91,7 @@ call s:initVariable("g:NERDTreeWinSize", 31) "init the shell commands that will be used to copy nodes, and remove dir trees " "Note: the space after the command is important -if s:running_windows +if nerdtree#runningWindows() call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ') else call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ') @@ -140,4250 +133,84 @@ call s:initVariable("g:NERDTreeMapToggleHidden", "I") call s:initVariable("g:NERDTreeMapToggleZoom", "A") call s:initVariable("g:NERDTreeMapUpdir", "u") call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U") +call s:initVariable("g:NERDTreeMapCWD", "CD") -"SECTION: Script level variable declaration{{{2 -if s:running_windows - let s:escape_chars = " `\|\"#%&,?()\*^<>" -else - let s:escape_chars = " \\`\|\"#%&,?()\*^<>[]" -endif -let s:NERDTreeBufName = 'NERD_tree_' - -let s:tree_wid = 2 - -if g:NERDTreeDirArrows - let s:tree_markup_reg = '^\([▾▸] \| \+[▾▸] \| \+\)' -else - let s:tree_markup_reg = '^[ `|]*[\-+~]' -endif -let s:tree_up_dir_line = '.. (up a dir)' - -"the number to add to the nerd tree buffer name to make the buf name unique -let s:next_buffer_number = 1 +"SECTION: Load class files{{{2 +runtime plugin/nerdtree/path.vim +runtime plugin/nerdtree/menu_controller.vim +runtime plugin/nerdtree/menu_item.vim +runtime plugin/nerdtree/key_map.vim +runtime plugin/nerdtree/bookmark.vim +runtime plugin/nerdtree/tree_file_node.vim +runtime plugin/nerdtree/tree_dir_node.vim +runtime plugin/nerdtree/opener.vim +runtime plugin/nerdtree/creator.vim " SECTION: Commands {{{1 "============================================================ "init the command that users start the nerd tree with -command! -n=? -complete=dir -bar NERDTree :call s:initNerdTree('') -command! -n=? -complete=dir -bar NERDTreeToggle :call s:toggle('') -command! -n=0 -bar NERDTreeClose :call s:closeTreeIfOpen() -command! -n=1 -complete=customlist,s:completeBookmarks -bar NERDTreeFromBookmark call s:initNerdTree('') -command! -n=0 -bar NERDTreeMirror call s:initNerdTreeMirror() -command! -n=0 -bar NERDTreeFind call s:findAndRevealPath() +command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreatePrimary('') +command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.TogglePrimary('') +command! -n=0 -bar NERDTreeClose :call nerdtree#closeTreeIfOpen() +command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreatePrimary('') +command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() +command! -n=0 -bar NERDTreeFind call nerdtree#findAndRevealPath() command! -n=0 -bar NERDTreeFocus call NERDTreeFocus() +command! -n=0 -bar NERDTreeCWD call NERDTreeCWD() " SECTION: Auto commands {{{1 "============================================================ augroup NERDTree "Save the cursor position whenever we close the nerd tree - exec "autocmd BufWinLeave ". s:NERDTreeBufName ."* call saveScreenState()" + exec "autocmd BufWinLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call nerdtree#saveScreenState()" "disallow insert mode in the NERDTree - exec "autocmd BufEnter ". s:NERDTreeBufName ."* stopinsert" + exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert" augroup END if g:NERDTreeHijackNetrw augroup NERDTreeHijackNetrw autocmd VimEnter * silent! autocmd! FileExplorer - au BufEnter,VimEnter * call s:checkForBrowse(expand("")) + au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand("")) augroup END endif -"SECTION: Classes {{{1 -"============================================================ -"CLASS: Bookmark {{{2 -"============================================================ -let s:Bookmark = {} -" FUNCTION: Bookmark.activate() {{{3 -function! s:Bookmark.activate(...) - call self.open(a:0 ? a:1 : {}) -endfunction -" FUNCTION: Bookmark.AddBookmark(name, path) {{{3 -" Class method to add a new bookmark to the list, if a previous bookmark exists -" with the same name, just update the path for that bookmark -function! s:Bookmark.AddBookmark(name, path) - for i in s:Bookmark.Bookmarks() - if i.name ==# a:name - let i.path = a:path - return - endif - endfor - call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path)) - call s:Bookmark.Sort() -endfunction -" Function: Bookmark.Bookmarks() {{{3 -" Class method to get all bookmarks. Lazily initializes the bookmarks global -" variable -function! s:Bookmark.Bookmarks() - if !exists("g:NERDTreeBookmarks") - let g:NERDTreeBookmarks = [] - endif - return g:NERDTreeBookmarks -endfunction -" Function: Bookmark.BookmarkExistsFor(name) {{{3 -" class method that returns 1 if a bookmark with the given name is found, 0 -" otherwise -function! s:Bookmark.BookmarkExistsFor(name) - try - call s:Bookmark.BookmarkFor(a:name) - return 1 - catch /^NERDTree.BookmarkNotFoundError/ - return 0 - endtry -endfunction -" Function: Bookmark.BookmarkFor(name) {{{3 -" Class method to get the bookmark that has the given name. {} is return if no -" bookmark is found -function! s:Bookmark.BookmarkFor(name) - for i in s:Bookmark.Bookmarks() - if i.name ==# a:name - return i - endif - endfor - throw "NERDTree.BookmarkNotFoundError: no bookmark found for name: \"". a:name .'"' -endfunction -" Function: Bookmark.BookmarkNames() {{{3 -" Class method to return an array of all bookmark names -function! s:Bookmark.BookmarkNames() - let names = [] - for i in s:Bookmark.Bookmarks() - call add(names, i.name) - endfor - return names -endfunction -" FUNCTION: Bookmark.CacheBookmarks(silent) {{{3 -" Class method to read all bookmarks from the bookmarks file intialize -" bookmark objects for each one. -" -" Args: -" silent - dont echo an error msg if invalid bookmarks are found -function! s:Bookmark.CacheBookmarks(silent) - if filereadable(g:NERDTreeBookmarksFile) - let g:NERDTreeBookmarks = [] - let g:NERDTreeInvalidBookmarks = [] - let bookmarkStrings = readfile(g:NERDTreeBookmarksFile) - let invalidBookmarksFound = 0 - for i in bookmarkStrings - - "ignore blank lines - if i != '' - - let name = substitute(i, '^\(.\{-}\) .*$', '\1', '') - let path = substitute(i, '^.\{-} \(.*\)$', '\1', '') - - try - let bookmark = s:Bookmark.New(name, s:Path.New(path)) - call add(g:NERDTreeBookmarks, bookmark) - catch /^NERDTree.InvalidArgumentsError/ - call add(g:NERDTreeInvalidBookmarks, i) - let invalidBookmarksFound += 1 - endtry - endif - endfor - if invalidBookmarksFound - call s:Bookmark.Write() - if !a:silent - call s:echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.") - endif - endif - call s:Bookmark.Sort() - endif -endfunction -" FUNCTION: Bookmark.compareTo(otherbookmark) {{{3 -" Compare these two bookmarks for sorting purposes -function! s:Bookmark.compareTo(otherbookmark) - return a:otherbookmark.name < self.name -endfunction -" FUNCTION: Bookmark.ClearAll() {{{3 -" Class method to delete all bookmarks. -function! s:Bookmark.ClearAll() - for i in s:Bookmark.Bookmarks() - call i.delete() - endfor - call s:Bookmark.Write() -endfunction -" FUNCTION: Bookmark.delete() {{{3 -" Delete this bookmark. If the node for this bookmark is under the current -" root, then recache bookmarks for its Path object -function! s:Bookmark.delete() - let node = {} - try - let node = self.getNode(1) - catch /^NERDTree.BookmarkedNodeNotFoundError/ - endtry - call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self)) - if !empty(node) - call node.path.cacheDisplayString() - endif - call s:Bookmark.Write() -endfunction -" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{3 -" Gets the treenode for this bookmark -" -" Args: -" searchFromAbsoluteRoot: specifies whether we should search from the current -" tree root, or the highest cached node -function! s:Bookmark.getNode(searchFromAbsoluteRoot) - let searchRoot = a:searchFromAbsoluteRoot ? s:TreeDirNode.AbsoluteTreeRoot() : b:NERDTreeRoot - let targetNode = searchRoot.findNode(self.path) - if empty(targetNode) - throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name - endif - return targetNode -endfunction -" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{3 -" Class method that finds the bookmark with the given name and returns the -" treenode for it. -function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) - let bookmark = s:Bookmark.BookmarkFor(a:name) - return bookmark.getNode(a:searchFromAbsoluteRoot) -endfunction -" FUNCTION: Bookmark.GetSelected() {{{3 -" returns the Bookmark the cursor is over, or {} -function! s:Bookmark.GetSelected() - let line = getline(".") - let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '') - if name != line - try - return s:Bookmark.BookmarkFor(name) - catch /^NERDTree.BookmarkNotFoundError/ - return {} - endtry - endif - return {} -endfunction - -" Function: Bookmark.InvalidBookmarks() {{{3 -" Class method to get all invalid bookmark strings read from the bookmarks -" file -function! s:Bookmark.InvalidBookmarks() - if !exists("g:NERDTreeInvalidBookmarks") - let g:NERDTreeInvalidBookmarks = [] - endif - return g:NERDTreeInvalidBookmarks -endfunction -" FUNCTION: Bookmark.mustExist() {{{3 -function! s:Bookmark.mustExist() - if !self.path.exists() - call s:Bookmark.CacheBookmarks(1) - throw "NERDTree.BookmarkPointsToInvalidLocationError: the bookmark \"". - \ self.name ."\" points to a non existing location: \"". self.path.str() - endif -endfunction -" FUNCTION: Bookmark.New(name, path) {{{3 -" Create a new bookmark object with the given name and path object -function! s:Bookmark.New(name, path) - if a:name =~# ' ' - throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name - endif - - let newBookmark = copy(self) - let newBookmark.name = a:name - let newBookmark.path = a:path - return newBookmark -endfunction -" FUNCTION: Bookmark.open([options]) {{{3 -"Args: -"A dictionary containing the following keys (all optional): -" 'where': Specifies whether the node should be opened in new split/tab or in -" the previous window. Can be either 'v' (vertical split), 'h' -" (horizontal split), 't' (new tab) or 'p' (previous window). -" 'reuse': if a window is displaying the file then jump the cursor there -" 'keepopen': dont close the tree window -" 'stay': open the file, but keep the cursor in the tree win -" -function! s:Bookmark.open(...) - let opts = a:0 ? a:1 : {} - - if self.path.isDirectory && !has_key(opts, 'where') - call self.toRoot() - else - let opener = s:Opener.New(self.path, opts) - call opener.open(self) - endif -endfunction -" FUNCTION: Bookmark.openInNewTab(options) {{{3 -" Create a new bookmark object with the given name and path object -function! s:Bookmark.openInNewTab(options) - call s:deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead') - call self.open(a:options) -endfunction -" Function: Bookmark.setPath(path) {{{3 -" makes this bookmark point to the given path -function! s:Bookmark.setPath(path) - let self.path = a:path -endfunction -" Function: Bookmark.Sort() {{{3 -" Class method that sorts all bookmarks -function! s:Bookmark.Sort() - let CompareFunc = function("s:compareBookmarks") - call sort(s:Bookmark.Bookmarks(), CompareFunc) -endfunction -" Function: Bookmark.str() {{{3 -" Get the string that should be rendered in the view for this bookmark -function! s:Bookmark.str() - let pathStrMaxLen = winwidth(s:getTreeWinNum()) - 4 - len(self.name) - if &nu - let pathStrMaxLen = pathStrMaxLen - &numberwidth - endif - - let pathStr = self.path.str({'format': 'UI'}) - if len(pathStr) > pathStrMaxLen - let pathStr = '<' . strpart(pathStr, len(pathStr) - pathStrMaxLen) - endif - return '>' . self.name . ' ' . pathStr -endfunction -" FUNCTION: Bookmark.toRoot() {{{3 -" Make the node for this bookmark the new tree root -function! s:Bookmark.toRoot() - if self.validate() - try - let targetNode = self.getNode(1) - catch /^NERDTree.BookmarkedNodeNotFoundError/ - let targetNode = s:TreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path) - endtry - call targetNode.makeRoot() - call s:renderView() - call targetNode.putCursorHere(0, 0) - endif -endfunction -" FUNCTION: Bookmark.ToRoot(name) {{{3 -" Make the node for this bookmark the new tree root -function! s:Bookmark.ToRoot(name) - let bookmark = s:Bookmark.BookmarkFor(a:name) - call bookmark.toRoot() -endfunction - - -"FUNCTION: Bookmark.validate() {{{3 -function! s:Bookmark.validate() - if self.path.exists() - return 1 - else - call s:Bookmark.CacheBookmarks(1) - call s:renderView() - call s:echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.") - return 0 - endif -endfunction - -" Function: Bookmark.Write() {{{3 -" Class method to write all bookmarks to the bookmarks file -function! s:Bookmark.Write() - let bookmarkStrings = [] - for i in s:Bookmark.Bookmarks() - call add(bookmarkStrings, i.name . ' ' . i.path.str()) - endfor - - "add a blank line before the invalid ones - call add(bookmarkStrings, "") - - for j in s:Bookmark.InvalidBookmarks() - call add(bookmarkStrings, j) - endfor - call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) -endfunction -"CLASS: KeyMap {{{2 -"============================================================ -let s:KeyMap = {} -"FUNCTION: KeyMap.All() {{{3 -function! s:KeyMap.All() - if !exists("s:keyMaps") - let s:keyMaps = [] - endif - return s:keyMaps -endfunction - -"FUNCTION: KeyMap.FindFor(key, scope) {{{3 -function! s:KeyMap.FindFor(key, scope) - for i in s:KeyMap.All() - if i.key ==# a:key && i.scope ==# a:scope - return i - endif - endfor - return {} -endfunction - -"FUNCTION: KeyMap.BindAll() {{{3 -function! s:KeyMap.BindAll() - for i in s:KeyMap.All() - call i.bind() - endfor -endfunction - -"FUNCTION: KeyMap.bind() {{{3 -function! s:KeyMap.bind() - " If the key sequence we're trying to map contains any '<>' notation, we - " must replace each of the '<' characters with '' to ensure the string - " is not translated into its corresponding keycode during the later part - " of the map command below - " :he <> - let specialNotationRegex = '\m<\([[:alnum:]_-]\+>\)' - if self.key =~# specialNotationRegex - let keymapInvokeString = substitute(self.key, specialNotationRegex, '\1', 'g') - else - let keymapInvokeString = self.key - endif - - let premap = self.key == "" ? " " : " " - - exec 'nnoremap '. self.key . premap . ':call KeyMap_Invoke("'. keymapInvokeString .'")' -endfunction - -"FUNCTION: KeyMap.Remove(key, scope) {{{3 -function! s:KeyMap.Remove(key, scope) - let maps = s:KeyMap.All() - for i in range(len(maps)) - if maps[i].key ==# a:key && maps[i].scope ==# a:scope - return remove(maps, i) - endif - endfor -endfunction -"FUNCTION: KeyMap.invoke() {{{3 -"Call the KeyMaps callback function -function! s:KeyMap.invoke(...) - let Callback = function(self.callback) - if a:0 - call Callback(a:1) - else - call Callback() - endif -endfunction - - -"FUNCTION: KeyMap.Invoke() {{{3 -"Find a keymapping for a:key and the current scope invoke it. -" -"Scope is determined as follows: -" * if the cursor is on a dir node then "DirNode" -" * if the cursor is on a file node then "FileNode" -" * if the cursor is on a bookmark then "Bookmark" -" -"If a keymap has the scope of "all" then it will be called if no other keymap -"is found for a:key and the scope. -function! s:KeyMap.Invoke(key) - let node = s:TreeFileNode.GetSelected() - if !empty(node) - - "try file node - if !node.path.isDirectory - let km = s:KeyMap.FindFor(a:key, "FileNode") - if !empty(km) - return km.invoke(node) - endif - endif - - "try dir node - if node.path.isDirectory - let km = s:KeyMap.FindFor(a:key, "DirNode") - if !empty(km) - return km.invoke(node) - endif - endif - - "try generic node - let km = s:KeyMap.FindFor(a:key, "Node") - if !empty(km) - return km.invoke(node) - endif - - endif - - "try bookmark - let bm = s:Bookmark.GetSelected() - if !empty(bm) - let km = s:KeyMap.FindFor(a:key, "Bookmark") - if !empty(km) - return km.invoke(bm) - endif - endif - - "try all - let km = s:KeyMap.FindFor(a:key, "all") - if !empty(km) - return km.invoke() - endif -endfunction - -"this is needed since I cant figure out how to invoke dict functions from a -"key map -function! s:KeyMap_Invoke(key) - call s:KeyMap.Invoke(a:key) -endfunction - -"FUNCTION: KeyMap.Create(options) {{{3 -function! s:KeyMap.Create(options) - let newKeyMap = copy(self) - let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options)) - let newKeyMap.key = opts['key'] - let newKeyMap.quickhelpText = opts['quickhelpText'] - let newKeyMap.callback = opts['callback'] - let newKeyMap.scope = opts['scope'] - - call s:KeyMap.Add(newKeyMap) -endfunction - -"FUNCTION: KeyMap.Add(keymap) {{{3 -function! s:KeyMap.Add(keymap) - call s:KeyMap.Remove(a:keymap.key, a:keymap.scope) - call add(s:KeyMap.All(), a:keymap) -endfunction - -"CLASS: MenuController {{{2 -"============================================================ -let s:MenuController = {} -"FUNCTION: MenuController.New(menuItems) {{{3 -"create a new menu controller that operates on the given menu items -function! s:MenuController.New(menuItems) - let newMenuController = copy(self) - if a:menuItems[0].isSeparator() - let newMenuController.menuItems = a:menuItems[1:-1] - else - let newMenuController.menuItems = a:menuItems - endif - return newMenuController -endfunction - -"FUNCTION: MenuController.showMenu() {{{3 -"start the main loop of the menu and get the user to choose/execute a menu -"item -function! s:MenuController.showMenu() - call self._saveOptions() - - try - let self.selection = 0 - - let done = 0 - while !done - redraw! - call self._echoPrompt() - let key = nr2char(getchar()) - let done = self._handleKeypress(key) - endwhile - finally - call self._restoreOptions() - endtry - - if self.selection != -1 - let m = self._current() - call m.execute() - endif -endfunction - -"FUNCTION: MenuController._echoPrompt() {{{3 -function! s:MenuController._echoPrompt() - echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated" - echo "==========================================================" - - for i in range(0, len(self.menuItems)-1) - if self.selection == i - echo "> " . self.menuItems[i].text - else - echo " " . self.menuItems[i].text - endif - endfor -endfunction - -"FUNCTION: MenuController._current(key) {{{3 -"get the MenuItem that is currently selected -function! s:MenuController._current() - return self.menuItems[self.selection] -endfunction - -"FUNCTION: MenuController._handleKeypress(key) {{{3 -"change the selection (if appropriate) and return 1 if the user has made -"their choice, 0 otherwise -function! s:MenuController._handleKeypress(key) - if a:key == 'j' - call self._cursorDown() - elseif a:key == 'k' - call self._cursorUp() - elseif a:key == nr2char(27) "escape - let self.selection = -1 - return 1 - elseif a:key == "\r" || a:key == "\n" "enter and ctrl-j - return 1 - else - let index = self._nextIndexFor(a:key) - if index != -1 - let self.selection = index - if len(self._allIndexesFor(a:key)) == 1 - return 1 - endif - endif - endif - - return 0 -endfunction - -"FUNCTION: MenuController._allIndexesFor(shortcut) {{{3 -"get indexes to all menu items with the given shortcut -function! s:MenuController._allIndexesFor(shortcut) - let toReturn = [] - - for i in range(0, len(self.menuItems)-1) - if self.menuItems[i].shortcut == a:shortcut - call add(toReturn, i) - endif - endfor - - return toReturn -endfunction - -"FUNCTION: MenuController._nextIndexFor(shortcut) {{{3 -"get the index to the next menu item with the given shortcut, starts from the -"current cursor location and wraps around to the top again if need be -function! s:MenuController._nextIndexFor(shortcut) - for i in range(self.selection+1, len(self.menuItems)-1) - if self.menuItems[i].shortcut == a:shortcut - return i - endif - endfor - - for i in range(0, self.selection) - if self.menuItems[i].shortcut == a:shortcut - return i - endif - endfor - - return -1 -endfunction - -"FUNCTION: MenuController._setCmdheight() {{{3 -"sets &cmdheight to whatever is needed to display the menu -function! s:MenuController._setCmdheight() - let &cmdheight = len(self.menuItems) + 3 -endfunction - -"FUNCTION: MenuController._saveOptions() {{{3 -"set any vim options that are required to make the menu work (saving their old -"values) -function! s:MenuController._saveOptions() - let self._oldLazyredraw = &lazyredraw - let self._oldCmdheight = &cmdheight - set nolazyredraw - call self._setCmdheight() -endfunction - -"FUNCTION: MenuController._restoreOptions() {{{3 -"restore the options we saved in _saveOptions() -function! s:MenuController._restoreOptions() - let &cmdheight = self._oldCmdheight - let &lazyredraw = self._oldLazyredraw -endfunction - -"FUNCTION: MenuController._cursorDown() {{{3 -"move the cursor to the next menu item, skipping separators -function! s:MenuController._cursorDown() - let done = 0 - while !done - if self.selection < len(self.menuItems)-1 - let self.selection += 1 - else - let self.selection = 0 - endif - - if !self._current().isSeparator() - let done = 1 - endif - endwhile -endfunction - -"FUNCTION: MenuController._cursorUp() {{{3 -"move the cursor to the previous menu item, skipping separators -function! s:MenuController._cursorUp() - let done = 0 - while !done - if self.selection > 0 - let self.selection -= 1 - else - let self.selection = len(self.menuItems)-1 - endif - - if !self._current().isSeparator() - let done = 1 - endif - endwhile -endfunction - -"CLASS: MenuItem {{{2 -"============================================================ -let s:MenuItem = {} -"FUNCTION: MenuItem.All() {{{3 -"get all top level menu items -function! s:MenuItem.All() - if !exists("s:menuItems") - let s:menuItems = [] - endif - return s:menuItems -endfunction - -"FUNCTION: MenuItem.AllEnabled() {{{3 -"get all top level menu items that are currently enabled -function! s:MenuItem.AllEnabled() - let toReturn = [] - for i in s:MenuItem.All() - if i.enabled() - call add(toReturn, i) - endif - endfor - return toReturn -endfunction - -"FUNCTION: MenuItem.Create(options) {{{3 -"make a new menu item and add it to the global list -function! s:MenuItem.Create(options) - let newMenuItem = copy(self) - - let newMenuItem.text = a:options['text'] - let newMenuItem.shortcut = a:options['shortcut'] - let newMenuItem.children = [] - - let newMenuItem.isActiveCallback = -1 - if has_key(a:options, 'isActiveCallback') - let newMenuItem.isActiveCallback = a:options['isActiveCallback'] - endif - - let newMenuItem.callback = -1 - if has_key(a:options, 'callback') - let newMenuItem.callback = a:options['callback'] - endif - - if has_key(a:options, 'parent') - call add(a:options['parent'].children, newMenuItem) - else - call add(s:MenuItem.All(), newMenuItem) - endif - - return newMenuItem -endfunction - -"FUNCTION: MenuItem.CreateSeparator(options) {{{3 -"make a new separator menu item and add it to the global list -function! s:MenuItem.CreateSeparator(options) - let standard_options = { 'text': '--------------------', - \ 'shortcut': -1, - \ 'callback': -1 } - let options = extend(a:options, standard_options, "force") - - return s:MenuItem.Create(options) -endfunction - -"FUNCTION: MenuItem.CreateSubmenu(options) {{{3 -"make a new submenu and add it to global list -function! s:MenuItem.CreateSubmenu(options) - let standard_options = { 'callback': -1 } - let options = extend(a:options, standard_options, "force") - - return s:MenuItem.Create(options) -endfunction - -"FUNCTION: MenuItem.enabled() {{{3 -"return 1 if this menu item should be displayed -" -"delegates off to the isActiveCallback, and defaults to 1 if no callback was -"specified -function! s:MenuItem.enabled() - if self.isActiveCallback != -1 - return {self.isActiveCallback}() - endif - return 1 -endfunction - -"FUNCTION: MenuItem.execute() {{{3 -"perform the action behind this menu item, if this menuitem has children then -"display a new menu for them, otherwise deletegate off to the menuitem's -"callback -function! s:MenuItem.execute() - if len(self.children) - let mc = s:MenuController.New(self.children) - call mc.showMenu() - else - if self.callback != -1 - call {self.callback}() - endif - endif -endfunction - -"FUNCTION: MenuItem.isSeparator() {{{3 -"return 1 if this menuitem is a separator -function! s:MenuItem.isSeparator() - return self.callback == -1 && self.children == [] -endfunction - -"FUNCTION: MenuItem.isSubmenu() {{{3 -"return 1 if this menuitem is a submenu -function! s:MenuItem.isSubmenu() - return self.callback == -1 && !empty(self.children) -endfunction - -"CLASS: TreeFileNode {{{2 -"This class is the parent of the TreeDirNode class and constitures the -"'Component' part of the composite design pattern between the treenode -"classes. -"============================================================ -let s:TreeFileNode = {} -"FUNCTION: TreeFileNode.activate(...) {{{3 -function! s:TreeFileNode.activate(...) - call self.open(a:0 ? a:1 : {}) -endfunction -"FUNCTION: TreeFileNode.bookmark(name) {{{3 -"bookmark this node with a:name -function! s:TreeFileNode.bookmark(name) - - "if a bookmark exists with the same name and the node is cached then save - "it so we can update its display string - let oldMarkedNode = {} - try - let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1) - catch /^NERDTree.BookmarkNotFoundError/ - catch /^NERDTree.BookmarkedNodeNotFoundError/ - endtry - - call s:Bookmark.AddBookmark(a:name, self.path) - call self.path.cacheDisplayString() - call s:Bookmark.Write() - - if !empty(oldMarkedNode) - call oldMarkedNode.path.cacheDisplayString() - endif -endfunction -"FUNCTION: TreeFileNode.cacheParent() {{{3 -"initializes self.parent if it isnt already -function! s:TreeFileNode.cacheParent() - if empty(self.parent) - let parentPath = self.path.getParent() - if parentPath.equals(self.path) - throw "NERDTree.CannotCacheParentError: already at root" - endif - let self.parent = s:TreeFileNode.New(parentPath) - endif -endfunction -"FUNCTION: TreeFileNode.compareNodes {{{3 -"This is supposed to be a class level method but i cant figure out how to -"get func refs to work from a dict.. -" -"A class level method that compares two nodes -" -"Args: -"n1, n2: the 2 nodes to compare -function! s:compareNodes(n1, n2) - return a:n1.path.compareTo(a:n2.path) -endfunction - -"FUNCTION: TreeFileNode.clearBookmarks() {{{3 -function! s:TreeFileNode.clearBookmarks() - for i in s:Bookmark.Bookmarks() - if i.path.equals(self.path) - call i.delete() - end - endfor - call self.path.cacheDisplayString() -endfunction -"FUNCTION: TreeFileNode.copy(dest) {{{3 -function! s:TreeFileNode.copy(dest) - call self.path.copy(a:dest) - let newPath = s:Path.New(a:dest) - let parent = b:NERDTreeRoot.findNode(newPath.getParent()) - if !empty(parent) - call parent.refresh() - return parent.findNode(newPath) - else - return {} - endif -endfunction - -"FUNCTION: TreeFileNode.delete {{{3 -"Removes this node from the tree and calls the Delete method for its path obj -function! s:TreeFileNode.delete() - call self.path.delete() - call self.parent.removeChild(self) -endfunction - -"FUNCTION: TreeFileNode.displayString() {{{3 -" -"Returns a string that specifies how the node should be represented as a -"string -" -"Return: -"a string that can be used in the view to represent this node -function! s:TreeFileNode.displayString() - return self.path.displayString() -endfunction - -"FUNCTION: TreeFileNode.equals(treenode) {{{3 -" -"Compares this treenode to the input treenode and returns 1 if they are the -"same node. -" -"Use this method instead of == because sometimes when the treenodes contain -"many children, vim seg faults when doing == -" -"Args: -"treenode: the other treenode to compare to -function! s:TreeFileNode.equals(treenode) - return self.path.str() ==# a:treenode.path.str() -endfunction - -"FUNCTION: TreeFileNode.findNode(path) {{{3 -"Returns self if this node.path.Equals the given path. -"Returns {} if not equal. -" -"Args: -"path: the path object to compare against -function! s:TreeFileNode.findNode(path) - if a:path.equals(self.path) - return self - endif - return {} -endfunction -"FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{3 -" -"Finds the next sibling for this node in the indicated direction. This sibling -"must be a directory and may/may not have children as specified. -" -"Args: -"direction: 0 if you want to find the previous sibling, 1 for the next sibling -" -"Return: -"a treenode object or {} if no appropriate sibling could be found -function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) - "if we have no parent then we can have no siblings - if self.parent != {} - let nextSibling = self.findSibling(a:direction) - - while nextSibling != {} - if nextSibling.path.isDirectory && nextSibling.hasVisibleChildren() && nextSibling.isOpen - return nextSibling - endif - let nextSibling = nextSibling.findSibling(a:direction) - endwhile - endif - - return {} -endfunction -"FUNCTION: TreeFileNode.findSibling(direction) {{{3 -" -"Finds the next sibling for this node in the indicated direction -" -"Args: -"direction: 0 if you want to find the previous sibling, 1 for the next sibling -" -"Return: -"a treenode object or {} if no sibling could be found -function! s:TreeFileNode.findSibling(direction) - "if we have no parent then we can have no siblings - if self.parent != {} - - "get the index of this node in its parents children - let siblingIndx = self.parent.getChildIndex(self.path) - - if siblingIndx != -1 - "move a long to the next potential sibling node - let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 - - "keep moving along to the next sibling till we find one that is valid - let numSiblings = self.parent.getChildCount() - while siblingIndx >= 0 && siblingIndx < numSiblings - - "if the next node is not an ignored node (i.e. wont show up in the - "view) then return it - if self.parent.children[siblingIndx].path.ignore() ==# 0 - return self.parent.children[siblingIndx] - endif - - "go to next node - let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 - endwhile - endif - endif - - return {} -endfunction - -"FUNCTION: TreeFileNode.getLineNum(){{{3 -"returns the line number this node is rendered on, or -1 if it isnt rendered -function! s:TreeFileNode.getLineNum() - "if the node is the root then return the root line no. - if self.isRoot() - return s:TreeFileNode.GetRootLineNum() - endif - - let totalLines = line("$") - - "the path components we have matched so far - let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')] - "the index of the component we are searching for - let curPathComponent = 1 - - let fullpath = self.path.str({'format': 'UI'}) - - - let lnum = s:TreeFileNode.GetRootLineNum() - while lnum > 0 - let lnum = lnum + 1 - "have we reached the bottom of the tree? - if lnum ==# totalLines+1 - return -1 - endif - - let curLine = getline(lnum) - - let indent = s:indentLevelFor(curLine) - if indent ==# curPathComponent - let curLine = s:stripMarkupFromLine(curLine, 1) - - let curPath = join(pathcomponents, '/') . '/' . curLine - if stridx(fullpath, curPath, 0) ==# 0 - if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/' - let curLine = substitute(curLine, '/ *$', '', '') - call add(pathcomponents, curLine) - let curPathComponent = curPathComponent + 1 - - if fullpath ==# curPath - return lnum - endif - endif - endif - endif - endwhile - return -1 -endfunction - -"FUNCTION: TreeFileNode.GetRootForTab(){{{3 -"get the root node for this tab -function! s:TreeFileNode.GetRootForTab() - if s:treeExistsForTab() - return getbufvar(t:NERDTreeBufName, 'NERDTreeRoot') - end - return {} -endfunction -"FUNCTION: TreeFileNode.GetRootLineNum(){{{3 -"gets the line number of the root node -function! s:TreeFileNode.GetRootLineNum() - let rootLine = 1 - while getline(rootLine) !~# '^\(/\|<\)' - let rootLine = rootLine + 1 - endwhile - return rootLine -endfunction - -"FUNCTION: TreeFileNode.GetSelected() {{{3 -"gets the treenode that the cursor is currently over -function! s:TreeFileNode.GetSelected() - try - let path = s:getPath(line(".")) - if path ==# {} - return {} - endif - return b:NERDTreeRoot.findNode(path) - catch /NERDTree/ - return {} - endtry -endfunction -"FUNCTION: TreeFileNode.isVisible() {{{3 -"returns 1 if this node should be visible according to the tree filters and -"hidden file filters (and their on/off status) -function! s:TreeFileNode.isVisible() - return !self.path.ignore() -endfunction -"FUNCTION: TreeFileNode.isRoot() {{{3 -"returns 1 if this node is b:NERDTreeRoot -function! s:TreeFileNode.isRoot() - if !s:treeExistsForBuf() - throw "NERDTree.NoTreeError: No tree exists for the current buffer" - endif - - return self.equals(b:NERDTreeRoot) -endfunction - -"FUNCTION: TreeFileNode.makeRoot() {{{3 -"Make this node the root of the tree -function! s:TreeFileNode.makeRoot() - if self.path.isDirectory - let b:NERDTreeRoot = self - else - call self.cacheParent() - let b:NERDTreeRoot = self.parent - endif - - call b:NERDTreeRoot.open() - - "change dir to the dir of the new root if instructed to - if g:NERDTreeChDirMode ==# 2 - exec "cd " . b:NERDTreeRoot.path.str({'format': 'Edit'}) - endif - - silent doautocmd User NERDTreeNewRoot -endfunction -"FUNCTION: TreeFileNode.New(path) {{{3 -"Returns a new TreeNode object with the given path and parent -" -"Args: -"path: a path object representing the full filesystem path to the file/dir that the node represents -function! s:TreeFileNode.New(path) - if a:path.isDirectory - return s:TreeDirNode.New(a:path) - else - let newTreeNode = copy(self) - let newTreeNode.path = a:path - let newTreeNode.parent = {} - return newTreeNode - endif -endfunction - -"FUNCTION: TreeFileNode.open() {{{3 -function! s:TreeFileNode.open(...) - let opts = a:0 ? a:1 : {} - let opener = s:Opener.New(self.path, opts) - call opener.open(self) -endfunction - -"FUNCTION: TreeFileNode.openSplit() {{{3 -"Open this node in a new window -function! s:TreeFileNode.openSplit() - call s:deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.') - call self.open({'where': 'h'}) -endfunction -"FUNCTION: TreeFileNode.openVSplit() {{{3 -"Open this node in a new vertical window -function! s:TreeFileNode.openVSplit() - call s:deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.') - call self.open({'where': 'v'}) -endfunction -"FUNCTION: TreeFileNode.openInNewTab(options) {{{3 -function! s:TreeFileNode.openInNewTab(options) - echomsg 'TreeFileNode.openInNewTab is deprecated' - call self.open(extend({'where': 't'}, a:options)) -endfunction -"FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{3 -"Places the cursor on the line number this node is rendered on -" -"Args: -"isJump: 1 if this cursor movement should be counted as a jump by vim -"recurseUpward: try to put the cursor on the parent if the this node isnt -"visible -function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) - let ln = self.getLineNum() - if ln != -1 - if a:isJump - mark ' - endif - call cursor(ln, col(".")) - else - if a:recurseUpward - let node = self - while node != {} && node.getLineNum() ==# -1 - let node = node.parent - call node.open() - endwhile - call s:renderView() - call node.putCursorHere(a:isJump, 0) - endif - endif -endfunction - -"FUNCTION: TreeFileNode.refresh() {{{3 -function! s:TreeFileNode.refresh() - call self.path.refresh() -endfunction -"FUNCTION: TreeFileNode.rename() {{{3 -"Calls the rename method for this nodes path obj -function! s:TreeFileNode.rename(newName) - let newName = substitute(a:newName, '\(\\\|\/\)$', '', '') - call self.path.rename(newName) - call self.parent.removeChild(self) - - let parentPath = self.path.getParent() - let newParent = b:NERDTreeRoot.findNode(parentPath) - - if newParent != {} - call newParent.createChild(self.path, 1) - call newParent.refresh() - endif -endfunction -"FUNCTION: TreeFileNode.renderToString {{{3 -"returns a string representation for this tree to be rendered in the view -function! s:TreeFileNode.renderToString() - return self._renderToString(0, 0, [], self.getChildCount() ==# 1) -endfunction - - -"Args: -"depth: the current depth in the tree for this call -"drawText: 1 if we should actually draw the line for this node (if 0 then the -"child nodes are rendered only) -"vertMap: a binary array that indicates whether a vertical bar should be draw -"for each depth in the tree -"isLastChild:true if this curNode is the last child of its parent -function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) - let output = "" - if a:drawText ==# 1 - - let treeParts = '' - - "get all the leading spaces and vertical tree parts for this line - if a:depth > 1 - for j in a:vertMap[0:-2] - if g:NERDTreeDirArrows - let treeParts = treeParts . ' ' - else - if j ==# 1 - let treeParts = treeParts . '| ' - else - let treeParts = treeParts . ' ' - endif - endif - endfor - endif - - "get the last vertical tree part for this line which will be different - "if this node is the last child of its parent - if !g:NERDTreeDirArrows - if a:isLastChild - let treeParts = treeParts . '`' - else - let treeParts = treeParts . '|' - endif - endif - - "smack the appropriate dir/file symbol on the line before the file/dir - "name itself - if self.path.isDirectory - if self.isOpen - if g:NERDTreeDirArrows - let treeParts = treeParts . '▾ ' - else - let treeParts = treeParts . '~' - endif - else - if g:NERDTreeDirArrows - let treeParts = treeParts . '▸ ' - else - let treeParts = treeParts . '+' - endif - endif - else - if g:NERDTreeDirArrows - let treeParts = treeParts . ' ' - else - let treeParts = treeParts . '-' - endif - endif - let line = treeParts . self.displayString() - - let output = output . line . "\n" - endif - - "if the node is an open dir, draw its children - if self.path.isDirectory ==# 1 && self.isOpen ==# 1 - - let childNodesToDraw = self.getVisibleChildren() - if len(childNodesToDraw) > 0 - - "draw all the nodes children except the last - let lastIndx = len(childNodesToDraw)-1 - if lastIndx > 0 - for i in childNodesToDraw[0:lastIndx-1] - let output = output . i._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 1), 0) - endfor - endif - - "draw the last child, indicating that it IS the last - let output = output . childNodesToDraw[lastIndx]._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 0), 1) - endif - endif - - return output -endfunction -"CLASS: TreeDirNode {{{2 -"This class is a child of the TreeFileNode class and constitutes the -"'Composite' part of the composite design pattern between the treenode -"classes. -"============================================================ -let s:TreeDirNode = copy(s:TreeFileNode) -"FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{3 -"class method that returns the highest cached ancestor of the current root -function! s:TreeDirNode.AbsoluteTreeRoot() - let currentNode = b:NERDTreeRoot - while currentNode.parent != {} - let currentNode = currentNode.parent - endwhile - return currentNode -endfunction -"FUNCTION: TreeDirNode.activate([options]) {{{3 -unlet s:TreeDirNode.activate -function! s:TreeDirNode.activate(...) - let opts = a:0 ? a:1 : {} - call self.toggleOpen(opts) - call s:renderView() - call self.putCursorHere(0, 0) -endfunction -"FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{3 -"Adds the given treenode to the list of children for this node -" -"Args: -"-treenode: the node to add -"-inOrder: 1 if the new node should be inserted in sorted order -function! s:TreeDirNode.addChild(treenode, inOrder) - call add(self.children, a:treenode) - let a:treenode.parent = self - - if a:inOrder - call self.sortChildren() - endif -endfunction - -"FUNCTION: TreeDirNode.close() {{{3 -"Closes this directory -function! s:TreeDirNode.close() - let self.isOpen = 0 -endfunction - -"FUNCTION: TreeDirNode.closeChildren() {{{3 -"Closes all the child dir nodes of this node -function! s:TreeDirNode.closeChildren() - for i in self.children - if i.path.isDirectory - call i.close() - call i.closeChildren() - endif - endfor -endfunction - -"FUNCTION: TreeDirNode.createChild(path, inOrder) {{{3 -"Instantiates a new child node for this node with the given path. The new -"nodes parent is set to this node. -" -"Args: -"path: a Path object that this node will represent/contain -"inOrder: 1 if the new node should be inserted in sorted order -" -"Returns: -"the newly created node -function! s:TreeDirNode.createChild(path, inOrder) - let newTreeNode = s:TreeFileNode.New(a:path) - call self.addChild(newTreeNode, a:inOrder) - return newTreeNode -endfunction - -"FUNCTION: TreeDirNode.findNode(path) {{{3 -"Will find one of the children (recursively) that has the given path -" -"Args: -"path: a path object -unlet s:TreeDirNode.findNode -function! s:TreeDirNode.findNode(path) - if a:path.equals(self.path) - return self - endif - if stridx(a:path.str(), self.path.str(), 0) ==# -1 - return {} - endif - - if self.path.isDirectory - for i in self.children - let retVal = i.findNode(a:path) - if retVal != {} - return retVal - endif - endfor - endif - return {} -endfunction -"FUNCTION: TreeDirNode.getChildCount() {{{3 -"Returns the number of children this node has -function! s:TreeDirNode.getChildCount() - return len(self.children) -endfunction - -"FUNCTION: TreeDirNode.getChild(path) {{{3 -"Returns child node of this node that has the given path or {} if no such node -"exists. -" -"This function doesnt not recurse into child dir nodes -" -"Args: -"path: a path object -function! s:TreeDirNode.getChild(path) - if stridx(a:path.str(), self.path.str(), 0) ==# -1 - return {} - endif - - let index = self.getChildIndex(a:path) - if index ==# -1 - return {} - else - return self.children[index] - endif - -endfunction - -"FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{3 -"returns the child at the given index -"Args: -"indx: the index to get the child from -"visible: 1 if only the visible children array should be used, 0 if all the -"children should be searched. -function! s:TreeDirNode.getChildByIndex(indx, visible) - let array_to_search = a:visible? self.getVisibleChildren() : self.children - if a:indx > len(array_to_search) - throw "NERDTree.InvalidArgumentsError: Index is out of bounds." - endif - return array_to_search[a:indx] -endfunction - -"FUNCTION: TreeDirNode.getChildIndex(path) {{{3 -"Returns the index of the child node of this node that has the given path or -"-1 if no such node exists. -" -"This function doesnt not recurse into child dir nodes -" -"Args: -"path: a path object -function! s:TreeDirNode.getChildIndex(path) - if stridx(a:path.str(), self.path.str(), 0) ==# -1 - return -1 - endif - - "do a binary search for the child - let a = 0 - let z = self.getChildCount() - while a < z - let mid = (a+z)/2 - let diff = a:path.compareTo(self.children[mid].path) - - if diff ==# -1 - let z = mid - elseif diff ==# 1 - let a = mid+1 - else - return mid - endif - endwhile - return -1 -endfunction - -"FUNCTION: TreeDirNode.GetSelected() {{{3 -"Returns the current node if it is a dir node, or else returns the current -"nodes parent -unlet s:TreeDirNode.GetSelected -function! s:TreeDirNode.GetSelected() - let currentDir = s:TreeFileNode.GetSelected() - if currentDir != {} && !currentDir.isRoot() - if currentDir.path.isDirectory ==# 0 - let currentDir = currentDir.parent - endif - endif - return currentDir -endfunction -"FUNCTION: TreeDirNode.getVisibleChildCount() {{{3 -"Returns the number of visible children this node has -function! s:TreeDirNode.getVisibleChildCount() - return len(self.getVisibleChildren()) -endfunction - -"FUNCTION: TreeDirNode.getVisibleChildren() {{{3 -"Returns a list of children to display for this node, in the correct order -" -"Return: -"an array of treenodes -function! s:TreeDirNode.getVisibleChildren() - let toReturn = [] - for i in self.children - if i.path.ignore() ==# 0 - call add(toReturn, i) - endif - endfor - return toReturn -endfunction - -"FUNCTION: TreeDirNode.hasVisibleChildren() {{{3 -"returns 1 if this node has any childre, 0 otherwise.. -function! s:TreeDirNode.hasVisibleChildren() - return self.getVisibleChildCount() != 0 -endfunction - -"FUNCTION: TreeDirNode._initChildren() {{{3 -"Removes all childen from this node and re-reads them -" -"Args: -"silent: 1 if the function should not echo any "please wait" messages for -"large directories -" -"Return: the number of child nodes read -function! s:TreeDirNode._initChildren(silent) - "remove all the current child nodes - let self.children = [] - - "get an array of all the files in the nodes dir - let dir = self.path - let globDir = dir.str({'format': 'Glob'}) - let filesStr = globpath(globDir, '*',1) . "\n" . globpath(globDir, '.*',1) - let files = split(filesStr, "\n") - - if !a:silent && len(files) > g:NERDTreeNotificationThreshold - call s:echo("Please wait, caching a large dir ...") - endif - - let invalidFilesFound = 0 - for i in files - - "filter out the .. and . directories - "Note: we must match .. AND ../ cos sometimes the globpath returns - "../ for path with strange chars (eg $) - if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$' - - "put the next file in a new node and attach it - try - let path = s:Path.New(i) - call self.createChild(path, 0) - catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ - let invalidFilesFound += 1 - endtry - endif - endfor - - call self.sortChildren() - - if !a:silent && len(files) > g:NERDTreeNotificationThreshold - call s:echo("Please wait, caching a large dir ... DONE (". self.getChildCount() ." nodes cached).") - endif - - if invalidFilesFound - call s:echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree") - endif - return self.getChildCount() -endfunction -"FUNCTION: TreeDirNode.New(path) {{{3 -"Returns a new TreeNode object with the given path and parent -" -"Args: -"path: a path object representing the full filesystem path to the file/dir that the node represents -unlet s:TreeDirNode.New -function! s:TreeDirNode.New(path) - if a:path.isDirectory != 1 - throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object." - endif - - let newTreeNode = copy(self) - let newTreeNode.path = a:path - - let newTreeNode.isOpen = 0 - let newTreeNode.children = [] - - let newTreeNode.parent = {} - - return newTreeNode -endfunction -"FUNCTION: TreeDirNode.open([opts]) {{{3 -"Open the dir in the current tree or in a new tree elsewhere. -" -"If opening in the current tree, return the number of cached nodes. -unlet s:TreeDirNode.open -function! s:TreeDirNode.open(...) - let opts = a:0 ? a:1 : {} - - if has_key(opts, 'where') && !empty(opts['where']) - let opener = s:Opener.New(self.path, opts) - call opener.open(self) - else - let self.isOpen = 1 - if self.children ==# [] - return self._initChildren(0) - else - return 0 - endif - endif -endfunction -"FUNCTION: TreeDirNode.openAlong([opts]) {{{3 -"recursive open the dir if it has only one directory child. -" -"return the level of opened directories. -function! s:TreeDirNode.openAlong(...) - let opts = a:0 ? a:1 : {} - let level = 0 - - let node = self - while node.path.isDirectory - call node.open(opts) - let level += 1 - if node.getVisibleChildCount() == 1 - let node = node.getChildByIndex(0, 1) - else - break - endif - endwhile - return level -endfunction -" FUNCTION: TreeDirNode.openExplorer() {{{3 -" opens an explorer window for this node in the previous window (could be a -" nerd tree or a netrw) -function! s:TreeDirNode.openExplorer() - call self.open({'where': 'p'}) -endfunction -"FUNCTION: TreeDirNode.openInNewTab(options) {{{3 -unlet s:TreeDirNode.openInNewTab -function! s:TreeDirNode.openInNewTab(options) - call s:deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead') - call self.open({'where': 't'}) -endfunction -"FUNCTION: TreeDirNode._openInNewTab() {{{3 -function! s:TreeDirNode._openInNewTab() - tabnew - call s:initNerdTree(self.path.str()) -endfunction -"FUNCTION: TreeDirNode.openRecursively() {{{3 -"Opens this treenode and all of its children whose paths arent 'ignored' -"because of the file filters. -" -"This method is actually a wrapper for the OpenRecursively2 method which does -"the work. -function! s:TreeDirNode.openRecursively() - call self._openRecursively2(1) -endfunction - -"FUNCTION: TreeDirNode._openRecursively2() {{{3 -"Opens this all children of this treenode recursively if either: -" *they arent filtered by file filters -" *a:forceOpen is 1 -" -"Args: -"forceOpen: 1 if this node should be opened regardless of file filters -function! s:TreeDirNode._openRecursively2(forceOpen) - if self.path.ignore() ==# 0 || a:forceOpen - let self.isOpen = 1 - if self.children ==# [] - call self._initChildren(1) - endif - - for i in self.children - if i.path.isDirectory ==# 1 - call i._openRecursively2(0) - endif - endfor - endif -endfunction - -"FUNCTION: TreeDirNode.refresh() {{{3 -unlet s:TreeDirNode.refresh -function! s:TreeDirNode.refresh() - call self.path.refresh() - - "if this node was ever opened, refresh its children - if self.isOpen || !empty(self.children) - "go thru all the files/dirs under this node - let newChildNodes = [] - let invalidFilesFound = 0 - let dir = self.path - let globDir = dir.str({'format': 'Glob'}) - let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*') - let files = split(filesStr, "\n") - for i in files - "filter out the .. and . directories - "Note: we must match .. AND ../ cos sometimes the globpath returns - "../ for path with strange chars (eg $) - if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$' - - try - "create a new path and see if it exists in this nodes children - let path = s:Path.New(i) - let newNode = self.getChild(path) - if newNode != {} - call newNode.refresh() - call add(newChildNodes, newNode) - - "the node doesnt exist so create it - else - let newNode = s:TreeFileNode.New(path) - let newNode.parent = self - call add(newChildNodes, newNode) - endif - - - catch /^NERDTree.InvalidArgumentsError/ - let invalidFilesFound = 1 - endtry - endif - endfor - - "swap this nodes children out for the children we just read/refreshed - let self.children = newChildNodes - call self.sortChildren() - - if invalidFilesFound - call s:echoWarning("some files could not be loaded into the NERD tree") - endif - endif -endfunction - -"FUNCTION: TreeDirNode.reveal(path) {{{3 -"reveal the given path, i.e. cache and open all treenodes needed to display it -"in the UI -function! s:TreeDirNode.reveal(path) - if !a:path.isUnder(self.path) - throw "NERDTree.InvalidArgumentsError: " . a:path.str() . " should be under " . self.path.str() - endif - - call self.open() - - if self.path.equals(a:path.getParent()) - let n = self.findNode(a:path) - call s:renderView() - call n.putCursorHere(1,0) - return - endif - - let p = a:path - while !p.getParent().equals(self.path) - let p = p.getParent() - endwhile - - let n = self.findNode(p) - call n.reveal(a:path) -endfunction -"FUNCTION: TreeDirNode.removeChild(treenode) {{{3 -" -"Removes the given treenode from this nodes set of children -" -"Args: -"treenode: the node to remove -" -"Throws a NERDTree.ChildNotFoundError if the given treenode is not found -function! s:TreeDirNode.removeChild(treenode) - for i in range(0, self.getChildCount()-1) - if self.children[i].equals(a:treenode) - call remove(self.children, i) - return - endif - endfor - - throw "NERDTree.ChildNotFoundError: child node was not found" -endfunction - -"FUNCTION: TreeDirNode.sortChildren() {{{3 -" -"Sorts the children of this node according to alphabetical order and the -"directory priority. -" -function! s:TreeDirNode.sortChildren() - let CompareFunc = function("s:compareNodes") - call sort(self.children, CompareFunc) -endfunction - -"FUNCTION: TreeDirNode.toggleOpen([options]) {{{3 -"Opens this directory if it is closed and vice versa -function! s:TreeDirNode.toggleOpen(...) - let opts = a:0 ? a:1 : {} - if self.isOpen ==# 1 - call self.close() - else - if g:NERDTreeCasadeOpenSingleChildDir == 0 - call self.open(opts) - else - call self.openAlong(opts) - endif - endif -endfunction -"FUNCTION: TreeDirNode.transplantChild(newNode) {{{3 -"Replaces the child of this with the given node (where the child node's full -"path matches a:newNode's fullpath). The search for the matching node is -"non-recursive -" -"Arg: -"newNode: the node to graft into the tree -function! s:TreeDirNode.transplantChild(newNode) - for i in range(0, self.getChildCount()-1) - if self.children[i].equals(a:newNode) - let self.children[i] = a:newNode - let a:newNode.parent = self - break - endif - endfor -endfunction -"============================================================ -"CLASS: Opener {{{2 -"============================================================ -let s:Opener = {} - -"FUNCTION: Opener._checkToCloseTree(newtab) {{{3 -"Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see -"if the tree should be closed now. -" -"Args: -"a:newtab - boolean. If set, only close the tree now if we are opening the -"target in a new tab. This is needed because we have to close tree before we -"leave the tab -function! s:Opener._checkToCloseTree(newtab) - if self._keepopen - return - endif - - if (a:newtab && self._where == 't') || !a:newtab - call s:closeTreeIfQuitOnOpen() - endif -endfunction - -"FUNCTION: Opener._gotoTargetWin() {{{3 -function! s:Opener._gotoTargetWin() - if b:NERDTreeType ==# "secondary" - if self._where == 'v' - vsplit - elseif self._where == 'h' - split - elseif self._where == 't' - tabnew - endif - else - call self._checkToCloseTree(1) - - if self._where == 'v' - call self._newVSplit() - elseif self._where == 'h' - call self._newSplit() - elseif self._where == 't' - tabnew - elseif self._where == 'p' - call self._previousWindow() - endif - - call self._checkToCloseTree(0) - endif -endfunction - -"FUNCTION: Opener.New(path, opts) {{{3 -"Args: -" -"a:path: The path object that is to be opened. -" -"a:opts: -" -"A dictionary containing the following keys (all optional): -" 'where': Specifies whether the node should be opened in new split/tab or in -" the previous window. Can be either 'v' or 'h' or 't' (for open in -" new tab) -" 'reuse': if a window is displaying the file then jump the cursor there -" 'keepopen': dont close the tree window -" 'stay': open the file, but keep the cursor in the tree win -function! s:Opener.New(path, opts) - let newObj = copy(self) - - let newObj._path = a:path - let newObj._stay = s:has_opt(a:opts, 'stay') - let newObj._reuse = s:has_opt(a:opts, 'reuse') - let newObj._keepopen = s:has_opt(a:opts, 'keepopen') - let newObj._where = has_key(a:opts, 'where') ? a:opts['where'] : '' - let newObj._treetype = b:NERDTreeType - call newObj._saveCursorPos() - - return newObj -endfunction - -"FUNCTION: Opener._newSplit() {{{3 -function! s:Opener._newSplit() - " Save the user's settings for splitbelow and splitright - let savesplitbelow=&splitbelow - let savesplitright=&splitright - - " 'there' will be set to a command to move from the split window - " back to the explorer window - " - " 'back' will be set to a command to move from the explorer window - " back to the newly split window - " - " 'right' and 'below' will be set to the settings needed for - " splitbelow and splitright IF the explorer is the only window. - " - let there= g:NERDTreeWinPos ==# "left" ? "wincmd h" : "wincmd l" - let back = g:NERDTreeWinPos ==# "left" ? "wincmd l" : "wincmd h" - let right= g:NERDTreeWinPos ==# "left" - let below=0 - - " Attempt to go to adjacent window - call s:exec(back) - - let onlyOneWin = (winnr("$") ==# 1) - - " If no adjacent window, set splitright and splitbelow appropriately - if onlyOneWin - let &splitright=right - let &splitbelow=below - else - " found adjacent window - invert split direction - let &splitright=!right - let &splitbelow=!below - endif - - let splitMode = onlyOneWin ? "vertical" : "" - - " Open the new window - try - exec(splitMode." sp ") - catch /^Vim\%((\a\+)\)\=:E37/ - call s:putCursorInTreeWin() - throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." - catch /^Vim\%((\a\+)\)\=:/ - "do nothing - endtry - - "resize the tree window if no other window was open before - if onlyOneWin - let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - call s:exec(there) - exec("silent ". splitMode ." resize ". size) - call s:exec('wincmd p') - endif - - " Restore splitmode settings - let &splitbelow=savesplitbelow - let &splitright=savesplitright -endfunction - -"FUNCTION: Opener._newVSplit() {{{3 -function! s:Opener._newVSplit() - let winwidth = winwidth(".") - if winnr("$")==#1 - let winwidth = g:NERDTreeWinSize - endif - - call s:exec("wincmd p") - vnew - - "resize the nerd tree back to the original size - call s:putCursorInTreeWin() - exec("silent vertical resize ". winwidth) - call s:exec('wincmd p') -endfunction - -"FUNCTION: Opener.open(target) {{{3 -function! s:Opener.open(target) - if self._path.isDirectory - call self._openDirectory(a:target) - else - call self._openFile() - endif -endfunction - -"FUNCTION: Opener._openFile() {{{3 -function! s:Opener._openFile() - if self._reuse && self._reuseWindow() - return - endif - - call self._gotoTargetWin() - - if self._treetype ==# "secondary" - call self._path.edit() - else - call self._path.edit() - - - if self._stay - call self._restoreCursorPos() - endif - endif -endfunction - -"FUNCTION: Opener._openDirectory(node) {{{3 -function! s:Opener._openDirectory(node) - if self._treetype ==# "secondary" - call self._gotoTargetWin() - call s:initNerdTreeInPlace(a:node.path.str()) - else - call self._gotoTargetWin() - if empty(self._where) - call a:node.makeRoot() - call s:renderView() - call a:node.putCursorHere(0, 0) - elseif self._where == 't' - call s:initNerdTree(a:node.path.str()) - else - call s:initNerdTreeInPlace(a:node.path.str()) - endif - endif - - if self._stay - call self._restoreCursorPos() - endif -endfunction - -"FUNCTION: Opener._previousWindow() {{{3 -function! s:Opener._previousWindow() - if !s:isWindowUsable(winnr("#")) && s:firstUsableWindow() ==# -1 - call self._newSplit() - else - try - if !s:isWindowUsable(winnr("#")) - call s:exec(s:firstUsableWindow() . "wincmd w") - else - call s:exec('wincmd p') - endif - catch /^Vim\%((\a\+)\)\=:E37/ - call s:putCursorInTreeWin() - throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." - catch /^Vim\%((\a\+)\)\=:/ - echo v:exception - endtry - endif -endfunction - -"FUNCTION: Opener._restoreCursorPos(){{{3 -function! s:Opener._restoreCursorPos() - call s:exec('normal ' . self._tabnr . 'gt') - call s:exec(bufwinnr(self._bufnr) . 'wincmd w') -endfunction - -"FUNCTION: Opener._reuseWindow(){{{3 -"put the cursor in the first window we find for this file -" -"return 1 if we were successful -function! s:Opener._reuseWindow() - "check the current tab for the window - let winnr = bufwinnr('^' . self._path.str() . '$') - if winnr != -1 - call s:exec(winnr . "wincmd w") - call self._checkToCloseTree(0) - return 1 - else - "check other tabs - let tabnr = self._path.tabnr() - if tabnr - call self._checkToCloseTree(1) - call s:exec('normal! ' . tabnr . 'gt') - let winnr = bufwinnr('^' . self._path.str() . '$') - call s:exec(winnr . "wincmd w") - return 1 - endif - endif - return 0 -endfunction - -"FUNCTION: Opener._saveCursorPos(){{{3 -function! s:Opener._saveCursorPos() - let self._bufnr = bufnr("") - let self._tabnr = tabpagenr() -endfunction - -"CLASS: Path {{{2 -"============================================================ -let s:Path = {} -"FUNCTION: Path.AbsolutePathFor(str) {{{3 -function! s:Path.AbsolutePathFor(str) - let prependCWD = 0 - if s:running_windows - let prependCWD = a:str !~# '^.:\(\\\|\/\)' && a:str !~# '^\(\\\\\|\/\/\)' - else - let prependCWD = a:str !~# '^/' - endif - - let toReturn = a:str - if prependCWD - let toReturn = getcwd() . s:Path.Slash() . a:str - endif - - return toReturn -endfunction -"FUNCTION: Path.bookmarkNames() {{{3 -function! s:Path.bookmarkNames() - if !exists("self._bookmarkNames") - call self.cacheDisplayString() - endif - return self._bookmarkNames -endfunction -"FUNCTION: Path.cacheDisplayString() {{{3 -function! s:Path.cacheDisplayString() - let self.cachedDisplayString = self.getLastPathComponent(1) - - if self.isExecutable - let self.cachedDisplayString = self.cachedDisplayString . '*' - endif - - let self._bookmarkNames = [] - for i in s:Bookmark.Bookmarks() - if i.path.equals(self) - call add(self._bookmarkNames, i.name) - endif - endfor - if !empty(self._bookmarkNames) - let self.cachedDisplayString .= ' {' . join(self._bookmarkNames) . '}' - endif - - if self.isSymLink - let self.cachedDisplayString .= ' -> ' . self.symLinkDest - endif - - if self.isReadOnly - let self.cachedDisplayString .= ' [RO]' - endif -endfunction -"FUNCTION: Path.changeToDir() {{{3 -function! s:Path.changeToDir() - let dir = self.str({'format': 'Cd'}) - if self.isDirectory ==# 0 - let dir = self.getParent().str({'format': 'Cd'}) - endif - - try - execute "cd " . dir - call s:echo("CWD is now: " . getcwd()) - catch - throw "NERDTree.PathChangeError: cannot change CWD to " . dir - endtry -endfunction - -"FUNCTION: Path.compareTo() {{{3 -" -"Compares this Path to the given path and returns 0 if they are equal, -1 if -"this Path is "less than" the given path, or 1 if it is "greater". -" -"Args: -"path: the path object to compare this to -" -"Return: -"1, -1 or 0 -function! s:Path.compareTo(path) - let thisPath = self.getLastPathComponent(1) - let thatPath = a:path.getLastPathComponent(1) - - "if the paths are the same then clearly we return 0 - if thisPath ==# thatPath - return 0 - endif - - let thisSS = self.getSortOrderIndex() - let thatSS = a:path.getSortOrderIndex() - - "compare the sort sequences, if they are different then the return - "value is easy - if thisSS < thatSS - return -1 - elseif thisSS > thatSS - return 1 - else - "if the sort sequences are the same then compare the paths - "alphabetically - let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath limit - let toReturn = "<" . strpart(toReturn, len(toReturn) - limit + 1) - endif - endif - - return toReturn -endfunction - -"FUNCTION: Path._strForUI() {{{3 -function! s:Path._strForUI() - let toReturn = '/' . join(self.pathSegments, '/') - if self.isDirectory && toReturn != '/' - let toReturn = toReturn . '/' - endif - return toReturn -endfunction - -"FUNCTION: Path._strForCd() {{{3 -" -" returns a string that can be used with :cd -function! s:Path._strForCd() - return escape(self.str(), s:escape_chars) -endfunction -"FUNCTION: Path._strForEdit() {{{3 -" -"Return: the string for this path that is suitable to be used with the :edit -"command -function! s:Path._strForEdit() - let p = escape(self.str({'format': 'UI'}), s:escape_chars) - let cwd = getcwd() . s:Path.Slash() - - "return a relative path if we can - let isRelative = 0 - if s:running_windows - let isRelative = stridx(tolower(p), tolower(cwd)) == 0 - else - let isRelative = stridx(p, cwd) == 0 - endif - - if isRelative - let p = strpart(p, strlen(cwd)) - - "handle the edge case where the file begins with a + (vim interprets - "the +foo in `:e +foo` as an option to :edit) - if p[0] == "+" - let p = '\' . p - endif - endif - - if p ==# '' - let p = '.' - endif - - return p -endfunction -"FUNCTION: Path._strForGlob() {{{3 -function! s:Path._strForGlob() - let lead = s:Path.Slash() - - "if we are running windows then slap a drive letter on the front - if s:running_windows - let lead = self.drive . '\' - endif - - let toReturn = lead . join(self.pathSegments, s:Path.Slash()) - - if !s:running_windows - let toReturn = escape(toReturn, s:escape_chars) - endif - return toReturn -endfunction -"FUNCTION: Path._str() {{{3 -" -"Gets the string path for this path object that is appropriate for the OS. -"EG, in windows c:\foo\bar -" in *nix /foo/bar -function! s:Path._str() - let lead = s:Path.Slash() - - "if we are running windows then slap a drive letter on the front - if s:running_windows - let lead = self.drive . '\' - endif - - return lead . join(self.pathSegments, s:Path.Slash()) -endfunction - -"FUNCTION: Path.strTrunk() {{{3 -"Gets the path without the last segment on the end. -function! s:Path.strTrunk() - return self.drive . '/' . join(self.pathSegments[0:-2], '/') -endfunction - -" FUNCTION: Path.tabnr() {{{3 -" return the number of the first tab that is displaying this file -" -" return 0 if no tab was found -function! s:Path.tabnr() - let str = self.str() - for t in range(tabpagenr('$')) - for b in tabpagebuflist(t+1) - if str == expand('#' . b . ':p') - return t+1 - endif - endfor - endfor - return 0 -endfunction -"FUNCTION: Path.WinToUnixPath(pathstr){{{3 -"Takes in a windows path and returns the unix equiv -" -"A class level method -" -"Args: -"pathstr: the windows path to convert -function! s:Path.WinToUnixPath(pathstr) - if !s:running_windows - return a:pathstr - endif - - let toReturn = a:pathstr - - "remove the x:\ of the front - let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', "") - - "remove the \\ network share from the front - let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', "") - - "convert all \ chars to / - let toReturn = substitute(toReturn, '\', '/', "g") - - return toReturn -endfunction - -" SECTION: General Functions {{{1 -"============================================================ -"FUNCTION: s:bufInWindows(bnum){{{2 -"[[STOLEN FROM VTREEEXPLORER.VIM]] -"Determine the number of windows open to this buffer number. -"Care of Yegappan Lakshman. Thanks! -" -"Args: -"bnum: the subject buffers buffer number -function! s:bufInWindows(bnum) - let cnt = 0 - let winnum = 1 - while 1 - let bufnum = winbufnr(winnum) - if bufnum < 0 - break - endif - if bufnum ==# a:bnum - let cnt = cnt + 1 - endif - let winnum = winnum + 1 - endwhile - - return cnt -endfunction " >>> -"FUNCTION: s:checkForBrowse(dir) {{{2 -"inits a secondary nerd tree in the current buffer if appropriate -function! s:checkForBrowse(dir) - if a:dir != '' && isdirectory(a:dir) - call s:initNerdTreeInPlace(a:dir) - endif -endfunction -"FUNCTION: s:compareBookmarks(first, second) {{{2 -"Compares two bookmarks -function! s:compareBookmarks(first, second) - return a:first.compareTo(a:second) -endfunction - -" FUNCTION: s:completeBookmarks(A,L,P) {{{2 -" completion function for the bookmark commands -function! s:completeBookmarks(A,L,P) - return filter(s:Bookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') -endfunction -" FUNCTION: s:createDefaultBindings() {{{2 -function! s:createDefaultBindings() - let s = '' . s:SID() . '_' - - call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleMiddleMouse" }) - call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) - - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Bookmark", 'callback': s."openHSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Bookmark", 'callback': s."openVSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewNodeCurrent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Bookmark", 'callback': s."previewNodeVSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Bookmark", 'callback': s."previewNodeHSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': "all", 'callback': s."upDirCurrentRootClosed" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': "all", 'callback': s."upDirCurrentRootOpen" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': "Node", 'callback': s."chRoot" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" }) - -endfunction -" FUNCTION: s:deprecated(func, [msg]) {{{2 -" Issue a deprecation warning for a:func. If a second arg is given, use this -" as the deprecation message -function! s:deprecated(func, ...) - let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated' - - if !exists('s:deprecationWarnings') - let s:deprecationWarnings = {} - endif - if !has_key(s:deprecationWarnings, a:func) - let s:deprecationWarnings[a:func] = 1 - echomsg msg - endif -endfunction -" FUNCTION: s:exec(cmd) {{{2 -" same as :exec cmd but eventignore=all is set for the duration -function! s:exec(cmd) - let old_ei = &ei - set ei=all - exec a:cmd - let &ei = old_ei -endfunction -" FUNCTION: s:findAndRevealPath() {{{2 -function! s:findAndRevealPath() - try - let p = s:Path.New(expand("%:p")) - catch /^NERDTree.InvalidArgumentsError/ - call s:echo("no file for the current buffer") - return - endtry - - if !s:treeExistsForTab() - try - let cwd = s:Path.New(getcwd()) - catch /^NERDTree.InvalidArgumentsError/ - call s:echo("current directory does not exist.") - let cwd = p.getParent() - endtry - - if p.isUnder(cwd) - call s:initNerdTree(cwd.str()) - else - call s:initNerdTree(p.getParent().str()) - endif - else - if !p.isUnder(s:TreeFileNode.GetRootForTab().path) - call s:initNerdTree(p.getParent().str()) - else - if !s:isTreeOpen() - call s:toggle("") - endif - endif - endif - call s:putCursorInTreeWin() - call b:NERDTreeRoot.reveal(p) -endfunction - -" FUNCTION: s:has_opt(options, name) {{{2 -function! s:has_opt(options, name) - return has_key(a:options, a:name) && a:options[a:name] == 1 -endfunction - -"FUNCTION: s:initNerdTree(name) {{{2 -"Initialise the nerd tree for this tab. The tree will start in either the -"given directory, or the directory associated with the given bookmark -" -"Args: -"name: the name of a bookmark or a directory -function! s:initNerdTree(name) - let path = {} - if s:Bookmark.BookmarkExistsFor(a:name) - let path = s:Bookmark.BookmarkFor(a:name).path - else - let dir = a:name ==# '' ? getcwd() : a:name - - "hack to get an absolute path if a relative path is given - if dir =~# '^\.' - let dir = getcwd() . s:Path.Slash() . dir - endif - let dir = s:Path.Resolve(dir) - - try - let path = s:Path.New(dir) - catch /^NERDTree.InvalidArgumentsError/ - call s:echo("No bookmark or directory found for: " . a:name) - return - endtry - endif - if !path.isDirectory - let path = path.getParent() - endif - - "if instructed to, then change the vim CWD to the dir the NERDTree is - "inited in - if g:NERDTreeChDirMode != 0 - call path.changeToDir() - endif - - if s:treeExistsForTab() - if s:isTreeOpen() - call s:closeTree() - endif - unlet t:NERDTreeBufName - endif - - let newRoot = s:TreeDirNode.New(path) - call newRoot.open() - - call s:createTreeWin() - let b:treeShowHelp = 0 - let b:NERDTreeIgnoreEnabled = 1 - let b:NERDTreeShowFiles = g:NERDTreeShowFiles - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks - let b:NERDTreeRoot = newRoot - let b:NERDTreeType = "primary" - - call s:renderView() - call b:NERDTreeRoot.putCursorHere(0, 0) - - silent doautocmd User NERDTreeInit -endfunction - -"FUNCTION: s:initNerdTreeInPlace(dir) {{{2 -function! s:initNerdTreeInPlace(dir) - try - let path = s:Path.New(a:dir) - catch /^NERDTree.InvalidArgumentsError/ - call s:echo("Invalid directory name:" . a:name) - return - endtry - - "we want the directory buffer to disappear when we do the :edit below - setlocal bufhidden=wipe - - let previousBuf = expand("#") - - "we need a unique name for each secondary tree buffer to ensure they are - "all independent - exec "silent edit " . s:nextBufferName() - - let b:NERDTreePreviousBuf = bufnr(previousBuf) - - let b:NERDTreeRoot = s:TreeDirNode.New(path) - call b:NERDTreeRoot.open() - - call s:setCommonBufOptions() - let b:NERDTreeType = "secondary" - - call s:renderView() - - silent doautocmd User NERDTreeInit -endfunction -" FUNCTION: s:initNerdTreeMirror() {{{2 -function! s:initNerdTreeMirror() - - "get the names off all the nerd tree buffers - let treeBufNames = [] - for i in range(1, tabpagenr("$")) - let nextName = s:tabpagevar(i, 'NERDTreeBufName') - if nextName != -1 && (!exists("t:NERDTreeBufName") || nextName != t:NERDTreeBufName) - call add(treeBufNames, nextName) - endif - endfor - let treeBufNames = s:unique(treeBufNames) - - "map the option names (that the user will be prompted with) to the nerd - "tree buffer names - let options = {} - let i = 0 - while i < len(treeBufNames) - let bufName = treeBufNames[i] - let treeRoot = getbufvar(bufName, "NERDTreeRoot") - let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName - let i = i + 1 - endwhile - - "work out which tree to mirror, if there is more than 1 then ask the user - let bufferName = '' - if len(keys(options)) > 1 - let choices = ["Choose a tree to mirror"] - let choices = extend(choices, sort(keys(options))) - let choice = inputlist(choices) - if choice < 1 || choice > len(options) || choice ==# '' - return - endif - - let bufferName = options[sort(keys(options))[choice-1]] - elseif len(keys(options)) ==# 1 - let bufferName = values(options)[0] - else - call s:echo("No trees to mirror") - return - endif - - if s:treeExistsForTab() && s:isTreeOpen() - call s:closeTree() - endif - - let t:NERDTreeBufName = bufferName - call s:createTreeWin() - exec 'buffer ' . bufferName - if !&hidden - call s:renderView() - endif -endfunction -" FUNCTION: s:nextBufferName() {{{2 -" returns the buffer name for the next nerd tree -function! s:nextBufferName() - let name = s:NERDTreeBufName . s:next_buffer_number - let s:next_buffer_number += 1 - return name -endfunction -" FUNCTION: s:postSourceActions() {{{2 -function! s:postSourceActions() - call s:Bookmark.CacheBookmarks(0) - call s:createDefaultBindings() - - "load all nerdtree plugins - runtime! nerdtree_plugin/**/*.vim -endfunction -" FUNCTION: s:tabpagevar(tabnr, var) {{{2 -function! s:tabpagevar(tabnr, var) - let currentTab = tabpagenr() - let old_ei = &ei - set ei=all - - exec "tabnext " . a:tabnr - let v = -1 - if exists('t:' . a:var) - exec 'let v = t:' . a:var - endif - exec "tabnext " . currentTab - - let &ei = old_ei - - return v -endfunction -" Function: s:treeExistsForBuffer() {{{2 -" Returns 1 if a nerd tree root exists in the current buffer -function! s:treeExistsForBuf() - return exists("b:NERDTreeRoot") -endfunction -" Function: s:treeExistsForTab() {{{2 -" Returns 1 if a nerd tree root exists in the current tab -function! s:treeExistsForTab() - return exists("t:NERDTreeBufName") -endfunction -" Function: s:SID() {{{2 -function s:SID() - if !exists("s:sid") - let s:sid = matchstr(expand(''), '\zs\d\+\ze_SID$') - endif - return s:sid -endfun -"FUNCTION: s:upDir(keepState) {{{2 -"moves the tree up a level -" -"Args: -"keepState: 1 if the current root should be left open when the tree is -"re-rendered -function! s:upDir(keepState) - let cwd = b:NERDTreeRoot.path.str({'format': 'UI'}) - if cwd ==# "/" || cwd =~# '^[^/]..$' - call s:echo("already at top dir") - else - if !a:keepState - call b:NERDTreeRoot.close() - endif - - let oldRoot = b:NERDTreeRoot - - if empty(b:NERDTreeRoot.parent) - let path = b:NERDTreeRoot.path.getParent() - let newRoot = s:TreeDirNode.New(path) - call newRoot.open() - call newRoot.transplantChild(b:NERDTreeRoot) - let b:NERDTreeRoot = newRoot - else - let b:NERDTreeRoot = b:NERDTreeRoot.parent - endif - - if g:NERDTreeChDirMode ==# 2 - call b:NERDTreeRoot.path.changeToDir() - endif - - call s:renderView() - call oldRoot.putCursorHere(0, 0) - endif -endfunction -" Function: s:unique(list) {{{2 -" returns a:list without duplicates -function! s:unique(list) - let uniqlist = [] - for elem in a:list - if index(uniqlist, elem) ==# -1 - let uniqlist += [elem] - endif - endfor - return uniqlist -endfunction " SECTION: Public API {{{1 "============================================================ -let g:NERDTreePath = s:Path -let g:NERDTreeDirNode = s:TreeDirNode -let g:NERDTreeFileNode = s:TreeFileNode -let g:NERDTreeBookmark = s:Bookmark - function! NERDTreeAddMenuItem(options) - call s:MenuItem.Create(a:options) + call g:NERDTreeMenuItem.Create(a:options) endfunction function! NERDTreeAddMenuSeparator(...) let opts = a:0 ? a:1 : {} - call s:MenuItem.CreateSeparator(opts) + call g:NERDTreeMenuItem.CreateSeparator(opts) endfunction function! NERDTreeAddSubmenu(options) - return s:MenuItem.Create(a:options) + return g:NERDTreeMenuItem.Create(a:options) endfunction function! NERDTreeAddKeyMap(options) - call s:KeyMap.Create(a:options) + call g:NERDTreeKeyMap.Create(a:options) endfunction function! NERDTreeRender() - call s:renderView() + call nerdtree#renderView() endfunction function! NERDTreeFocus() - if s:isTreeOpen() - call s:putCursorInTreeWin() + if nerdtree#isTreeOpen() + call nerdtree#putCursorInTreeWin() else - call s:toggle("") + call g:NERDTreeCreator.TogglePrimary("") endif endfunction -" SECTION: View Functions {{{1 -"============================================================ -"FUNCTION: s:centerView() {{{2 -"centers the nerd tree window around the cursor (provided the nerd tree -"options permit) -function! s:centerView() - if g:NERDTreeAutoCenter - let current_line = winline() - let lines_to_top = current_line - let lines_to_bottom = winheight(s:getTreeWinNum()) - current_line - if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold - normal! zz - endif - endif +function! NERDTreeCWD() + call NERDTreeFocus() + call nerdtree#chRootCwd() endfunction -"FUNCTION: s:closeTree() {{{2 -"Closes the primary NERD tree window for this tab -function! s:closeTree() - if !s:isTreeOpen() - throw "NERDTree.NoTreeFoundError: no NERDTree is open" - endif - - if winnr("$") != 1 - if winnr() == s:getTreeWinNum() - call s:exec("wincmd p") - let bufnr = bufnr("") - call s:exec("wincmd p") - else - let bufnr = bufnr("") - endif - - call s:exec(s:getTreeWinNum() . " wincmd w") - close - call s:exec(bufwinnr(bufnr) . " wincmd w") - else - close - endif -endfunction - -"FUNCTION: s:closeTreeIfOpen() {{{2 -"Closes the NERD tree window if it is open -function! s:closeTreeIfOpen() - if s:isTreeOpen() - call s:closeTree() - endif -endfunction -"FUNCTION: s:closeTreeIfQuitOnOpen() {{{2 -"Closes the NERD tree window if the close on open option is set -function! s:closeTreeIfQuitOnOpen() - if g:NERDTreeQuitOnOpen && s:isTreeOpen() - call s:closeTree() - endif -endfunction -"FUNCTION: s:createTreeWin() {{{2 -"Inits the NERD tree window. ie. opens it, sizes it, sets all the local -"options etc -function! s:createTreeWin() - "create the nerd tree window - let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright " - let splitSize = g:NERDTreeWinSize - - if !exists('t:NERDTreeBufName') - let t:NERDTreeBufName = s:nextBufferName() - silent! exec splitLocation . 'vertical ' . splitSize . ' new' - silent! exec "edit " . t:NERDTreeBufName - else - silent! exec splitLocation . 'vertical ' . splitSize . ' split' - silent! exec "buffer " . t:NERDTreeBufName - endif - - setlocal winfixwidth - call s:setCommonBufOptions() -endfunction - -"FUNCTION: s:dumpHelp {{{2 -"prints out the quick help -function! s:dumpHelp() - let old_h = @h - if b:treeShowHelp ==# 1 - let @h= "\" NERD tree (" . s:NERD_tree_version . ") quickhelp~\n" - let @h=@h."\" ============================\n" - let @h=@h."\" File node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" - let @h=@h."\" ,\n" - if b:NERDTreeType ==# "primary" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n" - else - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n" - endif - if b:NERDTreeType ==# "primary" - let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n" - endif - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n" - let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n" - let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" - let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Directory node mappings~\n" - let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n" - let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" - let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n" - let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" - let @h=@h."\" current node recursively\n" - let @h=@h."\" middle-click,\n" - let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark table mappings~\n" - let @h=@h."\" double-click,\n" - let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree navigation mappings~\n" - let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n" - let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n" - let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" - let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" - let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" - let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Filesystem mappings~\n" - let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" - let @h=@h."\" selected dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" - let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" - let @h=@h."\" but leave old root open\n" - let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" - let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" - let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n" - let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n" - let @h=@h."\" selected dir\n" - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Tree filtering mappings~\n" - let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (b:NERDTreeShowHidden ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (b:NERDTreeIgnoreEnabled ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (b:NERDTreeShowFiles ? "on" : "off") . ")\n" - let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (b:NERDTreeShowBookmarks ? "on" : "off") . ")\n" - - "add quickhelp entries for each custom key map - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Custom mappings~\n" - for i in s:KeyMap.All() - if !empty(i.quickhelpText) - let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n" - endif - endfor - - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Other mappings~\n" - let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" - let @h=@h."\" the NERDTree window\n" - let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n" - let @h=@h."\"\n\" ----------------------------\n" - let @h=@h."\" Bookmark commands~\n" - let @h=@h."\" :Bookmark \n" - let @h=@h."\" :BookmarkToRoot \n" - let @h=@h."\" :RevealBookmark \n" - let @h=@h."\" :OpenBookmark \n" - let @h=@h."\" :ClearBookmarks []\n" - let @h=@h."\" :ClearAllBookmarks\n" - silent! put h - elseif g:NERDTreeMinimalUI == 0 - let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" - silent! put h - endif - - let @h = old_h -endfunction -"FUNCTION: s:echo {{{2 -"A wrapper for :echo. Appends 'NERDTree:' on the front of all messages -" -"Args: -"msg: the message to echo -function! s:echo(msg) - redraw - echomsg "NERDTree: " . a:msg -endfunction -"FUNCTION: s:echoWarning {{{2 -"Wrapper for s:echo, sets the message type to warningmsg for this message -"Args: -"msg: the message to echo -function! s:echoWarning(msg) - echohl warningmsg - call s:echo(a:msg) - echohl normal -endfunction -"FUNCTION: s:echoError {{{2 -"Wrapper for s:echo, sets the message type to errormsg for this message -"Args: -"msg: the message to echo -function! s:echoError(msg) - echohl errormsg - call s:echo(a:msg) - echohl normal -endfunction -"FUNCTION: s:firstUsableWindow(){{{2 -"find the window number of the first normal window -function! s:firstUsableWindow() - let i = 1 - while i <= winnr("$") - let bnum = winbufnr(i) - if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' - \ && !getwinvar(i, '&previewwindow') - \ && (!getbufvar(bnum, '&modified') || &hidden) - return i - endif - - let i += 1 - endwhile - return -1 -endfunction -"FUNCTION: s:getPath(ln) {{{2 -"Gets the full path to the node that is rendered on the given line number -" -"Args: -"ln: the line number to get the path for -" -"Return: -"A path if a node was selected, {} if nothing is selected. -"If the 'up a dir' line was selected then the path to the parent of the -"current root is returned -function! s:getPath(ln) - let line = getline(a:ln) - - let rootLine = s:TreeFileNode.GetRootLineNum() - - "check to see if we have the root node - if a:ln == rootLine - return b:NERDTreeRoot.path - endif - - if !g:NERDTreeDirArrows - " in case called from outside the tree - if line !~# '^ *[|`▸▾ ]' || line =~# '^$' - return {} - endif - endif - - if line ==# s:tree_up_dir_line - return b:NERDTreeRoot.path.getParent() - endif - - let indent = s:indentLevelFor(line) - - "remove the tree parts and the leading space - let curFile = s:stripMarkupFromLine(line, 0) - - let wasdir = 0 - if curFile =~# '/$' - let wasdir = 1 - let curFile = substitute(curFile, '/\?$', '/', "") - endif - - let dir = "" - let lnum = a:ln - while lnum > 0 - let lnum = lnum - 1 - let curLine = getline(lnum) - let curLineStripped = s:stripMarkupFromLine(curLine, 1) - - "have we reached the top of the tree? - if lnum == rootLine - let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir - break - endif - if curLineStripped =~# '/$' - let lpindent = s:indentLevelFor(curLine) - if lpindent < indent - let indent = indent - 1 - - let dir = substitute (curLineStripped,'^\\', "", "") . dir - continue - endif - endif - endwhile - let curFile = b:NERDTreeRoot.path.drive . dir . curFile - let toReturn = s:Path.New(curFile) - return toReturn -endfunction - -"FUNCTION: s:getTreeWinNum() {{{2 -"gets the nerd tree window number for this tab -function! s:getTreeWinNum() - if exists("t:NERDTreeBufName") - return bufwinnr(t:NERDTreeBufName) - else - return -1 - endif -endfunction -"FUNCTION: s:indentLevelFor(line) {{{2 -function! s:indentLevelFor(line) - let level = match(a:line, '[^ \-+~▸▾`|]') / s:tree_wid - " check if line includes arrows - if match(a:line, '[▸▾]') > -1 - " decrement level as arrow uses 3 ascii chars - let level = level - 1 - endif - return level -endfunction -"FUNCTION: s:isTreeOpen() {{{2 -function! s:isTreeOpen() - return s:getTreeWinNum() != -1 -endfunction -"FUNCTION: s:isWindowUsable(winnumber) {{{2 -"Returns 0 if opening a file from the tree in the given window requires it to -"be split, 1 otherwise -" -"Args: -"winnumber: the number of the window in question -function! s:isWindowUsable(winnumber) - "gotta split if theres only one window (i.e. the NERD tree) - if winnr("$") ==# 1 - return 0 - endif - - let oldwinnr = winnr() - call s:exec(a:winnumber . "wincmd p") - let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') - let modified = &modified - call s:exec(oldwinnr . "wincmd p") - - "if its a special window e.g. quickfix or another explorer plugin then we - "have to split - if specialWindow - return 0 - endif - - if &hidden - return 1 - endif - - return !modified || s:bufInWindows(winbufnr(a:winnumber)) >= 2 -endfunction - -" FUNCTION: s:jumpToChild(direction) {{{2 -" Args: -" direction: 0 if going to first child, 1 if going to last -function! s:jumpToChild(currentNode, direction) - if a:currentNode.isRoot() - return s:echo("cannot jump to " . (a:direction ? "last" : "first") . " child") - end - let dirNode = a:currentNode.parent - let childNodes = dirNode.getVisibleChildren() - - let targetNode = childNodes[0] - if a:direction - let targetNode = childNodes[len(childNodes) - 1] - endif - - if targetNode.equals(a:currentNode) - let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction) - if siblingDir != {} - let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0 - let targetNode = siblingDir.getChildByIndex(indx, 1) - endif - endif - - call targetNode.putCursorHere(1, 0) - - call s:centerView() -endfunction - - -" FUNCTION: s:jumpToSibling(currentNode, forward) {{{2 -" moves the cursor to the sibling of the current node in the given direction -" -" Args: -" forward: 1 if the cursor should move to the next sibling, 0 if it should -" move back to the previous sibling -function! s:jumpToSibling(currentNode, forward) - let sibling = a:currentNode.findSibling(a:forward) - - if !empty(sibling) - call sibling.putCursorHere(1, 0) - call s:centerView() - endif -endfunction - -"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{2 -"prints out the given msg and, if the user responds by pushing 'y' then the -"buffer with the given bufnum is deleted -" -"Args: -"bufnum: the buffer that may be deleted -"msg: a message that will be echoed to the user asking them if they wish to -" del the buffer -function! s:promptToDelBuffer(bufnum, msg) - echo a:msg - if nr2char(getchar()) ==# 'y' - exec "silent bdelete! " . a:bufnum - endif -endfunction - -"FUNCTION: s:putCursorOnBookmarkTable(){{{2 -"Places the cursor at the top of the bookmarks table -function! s:putCursorOnBookmarkTable() - if !b:NERDTreeShowBookmarks - throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active" - endif - - if g:NERDTreeMinimalUI - return cursor(1, 2) - endif - - let rootNodeLine = s:TreeFileNode.GetRootLineNum() - - let line = 1 - while getline(line) !~# '^>-\+Bookmarks-\+$' - let line = line + 1 - if line >= rootNodeLine - throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table" - endif - endwhile - call cursor(line, 2) -endfunction - -"FUNCTION: s:putCursorInTreeWin(){{{2 -"Places the cursor in the nerd tree window -function! s:putCursorInTreeWin() - if !s:isTreeOpen() - throw "NERDTree.InvalidOperationError: cant put cursor in NERD tree window, no window exists" - endif - - call s:exec(s:getTreeWinNum() . "wincmd w") -endfunction - -"FUNCTION: s:renderBookmarks {{{2 -function! s:renderBookmarks() - - if g:NERDTreeMinimalUI == 0 - call setline(line(".")+1, ">----------Bookmarks----------") - call cursor(line(".")+1, col(".")) - endif - - for i in s:Bookmark.Bookmarks() - call setline(line(".")+1, i.str()) - call cursor(line(".")+1, col(".")) - endfor - - call setline(line(".")+1, '') - call cursor(line(".")+1, col(".")) -endfunction -"FUNCTION: s:renderView {{{2 -"The entry function for rendering the tree -function! s:renderView() - setlocal modifiable - - "remember the top line of the buffer and the current line so we can - "restore the view exactly how it was - let curLine = line(".") - let curCol = col(".") - let topLine = line("w0") - - "delete all lines in the buffer (being careful not to clobber a register) - silent 1,$delete _ - - call s:dumpHelp() - - "delete the blank line before the help and add one after it - if g:NERDTreeMinimalUI == 0 - call setline(line(".")+1, "") - call cursor(line(".")+1, col(".")) - endif - - if b:NERDTreeShowBookmarks - call s:renderBookmarks() - endif - - "add the 'up a dir' line - if !g:NERDTreeMinimalUI - call setline(line(".")+1, s:tree_up_dir_line) - call cursor(line(".")+1, col(".")) - endif - - "draw the header line - let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) - call setline(line(".")+1, header) - call cursor(line(".")+1, col(".")) - - "draw the tree - let old_o = @o - let @o = b:NERDTreeRoot.renderToString() - silent put o - let @o = old_o - - "delete the blank line at the top of the buffer - silent 1,1delete _ - - "restore the view - let old_scrolloff=&scrolloff - let &scrolloff=0 - call cursor(topLine, 1) - normal! zt - call cursor(curLine, curCol) - let &scrolloff = old_scrolloff - - setlocal nomodifiable -endfunction - -"FUNCTION: s:renderViewSavingPosition {{{2 -"Renders the tree and ensures the cursor stays on the current node or the -"current nodes parent if it is no longer available upon re-rendering -function! s:renderViewSavingPosition() - let currentNode = s:TreeFileNode.GetSelected() - - "go up the tree till we find a node that will be visible or till we run - "out of nodes - while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot() - let currentNode = currentNode.parent - endwhile - - call s:renderView() - - if currentNode != {} - call currentNode.putCursorHere(0, 0) - endif -endfunction -"FUNCTION: s:restoreScreenState() {{{2 -" -"Sets the screen state back to what it was when s:saveScreenState was last -"called. -" -"Assumes the cursor is in the NERDTree window -function! s:restoreScreenState() - if !exists("b:NERDTreeOldTopLine") || !exists("b:NERDTreeOldPos") || !exists("b:NERDTreeOldWindowSize") - return - endif - exec("silent vertical resize ".b:NERDTreeOldWindowSize) - - let old_scrolloff=&scrolloff - let &scrolloff=0 - call cursor(b:NERDTreeOldTopLine, 0) - normal! zt - call setpos(".", b:NERDTreeOldPos) - let &scrolloff=old_scrolloff -endfunction - -"FUNCTION: s:saveScreenState() {{{2 -"Saves the current cursor position in the current buffer and the window -"scroll position -function! s:saveScreenState() - let win = winnr() - try - call s:putCursorInTreeWin() - let b:NERDTreeOldPos = getpos(".") - let b:NERDTreeOldTopLine = line("w0") - let b:NERDTreeOldWindowSize = winwidth("") - call s:exec(win . "wincmd w") - catch /^NERDTree.InvalidOperationError/ - endtry -endfunction - -"FUNCTION: s:setCommonBufOptions() {{{2 -function! s:setCommonBufOptions() - "throwaway buffer options - setlocal noswapfile - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal nowrap - setlocal foldcolumn=0 - setlocal foldmethod=manual - setlocal nofoldenable - setlocal nobuflisted - setlocal nospell - if g:NERDTreeShowLineNumbers - setlocal nu - else - setlocal nonu - if v:version >= 703 - setlocal nornu - endif - endif - - iabc - - if g:NERDTreeHighlightCursorline - setlocal cursorline - endif - - call s:setupStatusline() - - - let b:treeShowHelp = 0 - let b:NERDTreeIgnoreEnabled = 1 - let b:NERDTreeShowFiles = g:NERDTreeShowFiles - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks - setfiletype nerdtree - call s:bindMappings() -endfunction - -"FUNCTION: s:setupStatusline() {{{2 -function! s:setupStatusline() - if g:NERDTreeStatusline != -1 - let &l:statusline = g:NERDTreeStatusline - endif -endfunction -"FUNCTION: s:stripMarkupFromLine(line, removeLeadingSpaces){{{2 -"returns the given line with all the tree parts stripped off -" -"Args: -"line: the subject line -"removeLeadingSpaces: 1 if leading spaces are to be removed (leading spaces = -"any spaces before the actual text of the node) -function! s:stripMarkupFromLine(line, removeLeadingSpaces) - let line = a:line - "remove the tree parts and the leading space - let line = substitute (line, s:tree_markup_reg,"","") - - "strip off any read only flag - let line = substitute (line, ' \[RO\]', "","") - - "strip off any bookmark flags - let line = substitute (line, ' {[^}]*}', "","") - - "strip off any executable flags - let line = substitute (line, '*\ze\($\| \)', "","") - - let wasdir = 0 - if line =~# '/$' - let wasdir = 1 - endif - let line = substitute (line,' -> .*',"","") " remove link to - if wasdir ==# 1 - let line = substitute (line, '/\?$', '/', "") - endif - - if a:removeLeadingSpaces - let line = substitute (line, '^ *', '', '') - endif - - return line -endfunction - -"FUNCTION: s:toggle(dir) {{{2 -"Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is -"closed it is restored or initialized (if it doesnt exist) -" -"Args: -"dir: the full path for the root node (is only used if the NERD tree is being -"initialized. -function! s:toggle(dir) - if s:treeExistsForTab() - if !s:isTreeOpen() - call s:createTreeWin() - if !&hidden - call s:renderView() - endif - call s:restoreScreenState() - else - call s:closeTree() - endif - else - call s:initNerdTree(a:dir) - endif -endfunction -"SECTION: Interface bindings {{{1 -"============================================================ - -"FUNCTION: s:activateAll() {{{2 -"handle the user activating the updir line -function! s:activateAll() - if getline(".") ==# s:tree_up_dir_line - return s:upDir(0) - endif -endfunction - -"FUNCTION: s:activateDirNode() {{{2 -"handle the user activating a tree node -function! s:activateDirNode(node) - call a:node.activate({'reuse': 1}) -endfunction - -"FUNCTION: s:activateFileNode() {{{2 -"handle the user activating a tree node -function! s:activateFileNode(node) - call a:node.activate({'reuse': 1, 'where': 'p'}) -endfunction - -"FUNCTION: s:activateBookmark() {{{2 -"handle the user activating a bookmark -function! s:activateBookmark(bm) - call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {}) -endfunction - -"FUNCTION: s:bindMappings() {{{2 -function! s:bindMappings() - "make do the same as the default 'o' mapping - exec "nnoremap :call KeyMap_Invoke('". g:NERDTreeMapActivateNode ."')" - - call s:KeyMap.BindAll() - - command! -buffer -nargs=? Bookmark :call bookmarkNode('') - command! -buffer -complete=customlist,s:completeBookmarks -nargs=1 RevealBookmark :call revealBookmark('') - command! -buffer -complete=customlist,s:completeBookmarks -nargs=1 OpenBookmark :call openBookmark('') - command! -buffer -complete=customlist,s:completeBookmarks -nargs=* ClearBookmarks call clearBookmarks('') - command! -buffer -complete=customlist,s:completeBookmarks -nargs=+ BookmarkToRoot call s:Bookmark.ToRoot('') - command! -buffer -nargs=0 ClearAllBookmarks call s:Bookmark.ClearAll() call renderView() - command! -buffer -nargs=0 ReadBookmarks call s:Bookmark.CacheBookmarks(0) call renderView() - command! -buffer -nargs=0 WriteBookmarks call s:Bookmark.Write() -endfunction - -" FUNCTION: s:bookmarkNode(name) {{{2 -" Associate the current node with the given name -function! s:bookmarkNode(...) - let currentNode = s:TreeFileNode.GetSelected() - if currentNode != {} - let name = a:1 - if empty(name) - let name = currentNode.path.getLastPathComponent(0) - endif - try - call currentNode.bookmark(name) - call s:renderView() - catch /^NERDTree.IllegalBookmarkNameError/ - call s:echo("bookmark names must not contain spaces") - endtry - else - call s:echo("select a node first") - endif -endfunction - -" FUNCTION: s:chCwd(node) {{{2 -function! s:chCwd(node) - try - call a:node.path.changeToDir() - catch /^NERDTree.PathChangeError/ - call s:echoWarning("could not change cwd") - endtry -endfunction - -" FUNCTION: s:chRoot(node) {{{2 -" changes the current root to the selected one -function! s:chRoot(node) - call a:node.makeRoot() - call s:renderView() - call b:NERDTreeRoot.putCursorHere(0, 0) -endfunction - -" FUNCTION: s:clearBookmarks(bookmarks) {{{2 -function! s:clearBookmarks(bookmarks) - if a:bookmarks ==# '' - let currentNode = s:TreeFileNode.GetSelected() - if currentNode != {} - call currentNode.clearBookmarks() - endif - else - for name in split(a:bookmarks, ' ') - let bookmark = s:Bookmark.BookmarkFor(name) - call bookmark.delete() - endfor - endif - call s:renderView() -endfunction -" FUNCTION: s:closeChildren(node) {{{2 -" closes all childnodes of the current node -function! s:closeChildren(node) - call a:node.closeChildren() - call s:renderView() - call a:node.putCursorHere(0, 0) -endfunction -" FUNCTION: s:closeCurrentDir(node) {{{2 -" closes the parent dir of the current node -function! s:closeCurrentDir(node) - let parent = a:node.parent - if parent ==# {} || parent.isRoot() - call s:echo("cannot close tree root") - else - call a:node.parent.close() - call s:renderView() - call a:node.parent.putCursorHere(0, 0) - endif -endfunction -" FUNCTION: s:closeTreeWindow() {{{2 -" close the tree window -function! s:closeTreeWindow() - if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1 - exec "buffer " . b:NERDTreePreviousBuf - else - if winnr("$") > 1 - call s:closeTree() - else - call s:echo("Cannot close last window") - endif - endif -endfunction -" FUNCTION: s:deleteBookmark(bm) {{{2 -" if the cursor is on a bookmark, prompt to delete -function! s:deleteBookmark(bm) - echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):" - - if nr2char(getchar()) ==# 'y' - try - call a:bm.delete() - call s:renderView() - redraw - catch /^NERDTree/ - call s:echoWarning("Could not remove bookmark") - endtry - else - call s:echo("delete aborted" ) - endif - -endfunction - -" FUNCTION: s:displayHelp() {{{2 -" toggles the help display -function! s:displayHelp() - let b:treeShowHelp = b:treeShowHelp ? 0 : 1 - call s:renderView() - call s:centerView() -endfunction - -"FUNCTION: s:handleLeftClick() {{{2 -"Checks if the click should open the current node -function! s:handleLeftClick() - let currentNode = s:TreeFileNode.GetSelected() - if currentNode != {} - - "the dir arrows are multibyte chars, and vim's string functions only - "deal with single bytes - so split the line up with the hack below and - "take the line substring manually - let line = split(getline(line(".")), '\zs') - let startToCur = "" - for i in range(0,virtcol(".")-1) - let startToCur .= line[i] - endfor - - if currentNode.path.isDirectory - if startToCur =~# s:tree_markup_reg && startToCur =~# '[+~▾▸] \?$' - call currentNode.activate() - return - endif - endif - - if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3 - let char = strpart(startToCur, strlen(startToCur)-1, 1) - if char !~# s:tree_markup_reg - if currentNode.path.isDirectory - call currentNode.activate() - else - call currentNode.activate({'reuse': 1, 'where': 'p'}) - endif - return - endif - endif - endif -endfunction - -" FUNCTION: s:handleMiddleMouse() {{{2 -function! s:handleMiddleMouse() - let curNode = s:TreeFileNode.GetSelected() - if curNode ==# {} - call s:echo("Put the cursor on a node first" ) - return - endif - - if curNode.path.isDirectory - call s:openExplorer(curNode) - else - call curNode.open({'where': 'h'}) - endif -endfunction - -" FUNCTION: s:jumpToFirstChild() {{{2 -" wrapper for the jump to child method -function! s:jumpToFirstChild(node) - call s:jumpToChild(a:node, 0) -endfunction - -" FUNCTION: s:jumpToLastChild() {{{2 -" wrapper for the jump to child method -function! s:jumpToLastChild(node) - call s:jumpToChild(a:node, 1) -endfunction - -" FUNCTION: s:jumpToParent(node) {{{2 -" moves the cursor to the parent of the current node -function! s:jumpToParent(node) - if !empty(a:node.parent) - call a:node.parent.putCursorHere(1, 0) - call s:centerView() - else - call s:echo("cannot jump to parent") - endif -endfunction - -" FUNCTION: s:jumpToRoot() {{{2 -" moves the cursor to the root node -function! s:jumpToRoot() - call b:NERDTreeRoot.putCursorHere(1, 0) - call s:centerView() -endfunction - -" FUNCTION: s:jumpToNextSibling(node) {{{2 -function! s:jumpToNextSibling(node) - call s:jumpToSibling(a:node, 1) -endfunction - -" FUNCTION: s:jumpToPrevSibling(node) {{{2 -function! s:jumpToPrevSibling(node) - call s:jumpToSibling(a:node, 0) -endfunction - -" FUNCTION: s:openBookmark(name) {{{2 -" put the cursor on the given bookmark and, if its a file, open it -function! s:openBookmark(name) - try - let targetNode = s:Bookmark.GetNodeForName(a:name, 0) - call targetNode.putCursorHere(0, 1) - redraw! - catch /^NERDTree.BookmarkedNodeNotFoundError/ - call s:echo("note - target node is not cached") - let bookmark = s:Bookmark.BookmarkFor(a:name) - let targetNode = s:TreeFileNode.New(bookmark.path) - endtry - if targetNode.path.isDirectory - call targetNode.openExplorer() - else - call targetNode.open({'where': 'p'}) - endif -endfunction - -" FUNCTION: s:openHSplit(target) {{{2 -function! s:openHSplit(target) - call a:target.activate({'where': 'h'}) -endfunction - -" FUNCTION: s:openVSplit(target) {{{2 -function! s:openVSplit(target) - call a:target.activate({'where': 'v'}) -endfunction - -" FUNCTION: s:openExplorer(node) {{{2 -function! s:openExplorer(node) - call a:node.openExplorer() -endfunction - -" FUNCTION: s:openInNewTab(target) {{{2 -function! s:openInNewTab(target) - call a:target.activate({'where': 't'}) -endfunction - -" FUNCTION: s:openInNewTabSilent(target) {{{2 -function! s:openInNewTabSilent(target) - call a:target.activate({'where': 't', 'stay': 1}) -endfunction - -" FUNCTION: s:openNodeRecursively(node) {{{2 -function! s:openNodeRecursively(node) - call s:echo("Recursively opening node. Please wait...") - call a:node.openRecursively() - call s:renderView() - redraw - call s:echo("Recursively opening node. Please wait... DONE") -endfunction - -"FUNCTION: s:previewNodeCurrent(node) {{{2 -function! s:previewNodeCurrent(node) - call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) -endfunction - -"FUNCTION: s:previewNodeHSplit(node) {{{2 -function! s:previewNodeHSplit(node) - call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) -endfunction - -"FUNCTION: s:previewNodeVSplit(node) {{{2 -function! s:previewNodeVSplit(node) - call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) -endfunction - -" FUNCTION: s:revealBookmark(name) {{{2 -" put the cursor on the node associate with the given name -function! s:revealBookmark(name) - try - let targetNode = s:Bookmark.GetNodeForName(a:name, 0) - call targetNode.putCursorHere(0, 1) - catch /^NERDTree.BookmarkNotFoundError/ - call s:echo("Bookmark isnt cached under the current root") - endtry -endfunction -" FUNCTION: s:refreshRoot() {{{2 -" Reloads the current root. All nodes below this will be lost and the root dir -" will be reloaded. -function! s:refreshRoot() - call s:echo("Refreshing the root node. This could take a while...") - call b:NERDTreeRoot.refresh() - call s:renderView() - redraw - call s:echo("Refreshing the root node. This could take a while... DONE") -endfunction - -" FUNCTION: s:refreshCurrent(node) {{{2 -" refreshes the root for the current node -function! s:refreshCurrent(node) - let node = a:node - if !node.path.isDirectory - let node = node.parent - endif - - call s:echo("Refreshing node. This could take a while...") - call node.refresh() - call s:renderView() - redraw - call s:echo("Refreshing node. This could take a while... DONE") -endfunction -" FUNCTION: s:showMenu(node) {{{2 -function! s:showMenu(node) - let mc = s:MenuController.New(s:MenuItem.AllEnabled()) - call mc.showMenu() -endfunction - -" FUNCTION: s:toggleIgnoreFilter() {{{2 -" toggles the use of the NERDTreeIgnore option -function! s:toggleIgnoreFilter() - let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled - call s:renderViewSavingPosition() - call s:centerView() -endfunction - -" FUNCTION: s:toggleShowBookmarks() {{{2 -" toggles the display of bookmarks -function! s:toggleShowBookmarks() - let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks - if b:NERDTreeShowBookmarks - call s:renderView() - call s:putCursorOnBookmarkTable() - else - call s:renderViewSavingPosition() - endif - call s:centerView() -endfunction -" FUNCTION: s:toggleShowFiles() {{{2 -" toggles the display of hidden files -function! s:toggleShowFiles() - let b:NERDTreeShowFiles = !b:NERDTreeShowFiles - call s:renderViewSavingPosition() - call s:centerView() -endfunction - -" FUNCTION: s:toggleShowHidden() {{{2 -" toggles the display of hidden files -function! s:toggleShowHidden() - let b:NERDTreeShowHidden = !b:NERDTreeShowHidden - call s:renderViewSavingPosition() - call s:centerView() -endfunction - -" FUNCTION: s:toggleZoom() {{{2 -" zoom (maximize/minimize) the NERDTree window -function! s:toggleZoom() - if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed - let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - exec "silent vertical resize ". size - let b:NERDTreeZoomed = 0 - else - exec "vertical resize" - let b:NERDTreeZoomed = 1 - endif -endfunction - -" FUNCTION: s:upDirCurrentRootOpen() {{{2 -function! s:upDirCurrentRootOpen() - call s:upDir(1) -endfunction - -" FUNCTION: s:upDirCurrentRootClosed() {{{2 -function! s:upDirCurrentRootClosed() - call s:upDir(0) -endfunction - " SECTION: Post Source Actions {{{1 -call s:postSourceActions() +call nerdtree#postSourceActions() "reset &cpo back to users setting let &cpo = s:old_cpo diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/plugin/nerdtree/bookmark.vim new file mode 100644 index 00000000..0d37b478 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/bookmark.vim @@ -0,0 +1,315 @@ +"CLASS: Bookmark +"============================================================ +let s:Bookmark = {} +let g:NERDTreeBookmark = s:Bookmark + +" FUNCTION: Bookmark.activate() {{{1 +function! s:Bookmark.activate(...) + call self.open(a:0 ? a:1 : {}) +endfunction + +" FUNCTION: Bookmark.AddBookmark(name, path) {{{1 +" Class method to add a new bookmark to the list, if a previous bookmark exists +" with the same name, just update the path for that bookmark +function! s:Bookmark.AddBookmark(name, path) + for i in s:Bookmark.Bookmarks() + if i.name ==# a:name + let i.path = a:path + return + endif + endfor + call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path)) + call s:Bookmark.Sort() +endfunction + +" FUNCTION: Bookmark.Bookmarks() {{{1 +" Class method to get all bookmarks. Lazily initializes the bookmarks global +" variable +function! s:Bookmark.Bookmarks() + if !exists("g:NERDTreeBookmarks") + let g:NERDTreeBookmarks = [] + endif + return g:NERDTreeBookmarks +endfunction + +" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1 +" class method that returns 1 if a bookmark with the given name is found, 0 +" otherwise +function! s:Bookmark.BookmarkExistsFor(name) + try + call s:Bookmark.BookmarkFor(a:name) + return 1 + catch /^NERDTree.BookmarkNotFoundError/ + return 0 + endtry +endfunction + +" FUNCTION: Bookmark.BookmarkFor(name) {{{1 +" Class method to get the bookmark that has the given name. {} is return if no +" bookmark is found +function! s:Bookmark.BookmarkFor(name) + for i in s:Bookmark.Bookmarks() + if i.name ==# a:name + return i + endif + endfor + throw "NERDTree.BookmarkNotFoundError: no bookmark found for name: \"". a:name .'"' +endfunction + +" FUNCTION: Bookmark.BookmarkNames() {{{1 +" Class method to return an array of all bookmark names +function! s:Bookmark.BookmarkNames() + let names = [] + for i in s:Bookmark.Bookmarks() + call add(names, i.name) + endfor + return names +endfunction + +" FUNCTION: Bookmark.CacheBookmarks(silent) {{{1 +" Class method to read all bookmarks from the bookmarks file intialize +" bookmark objects for each one. +" +" Args: +" silent - dont echo an error msg if invalid bookmarks are found +function! s:Bookmark.CacheBookmarks(silent) + if filereadable(g:NERDTreeBookmarksFile) + let g:NERDTreeBookmarks = [] + let g:NERDTreeInvalidBookmarks = [] + let bookmarkStrings = readfile(g:NERDTreeBookmarksFile) + let invalidBookmarksFound = 0 + for i in bookmarkStrings + + "ignore blank lines + if i != '' + + let name = substitute(i, '^\(.\{-}\) .*$', '\1', '') + let path = substitute(i, '^.\{-} \(.*\)$', '\1', '') + + try + let bookmark = s:Bookmark.New(name, g:NERDTreePath.New(path)) + call add(g:NERDTreeBookmarks, bookmark) + catch /^NERDTree.InvalidArgumentsError/ + call add(g:NERDTreeInvalidBookmarks, i) + let invalidBookmarksFound += 1 + endtry + endif + endfor + if invalidBookmarksFound + call s:Bookmark.Write() + if !a:silent + call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.") + endif + endif + call s:Bookmark.Sort() + endif +endfunction + +" FUNCTION: Bookmark.compareTo(otherbookmark) {{{1 +" Compare these two bookmarks for sorting purposes +function! s:Bookmark.compareTo(otherbookmark) + return a:otherbookmark.name < self.name +endfunction +" FUNCTION: Bookmark.ClearAll() {{{1 +" Class method to delete all bookmarks. +function! s:Bookmark.ClearAll() + for i in s:Bookmark.Bookmarks() + call i.delete() + endfor + call s:Bookmark.Write() +endfunction + +" FUNCTION: Bookmark.delete() {{{1 +" Delete this bookmark. If the node for this bookmark is under the current +" root, then recache bookmarks for its Path object +function! s:Bookmark.delete() + let node = {} + try + let node = self.getNode(1) + catch /^NERDTree.BookmarkedNodeNotFoundError/ + endtry + call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self)) + if !empty(node) + call node.path.cacheDisplayString() + endif + call s:Bookmark.Write() +endfunction + +" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{1 +" Gets the treenode for this bookmark +" +" Args: +" searchFromAbsoluteRoot: specifies whether we should search from the current +" tree root, or the highest cached node +function! s:Bookmark.getNode(searchFromAbsoluteRoot) + let searchRoot = a:searchFromAbsoluteRoot ? g:NERDTreeDirNode.AbsoluteTreeRoot() : b:NERDTreeRoot + let targetNode = searchRoot.findNode(self.path) + if empty(targetNode) + throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name + endif + return targetNode +endfunction + +" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{1 +" Class method that finds the bookmark with the given name and returns the +" treenode for it. +function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) + let bookmark = s:Bookmark.BookmarkFor(a:name) + return bookmark.getNode(a:searchFromAbsoluteRoot) +endfunction + +" FUNCTION: Bookmark.GetSelected() {{{1 +" returns the Bookmark the cursor is over, or {} +function! s:Bookmark.GetSelected() + let line = getline(".") + let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '') + if name != line + try + return s:Bookmark.BookmarkFor(name) + catch /^NERDTree.BookmarkNotFoundError/ + return {} + endtry + endif + return {} +endfunction + +" FUNCTION: Bookmark.InvalidBookmarks() {{{1 +" Class method to get all invalid bookmark strings read from the bookmarks +" file +function! s:Bookmark.InvalidBookmarks() + if !exists("g:NERDTreeInvalidBookmarks") + let g:NERDTreeInvalidBookmarks = [] + endif + return g:NERDTreeInvalidBookmarks +endfunction + +" FUNCTION: Bookmark.mustExist() {{{1 +function! s:Bookmark.mustExist() + if !self.path.exists() + call s:Bookmark.CacheBookmarks(1) + throw "NERDTree.BookmarkPointsToInvalidLocationError: the bookmark \"". + \ self.name ."\" points to a non existing location: \"". self.path.str() + endif +endfunction + +" FUNCTION: Bookmark.New(name, path) {{{1 +" Create a new bookmark object with the given name and path object +function! s:Bookmark.New(name, path) + if a:name =~# ' ' + throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name + endif + + let newBookmark = copy(self) + let newBookmark.name = a:name + let newBookmark.path = a:path + return newBookmark +endfunction + +" FUNCTION: Bookmark.open([options]) {{{1 +"Args: +"A dictionary containing the following keys (all optional): +" 'where': Specifies whether the node should be opened in new split/tab or in +" the previous window. Can be either 'v' (vertical split), 'h' +" (horizontal split), 't' (new tab) or 'p' (previous window). +" 'reuse': if a window is displaying the file then jump the cursor there +" 'keepopen': dont close the tree window +" 'stay': open the file, but keep the cursor in the tree win +" +function! s:Bookmark.open(...) + let opts = a:0 ? a:1 : {} + + if self.path.isDirectory && !has_key(opts, 'where') + call self.toRoot() + else + let opener = g:NERDTreeOpener.New(self.path, opts) + call opener.open(self) + endif +endfunction + +" FUNCTION: Bookmark.openInNewTab(options) {{{1 +" Create a new bookmark object with the given name and path object +function! s:Bookmark.openInNewTab(options) + call nerdtree#deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead') + call self.open(a:options) +endfunction + +" FUNCTION: Bookmark.setPath(path) {{{1 +" makes this bookmark point to the given path +function! s:Bookmark.setPath(path) + let self.path = a:path +endfunction + +" FUNCTION: Bookmark.Sort() {{{1 +" Class method that sorts all bookmarks +function! s:Bookmark.Sort() + let CompareFunc = function("nerdtree#compareBookmarks") + call sort(s:Bookmark.Bookmarks(), CompareFunc) +endfunction + +" FUNCTION: Bookmark.str() {{{1 +" Get the string that should be rendered in the view for this bookmark +function! s:Bookmark.str() + let pathStrMaxLen = winwidth(nerdtree#getTreeWinNum()) - 4 - len(self.name) + if &nu + let pathStrMaxLen = pathStrMaxLen - &numberwidth + endif + + let pathStr = self.path.str({'format': 'UI'}) + if len(pathStr) > pathStrMaxLen + let pathStr = '<' . strpart(pathStr, len(pathStr) - pathStrMaxLen) + endif + return '>' . self.name . ' ' . pathStr +endfunction + +" FUNCTION: Bookmark.toRoot() {{{1 +" Make the node for this bookmark the new tree root +function! s:Bookmark.toRoot() + if self.validate() + try + let targetNode = self.getNode(1) + catch /^NERDTree.BookmarkedNodeNotFoundError/ + let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path) + endtry + call targetNode.makeRoot() + call nerdtree#renderView() + call targetNode.putCursorHere(0, 0) + endif +endfunction + +" FUNCTION: Bookmark.ToRoot(name) {{{1 +" Make the node for this bookmark the new tree root +function! s:Bookmark.ToRoot(name) + let bookmark = s:Bookmark.BookmarkFor(a:name) + call bookmark.toRoot() +endfunction + +" FUNCTION: Bookmark.validate() {{{1 +function! s:Bookmark.validate() + if self.path.exists() + return 1 + else + call s:Bookmark.CacheBookmarks(1) + call nerdtree#renderView() + call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.") + return 0 + endif +endfunction + +" FUNCTION: Bookmark.Write() {{{1 +" Class method to write all bookmarks to the bookmarks file +function! s:Bookmark.Write() + let bookmarkStrings = [] + for i in s:Bookmark.Bookmarks() + call add(bookmarkStrings, i.name . ' ' . i.path.str()) + endfor + + "add a blank line before the invalid ones + call add(bookmarkStrings, "") + + for j in s:Bookmark.InvalidBookmarks() + call add(bookmarkStrings, j) + endfor + call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/creator.vim b/sources_non_forked/nerdtree/plugin/nerdtree/creator.vim new file mode 100644 index 00000000..7f0721f0 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/creator.vim @@ -0,0 +1,322 @@ +"CLASS: Creator +"Creates primary/secondary/mirror nerdtree windows. Sets up all the window and +"buffer options and key mappings etc. +"============================================================ +let s:Creator = {} +let g:NERDTreeCreator = s:Creator + +"FUNCTION: s:Creator._bindMappings() {{{1 +function! s:Creator._bindMappings() + "make do the same as the default 'o' mapping + exec "nnoremap :call nerdtree#invokeKeyMap('". g:NERDTreeMapActivateNode ."')" + + call g:NERDTreeKeyMap.BindAll() + + command! -buffer -nargs=? Bookmark :call nerdtree#bookmarkNode('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#revealBookmark('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#openBookmark('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#clearBookmarks('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('') + command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() call nerdtree#renderView() + command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) call nerdtree#renderView() + command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write() +endfunction + +"FUNCTION: s:Creator._broadcastInitEvent() {{{1 +function! s:Creator._broadcastInitEvent() + silent doautocmd User NERDTreeInit +endfunction + +" FUNCTION: s:Creator.BufNamePrefix() {{{2 +function! s:Creator.BufNamePrefix() + return 'NERD_tree_' +endfunction + +"FUNCTION: s:Creator.CreatePrimary(a:name) {{{1 +function! s:Creator.CreatePrimary(name) + let creator = s:Creator.New() + call creator.createPrimary(a:name) +endfunction + +"FUNCTION: s:Creator.createPrimary(a:name) {{{1 +"name: the name of a bookmark or a directory +function! s:Creator.createPrimary(name) + let path = self._pathForString(a:name) + + "if instructed to, then change the vim CWD to the dir the NERDTree is + "inited in + if g:NERDTreeChDirMode != 0 + call path.changeToDir() + endif + + if nerdtree#treeExistsForTab() + if nerdtree#isTreeOpen() + call nerdtree#closeTree() + endif + unlet t:NERDTreeBufName + endif + + let newRoot = g:NERDTreeDirNode.New(path) + call newRoot.open() + + call self._createTreeWin() + let b:treeShowHelp = 0 + let b:NERDTreeIgnoreEnabled = 1 + let b:NERDTreeShowFiles = g:NERDTreeShowFiles + let b:NERDTreeShowHidden = g:NERDTreeShowHidden + let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks + let b:NERDTreeRoot = newRoot + let b:NERDTreeType = "primary" + + call nerdtree#renderView() + call b:NERDTreeRoot.putCursorHere(0, 0) + + call self._broadcastInitEvent() +endfunction + +"FUNCTION: s:Creator.CreateSecondary(dir) {{{1 +function! s:Creator.CreateSecondary(dir) + let creator = s:Creator.New() + call creator.createSecondary(a:dir) +endfunction + +"FUNCTION: s:Creator.createSecondary(dir) {{{1 +function! s:Creator.createSecondary(dir) + try + let path = g:NERDTreePath.New(a:dir) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("Invalid directory name:" . a:name) + return + endtry + + "we want the directory buffer to disappear when we do the :edit below + setlocal bufhidden=wipe + + let previousBuf = expand("#") + + "we need a unique name for each secondary tree buffer to ensure they are + "all independent + exec "silent edit " . self._nextBufferName() + + let b:NERDTreePreviousBuf = bufnr(previousBuf) + + let b:NERDTreeRoot = g:NERDTreeDirNode.New(path) + call b:NERDTreeRoot.open() + + call self._setCommonBufOptions() + let b:NERDTreeType = "secondary" + + call nerdtree#renderView() + + call self._broadcastInitEvent() +endfunction + +" FUNCTION: s:Creator.CreateMirror() {{{1 +function! s:Creator.CreateMirror() + let creator = s:Creator.New() + call creator.createMirror() +endfunction + +" FUNCTION: s:Creator.createMirror() {{{1 +function! s:Creator.createMirror() + "get the names off all the nerd tree buffers + let treeBufNames = [] + for i in range(1, tabpagenr("$")) + let nextName = nerdtree#tabpagevar(i, 'NERDTreeBufName') + if nextName != -1 && (!exists("t:NERDTreeBufName") || nextName != t:NERDTreeBufName) + call add(treeBufNames, nextName) + endif + endfor + let treeBufNames = nerdtree#unique(treeBufNames) + + "map the option names (that the user will be prompted with) to the nerd + "tree buffer names + let options = {} + let i = 0 + while i < len(treeBufNames) + let bufName = treeBufNames[i] + let treeRoot = getbufvar(bufName, "NERDTreeRoot") + let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName + let i = i + 1 + endwhile + + "work out which tree to mirror, if there is more than 1 then ask the user + let bufferName = '' + if len(keys(options)) > 1 + let choices = ["Choose a tree to mirror"] + let choices = extend(choices, sort(keys(options))) + let choice = inputlist(choices) + if choice < 1 || choice > len(options) || choice ==# '' + return + endif + + let bufferName = options[sort(keys(options))[choice-1]] + elseif len(keys(options)) ==# 1 + let bufferName = values(options)[0] + else + call nerdtree#echo("No trees to mirror") + return + endif + + if nerdtree#treeExistsForTab() && nerdtree#isTreeOpen() + call nerdtree#closeTree() + endif + + let t:NERDTreeBufName = bufferName + call self._createTreeWin() + exec 'buffer ' . bufferName + if !&hidden + call nerdtree#renderView() + endif +endfunction + +"FUNCTION: s:Creator._createTreeWin() {{{1 +"Inits the NERD tree window. ie. opens it, sizes it, sets all the local +"options etc +function! s:Creator._createTreeWin() + "create the nerd tree window + let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright " + let splitSize = g:NERDTreeWinSize + + if !exists('t:NERDTreeBufName') + let t:NERDTreeBufName = self._nextBufferName() + silent! exec splitLocation . 'vertical ' . splitSize . ' new' + silent! exec "edit " . t:NERDTreeBufName + else + silent! exec splitLocation . 'vertical ' . splitSize . ' split' + silent! exec "buffer " . t:NERDTreeBufName + endif + + setlocal winfixwidth + call self._setCommonBufOptions() +endfunction + +"FUNCTION: s:Creator.New() {{{1 +function! s:Creator.New() + let newCreator = copy(self) + return newCreator +endfunction + +" FUNCTION: s:Creator._nextBufferName() {{{2 +" returns the buffer name for the next nerd tree +function! s:Creator._nextBufferName() + let name = s:Creator.BufNamePrefix() . self._nextBufferNumber() + return name +endfunction + +" FUNCTION: s:Creator._nextBufferNumber() {{{2 +" the number to add to the nerd tree buffer name to make the buf name unique +function! s:Creator._nextBufferNumber() + if !exists("s:Creator._NextBufNum") + let s:Creator._NextBufNum = 1 + else + let s:Creator._NextBufNum += 1 + endif + + return s:Creator._NextBufNum +endfunction + +"FUNCTION: s:Creator._pathForString(str) {{{1 +"find a bookmark or adirectory for the given string +function! s:Creator._pathForString(str) + let path = {} + if g:NERDTreeBookmark.BookmarkExistsFor(a:str) + let path = g:NERDTreeBookmark.BookmarkFor(a:str).path + else + let dir = a:str ==# '' ? getcwd() : a:str + + "hack to get an absolute path if a relative path is given + if dir =~# '^\.' + let dir = getcwd() . g:NERDTreePath.Slash() . dir + endif + let dir = g:NERDTreePath.Resolve(dir) + + try + let path = g:NERDTreePath.New(dir) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("No bookmark or directory found for: " . a:str) + return + endtry + endif + if !path.isDirectory + let path = path.getParent() + endif + + return path +endfunction + +"FUNCTION: s:Creator._setCommonBufOptions() {{{1 +function! s:Creator._setCommonBufOptions() + "throwaway buffer options + setlocal noswapfile + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal nowrap + setlocal foldcolumn=0 + setlocal foldmethod=manual + setlocal nofoldenable + setlocal nobuflisted + setlocal nospell + if g:NERDTreeShowLineNumbers + setlocal nu + else + setlocal nonu + if v:version >= 703 + setlocal nornu + endif + endif + + iabc + + if g:NERDTreeHighlightCursorline + setlocal cursorline + endif + + call self._setupStatusline() + + let b:treeShowHelp = 0 + let b:NERDTreeIgnoreEnabled = 1 + let b:NERDTreeShowFiles = g:NERDTreeShowFiles + let b:NERDTreeShowHidden = g:NERDTreeShowHidden + let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks + setfiletype nerdtree + call self._bindMappings() +endfunction + +"FUNCTION: s:Creator._setupStatusline() {{{1 +function! s:Creator._setupStatusline() + if g:NERDTreeStatusline != -1 + let &l:statusline = g:NERDTreeStatusline + endif +endfunction + +"FUNCTION: s:Creator.TogglePrimary(dir) {{{1 +function! s:Creator.TogglePrimary(dir) + let creator = s:Creator.New() + call creator.togglePrimary(a:dir) +endfunction + +"FUNCTION: s:Creator.togglePrimary(dir) {{{1 +"Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is +"closed it is restored or initialized (if it doesnt exist) +" +"Args: +"dir: the full path for the root node (is only used if the NERD tree is being +"initialized. +function! s:Creator.togglePrimary(dir) + if nerdtree#treeExistsForTab() + if !nerdtree#isTreeOpen() + call self._createTreeWin() + if !&hidden + call nerdtree#renderView() + endif + call nerdtree#restoreScreenState() + else + call nerdtree#closeTree() + endif + else + call self.createPrimary(a:dir) + endif +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/key_map.vim b/sources_non_forked/nerdtree/plugin/nerdtree/key_map.vim new file mode 100644 index 00000000..86457652 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/key_map.vim @@ -0,0 +1,143 @@ +"CLASS: KeyMap +"============================================================ +let s:KeyMap = {} +let g:NERDTreeKeyMap = s:KeyMap + +"FUNCTION: KeyMap.All() {{{1 +function! s:KeyMap.All() + if !exists("s:keyMaps") + let s:keyMaps = [] + endif + return s:keyMaps +endfunction + +"FUNCTION: KeyMap.FindFor(key, scope) {{{1 +function! s:KeyMap.FindFor(key, scope) + for i in s:KeyMap.All() + if i.key ==# a:key && i.scope ==# a:scope + return i + endif + endfor + return {} +endfunction + +"FUNCTION: KeyMap.BindAll() {{{1 +function! s:KeyMap.BindAll() + for i in s:KeyMap.All() + call i.bind() + endfor +endfunction + +"FUNCTION: KeyMap.bind() {{{1 +function! s:KeyMap.bind() + " If the key sequence we're trying to map contains any '<>' notation, we + " must replace each of the '<' characters with '' to ensure the string + " is not translated into its corresponding keycode during the later part + " of the map command below + " :he <> + let specialNotationRegex = '\m<\([[:alnum:]_-]\+>\)' + if self.key =~# specialNotationRegex + let keymapInvokeString = substitute(self.key, specialNotationRegex, '\1', 'g') + else + let keymapInvokeString = self.key + endif + + let premap = self.key == "" ? " " : " " + + exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' +endfunction + +"FUNCTION: KeyMap.Remove(key, scope) {{{1 +function! s:KeyMap.Remove(key, scope) + let maps = s:KeyMap.All() + for i in range(len(maps)) + if maps[i].key ==# a:key && maps[i].scope ==# a:scope + return remove(maps, i) + endif + endfor +endfunction + +"FUNCTION: KeyMap.invoke() {{{1 +"Call the KeyMaps callback function +function! s:KeyMap.invoke(...) + let Callback = function(self.callback) + if a:0 + call Callback(a:1) + else + call Callback() + endif +endfunction + +"FUNCTION: KeyMap.Invoke() {{{1 +"Find a keymapping for a:key and the current scope invoke it. +" +"Scope is determined as follows: +" * if the cursor is on a dir node then "DirNode" +" * if the cursor is on a file node then "FileNode" +" * if the cursor is on a bookmark then "Bookmark" +" +"If a keymap has the scope of "all" then it will be called if no other keymap +"is found for a:key and the scope. +function! s:KeyMap.Invoke(key) + let node = g:NERDTreeFileNode.GetSelected() + if !empty(node) + + "try file node + if !node.path.isDirectory + let km = s:KeyMap.FindFor(a:key, "FileNode") + if !empty(km) + return km.invoke(node) + endif + endif + + "try dir node + if node.path.isDirectory + let km = s:KeyMap.FindFor(a:key, "DirNode") + if !empty(km) + return km.invoke(node) + endif + endif + + "try generic node + let km = s:KeyMap.FindFor(a:key, "Node") + if !empty(km) + return km.invoke(node) + endif + + endif + + "try bookmark + let bm = g:NERDTreeBookmark.GetSelected() + if !empty(bm) + let km = s:KeyMap.FindFor(a:key, "Bookmark") + if !empty(km) + return km.invoke(bm) + endif + endif + + "try all + let km = s:KeyMap.FindFor(a:key, "all") + if !empty(km) + return km.invoke() + endif +endfunction + +"FUNCTION: KeyMap.Create(options) {{{1 +function! s:KeyMap.Create(options) + let newKeyMap = copy(self) + let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options)) + let newKeyMap.key = opts['key'] + let newKeyMap.quickhelpText = opts['quickhelpText'] + let newKeyMap.callback = opts['callback'] + let newKeyMap.scope = opts['scope'] + + call s:KeyMap.Add(newKeyMap) +endfunction + +"FUNCTION: KeyMap.Add(keymap) {{{1 +function! s:KeyMap.Add(keymap) + call s:KeyMap.Remove(a:keymap.key, a:keymap.scope) + call add(s:KeyMap.All(), a:keymap) +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/menu_controller.vim b/sources_non_forked/nerdtree/plugin/nerdtree/menu_controller.vim new file mode 100644 index 00000000..ae0ee848 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/menu_controller.vim @@ -0,0 +1,180 @@ +"CLASS: MenuController +"============================================================ +let s:MenuController = {} +let g:NERDTreeMenuController = s:MenuController + +"FUNCTION: MenuController.New(menuItems) {{{1 +"create a new menu controller that operates on the given menu items +function! s:MenuController.New(menuItems) + let newMenuController = copy(self) + if a:menuItems[0].isSeparator() + let newMenuController.menuItems = a:menuItems[1:-1] + else + let newMenuController.menuItems = a:menuItems + endif + return newMenuController +endfunction + +"FUNCTION: MenuController.showMenu() {{{1 +"start the main loop of the menu and get the user to choose/execute a menu +"item +function! s:MenuController.showMenu() + call self._saveOptions() + + try + let self.selection = 0 + + let done = 0 + while !done + redraw! + call self._echoPrompt() + let key = nr2char(getchar()) + let done = self._handleKeypress(key) + endwhile + finally + call self._restoreOptions() + endtry + + if self.selection != -1 + let m = self._current() + call m.execute() + endif +endfunction + +"FUNCTION: MenuController._echoPrompt() {{{1 +function! s:MenuController._echoPrompt() + echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated" + echo "==========================================================" + + for i in range(0, len(self.menuItems)-1) + if self.selection == i + echo "> " . self.menuItems[i].text + else + echo " " . self.menuItems[i].text + endif + endfor +endfunction + +"FUNCTION: MenuController._current(key) {{{1 +"get the MenuItem that is currently selected +function! s:MenuController._current() + return self.menuItems[self.selection] +endfunction + +"FUNCTION: MenuController._handleKeypress(key) {{{1 +"change the selection (if appropriate) and return 1 if the user has made +"their choice, 0 otherwise +function! s:MenuController._handleKeypress(key) + if a:key == 'j' + call self._cursorDown() + elseif a:key == 'k' + call self._cursorUp() + elseif a:key == nr2char(27) "escape + let self.selection = -1 + return 1 + elseif a:key == "\r" || a:key == "\n" "enter and ctrl-j + return 1 + else + let index = self._nextIndexFor(a:key) + if index != -1 + let self.selection = index + if len(self._allIndexesFor(a:key)) == 1 + return 1 + endif + endif + endif + + return 0 +endfunction + +"FUNCTION: MenuController._allIndexesFor(shortcut) {{{1 +"get indexes to all menu items with the given shortcut +function! s:MenuController._allIndexesFor(shortcut) + let toReturn = [] + + for i in range(0, len(self.menuItems)-1) + if self.menuItems[i].shortcut == a:shortcut + call add(toReturn, i) + endif + endfor + + return toReturn +endfunction + +"FUNCTION: MenuController._nextIndexFor(shortcut) {{{1 +"get the index to the next menu item with the given shortcut, starts from the +"current cursor location and wraps around to the top again if need be +function! s:MenuController._nextIndexFor(shortcut) + for i in range(self.selection+1, len(self.menuItems)-1) + if self.menuItems[i].shortcut == a:shortcut + return i + endif + endfor + + for i in range(0, self.selection) + if self.menuItems[i].shortcut == a:shortcut + return i + endif + endfor + + return -1 +endfunction + +"FUNCTION: MenuController._setCmdheight() {{{1 +"sets &cmdheight to whatever is needed to display the menu +function! s:MenuController._setCmdheight() + let &cmdheight = len(self.menuItems) + 3 +endfunction + +"FUNCTION: MenuController._saveOptions() {{{1 +"set any vim options that are required to make the menu work (saving their old +"values) +function! s:MenuController._saveOptions() + let self._oldLazyredraw = &lazyredraw + let self._oldCmdheight = &cmdheight + set nolazyredraw + call self._setCmdheight() +endfunction + +"FUNCTION: MenuController._restoreOptions() {{{1 +"restore the options we saved in _saveOptions() +function! s:MenuController._restoreOptions() + let &cmdheight = self._oldCmdheight + let &lazyredraw = self._oldLazyredraw +endfunction + +"FUNCTION: MenuController._cursorDown() {{{1 +"move the cursor to the next menu item, skipping separators +function! s:MenuController._cursorDown() + let done = 0 + while !done + if self.selection < len(self.menuItems)-1 + let self.selection += 1 + else + let self.selection = 0 + endif + + if !self._current().isSeparator() + let done = 1 + endif + endwhile +endfunction + +"FUNCTION: MenuController._cursorUp() {{{1 +"move the cursor to the previous menu item, skipping separators +function! s:MenuController._cursorUp() + let done = 0 + while !done + if self.selection > 0 + let self.selection -= 1 + else + let self.selection = len(self.menuItems)-1 + endif + + if !self._current().isSeparator() + let done = 1 + endif + endwhile +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/plugin/nerdtree/menu_item.vim new file mode 100644 index 00000000..6fb9d9e3 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/menu_item.vim @@ -0,0 +1,114 @@ +"CLASS: MenuItem +"============================================================ +let s:MenuItem = {} +let g:NERDTreeMenuItem = s:MenuItem + +"FUNCTION: MenuItem.All() {{{1 +"get all top level menu items +function! s:MenuItem.All() + if !exists("s:menuItems") + let s:menuItems = [] + endif + return s:menuItems +endfunction + +"FUNCTION: MenuItem.AllEnabled() {{{1 +"get all top level menu items that are currently enabled +function! s:MenuItem.AllEnabled() + let toReturn = [] + for i in s:MenuItem.All() + if i.enabled() + call add(toReturn, i) + endif + endfor + return toReturn +endfunction + +"FUNCTION: MenuItem.Create(options) {{{1 +"make a new menu item and add it to the global list +function! s:MenuItem.Create(options) + let newMenuItem = copy(self) + + let newMenuItem.text = a:options['text'] + let newMenuItem.shortcut = a:options['shortcut'] + let newMenuItem.children = [] + + let newMenuItem.isActiveCallback = -1 + if has_key(a:options, 'isActiveCallback') + let newMenuItem.isActiveCallback = a:options['isActiveCallback'] + endif + + let newMenuItem.callback = -1 + if has_key(a:options, 'callback') + let newMenuItem.callback = a:options['callback'] + endif + + if has_key(a:options, 'parent') + call add(a:options['parent'].children, newMenuItem) + else + call add(s:MenuItem.All(), newMenuItem) + endif + + return newMenuItem +endfunction + +"FUNCTION: MenuItem.CreateSeparator(options) {{{1 +"make a new separator menu item and add it to the global list +function! s:MenuItem.CreateSeparator(options) + let standard_options = { 'text': '--------------------', + \ 'shortcut': -1, + \ 'callback': -1 } + let options = extend(a:options, standard_options, "force") + + return s:MenuItem.Create(options) +endfunction + +"FUNCTION: MenuItem.CreateSubmenu(options) {{{1 +"make a new submenu and add it to global list +function! s:MenuItem.CreateSubmenu(options) + let standard_options = { 'callback': -1 } + let options = extend(a:options, standard_options, "force") + + return s:MenuItem.Create(options) +endfunction + +"FUNCTION: MenuItem.enabled() {{{1 +"return 1 if this menu item should be displayed +" +"delegates off to the isActiveCallback, and defaults to 1 if no callback was +"specified +function! s:MenuItem.enabled() + if self.isActiveCallback != -1 + return {self.isActiveCallback}() + endif + return 1 +endfunction + +"FUNCTION: MenuItem.execute() {{{1 +"perform the action behind this menu item, if this menuitem has children then +"display a new menu for them, otherwise deletegate off to the menuitem's +"callback +function! s:MenuItem.execute() + if len(self.children) + let mc = s:MenuController.New(self.children) + call mc.showMenu() + else + if self.callback != -1 + call {self.callback}() + endif + endif +endfunction + +"FUNCTION: MenuItem.isSeparator() {{{1 +"return 1 if this menuitem is a separator +function! s:MenuItem.isSeparator() + return self.callback == -1 && self.children == [] +endfunction + +"FUNCTION: MenuItem.isSubmenu() {{{1 +"return 1 if this menuitem is a submenu +function! s:MenuItem.isSubmenu() + return self.callback == -1 && !empty(self.children) +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/opener.vim b/sources_non_forked/nerdtree/plugin/nerdtree/opener.vim new file mode 100644 index 00000000..bcc0d4fc --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/opener.vim @@ -0,0 +1,264 @@ +"CLASS: Opener +"============================================================ +let s:Opener = {} +let g:NERDTreeOpener = s:Opener + +"FUNCTION: Opener._checkToCloseTree(newtab) {{{1 +"Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see +"if the tree should be closed now. +" +"Args: +"a:newtab - boolean. If set, only close the tree now if we are opening the +"target in a new tab. This is needed because we have to close tree before we +"leave the tab +function! s:Opener._checkToCloseTree(newtab) + if self._keepopen + return + endif + + if (a:newtab && self._where == 't') || !a:newtab + call nerdtree#closeTreeIfQuitOnOpen() + endif +endfunction + +"FUNCTION: Opener._gotoTargetWin() {{{1 +function! s:Opener._gotoTargetWin() + if b:NERDTreeType ==# "secondary" + if self._where == 'v' + vsplit + elseif self._where == 'h' + split + elseif self._where == 't' + tabnew + endif + else + call self._checkToCloseTree(1) + + if self._where == 'v' + call self._newVSplit() + elseif self._where == 'h' + call self._newSplit() + elseif self._where == 't' + tabnew + elseif self._where == 'p' + call self._previousWindow() + endif + + call self._checkToCloseTree(0) + endif +endfunction + +"FUNCTION: Opener.New(path, opts) {{{1 +"Args: +" +"a:path: The path object that is to be opened. +" +"a:opts: +" +"A dictionary containing the following keys (all optional): +" 'where': Specifies whether the node should be opened in new split/tab or in +" the previous window. Can be either 'v' or 'h' or 't' (for open in +" new tab) +" 'reuse': if a window is displaying the file then jump the cursor there +" 'keepopen': dont close the tree window +" 'stay': open the file, but keep the cursor in the tree win +function! s:Opener.New(path, opts) + let newObj = copy(self) + + let newObj._path = a:path + let newObj._stay = nerdtree#has_opt(a:opts, 'stay') + let newObj._reuse = nerdtree#has_opt(a:opts, 'reuse') + let newObj._keepopen = nerdtree#has_opt(a:opts, 'keepopen') + let newObj._where = has_key(a:opts, 'where') ? a:opts['where'] : '' + let newObj._treetype = b:NERDTreeType + call newObj._saveCursorPos() + + return newObj +endfunction + +"FUNCTION: Opener._newSplit() {{{1 +function! s:Opener._newSplit() + " Save the user's settings for splitbelow and splitright + let savesplitbelow=&splitbelow + let savesplitright=&splitright + + " 'there' will be set to a command to move from the split window + " back to the explorer window + " + " 'back' will be set to a command to move from the explorer window + " back to the newly split window + " + " 'right' and 'below' will be set to the settings needed for + " splitbelow and splitright IF the explorer is the only window. + " + let there= g:NERDTreeWinPos ==# "left" ? "wincmd h" : "wincmd l" + let back = g:NERDTreeWinPos ==# "left" ? "wincmd l" : "wincmd h" + let right= g:NERDTreeWinPos ==# "left" + let below=0 + + " Attempt to go to adjacent window + call nerdtree#exec(back) + + let onlyOneWin = (winnr("$") ==# 1) + + " If no adjacent window, set splitright and splitbelow appropriately + if onlyOneWin + let &splitright=right + let &splitbelow=below + else + " found adjacent window - invert split direction + let &splitright=!right + let &splitbelow=!below + endif + + let splitMode = onlyOneWin ? "vertical" : "" + + " Open the new window + try + exec(splitMode." sp ") + catch /^Vim\%((\a\+)\)\=:E37/ + call nerdtree#putCursorInTreeWin() + throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." + catch /^Vim\%((\a\+)\)\=:/ + "do nothing + endtry + + "resize the tree window if no other window was open before + if onlyOneWin + let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize + call nerdtree#exec(there) + exec("silent ". splitMode ." resize ". size) + call nerdtree#exec('wincmd p') + endif + + " Restore splitmode settings + let &splitbelow=savesplitbelow + let &splitright=savesplitright +endfunction + +"FUNCTION: Opener._newVSplit() {{{1 +function! s:Opener._newVSplit() + let winwidth = winwidth(".") + if winnr("$")==#1 + let winwidth = g:NERDTreeWinSize + endif + + call nerdtree#exec("wincmd p") + vnew + + "resize the nerd tree back to the original size + call nerdtree#putCursorInTreeWin() + exec("silent vertical resize ". winwidth) + call nerdtree#exec('wincmd p') +endfunction + +"FUNCTION: Opener.open(target) {{{1 +function! s:Opener.open(target) + if self._path.isDirectory + call self._openDirectory(a:target) + else + call self._openFile() + endif +endfunction + +"FUNCTION: Opener._openFile() {{{1 +function! s:Opener._openFile() + if self._reuse && self._reuseWindow() + return + endif + + call self._gotoTargetWin() + + if self._treetype ==# "secondary" + call self._path.edit() + else + call self._path.edit() + + + if self._stay + call self._restoreCursorPos() + endif + endif +endfunction + +"FUNCTION: Opener._openDirectory(node) {{{1 +function! s:Opener._openDirectory(node) + if self._treetype ==# "secondary" + call self._gotoTargetWin() + call g:NERDTreeCreator.CreateSecondary(a:node.path.str()) + else + call self._gotoTargetWin() + if empty(self._where) + call a:node.makeRoot() + call nerdtree#renderView() + call a:node.putCursorHere(0, 0) + elseif self._where == 't' + call g:NERDTreeCreator.CreatePrimary(a:node.path.str()) + else + call g:NERDTreeCreator.CreateSecondary(a:node.path.str()) + endif + endif + + if self._stay + call self._restoreCursorPos() + endif +endfunction + +"FUNCTION: Opener._previousWindow() {{{1 +function! s:Opener._previousWindow() + if !nerdtree#isWindowUsable(winnr("#")) && nerdtree#firstUsableWindow() ==# -1 + call self._newSplit() + else + try + if !nerdtree#isWindowUsable(winnr("#")) + call nerdtree#exec(nerdtree#firstUsableWindow() . "wincmd w") + else + call nerdtree#exec('wincmd p') + endif + catch /^Vim\%((\a\+)\)\=:E37/ + call nerdtree#putCursorInTreeWin() + throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." + catch /^Vim\%((\a\+)\)\=:/ + echo v:exception + endtry + endif +endfunction + +"FUNCTION: Opener._restoreCursorPos(){{{1 +function! s:Opener._restoreCursorPos() + call nerdtree#exec('normal ' . self._tabnr . 'gt') + call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w') +endfunction + +"FUNCTION: Opener._reuseWindow(){{{1 +"put the cursor in the first window we find for this file +" +"return 1 if we were successful +function! s:Opener._reuseWindow() + "check the current tab for the window + let winnr = bufwinnr('^' . self._path.str() . '$') + if winnr != -1 + call nerdtree#exec(winnr . "wincmd w") + call self._checkToCloseTree(0) + return 1 + else + "check other tabs + let tabnr = self._path.tabnr() + if tabnr + call self._checkToCloseTree(1) + call nerdtree#exec('normal! ' . tabnr . 'gt') + let winnr = bufwinnr('^' . self._path.str() . '$') + call nerdtree#exec(winnr . "wincmd w") + return 1 + endif + endif + return 0 +endfunction + +"FUNCTION: Opener._saveCursorPos(){{{1 +function! s:Opener._saveCursorPos() + let self._bufnr = bufnr("") + let self._tabnr = tabpagenr() +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/path.vim b/sources_non_forked/nerdtree/plugin/nerdtree/path.vim new file mode 100644 index 00000000..58bb0138 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/path.vim @@ -0,0 +1,724 @@ +"we need to use this number many times for sorting... so we calculate it only +"once here +let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*') + +"CLASS: Path +"============================================================ +let s:Path = {} +let g:NERDTreePath = s:Path + +"FUNCTION: Path.AbsolutePathFor(str) {{{1 +function! s:Path.AbsolutePathFor(str) + let prependCWD = 0 + if nerdtree#runningWindows() + let prependCWD = a:str !~# '^.:\(\\\|\/\)' && a:str !~# '^\(\\\\\|\/\/\)' + else + let prependCWD = a:str !~# '^/' + endif + + let toReturn = a:str + if prependCWD + let toReturn = getcwd() . s:Path.Slash() . a:str + endif + + return toReturn +endfunction + +"FUNCTION: Path.bookmarkNames() {{{1 +function! s:Path.bookmarkNames() + if !exists("self._bookmarkNames") + call self.cacheDisplayString() + endif + return self._bookmarkNames +endfunction + +"FUNCTION: Path.cacheDisplayString() {{{1 +function! s:Path.cacheDisplayString() + let self.cachedDisplayString = self.getLastPathComponent(1) + + if self.isExecutable + let self.cachedDisplayString = self.cachedDisplayString . '*' + endif + + let self._bookmarkNames = [] + for i in g:NERDTreeBookmark.Bookmarks() + if i.path.equals(self) + call add(self._bookmarkNames, i.name) + endif + endfor + if !empty(self._bookmarkNames) + let self.cachedDisplayString .= ' {' . join(self._bookmarkNames) . '}' + endif + + if self.isSymLink + let self.cachedDisplayString .= ' -> ' . self.symLinkDest + endif + + if self.isReadOnly + let self.cachedDisplayString .= ' [RO]' + endif +endfunction + +"FUNCTION: Path.changeToDir() {{{1 +function! s:Path.changeToDir() + let dir = self.str({'format': 'Cd'}) + if self.isDirectory ==# 0 + let dir = self.getParent().str({'format': 'Cd'}) + endif + + try + execute "cd " . dir + call nerdtree#echo("CWD is now: " . getcwd()) + catch + throw "NERDTree.PathChangeError: cannot change CWD to " . dir + endtry +endfunction + +"FUNCTION: Path.compareTo() {{{1 +" +"Compares this Path to the given path and returns 0 if they are equal, -1 if +"this Path is "less than" the given path, or 1 if it is "greater". +" +"Args: +"path: the path object to compare this to +" +"Return: +"1, -1 or 0 +function! s:Path.compareTo(path) + let thisPath = self.getLastPathComponent(1) + let thatPath = a:path.getLastPathComponent(1) + + "if the paths are the same then clearly we return 0 + if thisPath ==# thatPath + return 0 + endif + + let thisSS = self.getSortOrderIndex() + let thatSS = a:path.getSortOrderIndex() + + "compare the sort sequences, if they are different then the return + "value is easy + if thisSS < thatSS + return -1 + elseif thisSS > thatSS + return 1 + else + "if the sort sequences are the same then compare the paths + "alphabetically + let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath limit + let toReturn = "<" . strpart(toReturn, len(toReturn) - limit + 1) + endif + endif + + return toReturn +endfunction + +"FUNCTION: Path._strForUI() {{{1 +function! s:Path._strForUI() + let toReturn = '/' . join(self.pathSegments, '/') + if self.isDirectory && toReturn != '/' + let toReturn = toReturn . '/' + endif + return toReturn +endfunction + +"FUNCTION: Path._strForCd() {{{1 +" +" returns a string that can be used with :cd +function! s:Path._strForCd() + return escape(self.str(), nerdtree#escChars()) +endfunction + +"FUNCTION: Path._strForEdit() {{{1 +" +"Return: the string for this path that is suitable to be used with the :edit +"command +function! s:Path._strForEdit() + let p = escape(self.str({'format': 'UI'}), nerdtree#escChars()) + let cwd = getcwd() . s:Path.Slash() + + "return a relative path if we can + let isRelative = 0 + if nerdtree#runningWindows() + let isRelative = stridx(tolower(p), tolower(cwd)) == 0 + else + let isRelative = stridx(p, cwd) == 0 + endif + + if isRelative + let p = strpart(p, strlen(cwd)) + + "handle the edge case where the file begins with a + (vim interprets + "the +foo in `:e +foo` as an option to :edit) + if p[0] == "+" + let p = '\' . p + endif + endif + + if p ==# '' + let p = '.' + endif + + return p +endfunction + +"FUNCTION: Path._strForGlob() {{{1 +function! s:Path._strForGlob() + let lead = s:Path.Slash() + + "if we are running windows then slap a drive letter on the front + if nerdtree#runningWindows() + let lead = self.drive . '\' + endif + + let toReturn = lead . join(self.pathSegments, s:Path.Slash()) + + if !nerdtree#runningWindows() + let toReturn = escape(toReturn, nerdtree#escChars()) + endif + return toReturn +endfunction + +"FUNCTION: Path._str() {{{1 +" +"Gets the string path for this path object that is appropriate for the OS. +"EG, in windows c:\foo\bar +" in *nix /foo/bar +function! s:Path._str() + let lead = s:Path.Slash() + + "if we are running windows then slap a drive letter on the front + if nerdtree#runningWindows() + let lead = self.drive . '\' + endif + + return lead . join(self.pathSegments, s:Path.Slash()) +endfunction + +"FUNCTION: Path.strTrunk() {{{1 +"Gets the path without the last segment on the end. +function! s:Path.strTrunk() + return self.drive . '/' . join(self.pathSegments[0:-2], '/') +endfunction + +" FUNCTION: Path.tabnr() {{{1 +" return the number of the first tab that is displaying this file +" +" return 0 if no tab was found +function! s:Path.tabnr() + let str = self.str() + for t in range(tabpagenr('$')) + for b in tabpagebuflist(t+1) + if str == expand('#' . b . ':p') + return t+1 + endif + endfor + endfor + return 0 +endfunction + +"FUNCTION: Path.WinToUnixPath(pathstr){{{1 +"Takes in a windows path and returns the unix equiv +" +"A class level method +" +"Args: +"pathstr: the windows path to convert +function! s:Path.WinToUnixPath(pathstr) + if !nerdtree#runningWindows() + return a:pathstr + endif + + let toReturn = a:pathstr + + "remove the x:\ of the front + let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', "") + + "remove the \\ network share from the front + let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', "") + + "convert all \ chars to / + let toReturn = substitute(toReturn, '\', '/', "g") + + return toReturn +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/tree_dir_node.vim b/sources_non_forked/nerdtree/plugin/nerdtree/tree_dir_node.vim new file mode 100644 index 00000000..e3a068ed --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/tree_dir_node.vim @@ -0,0 +1,528 @@ +"CLASS: TreeDirNode +"A subclass of NERDTreeFileNode. +" +"The 'composite' part of the file/dir composite. +"============================================================ +let s:TreeDirNode = copy(g:NERDTreeFileNode) +let g:NERDTreeDirNode = s:TreeDirNode + +"FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1 +"class method that returns the highest cached ancestor of the current root +function! s:TreeDirNode.AbsoluteTreeRoot() + let currentNode = b:NERDTreeRoot + while currentNode.parent != {} + let currentNode = currentNode.parent + endwhile + return currentNode +endfunction + +"FUNCTION: TreeDirNode.activate([options]) {{{1 +unlet s:TreeDirNode.activate +function! s:TreeDirNode.activate(...) + let opts = a:0 ? a:1 : {} + call self.toggleOpen(opts) + call nerdtree#renderView() + call self.putCursorHere(0, 0) +endfunction + +"FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1 +"Adds the given treenode to the list of children for this node +" +"Args: +"-treenode: the node to add +"-inOrder: 1 if the new node should be inserted in sorted order +function! s:TreeDirNode.addChild(treenode, inOrder) + call add(self.children, a:treenode) + let a:treenode.parent = self + + if a:inOrder + call self.sortChildren() + endif +endfunction + +"FUNCTION: TreeDirNode.close() {{{1 +"Closes this directory +function! s:TreeDirNode.close() + let self.isOpen = 0 +endfunction + +"FUNCTION: TreeDirNode.closeChildren() {{{1 +"Closes all the child dir nodes of this node +function! s:TreeDirNode.closeChildren() + for i in self.children + if i.path.isDirectory + call i.close() + call i.closeChildren() + endif + endfor +endfunction + +"FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1 +"Instantiates a new child node for this node with the given path. The new +"nodes parent is set to this node. +" +"Args: +"path: a Path object that this node will represent/contain +"inOrder: 1 if the new node should be inserted in sorted order +" +"Returns: +"the newly created node +function! s:TreeDirNode.createChild(path, inOrder) + let newTreeNode = g:NERDTreeFileNode.New(a:path) + call self.addChild(newTreeNode, a:inOrder) + return newTreeNode +endfunction + +"FUNCTION: TreeDirNode.findNode(path) {{{1 +"Will find one of the children (recursively) that has the given path +" +"Args: +"path: a path object +unlet s:TreeDirNode.findNode +function! s:TreeDirNode.findNode(path) + if a:path.equals(self.path) + return self + endif + if stridx(a:path.str(), self.path.str(), 0) ==# -1 + return {} + endif + + if self.path.isDirectory + for i in self.children + let retVal = i.findNode(a:path) + if retVal != {} + return retVal + endif + endfor + endif + return {} +endfunction + +"FUNCTION: TreeDirNode.getChildCount() {{{1 +"Returns the number of children this node has +function! s:TreeDirNode.getChildCount() + return len(self.children) +endfunction + +"FUNCTION: TreeDirNode.getChild(path) {{{1 +"Returns child node of this node that has the given path or {} if no such node +"exists. +" +"This function doesnt not recurse into child dir nodes +" +"Args: +"path: a path object +function! s:TreeDirNode.getChild(path) + if stridx(a:path.str(), self.path.str(), 0) ==# -1 + return {} + endif + + let index = self.getChildIndex(a:path) + if index ==# -1 + return {} + else + return self.children[index] + endif + +endfunction + +"FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1 +"returns the child at the given index +"Args: +"indx: the index to get the child from +"visible: 1 if only the visible children array should be used, 0 if all the +"children should be searched. +function! s:TreeDirNode.getChildByIndex(indx, visible) + let array_to_search = a:visible? self.getVisibleChildren() : self.children + if a:indx > len(array_to_search) + throw "NERDTree.InvalidArgumentsError: Index is out of bounds." + endif + return array_to_search[a:indx] +endfunction + +"FUNCTION: TreeDirNode.getChildIndex(path) {{{1 +"Returns the index of the child node of this node that has the given path or +"-1 if no such node exists. +" +"This function doesnt not recurse into child dir nodes +" +"Args: +"path: a path object +function! s:TreeDirNode.getChildIndex(path) + if stridx(a:path.str(), self.path.str(), 0) ==# -1 + return -1 + endif + + "do a binary search for the child + let a = 0 + let z = self.getChildCount() + while a < z + let mid = (a+z)/2 + let diff = a:path.compareTo(self.children[mid].path) + + if diff ==# -1 + let z = mid + elseif diff ==# 1 + let a = mid+1 + else + return mid + endif + endwhile + return -1 +endfunction + +"FUNCTION: TreeDirNode.GetSelected() {{{1 +"Returns the current node if it is a dir node, or else returns the current +"nodes parent +unlet s:TreeDirNode.GetSelected +function! s:TreeDirNode.GetSelected() + let currentDir = g:NERDTreeFileNode.GetSelected() + if currentDir != {} && !currentDir.isRoot() + if currentDir.path.isDirectory ==# 0 + let currentDir = currentDir.parent + endif + endif + return currentDir +endfunction + +"FUNCTION: TreeDirNode.getVisibleChildCount() {{{1 +"Returns the number of visible children this node has +function! s:TreeDirNode.getVisibleChildCount() + return len(self.getVisibleChildren()) +endfunction + +"FUNCTION: TreeDirNode.getVisibleChildren() {{{1 +"Returns a list of children to display for this node, in the correct order +" +"Return: +"an array of treenodes +function! s:TreeDirNode.getVisibleChildren() + let toReturn = [] + for i in self.children + if i.path.ignore() ==# 0 + call add(toReturn, i) + endif + endfor + return toReturn +endfunction + +"FUNCTION: TreeDirNode.hasVisibleChildren() {{{1 +"returns 1 if this node has any childre, 0 otherwise.. +function! s:TreeDirNode.hasVisibleChildren() + return self.getVisibleChildCount() != 0 +endfunction + +"FUNCTION: TreeDirNode._initChildren() {{{1 +"Removes all childen from this node and re-reads them +" +"Args: +"silent: 1 if the function should not echo any "please wait" messages for +"large directories +" +"Return: the number of child nodes read +function! s:TreeDirNode._initChildren(silent) + "remove all the current child nodes + let self.children = [] + + "get an array of all the files in the nodes dir + let dir = self.path + let globDir = dir.str({'format': 'Glob'}) + + if version >= 703 + let filesStr = globpath(globDir, '*', 1) . "\n" . globpath(globDir, '.*', 1) + else + let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*') + endif + + let files = split(filesStr, "\n") + + if !a:silent && len(files) > g:NERDTreeNotificationThreshold + call nerdtree#echo("Please wait, caching a large dir ...") + endif + + let invalidFilesFound = 0 + for i in files + + "filter out the .. and . directories + "Note: we must match .. AND ../ cos sometimes the globpath returns + "../ for path with strange chars (eg $) + if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$' + + "put the next file in a new node and attach it + try + let path = g:NERDTreePath.New(i) + call self.createChild(path, 0) + catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ + let invalidFilesFound += 1 + endtry + endif + endfor + + call self.sortChildren() + + if !a:silent && len(files) > g:NERDTreeNotificationThreshold + call nerdtree#echo("Please wait, caching a large dir ... DONE (". self.getChildCount() ." nodes cached).") + endif + + if invalidFilesFound + call nerdtree#echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree") + endif + return self.getChildCount() +endfunction + +"FUNCTION: TreeDirNode.New(path) {{{1 +"Returns a new TreeNode object with the given path and parent +" +"Args: +"path: a path object representing the full filesystem path to the file/dir that the node represents +unlet s:TreeDirNode.New +function! s:TreeDirNode.New(path) + if a:path.isDirectory != 1 + throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object." + endif + + let newTreeNode = copy(self) + let newTreeNode.path = a:path + + let newTreeNode.isOpen = 0 + let newTreeNode.children = [] + + let newTreeNode.parent = {} + + return newTreeNode +endfunction + +"FUNCTION: TreeDirNode.open([opts]) {{{1 +"Open the dir in the current tree or in a new tree elsewhere. +" +"If opening in the current tree, return the number of cached nodes. +unlet s:TreeDirNode.open +function! s:TreeDirNode.open(...) + let opts = a:0 ? a:1 : {} + + if has_key(opts, 'where') && !empty(opts['where']) + let opener = g:NERDTreeOpener.New(self.path, opts) + call opener.open(self) + else + let self.isOpen = 1 + if self.children ==# [] + return self._initChildren(0) + else + return 0 + endif + endif +endfunction + +"FUNCTION: TreeDirNode.openAlong([opts]) {{{1 +"recursive open the dir if it has only one directory child. +" +"return the level of opened directories. +function! s:TreeDirNode.openAlong(...) + let opts = a:0 ? a:1 : {} + let level = 0 + + let node = self + while node.path.isDirectory + call node.open(opts) + let level += 1 + if node.getVisibleChildCount() == 1 + let node = node.getChildByIndex(0, 1) + else + break + endif + endwhile + return level +endfunction + +" FUNCTION: TreeDirNode.openExplorer() {{{1 +" opens an explorer window for this node in the previous window (could be a +" nerd tree or a netrw) +function! s:TreeDirNode.openExplorer() + call self.open({'where': 'p'}) +endfunction + +"FUNCTION: TreeDirNode.openInNewTab(options) {{{1 +unlet s:TreeDirNode.openInNewTab +function! s:TreeDirNode.openInNewTab(options) + call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead') + call self.open({'where': 't'}) +endfunction + +"FUNCTION: TreeDirNode._openInNewTab() {{{1 +function! s:TreeDirNode._openInNewTab() + tabnew + call g:NERDTreeCreator.CreatePrimary(self.path.str()) +endfunction + +"FUNCTION: TreeDirNode.openRecursively() {{{1 +"Opens this treenode and all of its children whose paths arent 'ignored' +"because of the file filters. +" +"This method is actually a wrapper for the OpenRecursively2 method which does +"the work. +function! s:TreeDirNode.openRecursively() + call self._openRecursively2(1) +endfunction + +"FUNCTION: TreeDirNode._openRecursively2() {{{1 +"Opens this all children of this treenode recursively if either: +" *they arent filtered by file filters +" *a:forceOpen is 1 +" +"Args: +"forceOpen: 1 if this node should be opened regardless of file filters +function! s:TreeDirNode._openRecursively2(forceOpen) + if self.path.ignore() ==# 0 || a:forceOpen + let self.isOpen = 1 + if self.children ==# [] + call self._initChildren(1) + endif + + for i in self.children + if i.path.isDirectory ==# 1 + call i._openRecursively2(0) + endif + endfor + endif +endfunction + +"FUNCTION: TreeDirNode.refresh() {{{1 +unlet s:TreeDirNode.refresh +function! s:TreeDirNode.refresh() + call self.path.refresh() + + "if this node was ever opened, refresh its children + if self.isOpen || !empty(self.children) + "go thru all the files/dirs under this node + let newChildNodes = [] + let invalidFilesFound = 0 + let dir = self.path + let globDir = dir.str({'format': 'Glob'}) + let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*') + let files = split(filesStr, "\n") + for i in files + "filter out the .. and . directories + "Note: we must match .. AND ../ cos sometimes the globpath returns + "../ for path with strange chars (eg $) + if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$' + + try + "create a new path and see if it exists in this nodes children + let path = g:NERDTreePath.New(i) + let newNode = self.getChild(path) + if newNode != {} + call newNode.refresh() + call add(newChildNodes, newNode) + + "the node doesnt exist so create it + else + let newNode = g:NERDTreeFileNode.New(path) + let newNode.parent = self + call add(newChildNodes, newNode) + endif + + + catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ + let invalidFilesFound = 1 + endtry + endif + endfor + + "swap this nodes children out for the children we just read/refreshed + let self.children = newChildNodes + call self.sortChildren() + + if invalidFilesFound + call nerdtree#echoWarning("some files could not be loaded into the NERD tree") + endif + endif +endfunction + +"FUNCTION: TreeDirNode.reveal(path) {{{1 +"reveal the given path, i.e. cache and open all treenodes needed to display it +"in the UI +function! s:TreeDirNode.reveal(path) + if !a:path.isUnder(self.path) + throw "NERDTree.InvalidArgumentsError: " . a:path.str() . " should be under " . self.path.str() + endif + + call self.open() + + if self.path.equals(a:path.getParent()) + let n = self.findNode(a:path) + call nerdtree#renderView() + call n.putCursorHere(1,0) + return + endif + + let p = a:path + while !p.getParent().equals(self.path) + let p = p.getParent() + endwhile + + let n = self.findNode(p) + call n.reveal(a:path) +endfunction + +"FUNCTION: TreeDirNode.removeChild(treenode) {{{1 +" +"Removes the given treenode from this nodes set of children +" +"Args: +"treenode: the node to remove +" +"Throws a NERDTree.ChildNotFoundError if the given treenode is not found +function! s:TreeDirNode.removeChild(treenode) + for i in range(0, self.getChildCount()-1) + if self.children[i].equals(a:treenode) + call remove(self.children, i) + return + endif + endfor + + throw "NERDTree.ChildNotFoundError: child node was not found" +endfunction + +"FUNCTION: TreeDirNode.sortChildren() {{{1 +" +"Sorts the children of this node according to alphabetical order and the +"directory priority. +" +function! s:TreeDirNode.sortChildren() + let CompareFunc = function("nerdtree#compareNodes") + call sort(self.children, CompareFunc) +endfunction + +"FUNCTION: TreeDirNode.toggleOpen([options]) {{{1 +"Opens this directory if it is closed and vice versa +function! s:TreeDirNode.toggleOpen(...) + let opts = a:0 ? a:1 : {} + if self.isOpen ==# 1 + call self.close() + else + if g:NERDTreeCasadeOpenSingleChildDir == 0 + call self.open(opts) + else + call self.openAlong(opts) + endif + endif +endfunction + +"FUNCTION: TreeDirNode.transplantChild(newNode) {{{1 +"Replaces the child of this with the given node (where the child node's full +"path matches a:newNode's fullpath). The search for the matching node is +"non-recursive +" +"Arg: +"newNode: the node to graft into the tree +function! s:TreeDirNode.transplantChild(newNode) + for i in range(0, self.getChildCount()-1) + if self.children[i].equals(a:newNode) + let self.children[i] = a:newNode + let a:newNode.parent = self + break + endif + endfor +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/plugin/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/plugin/nerdtree/tree_file_node.vim new file mode 100644 index 00000000..ab8d3719 --- /dev/null +++ b/sources_non_forked/nerdtree/plugin/nerdtree/tree_file_node.vim @@ -0,0 +1,485 @@ +"CLASS: TreeFileNode +"This class is the parent of the TreeDirNode class and is the +"'Component' part of the composite design pattern between the treenode +"classes. +"============================================================ +let s:TreeFileNode = {} +let g:NERDTreeFileNode = s:TreeFileNode + +"FUNCTION: TreeFileNode.activate(...) {{{1 +function! s:TreeFileNode.activate(...) + call self.open(a:0 ? a:1 : {}) +endfunction + +"FUNCTION: TreeFileNode.bookmark(name) {{{1 +"bookmark this node with a:name +function! s:TreeFileNode.bookmark(name) + + "if a bookmark exists with the same name and the node is cached then save + "it so we can update its display string + let oldMarkedNode = {} + try + let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1) + catch /^NERDTree.BookmarkNotFoundError/ + catch /^NERDTree.BookmarkedNodeNotFoundError/ + endtry + + call g:NERDTreeBookmark.AddBookmark(a:name, self.path) + call self.path.cacheDisplayString() + call g:NERDTreeBookmark.Write() + + if !empty(oldMarkedNode) + call oldMarkedNode.path.cacheDisplayString() + endif +endfunction + +"FUNCTION: TreeFileNode.cacheParent() {{{1 +"initializes self.parent if it isnt already +function! s:TreeFileNode.cacheParent() + if empty(self.parent) + let parentPath = self.path.getParent() + if parentPath.equals(self.path) + throw "NERDTree.CannotCacheParentError: already at root" + endif + let self.parent = s:TreeFileNode.New(parentPath) + endif +endfunction + +"FUNCTION: TreeFileNode.clearBookmarks() {{{1 +function! s:TreeFileNode.clearBookmarks() + for i in g:NERDTreeBookmark.Bookmarks() + if i.path.equals(self.path) + call i.delete() + end + endfor + call self.path.cacheDisplayString() +endfunction + +"FUNCTION: TreeFileNode.copy(dest) {{{1 +function! s:TreeFileNode.copy(dest) + call self.path.copy(a:dest) + let newPath = g:NERDTreePath.New(a:dest) + let parent = b:NERDTreeRoot.findNode(newPath.getParent()) + if !empty(parent) + call parent.refresh() + return parent.findNode(newPath) + else + return {} + endif +endfunction + +"FUNCTION: TreeFileNode.delete {{{1 +"Removes this node from the tree and calls the Delete method for its path obj +function! s:TreeFileNode.delete() + call self.path.delete() + call self.parent.removeChild(self) +endfunction + +"FUNCTION: TreeFileNode.displayString() {{{1 +" +"Returns a string that specifies how the node should be represented as a +"string +" +"Return: +"a string that can be used in the view to represent this node +function! s:TreeFileNode.displayString() + return self.path.displayString() +endfunction + +"FUNCTION: TreeFileNode.equals(treenode) {{{1 +" +"Compares this treenode to the input treenode and returns 1 if they are the +"same node. +" +"Use this method instead of == because sometimes when the treenodes contain +"many children, vim seg faults when doing == +" +"Args: +"treenode: the other treenode to compare to +function! s:TreeFileNode.equals(treenode) + return self.path.str() ==# a:treenode.path.str() +endfunction + +"FUNCTION: TreeFileNode.findNode(path) {{{1 +"Returns self if this node.path.Equals the given path. +"Returns {} if not equal. +" +"Args: +"path: the path object to compare against +function! s:TreeFileNode.findNode(path) + if a:path.equals(self.path) + return self + endif + return {} +endfunction + +"FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{1 +" +"Finds the next sibling for this node in the indicated direction. This sibling +"must be a directory and may/may not have children as specified. +" +"Args: +"direction: 0 if you want to find the previous sibling, 1 for the next sibling +" +"Return: +"a treenode object or {} if no appropriate sibling could be found +function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) + "if we have no parent then we can have no siblings + if self.parent != {} + let nextSibling = self.findSibling(a:direction) + + while nextSibling != {} + if nextSibling.path.isDirectory && nextSibling.hasVisibleChildren() && nextSibling.isOpen + return nextSibling + endif + let nextSibling = nextSibling.findSibling(a:direction) + endwhile + endif + + return {} +endfunction + +"FUNCTION: TreeFileNode.findSibling(direction) {{{1 +" +"Finds the next sibling for this node in the indicated direction +" +"Args: +"direction: 0 if you want to find the previous sibling, 1 for the next sibling +" +"Return: +"a treenode object or {} if no sibling could be found +function! s:TreeFileNode.findSibling(direction) + "if we have no parent then we can have no siblings + if self.parent != {} + + "get the index of this node in its parents children + let siblingIndx = self.parent.getChildIndex(self.path) + + if siblingIndx != -1 + "move a long to the next potential sibling node + let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 + + "keep moving along to the next sibling till we find one that is valid + let numSiblings = self.parent.getChildCount() + while siblingIndx >= 0 && siblingIndx < numSiblings + + "if the next node is not an ignored node (i.e. wont show up in the + "view) then return it + if self.parent.children[siblingIndx].path.ignore() ==# 0 + return self.parent.children[siblingIndx] + endif + + "go to next node + let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1 + endwhile + endif + endif + + return {} +endfunction + +"FUNCTION: TreeFileNode.getLineNum(){{{1 +"returns the line number this node is rendered on, or -1 if it isnt rendered +function! s:TreeFileNode.getLineNum() + "if the node is the root then return the root line no. + if self.isRoot() + return s:TreeFileNode.GetRootLineNum() + endif + + let totalLines = line("$") + + "the path components we have matched so far + let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')] + "the index of the component we are searching for + let curPathComponent = 1 + + let fullpath = self.path.str({'format': 'UI'}) + + + let lnum = s:TreeFileNode.GetRootLineNum() + while lnum > 0 + let lnum = lnum + 1 + "have we reached the bottom of the tree? + if lnum ==# totalLines+1 + return -1 + endif + + let curLine = getline(lnum) + + let indent = nerdtree#indentLevelFor(curLine) + if indent ==# curPathComponent + let curLine = nerdtree#stripMarkupFromLine(curLine, 1) + + let curPath = join(pathcomponents, '/') . '/' . curLine + if stridx(fullpath, curPath, 0) ==# 0 + if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/' + let curLine = substitute(curLine, '/ *$', '', '') + call add(pathcomponents, curLine) + let curPathComponent = curPathComponent + 1 + + if fullpath ==# curPath + return lnum + endif + endif + endif + endif + endwhile + return -1 +endfunction + +"FUNCTION: TreeFileNode.GetRootForTab(){{{1 +"get the root node for this tab +function! s:TreeFileNode.GetRootForTab() + if nerdtree#treeExistsForTab() + return getbufvar(t:NERDTreeBufName, 'NERDTreeRoot') + end + return {} +endfunction + +"FUNCTION: TreeFileNode.GetRootLineNum(){{{1 +"gets the line number of the root node +function! s:TreeFileNode.GetRootLineNum() + let rootLine = 1 + while getline(rootLine) !~# '^\(/\|<\)' + let rootLine = rootLine + 1 + endwhile + return rootLine +endfunction + +"FUNCTION: TreeFileNode.GetSelected() {{{1 +"gets the treenode that the cursor is currently over +function! s:TreeFileNode.GetSelected() + try + let path = nerdtree#getPath(line(".")) + if path ==# {} + return {} + endif + return b:NERDTreeRoot.findNode(path) + catch /^NERDTree/ + return {} + endtry +endfunction + +"FUNCTION: TreeFileNode.isVisible() {{{1 +"returns 1 if this node should be visible according to the tree filters and +"hidden file filters (and their on/off status) +function! s:TreeFileNode.isVisible() + return !self.path.ignore() +endfunction + +"FUNCTION: TreeFileNode.isRoot() {{{1 +"returns 1 if this node is b:NERDTreeRoot +function! s:TreeFileNode.isRoot() + if !nerdtree#treeExistsForBuf() + throw "NERDTree.NoTreeError: No tree exists for the current buffer" + endif + + return self.equals(b:NERDTreeRoot) +endfunction + +"FUNCTION: TreeFileNode.makeRoot() {{{1 +"Make this node the root of the tree +function! s:TreeFileNode.makeRoot() + if self.path.isDirectory + let b:NERDTreeRoot = self + else + call self.cacheParent() + let b:NERDTreeRoot = self.parent + endif + + call b:NERDTreeRoot.open() + + "change dir to the dir of the new root if instructed to + if g:NERDTreeChDirMode ==# 2 + exec "cd " . b:NERDTreeRoot.path.str({'format': 'Edit'}) + endif + + silent doautocmd User NERDTreeNewRoot +endfunction + +"FUNCTION: TreeFileNode.New(path) {{{1 +"Returns a new TreeNode object with the given path and parent +" +"Args: +"path: a path object representing the full filesystem path to the file/dir that the node represents +function! s:TreeFileNode.New(path) + if a:path.isDirectory + return g:NERDTreeDirNode.New(a:path) + else + let newTreeNode = copy(self) + let newTreeNode.path = a:path + let newTreeNode.parent = {} + return newTreeNode + endif +endfunction + +"FUNCTION: TreeFileNode.open() {{{1 +function! s:TreeFileNode.open(...) + let opts = a:0 ? a:1 : {} + let opener = g:NERDTreeOpener.New(self.path, opts) + call opener.open(self) +endfunction + +"FUNCTION: TreeFileNode.openSplit() {{{1 +"Open this node in a new window +function! s:TreeFileNode.openSplit() + call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.') + call self.open({'where': 'h'}) +endfunction + +"FUNCTION: TreeFileNode.openVSplit() {{{1 +"Open this node in a new vertical window +function! s:TreeFileNode.openVSplit() + call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.') + call self.open({'where': 'v'}) +endfunction + +"FUNCTION: TreeFileNode.openInNewTab(options) {{{1 +function! s:TreeFileNode.openInNewTab(options) + echomsg 'TreeFileNode.openInNewTab is deprecated' + call self.open(extend({'where': 't'}, a:options)) +endfunction + +"FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1 +"Places the cursor on the line number this node is rendered on +" +"Args: +"isJump: 1 if this cursor movement should be counted as a jump by vim +"recurseUpward: try to put the cursor on the parent if the this node isnt +"visible +function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) + let ln = self.getLineNum() + if ln != -1 + if a:isJump + mark ' + endif + call cursor(ln, col(".")) + else + if a:recurseUpward + let node = self + while node != {} && node.getLineNum() ==# -1 + let node = node.parent + call node.open() + endwhile + call nerdtree#renderView() + call node.putCursorHere(a:isJump, 0) + endif + endif +endfunction + +"FUNCTION: TreeFileNode.refresh() {{{1 +function! s:TreeFileNode.refresh() + call self.path.refresh() +endfunction + +"FUNCTION: TreeFileNode.rename() {{{1 +"Calls the rename method for this nodes path obj +function! s:TreeFileNode.rename(newName) + let newName = substitute(a:newName, '\(\\\|\/\)$', '', '') + call self.path.rename(newName) + call self.parent.removeChild(self) + + let parentPath = self.path.getParent() + let newParent = b:NERDTreeRoot.findNode(parentPath) + + if newParent != {} + call newParent.createChild(self.path, 1) + call newParent.refresh() + endif +endfunction + +"FUNCTION: TreeFileNode.renderToString {{{1 +"returns a string representation for this tree to be rendered in the view +function! s:TreeFileNode.renderToString() + return self._renderToString(0, 0, [], self.getChildCount() ==# 1) +endfunction + +"Args: +"depth: the current depth in the tree for this call +"drawText: 1 if we should actually draw the line for this node (if 0 then the +"child nodes are rendered only) +"vertMap: a binary array that indicates whether a vertical bar should be draw +"for each depth in the tree +"isLastChild:true if this curNode is the last child of its parent +function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) + let output = "" + if a:drawText ==# 1 + + let treeParts = '' + + "get all the leading spaces and vertical tree parts for this line + if a:depth > 1 + for j in a:vertMap[0:-2] + if g:NERDTreeDirArrows + let treeParts = treeParts . ' ' + else + if j ==# 1 + let treeParts = treeParts . '| ' + else + let treeParts = treeParts . ' ' + endif + endif + endfor + endif + + "get the last vertical tree part for this line which will be different + "if this node is the last child of its parent + if !g:NERDTreeDirArrows + if a:isLastChild + let treeParts = treeParts . '`' + else + let treeParts = treeParts . '|' + endif + endif + + "smack the appropriate dir/file symbol on the line before the file/dir + "name itself + if self.path.isDirectory + if self.isOpen + if g:NERDTreeDirArrows + let treeParts = treeParts . '▾ ' + else + let treeParts = treeParts . '~' + endif + else + if g:NERDTreeDirArrows + let treeParts = treeParts . '▸ ' + else + let treeParts = treeParts . '+' + endif + endif + else + if g:NERDTreeDirArrows + let treeParts = treeParts . ' ' + else + let treeParts = treeParts . '-' + endif + endif + let line = treeParts . self.displayString() + + let output = output . line . "\n" + endif + + "if the node is an open dir, draw its children + if self.path.isDirectory ==# 1 && self.isOpen ==# 1 + + let childNodesToDraw = self.getVisibleChildren() + if len(childNodesToDraw) > 0 + + "draw all the nodes children except the last + let lastIndx = len(childNodesToDraw)-1 + if lastIndx > 0 + for i in childNodesToDraw[0:lastIndx-1] + let output = output . i._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 1), 0) + endfor + endif + + "draw the last child, indicating that it IS the last + let output = output . childNodesToDraw[lastIndx]._renderToString(a:depth + 1, 1, add(copy(a:vertMap), 0), 1) + endif + endif + + return output +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nginx-vim/README.md b/sources_non_forked/nginx-vim/README.md new file mode 100755 index 00000000..8124452e --- /dev/null +++ b/sources_non_forked/nginx-vim/README.md @@ -0,0 +1,7 @@ +# nginx syntax files for Vim. + +Copied into a directory to play well with pathogen. + +* Original: http://www.vim.org/scripts/script.php?script_id=1886 + + diff --git a/sources_non_forked/nginx-vim/ftdetect/nginx.vim b/sources_non_forked/nginx-vim/ftdetect/nginx.vim new file mode 100755 index 00000000..d12c2bf1 --- /dev/null +++ b/sources_non_forked/nginx-vim/ftdetect/nginx.vim @@ -0,0 +1,2 @@ +au BufRead,BufNewFile /etc/nginx/* set ft=nginx +au BufRead,BufNewFile /usr/local/nginx/conf/* set ft=nginx diff --git a/sources_non_forked/nginx-vim/indent/nginx.vim b/sources_non_forked/nginx-vim/indent/nginx.vim new file mode 100755 index 00000000..51115e91 --- /dev/null +++ b/sources_non_forked/nginx-vim/indent/nginx.vim @@ -0,0 +1,9 @@ +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" cindent actually works for nginx' simple file structure +setlocal cindent +" Just make sure that the comments are not reset as defs would be. +setlocal cinkeys-=0# diff --git a/sources_non_forked/nginx-vim/syntax/nginx.vim b/sources_non_forked/nginx-vim/syntax/nginx.vim new file mode 100755 index 00000000..ccd47680 --- /dev/null +++ b/sources_non_forked/nginx-vim/syntax/nginx.vim @@ -0,0 +1,664 @@ +" Vim syntax file +" Language: nginx.conf + +if exists("b:current_syntax") + finish +end + +setlocal iskeyword+=. +setlocal iskeyword+=/ +setlocal iskeyword+=: + +syn match ngxVariable '\$\w\w*' +syn match ngxVariableBlock '\$\w\w*' contained +syn match ngxVariableString '\$\w\w*' contained +syn region ngxBlock start=+^+ end=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline +syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline +syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline +syn match ngxComment ' *#.*$' + +syn keyword ngxBoolean on +syn keyword ngxBoolean off + +syn keyword ngxDirectiveBlock http contained +syn keyword ngxDirectiveBlock mail contained +syn keyword ngxDirectiveBlock events contained +syn keyword ngxDirectiveBlock server contained +syn keyword ngxDirectiveBlock types contained +syn keyword ngxDirectiveBlock location contained +syn keyword ngxDirectiveBlock upstream contained +syn keyword ngxDirectiveBlock charset_map contained +syn keyword ngxDirectiveBlock limit_except contained +syn keyword ngxDirectiveBlock if contained +syn keyword ngxDirectiveBlock geo contained +syn keyword ngxDirectiveBlock map contained + +syn keyword ngxDirectiveImportant include +syn keyword ngxDirectiveImportant root +syn keyword ngxDirectiveImportant server +syn keyword ngxDirectiveImportant server_name +syn keyword ngxDirectiveImportant listen +syn keyword ngxDirectiveImportant internal +syn keyword ngxDirectiveImportant proxy_pass +syn keyword ngxDirectiveImportant memcached_pass +syn keyword ngxDirectiveImportant fastcgi_pass +syn keyword ngxDirectiveImportant try_files + +syn keyword ngxDirectiveControl break +syn keyword ngxDirectiveControl return +syn keyword ngxDirectiveControl rewrite +syn keyword ngxDirectiveControl set + +syn keyword ngxDirectiveError error_page +syn keyword ngxDirectiveError post_action + +syn keyword ngxDirectiveDeprecated connections +syn keyword ngxDirectiveDeprecated imap +syn keyword ngxDirectiveDeprecated open_file_cache_retest +syn keyword ngxDirectiveDeprecated optimize_server_names +syn keyword ngxDirectiveDeprecated satisfy_any + +syn keyword ngxDirective accept_mutex +syn keyword ngxDirective accept_mutex_delay +syn keyword ngxDirective access_log +syn keyword ngxDirective add_after_body +syn keyword ngxDirective add_before_body +syn keyword ngxDirective add_header +syn keyword ngxDirective addition_types +syn keyword ngxDirective aio +syn keyword ngxDirective alias +syn keyword ngxDirective allow +syn keyword ngxDirective ancient_browser +syn keyword ngxDirective ancient_browser_value +syn keyword ngxDirective auth_basic +syn keyword ngxDirective auth_basic_user_file +syn keyword ngxDirective auth_http +syn keyword ngxDirective auth_http_header +syn keyword ngxDirective auth_http_timeout +syn keyword ngxDirective autoindex +syn keyword ngxDirective autoindex_exact_size +syn keyword ngxDirective autoindex_localtime +syn keyword ngxDirective charset +syn keyword ngxDirective charset_types +syn keyword ngxDirective client_body_buffer_size +syn keyword ngxDirective client_body_in_file_only +syn keyword ngxDirective client_body_in_single_buffer +syn keyword ngxDirective client_body_temp_path +syn keyword ngxDirective client_body_timeout +syn keyword ngxDirective client_header_buffer_size +syn keyword ngxDirective client_header_timeout +syn keyword ngxDirective client_max_body_size +syn keyword ngxDirective connection_pool_size +syn keyword ngxDirective create_full_put_path +syn keyword ngxDirective daemon +syn keyword ngxDirective dav_access +syn keyword ngxDirective dav_methods +syn keyword ngxDirective debug_connection +syn keyword ngxDirective debug_points +syn keyword ngxDirective default_type +syn keyword ngxDirective degradation +syn keyword ngxDirective degrade +syn keyword ngxDirective deny +syn keyword ngxDirective devpoll_changes +syn keyword ngxDirective devpoll_events +syn keyword ngxDirective directio +syn keyword ngxDirective directio_alignment +syn keyword ngxDirective empty_gif +syn keyword ngxDirective env +syn keyword ngxDirective epoll_events +syn keyword ngxDirective error_log +syn keyword ngxDirective eventport_events +syn keyword ngxDirective expires +syn keyword ngxDirective fastcgi_bind +syn keyword ngxDirective fastcgi_buffer_size +syn keyword ngxDirective fastcgi_buffers +syn keyword ngxDirective fastcgi_busy_buffers_size +syn keyword ngxDirective fastcgi_cache +syn keyword ngxDirective fastcgi_cache_key +syn keyword ngxDirective fastcgi_cache_methods +syn keyword ngxDirective fastcgi_cache_min_uses +syn keyword ngxDirective fastcgi_cache_path +syn keyword ngxDirective fastcgi_cache_use_stale +syn keyword ngxDirective fastcgi_cache_valid +syn keyword ngxDirective fastcgi_catch_stderr +syn keyword ngxDirective fastcgi_connect_timeout +syn keyword ngxDirective fastcgi_hide_header +syn keyword ngxDirective fastcgi_ignore_client_abort +syn keyword ngxDirective fastcgi_ignore_headers +syn keyword ngxDirective fastcgi_index +syn keyword ngxDirective fastcgi_intercept_errors +syn keyword ngxDirective fastcgi_max_temp_file_size +syn keyword ngxDirective fastcgi_next_upstream +syn keyword ngxDirective fastcgi_param +syn keyword ngxDirective fastcgi_pass_header +syn keyword ngxDirective fastcgi_pass_request_body +syn keyword ngxDirective fastcgi_pass_request_headers +syn keyword ngxDirective fastcgi_read_timeout +syn keyword ngxDirective fastcgi_send_lowat +syn keyword ngxDirective fastcgi_send_timeout +syn keyword ngxDirective fastcgi_split_path_info +syn keyword ngxDirective fastcgi_store +syn keyword ngxDirective fastcgi_store_access +syn keyword ngxDirective fastcgi_temp_file_write_size +syn keyword ngxDirective fastcgi_temp_path +syn keyword ngxDirective fastcgi_upstream_fail_timeout +syn keyword ngxDirective fastcgi_upstream_max_fails +syn keyword ngxDirective flv +syn keyword ngxDirective geoip_city +syn keyword ngxDirective geoip_country +syn keyword ngxDirective google_perftools_profiles +syn keyword ngxDirective gzip +syn keyword ngxDirective gzip_buffers +syn keyword ngxDirective gzip_comp_level +syn keyword ngxDirective gzip_disable +syn keyword ngxDirective gzip_hash +syn keyword ngxDirective gzip_http_version +syn keyword ngxDirective gzip_min_length +syn keyword ngxDirective gzip_no_buffer +syn keyword ngxDirective gzip_proxied +syn keyword ngxDirective gzip_static +syn keyword ngxDirective gzip_types +syn keyword ngxDirective gzip_vary +syn keyword ngxDirective gzip_window +syn keyword ngxDirective if_modified_since +syn keyword ngxDirective ignore_invalid_headers +syn keyword ngxDirective image_filter +syn keyword ngxDirective image_filter_buffer +syn keyword ngxDirective image_filter_jpeg_quality +syn keyword ngxDirective image_filter_transparency +syn keyword ngxDirective imap_auth +syn keyword ngxDirective imap_capabilities +syn keyword ngxDirective imap_client_buffer +syn keyword ngxDirective index +syn keyword ngxDirective ip_hash +syn keyword ngxDirective keepalive_requests +syn keyword ngxDirective keepalive_timeout +syn keyword ngxDirective kqueue_changes +syn keyword ngxDirective kqueue_events +syn keyword ngxDirective large_client_header_buffers +syn keyword ngxDirective limit_conn +syn keyword ngxDirective limit_conn_log_level +syn keyword ngxDirective limit_rate +syn keyword ngxDirective limit_rate_after +syn keyword ngxDirective limit_req +syn keyword ngxDirective limit_req_log_level +syn keyword ngxDirective limit_req_zone +syn keyword ngxDirective limit_zone +syn keyword ngxDirective lingering_time +syn keyword ngxDirective lingering_timeout +syn keyword ngxDirective lock_file +syn keyword ngxDirective log_format +syn keyword ngxDirective log_not_found +syn keyword ngxDirective log_subrequest +syn keyword ngxDirective map_hash_bucket_size +syn keyword ngxDirective map_hash_max_size +syn keyword ngxDirective master_process +syn keyword ngxDirective memcached_bind +syn keyword ngxDirective memcached_buffer_size +syn keyword ngxDirective memcached_connect_timeout +syn keyword ngxDirective memcached_next_upstream +syn keyword ngxDirective memcached_read_timeout +syn keyword ngxDirective memcached_send_timeout +syn keyword ngxDirective memcached_upstream_fail_timeout +syn keyword ngxDirective memcached_upstream_max_fails +syn keyword ngxDirective merge_slashes +syn keyword ngxDirective min_delete_depth +syn keyword ngxDirective modern_browser +syn keyword ngxDirective modern_browser_value +syn keyword ngxDirective msie_padding +syn keyword ngxDirective msie_refresh +syn keyword ngxDirective multi_accept +syn keyword ngxDirective open_file_cache +syn keyword ngxDirective open_file_cache_errors +syn keyword ngxDirective open_file_cache_events +syn keyword ngxDirective open_file_cache_min_uses +syn keyword ngxDirective open_file_cache_valid +syn keyword ngxDirective open_log_file_cache +syn keyword ngxDirective output_buffers +syn keyword ngxDirective override_charset +syn keyword ngxDirective perl +syn keyword ngxDirective perl_modules +syn keyword ngxDirective perl_require +syn keyword ngxDirective perl_set +syn keyword ngxDirective pid +syn keyword ngxDirective pop3_auth +syn keyword ngxDirective pop3_capabilities +syn keyword ngxDirective port_in_redirect +syn keyword ngxDirective postpone_gzipping +syn keyword ngxDirective postpone_output +syn keyword ngxDirective protocol +syn keyword ngxDirective proxy +syn keyword ngxDirective proxy_bind +syn keyword ngxDirective proxy_buffer +syn keyword ngxDirective proxy_buffer_size +syn keyword ngxDirective proxy_buffering +syn keyword ngxDirective proxy_buffers +syn keyword ngxDirective proxy_busy_buffers_size +syn keyword ngxDirective proxy_cache +syn keyword ngxDirective proxy_cache_key +syn keyword ngxDirective proxy_cache_methods +syn keyword ngxDirective proxy_cache_min_uses +syn keyword ngxDirective proxy_cache_path +syn keyword ngxDirective proxy_cache_use_stale +syn keyword ngxDirective proxy_cache_valid +syn keyword ngxDirective proxy_connect_timeout +syn keyword ngxDirective proxy_headers_hash_bucket_size +syn keyword ngxDirective proxy_headers_hash_max_size +syn keyword ngxDirective proxy_hide_header +syn keyword ngxDirective proxy_ignore_client_abort +syn keyword ngxDirective proxy_ignore_headers +syn keyword ngxDirective proxy_intercept_errors +syn keyword ngxDirective proxy_max_temp_file_size +syn keyword ngxDirective proxy_method +syn keyword ngxDirective proxy_next_upstream +syn keyword ngxDirective proxy_pass_error_message +syn keyword ngxDirective proxy_pass_header +syn keyword ngxDirective proxy_pass_request_body +syn keyword ngxDirective proxy_pass_request_headers +syn keyword ngxDirective proxy_read_timeout +syn keyword ngxDirective proxy_redirect +syn keyword ngxDirective proxy_send_lowat +syn keyword ngxDirective proxy_send_timeout +syn keyword ngxDirective proxy_set_body +syn keyword ngxDirective proxy_set_header +syn keyword ngxDirective proxy_ssl_session_reuse +syn keyword ngxDirective proxy_store +syn keyword ngxDirective proxy_store_access +syn keyword ngxDirective proxy_temp_file_write_size +syn keyword ngxDirective proxy_temp_path +syn keyword ngxDirective proxy_timeout +syn keyword ngxDirective proxy_upstream_fail_timeout +syn keyword ngxDirective proxy_upstream_max_fails +syn keyword ngxDirective random_index +syn keyword ngxDirective read_ahead +syn keyword ngxDirective real_ip_header +syn keyword ngxDirective recursive_error_pages +syn keyword ngxDirective request_pool_size +syn keyword ngxDirective reset_timedout_connection +syn keyword ngxDirective resolver +syn keyword ngxDirective resolver_timeout +syn keyword ngxDirective rewrite_log +syn keyword ngxDirective rtsig_overflow_events +syn keyword ngxDirective rtsig_overflow_test +syn keyword ngxDirective rtsig_overflow_threshold +syn keyword ngxDirective rtsig_signo +syn keyword ngxDirective satisfy +syn keyword ngxDirective secure_link_secret +syn keyword ngxDirective send_lowat +syn keyword ngxDirective send_timeout +syn keyword ngxDirective sendfile +syn keyword ngxDirective sendfile_max_chunk +syn keyword ngxDirective server_name_in_redirect +syn keyword ngxDirective server_names_hash_bucket_size +syn keyword ngxDirective server_names_hash_max_size +syn keyword ngxDirective server_tokens +syn keyword ngxDirective set_real_ip_from +syn keyword ngxDirective smtp_auth +syn keyword ngxDirective smtp_capabilities +syn keyword ngxDirective smtp_client_buffer +syn keyword ngxDirective smtp_greeting_delay +syn keyword ngxDirective so_keepalive +syn keyword ngxDirective source_charset +syn keyword ngxDirective ssi +syn keyword ngxDirective ssi_ignore_recycled_buffers +syn keyword ngxDirective ssi_min_file_chunk +syn keyword ngxDirective ssi_silent_errors +syn keyword ngxDirective ssi_types +syn keyword ngxDirective ssi_value_length +syn keyword ngxDirective ssl +syn keyword ngxDirective ssl_certificate +syn keyword ngxDirective ssl_certificate_key +syn keyword ngxDirective ssl_ciphers +syn keyword ngxDirective ssl_client_certificate +syn keyword ngxDirective ssl_crl +syn keyword ngxDirective ssl_dhparam +syn keyword ngxDirective ssl_engine +syn keyword ngxDirective ssl_prefer_server_ciphers +syn keyword ngxDirective ssl_protocols +syn keyword ngxDirective ssl_session_cache +syn keyword ngxDirective ssl_session_timeout +syn keyword ngxDirective ssl_verify_client +syn keyword ngxDirective ssl_verify_depth +syn keyword ngxDirective starttls +syn keyword ngxDirective stub_status +syn keyword ngxDirective sub_filter +syn keyword ngxDirective sub_filter_once +syn keyword ngxDirective sub_filter_types +syn keyword ngxDirective tcp_nodelay +syn keyword ngxDirective tcp_nopush +syn keyword ngxDirective thread_stack_size +syn keyword ngxDirective timeout +syn keyword ngxDirective timer_resolution +syn keyword ngxDirective types_hash_bucket_size +syn keyword ngxDirective types_hash_max_size +syn keyword ngxDirective underscores_in_headers +syn keyword ngxDirective uninitialized_variable_warn +syn keyword ngxDirective use +syn keyword ngxDirective user +syn keyword ngxDirective userid +syn keyword ngxDirective userid_domain +syn keyword ngxDirective userid_expires +syn keyword ngxDirective userid_mark +syn keyword ngxDirective userid_name +syn keyword ngxDirective userid_p3p +syn keyword ngxDirective userid_path +syn keyword ngxDirective userid_service +syn keyword ngxDirective valid_referers +syn keyword ngxDirective variables_hash_bucket_size +syn keyword ngxDirective variables_hash_max_size +syn keyword ngxDirective worker_connections +syn keyword ngxDirective worker_cpu_affinity +syn keyword ngxDirective worker_priority +syn keyword ngxDirective worker_processes +syn keyword ngxDirective worker_rlimit_core +syn keyword ngxDirective worker_rlimit_nofile +syn keyword ngxDirective worker_rlimit_sigpending +syn keyword ngxDirective worker_threads +syn keyword ngxDirective working_directory +syn keyword ngxDirective xclient +syn keyword ngxDirective xml_entities +syn keyword ngxDirective xslt_stylesheet +syn keyword ngxDirective xslt_types + +" 3rd party module list: +" http://wiki.nginx.org/Nginx3rdPartyModules + +" Accept Language Module +" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales. +syn keyword ngxDirectiveThirdParty set_from_accept_language + +" Access Key Module +" Denies access unless the request URL contains an access key. +syn keyword ngxDirectiveThirdParty accesskey +syn keyword ngxDirectiveThirdParty accesskey_arg +syn keyword ngxDirectiveThirdParty accesskey_hashmethod +syn keyword ngxDirectiveThirdParty accesskey_signature + +" Auth PAM Module +" HTTP Basic Authentication using PAM. +syn keyword ngxDirectiveThirdParty auth_pam +syn keyword ngxDirectiveThirdParty auth_pam_service_name + +" Cache Purge Module +" Module adding ability to purge content from FastCGI and proxy caches. +syn keyword ngxDirectiveThirdParty fastcgi_cache_purge +syn keyword ngxDirectiveThirdParty proxy_cache_purge + +" Chunkin Module +" HTTP 1.1 chunked-encoding request body support for Nginx. +syn keyword ngxDirectiveThirdParty chunkin +syn keyword ngxDirectiveThirdParty chunkin_keepalive +syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf +syn keyword ngxDirectiveThirdParty chunkin_resume + +" Circle GIF Module +" Generates simple circle images with the colors and size specified in the URL. +syn keyword ngxDirectiveThirdParty circle_gif +syn keyword ngxDirectiveThirdParty circle_gif_max_radius +syn keyword ngxDirectiveThirdParty circle_gif_min_radius +syn keyword ngxDirectiveThirdParty circle_gif_step_radius + +" Drizzle Module +" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle. +syn keyword ngxDirectiveThirdParty drizzle_connect_timeout +syn keyword ngxDirectiveThirdParty drizzle_dbname +syn keyword ngxDirectiveThirdParty drizzle_keepalive +syn keyword ngxDirectiveThirdParty drizzle_module_header +syn keyword ngxDirectiveThirdParty drizzle_pass +syn keyword ngxDirectiveThirdParty drizzle_query +syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout +syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout +syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout +syn keyword ngxDirectiveThirdParty drizzle_server + +" Echo Module +" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file. +syn keyword ngxDirectiveThirdParty echo +syn keyword ngxDirectiveThirdParty echo_after_body +syn keyword ngxDirectiveThirdParty echo_before_body +syn keyword ngxDirectiveThirdParty echo_blocking_sleep +syn keyword ngxDirectiveThirdParty echo_duplicate +syn keyword ngxDirectiveThirdParty echo_end +syn keyword ngxDirectiveThirdParty echo_exec +syn keyword ngxDirectiveThirdParty echo_flush +syn keyword ngxDirectiveThirdParty echo_foreach_split +syn keyword ngxDirectiveThirdParty echo_location +syn keyword ngxDirectiveThirdParty echo_location_async +syn keyword ngxDirectiveThirdParty echo_read_request_body +syn keyword ngxDirectiveThirdParty echo_request_body +syn keyword ngxDirectiveThirdParty echo_reset_timer +syn keyword ngxDirectiveThirdParty echo_sleep +syn keyword ngxDirectiveThirdParty echo_subrequest +syn keyword ngxDirectiveThirdParty echo_subrequest_async + +" Events Module +" Privides options for start/stop events. +syn keyword ngxDirectiveThirdParty on_start +syn keyword ngxDirectiveThirdParty on_stop + +" EY Balancer Module +" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream. +syn keyword ngxDirectiveThirdParty max_connections +syn keyword ngxDirectiveThirdParty max_connections_max_queue_length +syn keyword ngxDirectiveThirdParty max_connections_queue_timeout + +" Fancy Indexes Module +" Like the built-in autoindex module, but fancier. +syn keyword ngxDirectiveThirdParty fancyindex +syn keyword ngxDirectiveThirdParty fancyindex_exact_size +syn keyword ngxDirectiveThirdParty fancyindex_footer +syn keyword ngxDirectiveThirdParty fancyindex_header +syn keyword ngxDirectiveThirdParty fancyindex_localtime +syn keyword ngxDirectiveThirdParty fancyindex_readme +syn keyword ngxDirectiveThirdParty fancyindex_readme_mode + +" GeoIP Module (DEPRECATED) +" Country code lookups via the MaxMind GeoIP API. +syn keyword ngxDirectiveThirdParty geoip_country_file + +" Headers More Module +" Set and clear input and output headers...more than "add"! +syn keyword ngxDirectiveThirdParty more_clear_headers +syn keyword ngxDirectiveThirdParty more_clear_input_headers +syn keyword ngxDirectiveThirdParty more_set_headers +syn keyword ngxDirectiveThirdParty more_set_input_headers + +" HTTP Push Module +" Turn Nginx into an adept long-polling HTTP Push (Comet) server. +syn keyword ngxDirectiveThirdParty push_buffer_size +syn keyword ngxDirectiveThirdParty push_listener +syn keyword ngxDirectiveThirdParty push_message_timeout +syn keyword ngxDirectiveThirdParty push_queue_messages +syn keyword ngxDirectiveThirdParty push_sender + +" HTTP Redis Module > +" Redis support.> +syn keyword ngxDirectiveThirdParty redis_bind +syn keyword ngxDirectiveThirdParty redis_buffer_size +syn keyword ngxDirectiveThirdParty redis_connect_timeout +syn keyword ngxDirectiveThirdParty redis_next_upstream +syn keyword ngxDirectiveThirdParty redis_pass +syn keyword ngxDirectiveThirdParty redis_read_timeout +syn keyword ngxDirectiveThirdParty redis_send_timeout + +" HTTP JavaScript Module +" Embedding SpiderMonkey. Nearly full port on Perl module. +syn keyword ngxDirectiveThirdParty js +syn keyword ngxDirectiveThirdParty js_filter +syn keyword ngxDirectiveThirdParty js_filter_types +syn keyword ngxDirectiveThirdParty js_load +syn keyword ngxDirectiveThirdParty js_maxmem +syn keyword ngxDirectiveThirdParty js_require +syn keyword ngxDirectiveThirdParty js_set +syn keyword ngxDirectiveThirdParty js_utf8 + +" Log Request Speed +" Log the time it took to process each request. +syn keyword ngxDirectiveThirdParty log_request_speed_filter +syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout + +" Memc Module +" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands. +syn keyword ngxDirectiveThirdParty memc_buffer_size +syn keyword ngxDirectiveThirdParty memc_cmds_allowed +syn keyword ngxDirectiveThirdParty memc_connect_timeout +syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified +syn keyword ngxDirectiveThirdParty memc_next_upstream +syn keyword ngxDirectiveThirdParty memc_pass +syn keyword ngxDirectiveThirdParty memc_read_timeout +syn keyword ngxDirectiveThirdParty memc_send_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_max_fails + +" Mogilefs Module +" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS. +syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout +syn keyword ngxDirectiveThirdParty mogilefs_domain +syn keyword ngxDirectiveThirdParty mogilefs_methods +syn keyword ngxDirectiveThirdParty mogilefs_noverify +syn keyword ngxDirectiveThirdParty mogilefs_pass +syn keyword ngxDirectiveThirdParty mogilefs_read_timeout +syn keyword ngxDirectiveThirdParty mogilefs_send_timeout +syn keyword ngxDirectiveThirdParty mogilefs_tracker + +" MP4 Streaming Lite Module +" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL. +syn keyword ngxDirectiveThirdParty mp4 + +" Nginx Notice Module +" Serve static file to POST requests. +syn keyword ngxDirectiveThirdParty notice +syn keyword ngxDirectiveThirdParty notice_type + +" Phusion Passenger +" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers. +syn keyword ngxDirectiveThirdParty passenger_base_uri +syn keyword ngxDirectiveThirdParty passenger_default_user +syn keyword ngxDirectiveThirdParty passenger_enabled +syn keyword ngxDirectiveThirdParty passenger_log_level +syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app +syn keyword ngxDirectiveThirdParty passenger_max_pool_size +syn keyword ngxDirectiveThirdParty passenger_pool_idle_time +syn keyword ngxDirectiveThirdParty passenger_root +syn keyword ngxDirectiveThirdParty passenger_ruby +syn keyword ngxDirectiveThirdParty passenger_use_global_queue +syn keyword ngxDirectiveThirdParty passenger_user_switching +syn keyword ngxDirectiveThirdParty rack_env +syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_env +syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_spawn_method + +" RDS JSON Module +" Help ngx_drizzle and other DBD modules emit JSON data. +syn keyword ngxDirectiveThirdParty rds_json +syn keyword ngxDirectiveThirdParty rds_json_content_type +syn keyword ngxDirectiveThirdParty rds_json_format +syn keyword ngxDirectiveThirdParty rds_json_ret + +" RRD Graph Module +" This module provides an HTTP interface to RRDtool's graphing facilities. +syn keyword ngxDirectiveThirdParty rrd_graph +syn keyword ngxDirectiveThirdParty rrd_graph_root + +" Secure Download +" Create expiring links. +syn keyword ngxDirectiveThirdParty secure_download +syn keyword ngxDirectiveThirdParty secure_download_fail_location +syn keyword ngxDirectiveThirdParty secure_download_path_mode +syn keyword ngxDirectiveThirdParty secure_download_secret + +" SlowFS Cache Module +" Module adding ability to cache static files. +syn keyword ngxDirectiveThirdParty slowfs_big_file_size +syn keyword ngxDirectiveThirdParty slowfs_cache +syn keyword ngxDirectiveThirdParty slowfs_cache_key +syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses +syn keyword ngxDirectiveThirdParty slowfs_cache_path +syn keyword ngxDirectiveThirdParty slowfs_cache_purge +syn keyword ngxDirectiveThirdParty slowfs_cache_valid +syn keyword ngxDirectiveThirdParty slowfs_temp_path + +" Strip Module +" Whitespace remover. +syn keyword ngxDirectiveThirdParty strip + +" Substitutions Module +" A filter module which can do both regular expression and fixed string substitutions on response bodies. +syn keyword ngxDirectiveThirdParty subs_filter +syn keyword ngxDirectiveThirdParty subs_filter_types + +" Supervisord Module +" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand. +syn keyword ngxDirectiveThirdParty supervisord +syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status +syn keyword ngxDirectiveThirdParty supervisord_name +syn keyword ngxDirectiveThirdParty supervisord_start +syn keyword ngxDirectiveThirdParty supervisord_stop + +" Upload Module +" Parses multipart/form-data allowing arbitrary handling of uploaded files. +syn keyword ngxDirectiveThirdParty upload_aggregate_form_field +syn keyword ngxDirectiveThirdParty upload_buffer_size +syn keyword ngxDirectiveThirdParty upload_cleanup +syn keyword ngxDirectiveThirdParty upload_limit_rate +syn keyword ngxDirectiveThirdParty upload_max_file_size +syn keyword ngxDirectiveThirdParty upload_max_output_body_len +syn keyword ngxDirectiveThirdParty upload_max_part_header_len +syn keyword ngxDirectiveThirdParty upload_pass +syn keyword ngxDirectiveThirdParty upload_pass_args +syn keyword ngxDirectiveThirdParty upload_pass_form_field +syn keyword ngxDirectiveThirdParty upload_set_form_field +syn keyword ngxDirectiveThirdParty upload_store +syn keyword ngxDirectiveThirdParty upload_store_access + +" Upload Progress Module +" Tracks and reports upload progress. +syn keyword ngxDirectiveThirdParty report_uploads +syn keyword ngxDirectiveThirdParty track_uploads +syn keyword ngxDirectiveThirdParty upload_progress +syn keyword ngxDirectiveThirdParty upload_progress_content_type +syn keyword ngxDirectiveThirdParty upload_progress_header +syn keyword ngxDirectiveThirdParty upload_progress_json_output +syn keyword ngxDirectiveThirdParty upload_progress_template + +" Upstream Fair Balancer +" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin. +syn keyword ngxDirectiveThirdParty fair +syn keyword ngxDirectiveThirdParty upstream_fair_shm_size + +" Upstream Consistent Hash +" Select backend based on Consistent hash ring. +syn keyword ngxDirectiveThirdParty consistent_hash + +" Upstream Hash Module +" Provides simple upstream load distribution by hashing a configurable variable. +syn keyword ngxDirectiveThirdParty hash +syn keyword ngxDirectiveThirdParty hash_again + +" XSS Module +" Native support for cross-site scripting (XSS) in an nginx. +syn keyword ngxDirectiveThirdParty xss_callback_arg +syn keyword ngxDirectiveThirdParty xss_get +syn keyword ngxDirectiveThirdParty xss_input_types +syn keyword ngxDirectiveThirdParty xss_output_type + +" highlight + +hi link ngxComment Comment +hi link ngxVariable Identifier +hi link ngxVariableBlock Identifier +hi link ngxVariableString PreProc +hi link ngxBlock Normal +hi link ngxString String + +hi link ngxBoolean Boolean +hi link ngxDirectiveBlock Statement +hi link ngxDirectiveImportant Type +hi link ngxDirectiveControl Keyword +hi link ngxDirectiveError Constant +hi link ngxDirectiveDeprecated Error +hi link ngxDirective Identifier +hi link ngxDirectiveThirdParty Special + +let b:current_syntax = "nginx" diff --git a/sources_non_forked/nginx.vim/README b/sources_non_forked/nginx.vim/README new file mode 100644 index 00000000..91ceb224 --- /dev/null +++ b/sources_non_forked/nginx.vim/README @@ -0,0 +1,3 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=1886 + +nginx.vim highlights configuration files for nginx, the high-performance web server (see http://nginx.net). diff --git a/sources_non_forked/nginx.vim/syntax/nginx.vim b/sources_non_forked/nginx.vim/syntax/nginx.vim new file mode 100644 index 00000000..ccd47680 --- /dev/null +++ b/sources_non_forked/nginx.vim/syntax/nginx.vim @@ -0,0 +1,664 @@ +" Vim syntax file +" Language: nginx.conf + +if exists("b:current_syntax") + finish +end + +setlocal iskeyword+=. +setlocal iskeyword+=/ +setlocal iskeyword+=: + +syn match ngxVariable '\$\w\w*' +syn match ngxVariableBlock '\$\w\w*' contained +syn match ngxVariableString '\$\w\w*' contained +syn region ngxBlock start=+^+ end=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline +syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline +syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline +syn match ngxComment ' *#.*$' + +syn keyword ngxBoolean on +syn keyword ngxBoolean off + +syn keyword ngxDirectiveBlock http contained +syn keyword ngxDirectiveBlock mail contained +syn keyword ngxDirectiveBlock events contained +syn keyword ngxDirectiveBlock server contained +syn keyword ngxDirectiveBlock types contained +syn keyword ngxDirectiveBlock location contained +syn keyword ngxDirectiveBlock upstream contained +syn keyword ngxDirectiveBlock charset_map contained +syn keyword ngxDirectiveBlock limit_except contained +syn keyword ngxDirectiveBlock if contained +syn keyword ngxDirectiveBlock geo contained +syn keyword ngxDirectiveBlock map contained + +syn keyword ngxDirectiveImportant include +syn keyword ngxDirectiveImportant root +syn keyword ngxDirectiveImportant server +syn keyword ngxDirectiveImportant server_name +syn keyword ngxDirectiveImportant listen +syn keyword ngxDirectiveImportant internal +syn keyword ngxDirectiveImportant proxy_pass +syn keyword ngxDirectiveImportant memcached_pass +syn keyword ngxDirectiveImportant fastcgi_pass +syn keyword ngxDirectiveImportant try_files + +syn keyword ngxDirectiveControl break +syn keyword ngxDirectiveControl return +syn keyword ngxDirectiveControl rewrite +syn keyword ngxDirectiveControl set + +syn keyword ngxDirectiveError error_page +syn keyword ngxDirectiveError post_action + +syn keyword ngxDirectiveDeprecated connections +syn keyword ngxDirectiveDeprecated imap +syn keyword ngxDirectiveDeprecated open_file_cache_retest +syn keyword ngxDirectiveDeprecated optimize_server_names +syn keyword ngxDirectiveDeprecated satisfy_any + +syn keyword ngxDirective accept_mutex +syn keyword ngxDirective accept_mutex_delay +syn keyword ngxDirective access_log +syn keyword ngxDirective add_after_body +syn keyword ngxDirective add_before_body +syn keyword ngxDirective add_header +syn keyword ngxDirective addition_types +syn keyword ngxDirective aio +syn keyword ngxDirective alias +syn keyword ngxDirective allow +syn keyword ngxDirective ancient_browser +syn keyword ngxDirective ancient_browser_value +syn keyword ngxDirective auth_basic +syn keyword ngxDirective auth_basic_user_file +syn keyword ngxDirective auth_http +syn keyword ngxDirective auth_http_header +syn keyword ngxDirective auth_http_timeout +syn keyword ngxDirective autoindex +syn keyword ngxDirective autoindex_exact_size +syn keyword ngxDirective autoindex_localtime +syn keyword ngxDirective charset +syn keyword ngxDirective charset_types +syn keyword ngxDirective client_body_buffer_size +syn keyword ngxDirective client_body_in_file_only +syn keyword ngxDirective client_body_in_single_buffer +syn keyword ngxDirective client_body_temp_path +syn keyword ngxDirective client_body_timeout +syn keyword ngxDirective client_header_buffer_size +syn keyword ngxDirective client_header_timeout +syn keyword ngxDirective client_max_body_size +syn keyword ngxDirective connection_pool_size +syn keyword ngxDirective create_full_put_path +syn keyword ngxDirective daemon +syn keyword ngxDirective dav_access +syn keyword ngxDirective dav_methods +syn keyword ngxDirective debug_connection +syn keyword ngxDirective debug_points +syn keyword ngxDirective default_type +syn keyword ngxDirective degradation +syn keyword ngxDirective degrade +syn keyword ngxDirective deny +syn keyword ngxDirective devpoll_changes +syn keyword ngxDirective devpoll_events +syn keyword ngxDirective directio +syn keyword ngxDirective directio_alignment +syn keyword ngxDirective empty_gif +syn keyword ngxDirective env +syn keyword ngxDirective epoll_events +syn keyword ngxDirective error_log +syn keyword ngxDirective eventport_events +syn keyword ngxDirective expires +syn keyword ngxDirective fastcgi_bind +syn keyword ngxDirective fastcgi_buffer_size +syn keyword ngxDirective fastcgi_buffers +syn keyword ngxDirective fastcgi_busy_buffers_size +syn keyword ngxDirective fastcgi_cache +syn keyword ngxDirective fastcgi_cache_key +syn keyword ngxDirective fastcgi_cache_methods +syn keyword ngxDirective fastcgi_cache_min_uses +syn keyword ngxDirective fastcgi_cache_path +syn keyword ngxDirective fastcgi_cache_use_stale +syn keyword ngxDirective fastcgi_cache_valid +syn keyword ngxDirective fastcgi_catch_stderr +syn keyword ngxDirective fastcgi_connect_timeout +syn keyword ngxDirective fastcgi_hide_header +syn keyword ngxDirective fastcgi_ignore_client_abort +syn keyword ngxDirective fastcgi_ignore_headers +syn keyword ngxDirective fastcgi_index +syn keyword ngxDirective fastcgi_intercept_errors +syn keyword ngxDirective fastcgi_max_temp_file_size +syn keyword ngxDirective fastcgi_next_upstream +syn keyword ngxDirective fastcgi_param +syn keyword ngxDirective fastcgi_pass_header +syn keyword ngxDirective fastcgi_pass_request_body +syn keyword ngxDirective fastcgi_pass_request_headers +syn keyword ngxDirective fastcgi_read_timeout +syn keyword ngxDirective fastcgi_send_lowat +syn keyword ngxDirective fastcgi_send_timeout +syn keyword ngxDirective fastcgi_split_path_info +syn keyword ngxDirective fastcgi_store +syn keyword ngxDirective fastcgi_store_access +syn keyword ngxDirective fastcgi_temp_file_write_size +syn keyword ngxDirective fastcgi_temp_path +syn keyword ngxDirective fastcgi_upstream_fail_timeout +syn keyword ngxDirective fastcgi_upstream_max_fails +syn keyword ngxDirective flv +syn keyword ngxDirective geoip_city +syn keyword ngxDirective geoip_country +syn keyword ngxDirective google_perftools_profiles +syn keyword ngxDirective gzip +syn keyword ngxDirective gzip_buffers +syn keyword ngxDirective gzip_comp_level +syn keyword ngxDirective gzip_disable +syn keyword ngxDirective gzip_hash +syn keyword ngxDirective gzip_http_version +syn keyword ngxDirective gzip_min_length +syn keyword ngxDirective gzip_no_buffer +syn keyword ngxDirective gzip_proxied +syn keyword ngxDirective gzip_static +syn keyword ngxDirective gzip_types +syn keyword ngxDirective gzip_vary +syn keyword ngxDirective gzip_window +syn keyword ngxDirective if_modified_since +syn keyword ngxDirective ignore_invalid_headers +syn keyword ngxDirective image_filter +syn keyword ngxDirective image_filter_buffer +syn keyword ngxDirective image_filter_jpeg_quality +syn keyword ngxDirective image_filter_transparency +syn keyword ngxDirective imap_auth +syn keyword ngxDirective imap_capabilities +syn keyword ngxDirective imap_client_buffer +syn keyword ngxDirective index +syn keyword ngxDirective ip_hash +syn keyword ngxDirective keepalive_requests +syn keyword ngxDirective keepalive_timeout +syn keyword ngxDirective kqueue_changes +syn keyword ngxDirective kqueue_events +syn keyword ngxDirective large_client_header_buffers +syn keyword ngxDirective limit_conn +syn keyword ngxDirective limit_conn_log_level +syn keyword ngxDirective limit_rate +syn keyword ngxDirective limit_rate_after +syn keyword ngxDirective limit_req +syn keyword ngxDirective limit_req_log_level +syn keyword ngxDirective limit_req_zone +syn keyword ngxDirective limit_zone +syn keyword ngxDirective lingering_time +syn keyword ngxDirective lingering_timeout +syn keyword ngxDirective lock_file +syn keyword ngxDirective log_format +syn keyword ngxDirective log_not_found +syn keyword ngxDirective log_subrequest +syn keyword ngxDirective map_hash_bucket_size +syn keyword ngxDirective map_hash_max_size +syn keyword ngxDirective master_process +syn keyword ngxDirective memcached_bind +syn keyword ngxDirective memcached_buffer_size +syn keyword ngxDirective memcached_connect_timeout +syn keyword ngxDirective memcached_next_upstream +syn keyword ngxDirective memcached_read_timeout +syn keyword ngxDirective memcached_send_timeout +syn keyword ngxDirective memcached_upstream_fail_timeout +syn keyword ngxDirective memcached_upstream_max_fails +syn keyword ngxDirective merge_slashes +syn keyword ngxDirective min_delete_depth +syn keyword ngxDirective modern_browser +syn keyword ngxDirective modern_browser_value +syn keyword ngxDirective msie_padding +syn keyword ngxDirective msie_refresh +syn keyword ngxDirective multi_accept +syn keyword ngxDirective open_file_cache +syn keyword ngxDirective open_file_cache_errors +syn keyword ngxDirective open_file_cache_events +syn keyword ngxDirective open_file_cache_min_uses +syn keyword ngxDirective open_file_cache_valid +syn keyword ngxDirective open_log_file_cache +syn keyword ngxDirective output_buffers +syn keyword ngxDirective override_charset +syn keyword ngxDirective perl +syn keyword ngxDirective perl_modules +syn keyword ngxDirective perl_require +syn keyword ngxDirective perl_set +syn keyword ngxDirective pid +syn keyword ngxDirective pop3_auth +syn keyword ngxDirective pop3_capabilities +syn keyword ngxDirective port_in_redirect +syn keyword ngxDirective postpone_gzipping +syn keyword ngxDirective postpone_output +syn keyword ngxDirective protocol +syn keyword ngxDirective proxy +syn keyword ngxDirective proxy_bind +syn keyword ngxDirective proxy_buffer +syn keyword ngxDirective proxy_buffer_size +syn keyword ngxDirective proxy_buffering +syn keyword ngxDirective proxy_buffers +syn keyword ngxDirective proxy_busy_buffers_size +syn keyword ngxDirective proxy_cache +syn keyword ngxDirective proxy_cache_key +syn keyword ngxDirective proxy_cache_methods +syn keyword ngxDirective proxy_cache_min_uses +syn keyword ngxDirective proxy_cache_path +syn keyword ngxDirective proxy_cache_use_stale +syn keyword ngxDirective proxy_cache_valid +syn keyword ngxDirective proxy_connect_timeout +syn keyword ngxDirective proxy_headers_hash_bucket_size +syn keyword ngxDirective proxy_headers_hash_max_size +syn keyword ngxDirective proxy_hide_header +syn keyword ngxDirective proxy_ignore_client_abort +syn keyword ngxDirective proxy_ignore_headers +syn keyword ngxDirective proxy_intercept_errors +syn keyword ngxDirective proxy_max_temp_file_size +syn keyword ngxDirective proxy_method +syn keyword ngxDirective proxy_next_upstream +syn keyword ngxDirective proxy_pass_error_message +syn keyword ngxDirective proxy_pass_header +syn keyword ngxDirective proxy_pass_request_body +syn keyword ngxDirective proxy_pass_request_headers +syn keyword ngxDirective proxy_read_timeout +syn keyword ngxDirective proxy_redirect +syn keyword ngxDirective proxy_send_lowat +syn keyword ngxDirective proxy_send_timeout +syn keyword ngxDirective proxy_set_body +syn keyword ngxDirective proxy_set_header +syn keyword ngxDirective proxy_ssl_session_reuse +syn keyword ngxDirective proxy_store +syn keyword ngxDirective proxy_store_access +syn keyword ngxDirective proxy_temp_file_write_size +syn keyword ngxDirective proxy_temp_path +syn keyword ngxDirective proxy_timeout +syn keyword ngxDirective proxy_upstream_fail_timeout +syn keyword ngxDirective proxy_upstream_max_fails +syn keyword ngxDirective random_index +syn keyword ngxDirective read_ahead +syn keyword ngxDirective real_ip_header +syn keyword ngxDirective recursive_error_pages +syn keyword ngxDirective request_pool_size +syn keyword ngxDirective reset_timedout_connection +syn keyword ngxDirective resolver +syn keyword ngxDirective resolver_timeout +syn keyword ngxDirective rewrite_log +syn keyword ngxDirective rtsig_overflow_events +syn keyword ngxDirective rtsig_overflow_test +syn keyword ngxDirective rtsig_overflow_threshold +syn keyword ngxDirective rtsig_signo +syn keyword ngxDirective satisfy +syn keyword ngxDirective secure_link_secret +syn keyword ngxDirective send_lowat +syn keyword ngxDirective send_timeout +syn keyword ngxDirective sendfile +syn keyword ngxDirective sendfile_max_chunk +syn keyword ngxDirective server_name_in_redirect +syn keyword ngxDirective server_names_hash_bucket_size +syn keyword ngxDirective server_names_hash_max_size +syn keyword ngxDirective server_tokens +syn keyword ngxDirective set_real_ip_from +syn keyword ngxDirective smtp_auth +syn keyword ngxDirective smtp_capabilities +syn keyword ngxDirective smtp_client_buffer +syn keyword ngxDirective smtp_greeting_delay +syn keyword ngxDirective so_keepalive +syn keyword ngxDirective source_charset +syn keyword ngxDirective ssi +syn keyword ngxDirective ssi_ignore_recycled_buffers +syn keyword ngxDirective ssi_min_file_chunk +syn keyword ngxDirective ssi_silent_errors +syn keyword ngxDirective ssi_types +syn keyword ngxDirective ssi_value_length +syn keyword ngxDirective ssl +syn keyword ngxDirective ssl_certificate +syn keyword ngxDirective ssl_certificate_key +syn keyword ngxDirective ssl_ciphers +syn keyword ngxDirective ssl_client_certificate +syn keyword ngxDirective ssl_crl +syn keyword ngxDirective ssl_dhparam +syn keyword ngxDirective ssl_engine +syn keyword ngxDirective ssl_prefer_server_ciphers +syn keyword ngxDirective ssl_protocols +syn keyword ngxDirective ssl_session_cache +syn keyword ngxDirective ssl_session_timeout +syn keyword ngxDirective ssl_verify_client +syn keyword ngxDirective ssl_verify_depth +syn keyword ngxDirective starttls +syn keyword ngxDirective stub_status +syn keyword ngxDirective sub_filter +syn keyword ngxDirective sub_filter_once +syn keyword ngxDirective sub_filter_types +syn keyword ngxDirective tcp_nodelay +syn keyword ngxDirective tcp_nopush +syn keyword ngxDirective thread_stack_size +syn keyword ngxDirective timeout +syn keyword ngxDirective timer_resolution +syn keyword ngxDirective types_hash_bucket_size +syn keyword ngxDirective types_hash_max_size +syn keyword ngxDirective underscores_in_headers +syn keyword ngxDirective uninitialized_variable_warn +syn keyword ngxDirective use +syn keyword ngxDirective user +syn keyword ngxDirective userid +syn keyword ngxDirective userid_domain +syn keyword ngxDirective userid_expires +syn keyword ngxDirective userid_mark +syn keyword ngxDirective userid_name +syn keyword ngxDirective userid_p3p +syn keyword ngxDirective userid_path +syn keyword ngxDirective userid_service +syn keyword ngxDirective valid_referers +syn keyword ngxDirective variables_hash_bucket_size +syn keyword ngxDirective variables_hash_max_size +syn keyword ngxDirective worker_connections +syn keyword ngxDirective worker_cpu_affinity +syn keyword ngxDirective worker_priority +syn keyword ngxDirective worker_processes +syn keyword ngxDirective worker_rlimit_core +syn keyword ngxDirective worker_rlimit_nofile +syn keyword ngxDirective worker_rlimit_sigpending +syn keyword ngxDirective worker_threads +syn keyword ngxDirective working_directory +syn keyword ngxDirective xclient +syn keyword ngxDirective xml_entities +syn keyword ngxDirective xslt_stylesheet +syn keyword ngxDirective xslt_types + +" 3rd party module list: +" http://wiki.nginx.org/Nginx3rdPartyModules + +" Accept Language Module +" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales. +syn keyword ngxDirectiveThirdParty set_from_accept_language + +" Access Key Module +" Denies access unless the request URL contains an access key. +syn keyword ngxDirectiveThirdParty accesskey +syn keyword ngxDirectiveThirdParty accesskey_arg +syn keyword ngxDirectiveThirdParty accesskey_hashmethod +syn keyword ngxDirectiveThirdParty accesskey_signature + +" Auth PAM Module +" HTTP Basic Authentication using PAM. +syn keyword ngxDirectiveThirdParty auth_pam +syn keyword ngxDirectiveThirdParty auth_pam_service_name + +" Cache Purge Module +" Module adding ability to purge content from FastCGI and proxy caches. +syn keyword ngxDirectiveThirdParty fastcgi_cache_purge +syn keyword ngxDirectiveThirdParty proxy_cache_purge + +" Chunkin Module +" HTTP 1.1 chunked-encoding request body support for Nginx. +syn keyword ngxDirectiveThirdParty chunkin +syn keyword ngxDirectiveThirdParty chunkin_keepalive +syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf +syn keyword ngxDirectiveThirdParty chunkin_resume + +" Circle GIF Module +" Generates simple circle images with the colors and size specified in the URL. +syn keyword ngxDirectiveThirdParty circle_gif +syn keyword ngxDirectiveThirdParty circle_gif_max_radius +syn keyword ngxDirectiveThirdParty circle_gif_min_radius +syn keyword ngxDirectiveThirdParty circle_gif_step_radius + +" Drizzle Module +" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle. +syn keyword ngxDirectiveThirdParty drizzle_connect_timeout +syn keyword ngxDirectiveThirdParty drizzle_dbname +syn keyword ngxDirectiveThirdParty drizzle_keepalive +syn keyword ngxDirectiveThirdParty drizzle_module_header +syn keyword ngxDirectiveThirdParty drizzle_pass +syn keyword ngxDirectiveThirdParty drizzle_query +syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout +syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout +syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout +syn keyword ngxDirectiveThirdParty drizzle_server + +" Echo Module +" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file. +syn keyword ngxDirectiveThirdParty echo +syn keyword ngxDirectiveThirdParty echo_after_body +syn keyword ngxDirectiveThirdParty echo_before_body +syn keyword ngxDirectiveThirdParty echo_blocking_sleep +syn keyword ngxDirectiveThirdParty echo_duplicate +syn keyword ngxDirectiveThirdParty echo_end +syn keyword ngxDirectiveThirdParty echo_exec +syn keyword ngxDirectiveThirdParty echo_flush +syn keyword ngxDirectiveThirdParty echo_foreach_split +syn keyword ngxDirectiveThirdParty echo_location +syn keyword ngxDirectiveThirdParty echo_location_async +syn keyword ngxDirectiveThirdParty echo_read_request_body +syn keyword ngxDirectiveThirdParty echo_request_body +syn keyword ngxDirectiveThirdParty echo_reset_timer +syn keyword ngxDirectiveThirdParty echo_sleep +syn keyword ngxDirectiveThirdParty echo_subrequest +syn keyword ngxDirectiveThirdParty echo_subrequest_async + +" Events Module +" Privides options for start/stop events. +syn keyword ngxDirectiveThirdParty on_start +syn keyword ngxDirectiveThirdParty on_stop + +" EY Balancer Module +" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream. +syn keyword ngxDirectiveThirdParty max_connections +syn keyword ngxDirectiveThirdParty max_connections_max_queue_length +syn keyword ngxDirectiveThirdParty max_connections_queue_timeout + +" Fancy Indexes Module +" Like the built-in autoindex module, but fancier. +syn keyword ngxDirectiveThirdParty fancyindex +syn keyword ngxDirectiveThirdParty fancyindex_exact_size +syn keyword ngxDirectiveThirdParty fancyindex_footer +syn keyword ngxDirectiveThirdParty fancyindex_header +syn keyword ngxDirectiveThirdParty fancyindex_localtime +syn keyword ngxDirectiveThirdParty fancyindex_readme +syn keyword ngxDirectiveThirdParty fancyindex_readme_mode + +" GeoIP Module (DEPRECATED) +" Country code lookups via the MaxMind GeoIP API. +syn keyword ngxDirectiveThirdParty geoip_country_file + +" Headers More Module +" Set and clear input and output headers...more than "add"! +syn keyword ngxDirectiveThirdParty more_clear_headers +syn keyword ngxDirectiveThirdParty more_clear_input_headers +syn keyword ngxDirectiveThirdParty more_set_headers +syn keyword ngxDirectiveThirdParty more_set_input_headers + +" HTTP Push Module +" Turn Nginx into an adept long-polling HTTP Push (Comet) server. +syn keyword ngxDirectiveThirdParty push_buffer_size +syn keyword ngxDirectiveThirdParty push_listener +syn keyword ngxDirectiveThirdParty push_message_timeout +syn keyword ngxDirectiveThirdParty push_queue_messages +syn keyword ngxDirectiveThirdParty push_sender + +" HTTP Redis Module > +" Redis support.> +syn keyword ngxDirectiveThirdParty redis_bind +syn keyword ngxDirectiveThirdParty redis_buffer_size +syn keyword ngxDirectiveThirdParty redis_connect_timeout +syn keyword ngxDirectiveThirdParty redis_next_upstream +syn keyword ngxDirectiveThirdParty redis_pass +syn keyword ngxDirectiveThirdParty redis_read_timeout +syn keyword ngxDirectiveThirdParty redis_send_timeout + +" HTTP JavaScript Module +" Embedding SpiderMonkey. Nearly full port on Perl module. +syn keyword ngxDirectiveThirdParty js +syn keyword ngxDirectiveThirdParty js_filter +syn keyword ngxDirectiveThirdParty js_filter_types +syn keyword ngxDirectiveThirdParty js_load +syn keyword ngxDirectiveThirdParty js_maxmem +syn keyword ngxDirectiveThirdParty js_require +syn keyword ngxDirectiveThirdParty js_set +syn keyword ngxDirectiveThirdParty js_utf8 + +" Log Request Speed +" Log the time it took to process each request. +syn keyword ngxDirectiveThirdParty log_request_speed_filter +syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout + +" Memc Module +" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands. +syn keyword ngxDirectiveThirdParty memc_buffer_size +syn keyword ngxDirectiveThirdParty memc_cmds_allowed +syn keyword ngxDirectiveThirdParty memc_connect_timeout +syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified +syn keyword ngxDirectiveThirdParty memc_next_upstream +syn keyword ngxDirectiveThirdParty memc_pass +syn keyword ngxDirectiveThirdParty memc_read_timeout +syn keyword ngxDirectiveThirdParty memc_send_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_max_fails + +" Mogilefs Module +" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS. +syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout +syn keyword ngxDirectiveThirdParty mogilefs_domain +syn keyword ngxDirectiveThirdParty mogilefs_methods +syn keyword ngxDirectiveThirdParty mogilefs_noverify +syn keyword ngxDirectiveThirdParty mogilefs_pass +syn keyword ngxDirectiveThirdParty mogilefs_read_timeout +syn keyword ngxDirectiveThirdParty mogilefs_send_timeout +syn keyword ngxDirectiveThirdParty mogilefs_tracker + +" MP4 Streaming Lite Module +" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL. +syn keyword ngxDirectiveThirdParty mp4 + +" Nginx Notice Module +" Serve static file to POST requests. +syn keyword ngxDirectiveThirdParty notice +syn keyword ngxDirectiveThirdParty notice_type + +" Phusion Passenger +" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers. +syn keyword ngxDirectiveThirdParty passenger_base_uri +syn keyword ngxDirectiveThirdParty passenger_default_user +syn keyword ngxDirectiveThirdParty passenger_enabled +syn keyword ngxDirectiveThirdParty passenger_log_level +syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app +syn keyword ngxDirectiveThirdParty passenger_max_pool_size +syn keyword ngxDirectiveThirdParty passenger_pool_idle_time +syn keyword ngxDirectiveThirdParty passenger_root +syn keyword ngxDirectiveThirdParty passenger_ruby +syn keyword ngxDirectiveThirdParty passenger_use_global_queue +syn keyword ngxDirectiveThirdParty passenger_user_switching +syn keyword ngxDirectiveThirdParty rack_env +syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_env +syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_spawn_method + +" RDS JSON Module +" Help ngx_drizzle and other DBD modules emit JSON data. +syn keyword ngxDirectiveThirdParty rds_json +syn keyword ngxDirectiveThirdParty rds_json_content_type +syn keyword ngxDirectiveThirdParty rds_json_format +syn keyword ngxDirectiveThirdParty rds_json_ret + +" RRD Graph Module +" This module provides an HTTP interface to RRDtool's graphing facilities. +syn keyword ngxDirectiveThirdParty rrd_graph +syn keyword ngxDirectiveThirdParty rrd_graph_root + +" Secure Download +" Create expiring links. +syn keyword ngxDirectiveThirdParty secure_download +syn keyword ngxDirectiveThirdParty secure_download_fail_location +syn keyword ngxDirectiveThirdParty secure_download_path_mode +syn keyword ngxDirectiveThirdParty secure_download_secret + +" SlowFS Cache Module +" Module adding ability to cache static files. +syn keyword ngxDirectiveThirdParty slowfs_big_file_size +syn keyword ngxDirectiveThirdParty slowfs_cache +syn keyword ngxDirectiveThirdParty slowfs_cache_key +syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses +syn keyword ngxDirectiveThirdParty slowfs_cache_path +syn keyword ngxDirectiveThirdParty slowfs_cache_purge +syn keyword ngxDirectiveThirdParty slowfs_cache_valid +syn keyword ngxDirectiveThirdParty slowfs_temp_path + +" Strip Module +" Whitespace remover. +syn keyword ngxDirectiveThirdParty strip + +" Substitutions Module +" A filter module which can do both regular expression and fixed string substitutions on response bodies. +syn keyword ngxDirectiveThirdParty subs_filter +syn keyword ngxDirectiveThirdParty subs_filter_types + +" Supervisord Module +" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand. +syn keyword ngxDirectiveThirdParty supervisord +syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status +syn keyword ngxDirectiveThirdParty supervisord_name +syn keyword ngxDirectiveThirdParty supervisord_start +syn keyword ngxDirectiveThirdParty supervisord_stop + +" Upload Module +" Parses multipart/form-data allowing arbitrary handling of uploaded files. +syn keyword ngxDirectiveThirdParty upload_aggregate_form_field +syn keyword ngxDirectiveThirdParty upload_buffer_size +syn keyword ngxDirectiveThirdParty upload_cleanup +syn keyword ngxDirectiveThirdParty upload_limit_rate +syn keyword ngxDirectiveThirdParty upload_max_file_size +syn keyword ngxDirectiveThirdParty upload_max_output_body_len +syn keyword ngxDirectiveThirdParty upload_max_part_header_len +syn keyword ngxDirectiveThirdParty upload_pass +syn keyword ngxDirectiveThirdParty upload_pass_args +syn keyword ngxDirectiveThirdParty upload_pass_form_field +syn keyword ngxDirectiveThirdParty upload_set_form_field +syn keyword ngxDirectiveThirdParty upload_store +syn keyword ngxDirectiveThirdParty upload_store_access + +" Upload Progress Module +" Tracks and reports upload progress. +syn keyword ngxDirectiveThirdParty report_uploads +syn keyword ngxDirectiveThirdParty track_uploads +syn keyword ngxDirectiveThirdParty upload_progress +syn keyword ngxDirectiveThirdParty upload_progress_content_type +syn keyword ngxDirectiveThirdParty upload_progress_header +syn keyword ngxDirectiveThirdParty upload_progress_json_output +syn keyword ngxDirectiveThirdParty upload_progress_template + +" Upstream Fair Balancer +" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin. +syn keyword ngxDirectiveThirdParty fair +syn keyword ngxDirectiveThirdParty upstream_fair_shm_size + +" Upstream Consistent Hash +" Select backend based on Consistent hash ring. +syn keyword ngxDirectiveThirdParty consistent_hash + +" Upstream Hash Module +" Provides simple upstream load distribution by hashing a configurable variable. +syn keyword ngxDirectiveThirdParty hash +syn keyword ngxDirectiveThirdParty hash_again + +" XSS Module +" Native support for cross-site scripting (XSS) in an nginx. +syn keyword ngxDirectiveThirdParty xss_callback_arg +syn keyword ngxDirectiveThirdParty xss_get +syn keyword ngxDirectiveThirdParty xss_input_types +syn keyword ngxDirectiveThirdParty xss_output_type + +" highlight + +hi link ngxComment Comment +hi link ngxVariable Identifier +hi link ngxVariableBlock Identifier +hi link ngxVariableString PreProc +hi link ngxBlock Normal +hi link ngxString String + +hi link ngxBoolean Boolean +hi link ngxDirectiveBlock Statement +hi link ngxDirectiveImportant Type +hi link ngxDirectiveControl Keyword +hi link ngxDirectiveError Constant +hi link ngxDirectiveDeprecated Error +hi link ngxDirective Identifier +hi link ngxDirectiveThirdParty Special + +let b:current_syntax = "nginx" diff --git a/sources_non_forked/snipmate-snippets/.gitignore b/sources_non_forked/snipmate-snippets/.gitignore new file mode 100644 index 00000000..da39d981 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/.gitignore @@ -0,0 +1,16 @@ +*~ +.DS_Store + +*.log +*.tmp +*.swp +*.old +*.bkp +*.zip +*.rar +*.arj +*.[t]gz +*.[t]bz2 + +tmp/ +log/ diff --git a/sources_non_forked/snipmate-snippets/README.md b/sources_non_forked/snipmate-snippets/README.md deleted file mode 100644 index f1f8bac9..00000000 --- a/sources_non_forked/snipmate-snippets/README.md +++ /dev/null @@ -1,47 +0,0 @@ -Snipmate Snippets -================= - -This repository contains snippets files for various programming languages for -the famous [snipMate][1] plugin for vim. This repository is -community-maintained and many people have contributed snippet files and other -improvements already. - -[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now -unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a -[fork][4] of the project in hopes of improving the existing code base. - -Language maintainers --------------------- - -No one can really be proficient in all programming languages. If you would like -to maintain snippets for a language, please get in touch. - -* Python - [honza](http://github.com/honza) -* Javascript - [honza](http://github.com/honza) -* HTML Django - [honza](http://github.com/honza) -* Markdown - [honza](http://github.com/honza) -* Ruby - [taq](http://github.com/taq) -* PHP - [chrisyue](http://github.com/chrisyue) - -Contributing notes ------------------- - -Until further work is done on `vim-snipmate`, please don't add folding markers -into snippets. - -Authors -------- - -For a list of authors, please see the `AUTHORS` files. - -License -------- - -Just as the original snipMate plugin, all the snippets are licensed under the -terms of the MIT license. - - -[1]: http://github.com/garbas/vim-snipmate -[2]: http://github.com/msanders -[3]: http://github.com/garbas -[4]: http://github.com/garbas/vim-snipmate diff --git a/sources_non_forked/snipmate-snippets/Rakefile b/sources_non_forked/snipmate-snippets/Rakefile new file mode 100644 index 00000000..15cece2f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/Rakefile @@ -0,0 +1,24 @@ +#require 'fileutils' +#include FileUtils + +namespace :snippets_dir do + task :find do + vim_dir = File.join(ENV['VIMFILES'] || ENV['HOME'] || ENV['USERPROFILE'], RUBY_PLATFORM =~ /mswin|msys|mingw32/ ? "vimfiles" : ".vim") + pathogen_dir = File.join(vim_dir, "bundle") + @snippets_dir = File.directory?(pathogen_dir) ? File.join(pathogen_dir, "snipmate", "snippets") : File.join(vim_dir, "snippets") + end + + desc "Purge the contents of the vim snippets directory" + task :purge => ["snippets_dir:find"] do + rm_rf @snippets_dir, :verbose => true if File.directory? @snippets_dir + mkdir @snippets_dir, :verbose => true + end +end + +desc "Copy the snippets directories into ~/.vim/snippets" +task :deploy_local => ["snippets_dir:purge"] do + Dir.foreach(".") do |f| + cp_r f, @snippets_dir, :verbose => true if File.directory?(f) && f =~ /^[^\.]/ + end + cp "support_functions.vim", @snippets_dir, :verbose => true +end diff --git a/sources_non_forked/snipmate-snippets/_/date/date + time.snippet b/sources_non_forked/snipmate-snippets/_/date/date + time.snippet new file mode 100644 index 00000000..c6a0e433 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/_/date/date + time.snippet @@ -0,0 +1 @@ +`strftime("%Y-%m-%d %H:%M:%S")` diff --git a/sources_non_forked/snipmate-snippets/_/date/date.snippet b/sources_non_forked/snipmate-snippets/_/date/date.snippet new file mode 100644 index 00000000..5d89951b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/_/date/date.snippet @@ -0,0 +1 @@ +`strftime("%Y-%m-%d")` diff --git a/sources_non_forked/snipmate-snippets/_/lorem.snippet b/sources_non_forked/snipmate-snippets/_/lorem.snippet new file mode 100644 index 00000000..cee7a927 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/_/lorem.snippet @@ -0,0 +1 @@ +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/sources_non_forked/snipmate-snippets/_/modeline.snippet b/sources_non_forked/snipmate-snippets/_/modeline.snippet new file mode 100644 index 00000000..bf0dfa3b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/_/modeline.snippet @@ -0,0 +1 @@ +`Snippet_Modeline()` diff --git a/sources_non_forked/snipmate-snippets/ant/skel/basic.snippet b/sources_non_forked/snipmate-snippets/ant/skel/basic.snippet new file mode 100644 index 00000000..276cf7db --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ant/skel/basic.snippet @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources_non_forked/snipmate-snippets/c/cl.snippet b/sources_non_forked/snipmate-snippets/c/cl.snippet new file mode 100644 index 00000000..81962872 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/cl.snippet @@ -0,0 +1,7 @@ +class ${1:`Filename('$1_t', 'name')`} { + public: + $1 (${2:arguments}); + virtual ~$1 (); + private: + ${3:/* data */} +}; diff --git a/sources_non_forked/snipmate-snippets/c/def.snippet b/sources_non_forked/snipmate-snippets/c/def.snippet new file mode 100644 index 00000000..35f73310 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/def.snippet @@ -0,0 +1,3 @@ +#ifndef $1 +#define ${1:SYMBOL} ${2:value} +#endif${3} diff --git a/sources_non_forked/snipmate-snippets/c/do.snippet b/sources_non_forked/snipmate-snippets/c/do.snippet new file mode 100644 index 00000000..9435f159 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/do.snippet @@ -0,0 +1,3 @@ +do { + ${2:/* code */} +} while (${1:/* condition */}); diff --git a/sources_non_forked/snipmate-snippets/c/el.snippet b/sources_non_forked/snipmate-snippets/c/el.snippet new file mode 100644 index 00000000..5966669a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/el.snippet @@ -0,0 +1,3 @@ +else { + ${1} +} diff --git a/sources_non_forked/snipmate-snippets/c/for.snippet b/sources_non_forked/snipmate-snippets/c/for.snippet new file mode 100644 index 00000000..58d6c36a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/for.snippet @@ -0,0 +1,3 @@ +for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} +} diff --git a/sources_non_forked/snipmate-snippets/c/forr.snippet b/sources_non_forked/snipmate-snippets/c/forr.snippet new file mode 100644 index 00000000..ea5b430b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/forr.snippet @@ -0,0 +1,3 @@ +for (${1:i} = 0; ${2:$1 < 5}; $1${3:++}) { + ${4:/* code */} +} diff --git a/sources_non_forked/snipmate-snippets/c/fpf.snippet b/sources_non_forked/snipmate-snippets/c/fpf.snippet new file mode 100644 index 00000000..53aed564 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/fpf.snippet @@ -0,0 +1 @@ +fprintf(${1:stderr}, "${2:%s}\n"${3});${4} diff --git a/sources_non_forked/snipmate-snippets/c/fun.snippet b/sources_non_forked/snipmate-snippets/c/fun.snippet new file mode 100644 index 00000000..b9d7663c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/fun.snippet @@ -0,0 +1,4 @@ +${1:void} ${2:function_name} (${3}) +{ + ${4:/* code */} +} diff --git a/sources_non_forked/snipmate-snippets/c/if.snippet b/sources_non_forked/snipmate-snippets/c/if.snippet new file mode 100644 index 00000000..df32c281 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/if.snippet @@ -0,0 +1,3 @@ +if (${1:/* condition */}) { + ${2:/* code */} +} diff --git a/sources_non_forked/snipmate-snippets/c/inc/inc.snippet b/sources_non_forked/snipmate-snippets/c/inc/inc.snippet new file mode 100644 index 00000000..302edffd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/inc/inc.snippet @@ -0,0 +1 @@ +#include "${1:`Filename("$1.h")`}"${2} diff --git a/sources_non_forked/snipmate-snippets/c/inc/inc_global.snippet b/sources_non_forked/snipmate-snippets/c/inc/inc_global.snippet new file mode 100644 index 00000000..cf049935 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/inc/inc_global.snippet @@ -0,0 +1 @@ +#include <${1:stdio}.h>${2} diff --git a/sources_non_forked/snipmate-snippets/c/main.snippet b/sources_non_forked/snipmate-snippets/c/main.snippet new file mode 100644 index 00000000..bbfd8bfb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/main.snippet @@ -0,0 +1,5 @@ +int main (int argc, char const* argv[]) +{ + ${1:/* code */} + return 0; +} diff --git a/sources_non_forked/snipmate-snippets/c/map.snippet b/sources_non_forked/snipmate-snippets/c/map.snippet new file mode 100644 index 00000000..59c4205b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/map.snippet @@ -0,0 +1 @@ +std::map<${1:key}, ${2:value}> map${3}; diff --git a/sources_non_forked/snipmate-snippets/c/ns.snippet b/sources_non_forked/snipmate-snippets/c/ns.snippet new file mode 100644 index 00000000..d9b0b337 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/ns.snippet @@ -0,0 +1,3 @@ +namespace ${1:`Filename('', 'my')`} { + ${2} +} /* $1 */ diff --git a/sources_non_forked/snipmate-snippets/c/once.snippet b/sources_non_forked/snipmate-snippets/c/once.snippet new file mode 100644 index 00000000..7b70667f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/once.snippet @@ -0,0 +1,6 @@ +#ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`} +#define $1 + +${2} + +#endif /* end of include guard: $1 */ diff --git a/sources_non_forked/snipmate-snippets/c/pr.snippet b/sources_non_forked/snipmate-snippets/c/pr.snippet new file mode 100644 index 00000000..0dd78dc6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/pr.snippet @@ -0,0 +1 @@ +printf("${1:%s}\n"${2});${3} diff --git a/sources_non_forked/snipmate-snippets/c/readfile.snippet b/sources_non_forked/snipmate-snippets/c/readfile.snippet new file mode 100644 index 00000000..9aaf9c36 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/readfile.snippet @@ -0,0 +1,7 @@ +std::vector v; +if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), $2)) + v.insert(v.end(), buf, buf + len); + fclose($2); +}${3} diff --git a/sources_non_forked/snipmate-snippets/c/st.snippet b/sources_non_forked/snipmate-snippets/c/st.snippet new file mode 100644 index 00000000..95b798ae --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/st.snippet @@ -0,0 +1,3 @@ +struct ${1:`Filename('$1_t', 'name')`} { + ${2:/* data */} +}${3: /* optional variable list */};${4} diff --git a/sources_non_forked/snipmate-snippets/c/t.snippet b/sources_non_forked/snipmate-snippets/c/t.snippet new file mode 100644 index 00000000..dbc2f2be --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/t.snippet @@ -0,0 +1 @@ +${1:/* condition */} ? ${2:a} : ${3:b}' diff --git a/sources_non_forked/snipmate-snippets/c/td.snippet b/sources_non_forked/snipmate-snippets/c/td.snippet new file mode 100644 index 00000000..61b147a2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/td.snippet @@ -0,0 +1 @@ +typedef ${1:int} ${2:MyCustomType}; diff --git a/sources_non_forked/snipmate-snippets/c/tds.snippet b/sources_non_forked/snipmate-snippets/c/tds.snippet new file mode 100644 index 00000000..fea80d2a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/tds.snippet @@ -0,0 +1,3 @@ +typedef struct { + ${2:/* data */} +} ${1:`Filename('$1_t', 'name')`}; diff --git a/sources_non_forked/snipmate-snippets/c/vector.snippet b/sources_non_forked/snipmate-snippets/c/vector.snippet new file mode 100644 index 00000000..f26dc223 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/vector.snippet @@ -0,0 +1 @@ +std::vector<${1:char}> v${2}; diff --git a/sources_non_forked/snipmate-snippets/c/wh.snippet b/sources_non_forked/snipmate-snippets/c/wh.snippet new file mode 100644 index 00000000..318ca590 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/c/wh.snippet @@ -0,0 +1,3 @@ +while (${1:/* condition */}) { + ${2:/* code */} +} diff --git a/sources_non_forked/snipmate-snippets/css/#.snippet b/sources_non_forked/snipmate-snippets/css/#.snippet new file mode 100644 index 00000000..5a926818 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/#.snippet @@ -0,0 +1,3 @@ +#${1:id} { + ${2} +} diff --git a/sources_non_forked/snipmate-snippets/css/background/all.snippet b/sources_non_forked/snipmate-snippets/css/background/all.snippet new file mode 100644 index 00000000..5e94d2c2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/all.snippet @@ -0,0 +1 @@ +background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/attachment.snippet b/sources_non_forked/snipmate-snippets/css/background/attachment.snippet new file mode 100644 index 00000000..cb0c8f81 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/attachment.snippet @@ -0,0 +1 @@ +background-attachment: ${1:scroll/fixed};$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/color.snippet b/sources_non_forked/snipmate-snippets/css/background/color.snippet new file mode 100644 index 00000000..ebf4bc70 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/color.snippet @@ -0,0 +1 @@ +background-color: #${1:DDD};$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/color_name.snippet b/sources_non_forked/snipmate-snippets/css/background/color_name.snippet new file mode 100644 index 00000000..c736f990 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/color_name.snippet @@ -0,0 +1 @@ +background-color: ${1:red};$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/color_rgb.snippet b/sources_non_forked/snipmate-snippets/css/background/color_rgb.snippet new file mode 100644 index 00000000..a818f86e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/color_rgb.snippet @@ -0,0 +1 @@ +background-color: rgb(${1:255},${2:255},${3:255});$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/color_transparent.snippet b/sources_non_forked/snipmate-snippets/css/background/color_transparent.snippet new file mode 100644 index 00000000..d4ecdd13 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/color_transparent.snippet @@ -0,0 +1 @@ +background-color: transparent;$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/image_none.snippet b/sources_non_forked/snipmate-snippets/css/background/image_none.snippet new file mode 100644 index 00000000..1112ab7d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/image_none.snippet @@ -0,0 +1 @@ +background-image: none;$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/image_url.snippet b/sources_non_forked/snipmate-snippets/css/background/image_url.snippet new file mode 100644 index 00000000..83bee3e8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/image_url.snippet @@ -0,0 +1 @@ +background-image: url($1);$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/position.snippet b/sources_non_forked/snipmate-snippets/css/background/position.snippet new file mode 100644 index 00000000..ccdcb692 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/position.snippet @@ -0,0 +1 @@ +background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0 diff --git a/sources_non_forked/snipmate-snippets/css/background/repeat.snippet b/sources_non_forked/snipmate-snippets/css/background/repeat.snippet new file mode 100644 index 00000000..5c6ce160 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/background/repeat.snippet @@ -0,0 +1 @@ +background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0 diff --git a/sources_non_forked/snipmate-snippets/css/border/basic.snippet b/sources_non_forked/snipmate-snippets/css/border/basic.snippet new file mode 100644 index 00000000..bb6adc0d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/border/basic.snippet @@ -0,0 +1 @@ +border: ${1:1px} ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/border/color.snippet b/sources_non_forked/snipmate-snippets/css/border/color.snippet new file mode 100644 index 00000000..b3e7721a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/border/color.snippet @@ -0,0 +1 @@ +border-color: ${1:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/border/style.snippet b/sources_non_forked/snipmate-snippets/css/border/style.snippet new file mode 100644 index 00000000..0dac5f13 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/border/style.snippet @@ -0,0 +1 @@ +border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 diff --git a/sources_non_forked/snipmate-snippets/css/border/width.snippet b/sources_non_forked/snipmate-snippets/css/border/width.snippet new file mode 100644 index 00000000..7c5fba05 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/border/width.snippet @@ -0,0 +1 @@ +border-width: ${1:1px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderb/basic.snippet b/sources_non_forked/snipmate-snippets/css/borderb/basic.snippet new file mode 100644 index 00000000..e0b7c21d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderb/basic.snippet @@ -0,0 +1 @@ +border-bottom: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderb/color.snippet b/sources_non_forked/snipmate-snippets/css/borderb/color.snippet new file mode 100644 index 00000000..d980e498 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderb/color.snippet @@ -0,0 +1 @@ +border-bottom-color: #${1:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderb/style.snippet b/sources_non_forked/snipmate-snippets/css/borderb/style.snippet new file mode 100644 index 00000000..24617c61 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderb/style.snippet @@ -0,0 +1 @@ +border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderb/width.snippet b/sources_non_forked/snipmate-snippets/css/borderb/width.snippet new file mode 100644 index 00000000..2689cd56 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderb/width.snippet @@ -0,0 +1 @@ +border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderl/basic.snippet b/sources_non_forked/snipmate-snippets/css/borderl/basic.snippet new file mode 100644 index 00000000..dd4dd2ab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderl/basic.snippet @@ -0,0 +1 @@ +border-left: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderl/color.snippet b/sources_non_forked/snipmate-snippets/css/borderl/color.snippet new file mode 100644 index 00000000..68afecb1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderl/color.snippet @@ -0,0 +1 @@ +border-left-color: #${1:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderl/style.snippet b/sources_non_forked/snipmate-snippets/css/borderl/style.snippet new file mode 100644 index 00000000..074cbfa8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderl/style.snippet @@ -0,0 +1 @@ +border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderl/width.snippet b/sources_non_forked/snipmate-snippets/css/borderl/width.snippet new file mode 100644 index 00000000..1e2acefc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderl/width.snippet @@ -0,0 +1 @@ +border-left-width: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderr/basic.snippet b/sources_non_forked/snipmate-snippets/css/borderr/basic.snippet new file mode 100644 index 00000000..a0a3e4bf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderr/basic.snippet @@ -0,0 +1 @@ +border-right: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderr/color.snippet b/sources_non_forked/snipmate-snippets/css/borderr/color.snippet new file mode 100644 index 00000000..320acccd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderr/color.snippet @@ -0,0 +1 @@ +border-right-color: #${1:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderr/style.snippet b/sources_non_forked/snipmate-snippets/css/borderr/style.snippet new file mode 100644 index 00000000..8b03f66a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderr/style.snippet @@ -0,0 +1 @@ +border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 diff --git a/sources_non_forked/snipmate-snippets/css/borderr/width.snippet b/sources_non_forked/snipmate-snippets/css/borderr/width.snippet new file mode 100644 index 00000000..9df04266 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/borderr/width.snippet @@ -0,0 +1 @@ +border-right-width: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/bordert/basic.snippet b/sources_non_forked/snipmate-snippets/css/bordert/basic.snippet new file mode 100644 index 00000000..e2334480 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/bordert/basic.snippet @@ -0,0 +1 @@ +border-top: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/bordert/color.snippet b/sources_non_forked/snipmate-snippets/css/bordert/color.snippet new file mode 100644 index 00000000..1a79fb44 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/bordert/color.snippet @@ -0,0 +1 @@ +border-top-color: #${1:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/bordert/style.snippet b/sources_non_forked/snipmate-snippets/css/bordert/style.snippet new file mode 100644 index 00000000..d6ae011b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/bordert/style.snippet @@ -0,0 +1 @@ +border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0 diff --git a/sources_non_forked/snipmate-snippets/css/bordert/width.snippet b/sources_non_forked/snipmate-snippets/css/bordert/width.snippet new file mode 100644 index 00000000..5faaef19 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/bordert/width.snippet @@ -0,0 +1 @@ +border-top-width: ${1:1}px ${2:solid} #${3:999};$0 diff --git a/sources_non_forked/snipmate-snippets/css/cl.snippet b/sources_non_forked/snipmate-snippets/css/cl.snippet new file mode 100644 index 00000000..a13d1209 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/cl.snippet @@ -0,0 +1,3 @@ +.${1:class} { + ${2:color: pink;} +} diff --git a/sources_non_forked/snipmate-snippets/css/clear.snippet b/sources_non_forked/snipmate-snippets/css/clear.snippet new file mode 100644 index 00000000..16b3930a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/clear.snippet @@ -0,0 +1 @@ +clear: ${1:left/right/both/none};$0 diff --git a/sources_non_forked/snipmate-snippets/css/color.snippet b/sources_non_forked/snipmate-snippets/css/color.snippet new file mode 100644 index 00000000..3d2728af --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/color.snippet @@ -0,0 +1 @@ +color: #${1:DDD};$0 diff --git a/sources_non_forked/snipmate-snippets/css/colorn.snippet b/sources_non_forked/snipmate-snippets/css/colorn.snippet new file mode 100644 index 00000000..52da6c9a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/colorn.snippet @@ -0,0 +1 @@ +color: ${1:red};$0 diff --git a/sources_non_forked/snipmate-snippets/css/colorr.snippet b/sources_non_forked/snipmate-snippets/css/colorr.snippet new file mode 100644 index 00000000..4204aadd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/colorr.snippet @@ -0,0 +1 @@ +color: rgb(${1:255},${2:255},${3:255});$0 diff --git a/sources_non_forked/snipmate-snippets/css/cursor.snippet b/sources_non_forked/snipmate-snippets/css/cursor.snippet new file mode 100644 index 00000000..c2e45c71 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/cursor.snippet @@ -0,0 +1 @@ +cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0 diff --git a/sources_non_forked/snipmate-snippets/css/cursuru.snippet b/sources_non_forked/snipmate-snippets/css/cursuru.snippet new file mode 100644 index 00000000..35b1ef22 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/cursuru.snippet @@ -0,0 +1 @@ +cursor: url($1);$0 diff --git a/sources_non_forked/snipmate-snippets/css/direction.snippet b/sources_non_forked/snipmate-snippets/css/direction.snippet new file mode 100644 index 00000000..e0a495a4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/direction.snippet @@ -0,0 +1 @@ +direction: ${1:ltr|rtl};$0 diff --git a/sources_non_forked/snipmate-snippets/css/display/block.snippet b/sources_non_forked/snipmate-snippets/css/display/block.snippet new file mode 100644 index 00000000..d35d1c2d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/display/block.snippet @@ -0,0 +1 @@ +display: block;$0 diff --git a/sources_non_forked/snipmate-snippets/css/display/common.snippet b/sources_non_forked/snipmate-snippets/css/display/common.snippet new file mode 100644 index 00000000..38100a8c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/display/common.snippet @@ -0,0 +1 @@ +display: ${1:none/inline/block/list-item/run-in/compact/marker};$0 diff --git a/sources_non_forked/snipmate-snippets/css/display/inline.snippet b/sources_non_forked/snipmate-snippets/css/display/inline.snippet new file mode 100644 index 00000000..1969678e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/display/inline.snippet @@ -0,0 +1 @@ +display: inline;$0 diff --git a/sources_non_forked/snipmate-snippets/css/display/table.snippet b/sources_non_forked/snipmate-snippets/css/display/table.snippet new file mode 100644 index 00000000..eeb4da0f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/display/table.snippet @@ -0,0 +1 @@ +display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0 diff --git a/sources_non_forked/snipmate-snippets/css/float.snippet b/sources_non_forked/snipmate-snippets/css/float.snippet new file mode 100644 index 00000000..b43a23c3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/float.snippet @@ -0,0 +1 @@ +float: ${1:left/right/none};$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/all.snippet b/sources_non_forked/snipmate-snippets/css/font/all.snippet new file mode 100644 index 00000000..30900a18 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/all.snippet @@ -0,0 +1 @@ +font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/family.snippet b/sources_non_forked/snipmate-snippets/css/font/family.snippet new file mode 100644 index 00000000..b48c3f6a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/family.snippet @@ -0,0 +1 @@ +font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/size.snippet b/sources_non_forked/snipmate-snippets/css/font/size.snippet new file mode 100644 index 00000000..4a43b045 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/size.snippet @@ -0,0 +1 @@ +font-size: ${1:100%};$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/size_font.snippet b/sources_non_forked/snipmate-snippets/css/font/size_font.snippet new file mode 100644 index 00000000..185b6150 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/size_font.snippet @@ -0,0 +1 @@ +font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/style.snippet b/sources_non_forked/snipmate-snippets/css/font/style.snippet new file mode 100644 index 00000000..94b6e1d3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/style.snippet @@ -0,0 +1 @@ +font-style: ${1:normal/italic/oblique};$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/variant.snippet b/sources_non_forked/snipmate-snippets/css/font/variant.snippet new file mode 100644 index 00000000..f0aa67fd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/variant.snippet @@ -0,0 +1 @@ +font-variant: ${1:normal/small-caps};$0 diff --git a/sources_non_forked/snipmate-snippets/css/font/weight.snippet b/sources_non_forked/snipmate-snippets/css/font/weight.snippet new file mode 100644 index 00000000..c355c88a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/font/weight.snippet @@ -0,0 +1 @@ +font-weight: ${1:normal/bold};$0 diff --git a/sources_non_forked/snipmate-snippets/css/i.snippet b/sources_non_forked/snipmate-snippets/css/i.snippet new file mode 100644 index 00000000..5ca99ef8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/i.snippet @@ -0,0 +1 @@ +${1:!important} diff --git a/sources_non_forked/snipmate-snippets/css/letter.snippet b/sources_non_forked/snipmate-snippets/css/letter.snippet new file mode 100644 index 00000000..53f64a1e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/letter.snippet @@ -0,0 +1 @@ +letter-spacing: ${1}${2:em/px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/letterem.snippet b/sources_non_forked/snipmate-snippets/css/letterem.snippet new file mode 100644 index 00000000..4d81aa34 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/letterem.snippet @@ -0,0 +1 @@ +letter-spacing: $1em;$0 diff --git a/sources_non_forked/snipmate-snippets/css/letterpx.snippet b/sources_non_forked/snipmate-snippets/css/letterpx.snippet new file mode 100644 index 00000000..d6d3fee7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/letterpx.snippet @@ -0,0 +1 @@ +letter-spacing: $1px;$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/image.snippet b/sources_non_forked/snipmate-snippets/css/list-style/image.snippet new file mode 100644 index 00000000..f6f0bc88 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/image.snippet @@ -0,0 +1 @@ +list-style-image: url($1);$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/position.snippet b/sources_non_forked/snipmate-snippets/css/list-style/position.snippet new file mode 100644 index 00000000..904f45d5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/position.snippet @@ -0,0 +1 @@ +list-style-position: ${1:inside/outside};$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_asian.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_asian.snippet new file mode 100644 index 00000000..220cf075 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_asian.snippet @@ -0,0 +1 @@ +list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_marker.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_marker.snippet new file mode 100644 index 00000000..5c9350a6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_marker.snippet @@ -0,0 +1 @@ +list-style-type: ${1:none/disc/circle/square};$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_numeric.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_numeric.snippet new file mode 100644 index 00000000..05efdcea --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_numeric.snippet @@ -0,0 +1 @@ +list-style-type: ${1:decimal/decimal-leading-zero/zero};$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_other.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_other.snippet new file mode 100644 index 00000000..0e987a97 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_other.snippet @@ -0,0 +1 @@ +list-style-type: ${1:hebrew/armenian/georgian};$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_position_image.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_position_image.snippet new file mode 100644 index 00000000..8d7397b3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_position_image.snippet @@ -0,0 +1 @@ +list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0 diff --git a/sources_non_forked/snipmate-snippets/css/list-style/type_roman_alpha_greek.snippet b/sources_non_forked/snipmate-snippets/css/list-style/type_roman_alpha_greek.snippet new file mode 100644 index 00000000..7a6a762e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/list-style/type_roman_alpha_greek.snippet @@ -0,0 +1 @@ +list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margin.snippet b/sources_non_forked/snipmate-snippets/css/margin.snippet new file mode 100644 index 00000000..06d3fa93 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margin.snippet @@ -0,0 +1 @@ +margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/marginb.snippet b/sources_non_forked/snipmate-snippets/css/marginb.snippet new file mode 100644 index 00000000..abb7f41c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/marginb.snippet @@ -0,0 +1 @@ +margin-bottom: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/marginl.snippet b/sources_non_forked/snipmate-snippets/css/marginl.snippet new file mode 100644 index 00000000..5ecc61b1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/marginl.snippet @@ -0,0 +1 @@ +margin-left: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/T_R_B_L.snippet b/sources_non_forked/snipmate-snippets/css/margino/T_R_B_L.snippet new file mode 100644 index 00000000..06d3fa93 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/T_R_B_L.snippet @@ -0,0 +1 @@ +margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/V_H.snippet b/sources_non_forked/snipmate-snippets/css/margino/V_H.snippet new file mode 100644 index 00000000..e3427971 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/V_H.snippet @@ -0,0 +1 @@ +margin: ${1:20px} ${2:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/all.snippet b/sources_non_forked/snipmate-snippets/css/margino/all.snippet new file mode 100644 index 00000000..1be5f95b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/all.snippet @@ -0,0 +1 @@ +margin: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/bottom.snippet b/sources_non_forked/snipmate-snippets/css/margino/bottom.snippet new file mode 100644 index 00000000..abb7f41c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/bottom.snippet @@ -0,0 +1 @@ +margin-bottom: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/left.snippet b/sources_non_forked/snipmate-snippets/css/margino/left.snippet new file mode 100644 index 00000000..5ecc61b1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/left.snippet @@ -0,0 +1 @@ +margin-left: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/right.snippet b/sources_non_forked/snipmate-snippets/css/margino/right.snippet new file mode 100644 index 00000000..d600636a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/right.snippet @@ -0,0 +1 @@ +margin-right: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margino/top.snippet b/sources_non_forked/snipmate-snippets/css/margino/top.snippet new file mode 100644 index 00000000..c2bc40fe --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margino/top.snippet @@ -0,0 +1 @@ +margin-top: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/marginr.snippet b/sources_non_forked/snipmate-snippets/css/marginr.snippet new file mode 100644 index 00000000..d600636a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/marginr.snippet @@ -0,0 +1 @@ +margin-right: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/margint.snippet b/sources_non_forked/snipmate-snippets/css/margint.snippet new file mode 100644 index 00000000..c2bc40fe --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/margint.snippet @@ -0,0 +1 @@ +margin-top: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/marker/offset_auto.snippet b/sources_non_forked/snipmate-snippets/css/marker/offset_auto.snippet new file mode 100644 index 00000000..f4c107af --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/marker/offset_auto.snippet @@ -0,0 +1 @@ +marker-offset: auto;$0 diff --git a/sources_non_forked/snipmate-snippets/css/marker/offset_length.snippet b/sources_non_forked/snipmate-snippets/css/marker/offset_length.snippet new file mode 100644 index 00000000..864e7501 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/marker/offset_length.snippet @@ -0,0 +1 @@ +marker-offset: ${1:10px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/opacity.snippet b/sources_non_forked/snipmate-snippets/css/opacity.snippet new file mode 100644 index 00000000..de7d62b8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/opacity.snippet @@ -0,0 +1,3 @@ +opacity: ${1:0.5};${100: +}-moz-opacity: ${1:0.5};${100: +}filter:alpha(opacity=${2:${1/(1?)0?\.(.*)/$1$2/}${1/^\d*\.\d\d+$|^\d*$|(^\d\.\d$)/(?1:0)/}});$0 diff --git a/sources_non_forked/snipmate-snippets/css/overflow.snippet b/sources_non_forked/snipmate-snippets/css/overflow.snippet new file mode 100644 index 00000000..3caac03a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/overflow.snippet @@ -0,0 +1 @@ +overflow: ${1:visible/hidden/scroll/auto};$0 diff --git a/sources_non_forked/snipmate-snippets/css/padding.snippet b/sources_non_forked/snipmate-snippets/css/padding.snippet new file mode 100644 index 00000000..db2a3ef2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/padding.snippet @@ -0,0 +1 @@ +padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingb.snippet b/sources_non_forked/snipmate-snippets/css/paddingb.snippet new file mode 100644 index 00000000..66ad6be8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingb.snippet @@ -0,0 +1 @@ +padding-bottom: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingl.snippet b/sources_non_forked/snipmate-snippets/css/paddingl.snippet new file mode 100644 index 00000000..0853f499 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingl.snippet @@ -0,0 +1 @@ +padding-left: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/T_R_B_L.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/T_R_B_L.snippet new file mode 100644 index 00000000..db2a3ef2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/T_R_B_L.snippet @@ -0,0 +1 @@ +padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/V_H.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/V_H.snippet new file mode 100644 index 00000000..0b92d8eb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/V_H.snippet @@ -0,0 +1 @@ +padding: ${1:20px} ${2:0px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/all.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/all.snippet new file mode 100644 index 00000000..6d38bf79 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/all.snippet @@ -0,0 +1 @@ +padding: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/bottom.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/bottom.snippet new file mode 100644 index 00000000..66ad6be8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/bottom.snippet @@ -0,0 +1 @@ +padding-bottom: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/left.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/left.snippet new file mode 100644 index 00000000..0853f499 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/left.snippet @@ -0,0 +1 @@ +padding-left: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/right.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/right.snippet new file mode 100644 index 00000000..91a4c80e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/right.snippet @@ -0,0 +1 @@ +padding-right: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingo/top.snippet b/sources_non_forked/snipmate-snippets/css/paddingo/top.snippet new file mode 100644 index 00000000..9ba63357 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingo/top.snippet @@ -0,0 +1 @@ +padding-top: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingr.snippet b/sources_non_forked/snipmate-snippets/css/paddingr.snippet new file mode 100644 index 00000000..91a4c80e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingr.snippet @@ -0,0 +1 @@ +padding-right: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/paddingt.snippet b/sources_non_forked/snipmate-snippets/css/paddingt.snippet new file mode 100644 index 00000000..9ba63357 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/paddingt.snippet @@ -0,0 +1 @@ +padding-top: ${1:20px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/position.snippet b/sources_non_forked/snipmate-snippets/css/position.snippet new file mode 100644 index 00000000..2643aaec --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/position.snippet @@ -0,0 +1 @@ +position: ${1:static/relative/absolute/fixed};$0 diff --git a/sources_non_forked/snipmate-snippets/css/scrollbar.snippet b/sources_non_forked/snipmate-snippets/css/scrollbar.snippet new file mode 100644 index 00000000..f0172496 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/scrollbar.snippet @@ -0,0 +1,8 @@ +scrollbar-base-color: ${1:#CCCCCC};${2: +scrollbar-arrow-color: ${3:#000000}; +scrollbar-track-color: ${4:#999999}; +scrollbar-3dlight-color: ${5:#EEEEEE}; +scrollbar-highlight-color: ${6:#FFFFFF}; +scrollbar-face-color: ${7:#CCCCCC}; +scrollbar-shadow-color: ${9:#999999}; +scrollbar-darkshadow-color: ${8:#666666};} diff --git a/sources_non_forked/snipmate-snippets/css/tag.snippet b/sources_non_forked/snipmate-snippets/css/tag.snippet new file mode 100644 index 00000000..765269c5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/tag.snippet @@ -0,0 +1,3 @@ +${1:tag} { + ${2:color: pink;} +} diff --git a/sources_non_forked/snipmate-snippets/css/text/align.snippet b/sources_non_forked/snipmate-snippets/css/text/align.snippet new file mode 100644 index 00000000..c3a4db3d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/align.snippet @@ -0,0 +1 @@ +text-align: ${1:left/right/center/justify};$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/decoration.snippet b/sources_non_forked/snipmate-snippets/css/text/decoration.snippet new file mode 100644 index 00000000..1af58ee1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/decoration.snippet @@ -0,0 +1 @@ +text-decoration: ${1:none/underline/overline/line-through/blink};$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/indent.snippet b/sources_non_forked/snipmate-snippets/css/text/indent.snippet new file mode 100644 index 00000000..2dac54b8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/indent.snippet @@ -0,0 +1 @@ +text-indent: ${1:10}px;$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/shadow_hex.snippet b/sources_non_forked/snipmate-snippets/css/text/shadow_hex.snippet new file mode 100644 index 00000000..f6559e43 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/shadow_hex.snippet @@ -0,0 +1 @@ +text-shadow: #${1:DDD} ${2:10px} ${3:10px} ${4:2px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/shadow_none.snippet b/sources_non_forked/snipmate-snippets/css/text/shadow_none.snippet new file mode 100644 index 00000000..57a9eb36 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/shadow_none.snippet @@ -0,0 +1 @@ +text-shadow: none;$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/shadow_rgb.snippet b/sources_non_forked/snipmate-snippets/css/text/shadow_rgb.snippet new file mode 100644 index 00000000..9b5eacbd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/shadow_rgb.snippet @@ -0,0 +1 @@ +text-shadow: rgb(${1:255},${2:255},${3:255}) ${4:10px} ${5:10px} ${6:2px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/transform.snippet b/sources_non_forked/snipmate-snippets/css/text/transform.snippet new file mode 100644 index 00000000..e5cec4cd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/transform.snippet @@ -0,0 +1 @@ +text-transform: ${1:capitalize/uppercase/lowercase};$0 diff --git a/sources_non_forked/snipmate-snippets/css/text/transform_none.snippet b/sources_non_forked/snipmate-snippets/css/text/transform_none.snippet new file mode 100644 index 00000000..86180476 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/text/transform_none.snippet @@ -0,0 +1 @@ +text-transform: none;$0 diff --git a/sources_non_forked/snipmate-snippets/css/vertical.snippet b/sources_non_forked/snipmate-snippets/css/vertical.snippet new file mode 100644 index 00000000..5f76ac1a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/vertical.snippet @@ -0,0 +1 @@ +vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0 diff --git a/sources_non_forked/snipmate-snippets/css/visibility.snippet b/sources_non_forked/snipmate-snippets/css/visibility.snippet new file mode 100644 index 00000000..5f76ac1a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/visibility.snippet @@ -0,0 +1 @@ +vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0 diff --git a/sources_non_forked/snipmate-snippets/css/white.snippet b/sources_non_forked/snipmate-snippets/css/white.snippet new file mode 100644 index 00000000..066260af --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/white.snippet @@ -0,0 +1 @@ +white-space: ${1:normal/pre/nowrap};$0 diff --git a/sources_non_forked/snipmate-snippets/css/word/spacing_length.snippet b/sources_non_forked/snipmate-snippets/css/word/spacing_length.snippet new file mode 100644 index 00000000..647ea3eb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/word/spacing_length.snippet @@ -0,0 +1 @@ +word-spacing: ${1:10px};$0 diff --git a/sources_non_forked/snipmate-snippets/css/word/spacing_normal.snippet b/sources_non_forked/snipmate-snippets/css/word/spacing_normal.snippet new file mode 100644 index 00000000..94615515 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/word/spacing_normal.snippet @@ -0,0 +1 @@ +word-spacing: normal;$0 diff --git a/sources_non_forked/snipmate-snippets/css/z.snippet b/sources_non_forked/snipmate-snippets/css/z.snippet new file mode 100644 index 00000000..fd19d5f6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/css/z.snippet @@ -0,0 +1 @@ +z-index: $1;$0 diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/conf.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/conf.snippet new file mode 100644 index 00000000..bf4aff3d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/conf.snippet @@ -0,0 +1,3 @@ +<% content_for :${1:yield_label_in_layout} do -%> + ${2} +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/cs.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/cs.snippet new file mode 100644 index 00000000..f8fa9097 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/cs.snippet @@ -0,0 +1 @@ +<%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ct.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ct.snippet new file mode 100644 index 00000000..c31743e4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ct.snippet @@ -0,0 +1 @@ +<%= content_tag '${1:DIV}', ${2:content}${3:,options} -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/end.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/end.snippet new file mode 100644 index 00000000..4c79184d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/end.snippet @@ -0,0 +1 @@ +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ff.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ff.snippet new file mode 100644 index 00000000..bb12f6d7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ff.snippet @@ -0,0 +1,3 @@ +<% form_for @${1:model} do |f| -%> + ${2} +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffcb.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffcb.snippet new file mode 100644 index 00000000..46feff86 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffcb.snippet @@ -0,0 +1 @@ +<%= ${1:f}.check_box :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffe.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffe.snippet new file mode 100644 index 00000000..bafdc111 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffe.snippet @@ -0,0 +1,5 @@ +<% error_messages_for :${1:model} -%> + +<% form_for @${2:model} do |f| -%> + ${3} +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffff.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffff.snippet new file mode 100644 index 00000000..7db85a21 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffff.snippet @@ -0,0 +1 @@ +<%= ${1:f}.file_field :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffhf.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffhf.snippet new file mode 100644 index 00000000..81f9dec6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffhf.snippet @@ -0,0 +1 @@ +<%= ${1:f}.hidden_field :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffl.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffl.snippet new file mode 100644 index 00000000..c0bdcee1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffl.snippet @@ -0,0 +1 @@ +<%= ${1:f}.label :${2:attribute}, '${3:$2}' %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffpf.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffpf.snippet new file mode 100644 index 00000000..3b579a36 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffpf.snippet @@ -0,0 +1 @@ +<%= ${1:f}.password_field :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffrb.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffrb.snippet new file mode 100644 index 00000000..d63f0a54 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffrb.snippet @@ -0,0 +1 @@ +<%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffs.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffs.snippet new file mode 100644 index 00000000..d0851db9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffs.snippet @@ -0,0 +1 @@ +<%= ${1:f}.submit "${2:submit}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ffta.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ffta.snippet new file mode 100644 index 00000000..9057483e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ffta.snippet @@ -0,0 +1 @@ +<%= ${1:f}.text_area :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/fftf.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/fftf.snippet new file mode 100644 index 00000000..83d1add5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/fftf.snippet @@ -0,0 +1 @@ +<%= ${1:f}.text_field :${2:attribute} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/fields.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/fields.snippet new file mode 100644 index 00000000..e936bd33 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/fields.snippet @@ -0,0 +1,3 @@ +<% fields_for :${1:model}, @$1 do |${2:f}| -%> + ${3} +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/for.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/for.snippet new file mode 100644 index 00000000..30da5608 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/for.snippet @@ -0,0 +1,3 @@ +<% for ${2:item} in ${1:list} -%> + ${3} +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ft.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ft.snippet new file mode 100644 index 00000000..5ff2f439 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ft.snippet @@ -0,0 +1,3 @@ +<% form_tag(<+:action => "<+update+>"+><+, {:<+class+> => "<+form+>"}+>) do -%> + <++> +<% end -%> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/i18.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/i18.snippet new file mode 100644 index 00000000..2a30fae0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/i18.snippet @@ -0,0 +1 @@ +I18n.t('${1:type.key}')${2} diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/it.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/it.snippet new file mode 100644 index 00000000..e15196e4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/it.snippet @@ -0,0 +1 @@ +<%= image_tag "${1}"${2} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/jit.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/jit.snippet new file mode 100644 index 00000000..e05213a0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/jit.snippet @@ -0,0 +1 @@ +<%= javascript_include_tag <+:all+><+, :cache => <+true+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/jsit.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/jsit.snippet new file mode 100644 index 00000000..187e9ab3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/jsit.snippet @@ -0,0 +1 @@ +<%= javascript_include_tag "${1}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lia.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lia.snippet new file mode 100644 index 00000000..2732e6e0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lia.snippet @@ -0,0 +1 @@ +<%= link_to "${1:link text}", :action => "${2:index}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/liai.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/liai.snippet new file mode 100644 index 00000000..30b703ce --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/liai.snippet @@ -0,0 +1 @@ +<%= link_to "<+link text+>", :action => "<+edit+>", :id => <+@<+item+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lic.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lic.snippet new file mode 100644 index 00000000..f8d5b953 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lic.snippet @@ -0,0 +1 @@ +<%= link_to "${1:link text}", :controller => "${2:items}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lica.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lica.snippet new file mode 100644 index 00000000..d9aae5f1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lica.snippet @@ -0,0 +1 @@ +<%= link_to "${1:link text}", :controller => "${2:items}", :action => "${3:index}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/licai.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/licai.snippet new file mode 100644 index 00000000..79f7ee0b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/licai.snippet @@ -0,0 +1 @@ +<%= link_to "<+link text+>", :controller => "<+items+>", :action => "<+edit+>", :id => <+@<+item+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lim.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lim.snippet new file mode 100644 index 00000000..7c1e04d9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lim.snippet @@ -0,0 +1 @@ +<%= link_to <+model+>.<+name+>, <+<+model+>_path(<+model+>)+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/linp.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/linp.snippet new file mode 100644 index 00000000..939ecc76 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/linp.snippet @@ -0,0 +1 @@ +<%= link_to <+"<+link text+>"+>, <+<+parent+>_<+child+>_path(<+@+><+parent+>, <+@+><+child+>)+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/linpp.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/linpp.snippet new file mode 100644 index 00000000..a5eacfec --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/linpp.snippet @@ -0,0 +1 @@ +<%= link_to <+"<+link text+>"+>, <+<+parent+>_<+child+>_path(<+@+><+parent+>)+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lip.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lip.snippet new file mode 100644 index 00000000..d09eb1f7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lip.snippet @@ -0,0 +1 @@ +<%= link_to <+"<+link text+>"+>, <+<+model+>_path(<+@+><+instance+>)+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lipp.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lipp.snippet new file mode 100644 index 00000000..56a653e1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lipp.snippet @@ -0,0 +1 @@ +<%= link_to <+"<+link text+>"+>, <+<+model+>s_path+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/lt.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/lt.snippet new file mode 100644 index 00000000..b6c9a5bf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/lt.snippet @@ -0,0 +1 @@ +<%= link_to "${1:name}", ${2:dest} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/ofcfs.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/ofcfs.snippet new file mode 100644 index 00000000..264de82a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/ofcfs.snippet @@ -0,0 +1 @@ +<%= options_from_collection_for_select <+collection+>, <+value_method+>, <+text_method+><+, <+[selected_value]+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/rf.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/rf.snippet new file mode 100644 index 00000000..16067e97 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/rf.snippet @@ -0,0 +1 @@ +<%= render :file => "${1:file}"${2} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/rp.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/rp.snippet new file mode 100644 index 00000000..706a4cb3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/rp.snippet @@ -0,0 +1 @@ +<%= render :partial => "${1:file}"${2} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/rt.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/rt.snippet new file mode 100644 index 00000000..75a8f931 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/rt.snippet @@ -0,0 +1 @@ +<%= render :template => "${1:file}"${2} %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/slt.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/slt.snippet new file mode 100644 index 00000000..dae49dc8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/slt.snippet @@ -0,0 +1 @@ +<%= stylesheet_link_tag <+:all+><+, :cache => <+true+>+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/sslt.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/sslt.snippet new file mode 100644 index 00000000..1fd0f68e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/sslt.snippet @@ -0,0 +1 @@ +<%= stylesheet_link_tag "${1}" %> diff --git a/sources_non_forked/snipmate-snippets/eruby-rails/st.snippet b/sources_non_forked/snipmate-snippets/eruby-rails/st.snippet new file mode 100644 index 00000000..a6538f98 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby-rails/st.snippet @@ -0,0 +1 @@ +<%= submit_tag "<+Save changes+>"<+, :id => "<+submit+>"+><+, :name => "<+submit+>"+><+, :class => "<+form_name+>"+><+, :disabled => <+false+>+><+, :disable_with => "<+Please wait+>"+> %> diff --git a/sources_non_forked/snipmate-snippets/eruby/if.snippet b/sources_non_forked/snipmate-snippets/eruby/if.snippet new file mode 100644 index 00000000..cc6d87cf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby/if.snippet @@ -0,0 +1,3 @@ +<% if ${1:condition} %> + ${2} +<% end %> diff --git a/sources_non_forked/snipmate-snippets/eruby/ife.snippet b/sources_non_forked/snipmate-snippets/eruby/ife.snippet new file mode 100644 index 00000000..fff2996e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby/ife.snippet @@ -0,0 +1,4 @@ +<% if ${1} %> + ${2} +<% else %> +<% end %> diff --git a/sources_non_forked/snipmate-snippets/eruby/unless.snippet b/sources_non_forked/snipmate-snippets/eruby/unless.snippet new file mode 100644 index 00000000..4e7e3d7e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby/unless.snippet @@ -0,0 +1,3 @@ +<% unless ${1} %> + ${2} +<% end %> diff --git a/sources_non_forked/snipmate-snippets/eruby/unlesse.snippet b/sources_non_forked/snipmate-snippets/eruby/unlesse.snippet new file mode 100644 index 00000000..6f447394 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/eruby/unlesse.snippet @@ -0,0 +1,4 @@ +<% unless ${1} %> + ${2} +<% else %> +<% end %> diff --git a/sources_non_forked/snipmate-snippets/haml/conf.snippet b/sources_non_forked/snipmate-snippets/haml/conf.snippet new file mode 100644 index 00000000..a4723cd8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/conf.snippet @@ -0,0 +1,3 @@ +-content_for :${1:yield_label_in_layout} do + ${2} + diff --git a/sources_non_forked/snipmate-snippets/haml/cs.snippet b/sources_non_forked/snipmate-snippets/haml/cs.snippet new file mode 100644 index 00000000..8dfa8d46 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/cs.snippet @@ -0,0 +1 @@ +=collection_select :${1:object}, :${2:method}, :${3:collection}, :${4:value_method}, :${5:text_method} ${6:, [options]} ${7:, [html_options]} diff --git a/sources_non_forked/snipmate-snippets/haml/ff.snippet b/sources_non_forked/snipmate-snippets/haml/ff.snippet new file mode 100644 index 00000000..aeb7fbe9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ff.snippet @@ -0,0 +1,2 @@ +-form_for @${1:model} do |f| + ${2} diff --git a/sources_non_forked/snipmate-snippets/haml/ffcb.snippet b/sources_non_forked/snipmate-snippets/haml/ffcb.snippet new file mode 100644 index 00000000..b042ca9f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffcb.snippet @@ -0,0 +1 @@ +=f.check_box :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/ffe.snippet b/sources_non_forked/snipmate-snippets/haml/ffe.snippet new file mode 100644 index 00000000..633bca1e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffe.snippet @@ -0,0 +1,4 @@ +=error_messages_for :${1:model} + +-form_for @${2:model} do |f| + ${3} diff --git a/sources_non_forked/snipmate-snippets/haml/ffff.snippet b/sources_non_forked/snipmate-snippets/haml/ffff.snippet new file mode 100644 index 00000000..fb86c2f5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffff.snippet @@ -0,0 +1 @@ +=f.file_field :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/ffhf.snippet b/sources_non_forked/snipmate-snippets/haml/ffhf.snippet new file mode 100644 index 00000000..06cd91e9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffhf.snippet @@ -0,0 +1 @@ +=f.hidden_field :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/ffl.snippet b/sources_non_forked/snipmate-snippets/haml/ffl.snippet new file mode 100644 index 00000000..c51d49e3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffl.snippet @@ -0,0 +1 @@ +=f.label :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/ffpf.snippet b/sources_non_forked/snipmate-snippets/haml/ffpf.snippet new file mode 100644 index 00000000..f200dc45 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffpf.snippet @@ -0,0 +1 @@ +=f.password_field :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/ffrb.snippet b/sources_non_forked/snipmate-snippets/haml/ffrb.snippet new file mode 100644 index 00000000..a6c3ffe6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffrb.snippet @@ -0,0 +1 @@ +=f.radio_button :${1:attribute}, :${2:tag_value} diff --git a/sources_non_forked/snipmate-snippets/haml/ffs.snippet b/sources_non_forked/snipmate-snippets/haml/ffs.snippet new file mode 100644 index 00000000..8489ac46 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffs.snippet @@ -0,0 +1 @@ +=f.submit "<+Submit+>"<+, :disable_with => '<+Submitting+>'+> diff --git a/sources_non_forked/snipmate-snippets/haml/ffta.snippet b/sources_non_forked/snipmate-snippets/haml/ffta.snippet new file mode 100644 index 00000000..df891241 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ffta.snippet @@ -0,0 +1 @@ +=f.text_area :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/fftf.snippet b/sources_non_forked/snipmate-snippets/haml/fftf.snippet new file mode 100644 index 00000000..80b4bd9a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/fftf.snippet @@ -0,0 +1 @@ +=f.text_field :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/haml/fields.snippet b/sources_non_forked/snipmate-snippets/haml/fields.snippet new file mode 100644 index 00000000..e9c9b200 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/fields.snippet @@ -0,0 +1,2 @@ +-fields_for :${1:model}, @$1 do |${2:f}| + ${3} diff --git a/sources_non_forked/snipmate-snippets/haml/for.snippet b/sources_non_forked/snipmate-snippets/haml/for.snippet new file mode 100644 index 00000000..40de6487 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/for.snippet @@ -0,0 +1,6 @@ +-if !${1:list}.blank? + -for ${2:item} in $1 + ${3} +-else + ${4} + diff --git a/sources_non_forked/snipmate-snippets/haml/ft.snippet b/sources_non_forked/snipmate-snippets/haml/ft.snippet new file mode 100644 index 00000000..5a051d93 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ft.snippet @@ -0,0 +1,2 @@ +-form_tag(<+:action => "<+update+>"+><+, {:<+class+> => "<+form+>"}+>) do + <++> diff --git a/sources_non_forked/snipmate-snippets/haml/if.snippet b/sources_non_forked/snipmate-snippets/haml/if.snippet new file mode 100644 index 00000000..d1e38b7f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/if.snippet @@ -0,0 +1,2 @@ +-if ${1} + ${2} diff --git a/sources_non_forked/snipmate-snippets/haml/ife.snippet b/sources_non_forked/snipmate-snippets/haml/ife.snippet new file mode 100644 index 00000000..b8d12d8d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ife.snippet @@ -0,0 +1,4 @@ +-if ${1} + ${2} +-else + diff --git a/sources_non_forked/snipmate-snippets/haml/it.snippet b/sources_non_forked/snipmate-snippets/haml/it.snippet new file mode 100644 index 00000000..9e15a59c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/it.snippet @@ -0,0 +1 @@ +=image_tag "${1}" diff --git a/sources_non_forked/snipmate-snippets/haml/jit.snippet b/sources_non_forked/snipmate-snippets/haml/jit.snippet new file mode 100644 index 00000000..af6edd24 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/jit.snippet @@ -0,0 +1 @@ +=javascript_include_tag <+:all+><+, :cache => <+true+>+> diff --git a/sources_non_forked/snipmate-snippets/haml/jsit.snippet b/sources_non_forked/snipmate-snippets/haml/jsit.snippet new file mode 100644 index 00000000..ea4d2fda --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/jsit.snippet @@ -0,0 +1 @@ +=javascript_include_tag "${1}" diff --git a/sources_non_forked/snipmate-snippets/haml/lia.snippet b/sources_non_forked/snipmate-snippets/haml/lia.snippet new file mode 100644 index 00000000..9fa23dfc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lia.snippet @@ -0,0 +1 @@ +=link_to "${1:link text}", :action => "${2:index}" diff --git a/sources_non_forked/snipmate-snippets/haml/liai.snippet b/sources_non_forked/snipmate-snippets/haml/liai.snippet new file mode 100644 index 00000000..bd4f8510 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/liai.snippet @@ -0,0 +1 @@ +=link_to "<+link text+>", :action => "<+edit+>", :id => <+@<+item+>+> diff --git a/sources_non_forked/snipmate-snippets/haml/lic.snippet b/sources_non_forked/snipmate-snippets/haml/lic.snippet new file mode 100644 index 00000000..9c642265 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lic.snippet @@ -0,0 +1 @@ +=link_to "${1:link text}", :controller => "${2:items}" diff --git a/sources_non_forked/snipmate-snippets/haml/lica.snippet b/sources_non_forked/snipmate-snippets/haml/lica.snippet new file mode 100644 index 00000000..67e9bc0c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lica.snippet @@ -0,0 +1 @@ +=link_to "${1:link text}", :controller => "${2:items}", :action => "${3:index}" diff --git a/sources_non_forked/snipmate-snippets/haml/licai.snippet b/sources_non_forked/snipmate-snippets/haml/licai.snippet new file mode 100644 index 00000000..58b65837 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/licai.snippet @@ -0,0 +1 @@ +=link_to "<+link text+>", :controller => "<+items+>", :action => "<+edit+>", :id => <+@<+item+>+> diff --git a/sources_non_forked/snipmate-snippets/haml/lim.snippet b/sources_non_forked/snipmate-snippets/haml/lim.snippet new file mode 100644 index 00000000..25821e4d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lim.snippet @@ -0,0 +1 @@ +=link_to <+model+>.<+name+>, <+<+model+>_path(<+model+>)+> diff --git a/sources_non_forked/snipmate-snippets/haml/linp.snippet b/sources_non_forked/snipmate-snippets/haml/linp.snippet new file mode 100644 index 00000000..4fdfab6c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/linp.snippet @@ -0,0 +1 @@ +=link_to <+"<+link text+>"+>, <+<+parent+>_<+child+>_path(<+@+><+parent+>, <+@+><+child+>)+> diff --git a/sources_non_forked/snipmate-snippets/haml/linpp.snippet b/sources_non_forked/snipmate-snippets/haml/linpp.snippet new file mode 100644 index 00000000..0f987725 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/linpp.snippet @@ -0,0 +1 @@ +=link_to <+"<+link text+>"+>, <+<+parent+>_<+child+>_path(<+@+><+parent+>)+> diff --git a/sources_non_forked/snipmate-snippets/haml/lip.snippet b/sources_non_forked/snipmate-snippets/haml/lip.snippet new file mode 100644 index 00000000..d882c5df --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lip.snippet @@ -0,0 +1 @@ +=link_to <+"<+link text+>"+>, <+<+model+>_path(<+@+><+instance+>)+> diff --git a/sources_non_forked/snipmate-snippets/haml/lipp.snippet b/sources_non_forked/snipmate-snippets/haml/lipp.snippet new file mode 100644 index 00000000..7484b24b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lipp.snippet @@ -0,0 +1 @@ +=link_to <+"<+link text+>"+>, <+<+model+>s_path+> diff --git a/sources_non_forked/snipmate-snippets/haml/lt.snippet b/sources_non_forked/snipmate-snippets/haml/lt.snippet new file mode 100644 index 00000000..d66cd763 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/lt.snippet @@ -0,0 +1 @@ +=link_to "${1}", ${2:dest} diff --git a/sources_non_forked/snipmate-snippets/haml/ofcfs.snippet b/sources_non_forked/snipmate-snippets/haml/ofcfs.snippet new file mode 100644 index 00000000..7d607129 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/ofcfs.snippet @@ -0,0 +1 @@ +=options_from_collection_for_select <+collection+>, <+value_method+>, <+text_method+><+, <+[selected_value]+>+> diff --git a/sources_non_forked/snipmate-snippets/haml/rf.snippet b/sources_non_forked/snipmate-snippets/haml/rf.snippet new file mode 100644 index 00000000..5758eb43 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/rf.snippet @@ -0,0 +1 @@ +=render :file => "${1:file}"${2} diff --git a/sources_non_forked/snipmate-snippets/haml/rp.snippet b/sources_non_forked/snipmate-snippets/haml/rp.snippet new file mode 100644 index 00000000..038225eb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/rp.snippet @@ -0,0 +1 @@ +=render :partial => "${1:file}"${2} diff --git a/sources_non_forked/snipmate-snippets/haml/rt.snippet b/sources_non_forked/snipmate-snippets/haml/rt.snippet new file mode 100644 index 00000000..5d3d2ffa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/rt.snippet @@ -0,0 +1 @@ +=render :template => "${1:file}"${2} diff --git a/sources_non_forked/snipmate-snippets/haml/slt.snippet b/sources_non_forked/snipmate-snippets/haml/slt.snippet new file mode 100644 index 00000000..294405ac --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/slt.snippet @@ -0,0 +1 @@ +=stylesheet_link_tag <+:all+><+, :cache => <+true+>+> diff --git a/sources_non_forked/snipmate-snippets/haml/sslt.snippet b/sources_non_forked/snipmate-snippets/haml/sslt.snippet new file mode 100644 index 00000000..1597d2f8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/sslt.snippet @@ -0,0 +1 @@ +=stylesheet_link_tag "${1}" diff --git a/sources_non_forked/snipmate-snippets/haml/st.snippet b/sources_non_forked/snipmate-snippets/haml/st.snippet new file mode 100644 index 00000000..60a889ea --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/st.snippet @@ -0,0 +1 @@ +=submit_tag "<+Save changes+>"<+, :id => "<+submit+>"+><+, :name => "<+submit+>"+><+, :class => "<+form_name+>"+><+, :disabled => <+false+>+><+, :disable_with => "<+Please wait+>"+> diff --git a/sources_non_forked/snipmate-snippets/haml/unless.snippet b/sources_non_forked/snipmate-snippets/haml/unless.snippet new file mode 100644 index 00000000..2e521039 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/unless.snippet @@ -0,0 +1,3 @@ +-unless ${1} + ${2} + diff --git a/sources_non_forked/snipmate-snippets/haml/unlesse.snippet b/sources_non_forked/snipmate-snippets/haml/unlesse.snippet new file mode 100644 index 00000000..b8d12d8d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/haml/unlesse.snippet @@ -0,0 +1,4 @@ +-if ${1} + ${2} +-else + diff --git a/sources_non_forked/snipmate-snippets/html/base.snippet b/sources_non_forked/snipmate-snippets/html/base.snippet new file mode 100644 index 00000000..0e273e23 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/base.snippet @@ -0,0 +1 @@ +/> diff --git a/sources_non_forked/snipmate-snippets/html/body.snippet b/sources_non_forked/snipmate-snippets/html/body.snippet new file mode 100644 index 00000000..692403d3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/body.snippet @@ -0,0 +1,3 @@ + + ${2} + diff --git a/sources_non_forked/snipmate-snippets/html/div.snippet b/sources_non_forked/snipmate-snippets/html/div.snippet new file mode 100644 index 00000000..1ee10bf6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/div.snippet @@ -0,0 +1,3 @@ +
            + ${2} +
            diff --git a/sources_non_forked/snipmate-snippets/html/doctype.snippet b/sources_non_forked/snipmate-snippets/html/doctype.snippet new file mode 100644 index 00000000..8d98d406 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/doctype.snippet @@ -0,0 +1 @@ +${1} diff --git a/sources_non_forked/snipmate-snippets/html/form.snippet b/sources_non_forked/snipmate-snippets/html/form.snippet new file mode 100644 index 00000000..6fa8a22d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/form.snippet @@ -0,0 +1,5 @@ +
            + ${3} + +

            +
            diff --git a/sources_non_forked/snipmate-snippets/html/h1.snippet b/sources_non_forked/snipmate-snippets/html/h1.snippet new file mode 100644 index 00000000..21e88b80 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/h1.snippet @@ -0,0 +1 @@ +

            ${2}

            diff --git a/sources_non_forked/snipmate-snippets/html/head.snippet b/sources_non_forked/snipmate-snippets/html/head.snippet new file mode 100644 index 00000000..81af7f88 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/head.snippet @@ -0,0 +1,5 @@ + + + ${1:Page Title} + ${2} + diff --git a/sources_non_forked/snipmate-snippets/html/href.snippet b/sources_non_forked/snipmate-snippets/html/href.snippet new file mode 100644 index 00000000..0b744a04 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/href.snippet @@ -0,0 +1 @@ +${2} diff --git a/sources_non_forked/snipmate-snippets/html/ifie.snippet b/sources_non_forked/snipmate-snippets/html/ifie.snippet new file mode 100644 index 00000000..abb68f50 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/ifie.snippet @@ -0,0 +1 @@ +${3} diff --git a/sources_non_forked/snipmate-snippets/html/img.snippet b/sources_non_forked/snipmate-snippets/html/img.snippet new file mode 100644 index 00000000..ba32a242 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/img.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/input.snippet b/sources_non_forked/snipmate-snippets/html/input.snippet new file mode 100644 index 00000000..a8814b28 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/input.snippet @@ -0,0 +1 @@ +${5} diff --git a/sources_non_forked/snipmate-snippets/html/inputl.snippet b/sources_non_forked/snipmate-snippets/html/inputl.snippet new file mode 100644 index 00000000..4efe9945 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/inputl.snippet @@ -0,0 +1,2 @@ + +${7} diff --git a/sources_non_forked/snipmate-snippets/html/label.snippet b/sources_non_forked/snipmate-snippets/html/label.snippet new file mode 100644 index 00000000..c32b6f74 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/label.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/link.snippet b/sources_non_forked/snipmate-snippets/html/link.snippet new file mode 100644 index 00000000..42dd1c6b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/link.snippet @@ -0,0 +1 @@ +${5} diff --git a/sources_non_forked/snipmate-snippets/html/mailto.snippet b/sources_non_forked/snipmate-snippets/html/mailto.snippet new file mode 100644 index 00000000..2538ab0f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/mailto.snippet @@ -0,0 +1 @@ +<+email me+> diff --git a/sources_non_forked/snipmate-snippets/html/meta.snippet b/sources_non_forked/snipmate-snippets/html/meta.snippet new file mode 100644 index 00000000..e0319b09 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/meta.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/option.snippet b/sources_non_forked/snipmate-snippets/html/option.snippet new file mode 100644 index 00000000..b7383d0e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/option.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/script/include_script.snippet b/sources_non_forked/snipmate-snippets/html/script/include_script.snippet new file mode 100644 index 00000000..dd35e4be --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/script/include_script.snippet @@ -0,0 +1 @@ +${2} diff --git a/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet b/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet new file mode 100644 index 00000000..35e078b3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet @@ -0,0 +1,5 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/select.snippet b/sources_non_forked/snipmate-snippets/html/select.snippet new file mode 100644 index 00000000..252e3f77 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/select.snippet @@ -0,0 +1,3 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic.snippet new file mode 100644 index 00000000..61ec2444 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/skel/basic.snippet @@ -0,0 +1,13 @@ + + + + + ${1:Page Title} + + + + + ${2} + + diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet new file mode 100644 index 00000000..b6de9f8d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet @@ -0,0 +1,15 @@ + + + + + ${1:Page Title} + + + + + + + ${2} + + diff --git a/sources_non_forked/snipmate-snippets/html/style.snippet b/sources_non_forked/snipmate-snippets/html/style.snippet new file mode 100644 index 00000000..26ae0fe9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/style.snippet @@ -0,0 +1,3 @@ + diff --git a/sources_non_forked/snipmate-snippets/html/t.snippet b/sources_non_forked/snipmate-snippets/html/t.snippet new file mode 100644 index 00000000..ef504276 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/t.snippet @@ -0,0 +1,3 @@ +<${1:div}${2}> + ${3} +${4} diff --git a/sources_non_forked/snipmate-snippets/html/table/basic.snippet b/sources_non_forked/snipmate-snippets/html/table/basic.snippet new file mode 100644 index 00000000..2100d13d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/table/basic.snippet @@ -0,0 +1,3 @@ + + ${2} +
            diff --git a/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet b/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet new file mode 100644 index 00000000..35fa01ae --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet @@ -0,0 +1,9 @@ ++>> + + <++> + + + + + + diff --git a/sources_non_forked/snipmate-snippets/html/textarea.snippet b/sources_non_forked/snipmate-snippets/html/textarea.snippet new file mode 100644 index 00000000..0b3fb84b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/html/textarea.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet new file mode 100644 index 00000000..3bd770e2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet @@ -0,0 +1,17 @@ +/** + * class $2 + * @author ${4:`g:snips_author`} + */ +${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { + + /** + * Constructor for $2 + */ + public $2(${4}) { + ${5} + } + + public static void main(String args[]) { + } + +} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet new file mode 100644 index 00000000..05eabefa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet @@ -0,0 +1,14 @@ +/** + * class $2 + * @author ${4:`g:snips_author`} + */ +${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { + + /** + * Constructor for $2 + */ + public $2(${5}){ + ${6} + } + +} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic.snippet b/sources_non_forked/snipmate-snippets/java/class/basic.snippet new file mode 100644 index 00000000..05eabefa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/class/basic.snippet @@ -0,0 +1,14 @@ +/** + * class $2 + * @author ${4:`g:snips_author`} + */ +${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { + + /** + * Constructor for $2 + */ + public $2(${5}){ + ${6} + } + +} diff --git a/sources_non_forked/snipmate-snippets/java/for.snippet b/sources_non_forked/snipmate-snippets/java/for.snippet new file mode 100644 index 00000000..70a41086 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/for.snippet @@ -0,0 +1,3 @@ +for(${1:int i=0}; ${2:condition}; ${3:i++}){ + ${4} +} diff --git a/sources_non_forked/snipmate-snippets/java/gs.snippet b/sources_non_forked/snipmate-snippets/java/gs.snippet new file mode 100644 index 00000000..954a9a09 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/gs.snippet @@ -0,0 +1,9 @@ +//getter for $3 +public ${2:variable_type} get${1:VariableName}() { + return ${3:variableName}; +} + +//setter for $3 +public void set$1($2 $3) { + this.$3 = $3; +}${4} diff --git a/sources_non_forked/snipmate-snippets/java/if.snippet b/sources_non_forked/snipmate-snippets/java/if.snippet new file mode 100644 index 00000000..b9d1c5c3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/if.snippet @@ -0,0 +1,3 @@ +if(${1}){ + ${2} +} diff --git a/sources_non_forked/snipmate-snippets/java/ife.snippet b/sources_non_forked/snipmate-snippets/java/ife.snippet new file mode 100644 index 00000000..a7e43d09 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/ife.snippet @@ -0,0 +1,4 @@ +if(${1}){ + ${2} +}else{ +} diff --git a/sources_non_forked/snipmate-snippets/java/log.snippet b/sources_non_forked/snipmate-snippets/java/log.snippet new file mode 100644 index 00000000..abb7c7d6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/log.snippet @@ -0,0 +1 @@ +System.${1:out}.println(${2}); diff --git a/sources_non_forked/snipmate-snippets/java/m.snippet b/sources_non_forked/snipmate-snippets/java/m.snippet new file mode 100644 index 00000000..67bf3fb0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/java/m.snippet @@ -0,0 +1,8 @@ +/** + * ${7:Method Description} + * ${5} + * @return ${6} + */ +${1:public} ${2:void} ${3:methodName}(${4}) { + ${8} +} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet new file mode 100644 index 00000000..3bf9756d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet @@ -0,0 +1 @@ +${1:obj}.add('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet new file mode 100644 index 00000000..68007744 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet @@ -0,0 +1 @@ +${1:obj}.addClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet new file mode 100644 index 00000000..34d1956d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet @@ -0,0 +1 @@ +${1:obj}.after('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet new file mode 100644 index 00000000..5453a257 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet @@ -0,0 +1,18 @@ +$.ajax({ + url: "${1:mydomain.com/url}", + type: "${2:POST}", + dataType: "${3:xml/html/script/json}", + data: $.param( $("${4:Element or Expression}") ), + + complete: function() { + ${5://called when complete} + }, + + success: function() { + ${6://called when successful} + }, + + error: function() { + ${7://called when there is an error} + }, +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet new file mode 100644 index 00000000..0f8ccdaf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet @@ -0,0 +1,4 @@ +.ajaxError(function(${1:request, settings}) { + ${2://stuff to do when an AJAX call returns an error}; +}); +${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet new file mode 100644 index 00000000..1489859a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet @@ -0,0 +1,3 @@ +$.get('${1:/test/ajax-test.xml}', function(xml){ + ${2:alert( ("title",xml).text() ) //optional stuff to do after get;} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet new file mode 100644 index 00000000..0f4d1ef0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet @@ -0,0 +1,3 @@ +$.getIfModified('${1:/test/test.cgi}', function(data){ + ${2:alert( "Data loaded: " + data ) //optional stuff to do after get;} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet new file mode 100644 index 00000000..f62bf102 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet @@ -0,0 +1,5 @@ +$.post('<+/path/to/file.cgi+>',{ + <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, + function(){ + <+//stuff to do after event occurs;+> +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet new file mode 100644 index 00000000..4b74cd98 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet @@ -0,0 +1,4 @@ +.ajaxSend(function(${1:request, settings}) { + ${2://stuff to do when an AJAX call returns an error}; +}); +${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet new file mode 100644 index 00000000..c5b4ad02 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet @@ -0,0 +1,18 @@ +$.ajaxSetup({ + url: "${1:mydomain.com/url}", + type: "${2:POST}", + dataType: "${3:xml/html/script/json}", + data: $.param( $("${4:Element or Expression}") ), + + complete: function() { + ${5://called when complete} + }, + + success: function() { + ${6://called when successful} + }, + + error: function() { + ${7://called when there is an error} + }, +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet new file mode 100644 index 00000000..3caafd58 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet @@ -0,0 +1,4 @@ +$.ajaxStart(function() { + ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; +}); +${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet new file mode 100644 index 00000000..6088a9f5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet @@ -0,0 +1,4 @@ +$.ajaxStop(function() { + ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; +}); +${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet new file mode 100644 index 00000000..ba2247dc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet @@ -0,0 +1,4 @@ +$.ajaxSuccess(function() { + ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; +}); +${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet new file mode 100644 index 00000000..19135327 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet @@ -0,0 +1 @@ +${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet new file mode 100644 index 00000000..bc4ff4d3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet @@ -0,0 +1 @@ +${1:obj}.append('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet new file mode 100644 index 00000000..97883710 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet @@ -0,0 +1 @@ +${1:obj}.appendTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet new file mode 100644 index 00000000..fb7e2f42 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet @@ -0,0 +1 @@ +${1:obj}.attr('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet new file mode 100644 index 00000000..15685512 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet @@ -0,0 +1 @@ +${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet new file mode 100644 index 00000000..e12c4aed --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet @@ -0,0 +1 @@ +${1:obj}.before('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet new file mode 100644 index 00000000..dda284d9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet @@ -0,0 +1,3 @@ +${1:obj}.bind('${2:event name}', function(${3:event}) { + ${4:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet new file mode 100644 index 00000000..674623db --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet @@ -0,0 +1,3 @@ +${1:obj}.blur(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet new file mode 100644 index 00000000..184f8a99 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet @@ -0,0 +1,3 @@ +${1:obj}.change(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet new file mode 100644 index 00000000..2db688b1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet @@ -0,0 +1 @@ +${1:obj}.children('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet new file mode 100644 index 00000000..d17a047e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet @@ -0,0 +1,3 @@ +${1:obj}.click(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet new file mode 100644 index 00000000..83b0b421 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet @@ -0,0 +1 @@ +${1:obj}.clone()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet new file mode 100644 index 00000000..2a073948 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet @@ -0,0 +1 @@ +${1:obj}.contains('${2:text to find}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet new file mode 100644 index 00000000..408199eb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet @@ -0,0 +1 @@ +${1:obj}.css('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet new file mode 100644 index 00000000..7eebe1e4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet @@ -0,0 +1 @@ +${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet new file mode 100644 index 00000000..4b2d6b2a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet @@ -0,0 +1,3 @@ +${1:obj}.dblclick(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet new file mode 100644 index 00000000..05beed2e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet @@ -0,0 +1,3 @@ +${1:obj}.each(function(index) { + ${2:this.innerHTML = this + " is the element, " + index + " is the position";} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet new file mode 100644 index 00000000..d2065238 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet @@ -0,0 +1 @@ +$('${1}')${2:} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet new file mode 100644 index 00000000..9cc0d692 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet @@ -0,0 +1 @@ +$.trim('${1:string}')${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet new file mode 100644 index 00000000..293102c4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet @@ -0,0 +1 @@ +${1:obj}.end()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet new file mode 100644 index 00000000..23b0e650 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet @@ -0,0 +1,3 @@ +${1:obj}.error(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet new file mode 100644 index 00000000..549d8464 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet @@ -0,0 +1 @@ +${1:obj}.fadeIn('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet new file mode 100644 index 00000000..9090853e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet @@ -0,0 +1,3 @@ +${1:obj}.fadeIn('slow/400/fast', function() { + ${2://Stuff to do *after* the animation takes place}; +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet new file mode 100644 index 00000000..24d6c763 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet @@ -0,0 +1 @@ +${1:obj}.fadeOut('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet new file mode 100644 index 00000000..76d54571 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet @@ -0,0 +1,3 @@ +${1:obj}.fadeOut('slow/400/fast', function() { + ${2://Stuff to do *after* the animation takes place}; +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet new file mode 100644 index 00000000..b0e584aa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet @@ -0,0 +1 @@ +${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet new file mode 100644 index 00000000..17243b4c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet @@ -0,0 +1,3 @@ +${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function() { + ${3://Stuff to do *after* the animation takes place}; +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet new file mode 100644 index 00000000..d33fdf2b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet @@ -0,0 +1 @@ +${1:obj}.filter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet new file mode 100644 index 00000000..1791e912 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet @@ -0,0 +1 @@ +${1:obj}.find('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet new file mode 100644 index 00000000..3b1b5719 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet @@ -0,0 +1,3 @@ +${1:obj}.focus(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet new file mode 100644 index 00000000..4374c183 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet @@ -0,0 +1 @@ +${1:obj}.get(${2:element index})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet new file mode 100644 index 00000000..518d676d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet @@ -0,0 +1,5 @@ +$.getJSON('<+/path/to/file.cgi+>',{ + <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, + function(json){ + <+//stuff to do after event occurs;+> +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet new file mode 100644 index 00000000..0b62d90b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet @@ -0,0 +1,3 @@ +$.getScript('${1:somescript.js}', function(){ + ${2://optional stuff to do after getScript;} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet new file mode 100644 index 00000000..1515d5c6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet @@ -0,0 +1 @@ +${1:obj}.height(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet new file mode 100644 index 00000000..c8071cbc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet @@ -0,0 +1 @@ +${1:obj}.hide('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet new file mode 100644 index 00000000..62f2280a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet @@ -0,0 +1,3 @@ +${1:obj}.hide('${2:slow/400/fast}', function() { + ${3://Stuff to do *after* the animation takes place} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet new file mode 100644 index 00000000..d8468c1a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet @@ -0,0 +1,5 @@ +${1:obj}.hover(function() { + ${2:// Stuff to do when the mouse enters the element;} +}, function() { + ${3:// Stuff to do when the mouse leaves the element;} +});${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet new file mode 100644 index 00000000..0c5a25e1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet @@ -0,0 +1 @@ +${1:obj}.html('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet new file mode 100644 index 00000000..66c389eb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet @@ -0,0 +1 @@ +${1:obj}.insertAfter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet new file mode 100644 index 00000000..e7090d4d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet @@ -0,0 +1 @@ +${1:obj}.insertBefore('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet new file mode 100644 index 00000000..28eefb02 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet @@ -0,0 +1 @@ +${1:obj}.is('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet new file mode 100644 index 00000000..1f09fbc9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet @@ -0,0 +1,3 @@ +${1:obj}.load(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet new file mode 100644 index 00000000..2e7d9c8b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet @@ -0,0 +1,3 @@ +<+obj+>.load('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { + <+// Stuff to do after the page is loaded+> +}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet new file mode 100644 index 00000000..fe45d05a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet @@ -0,0 +1,3 @@ +<+obj+>.loadIfModified('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { + <+// Stuff to do after the page is loaded+> +}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet new file mode 100644 index 00000000..3be70e1b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet @@ -0,0 +1,3 @@ +${1:obj}.mousedown(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet new file mode 100644 index 00000000..eb7ac052 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet @@ -0,0 +1,3 @@ +${1:obj}.mousemove(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet new file mode 100644 index 00000000..f2142756 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet @@ -0,0 +1,3 @@ +${1:obj}.mouseout(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet new file mode 100644 index 00000000..f1eb19cc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet @@ -0,0 +1,3 @@ +${1:obj}.mouseover(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet new file mode 100644 index 00000000..04fb36a3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet @@ -0,0 +1,3 @@ +${1:obj}.mouseup(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet new file mode 100644 index 00000000..b6a65281 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet @@ -0,0 +1 @@ +${1:obj}.next('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet new file mode 100644 index 00000000..c6a217f6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet @@ -0,0 +1 @@ +${1:obj}.not('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet new file mode 100644 index 00000000..cacdbfb5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet @@ -0,0 +1,3 @@ +${1:obj}.one('${2:event name}', function(${3:event}) { + ${4:// Act on the event once} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet new file mode 100644 index 00000000..0490f05a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet @@ -0,0 +1 @@ +${1:obj}.parent('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet new file mode 100644 index 00000000..fb0bd131 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet @@ -0,0 +1 @@ +${1:obj}.parents('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet new file mode 100644 index 00000000..bc41d48f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet @@ -0,0 +1 @@ +${1:obj}.prepend('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet new file mode 100644 index 00000000..e4406957 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet @@ -0,0 +1 @@ +${1:obj}.prependTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet new file mode 100644 index 00000000..b7aba645 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet @@ -0,0 +1 @@ +${1:obj}.prev('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet new file mode 100644 index 00000000..d0005318 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet @@ -0,0 +1,3 @@ +$(document).ready(function() { + ${1:// Stuff to do as soon as the DOM is ready;} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet new file mode 100644 index 00000000..4c976a17 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet @@ -0,0 +1 @@ +${1:obj}.remove()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet new file mode 100644 index 00000000..267d584a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet @@ -0,0 +1 @@ +${1:obj}.removeAttr('${2:attribute name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet new file mode 100644 index 00000000..f5538030 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet @@ -0,0 +1 @@ +${1:obj}.removeClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet new file mode 100644 index 00000000..777af958 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet @@ -0,0 +1,3 @@ +${1:obj}.reset(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet new file mode 100644 index 00000000..b46ac0a0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet @@ -0,0 +1,3 @@ +${1:obj}.resize(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet new file mode 100644 index 00000000..7a512442 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet @@ -0,0 +1,3 @@ +${1:obj}.scroll(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet new file mode 100644 index 00000000..b39840e9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet @@ -0,0 +1 @@ +${1:obj}.slideDown('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet new file mode 100644 index 00000000..3404b783 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet @@ -0,0 +1,3 @@ +${1:obj}.slideDown('${2:slow/400/fast}', function() { + ${3://Stuff to do *after* the animation takes place}; +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet new file mode 100644 index 00000000..873c6657 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet @@ -0,0 +1,3 @@ +${1:obj}.slideUp('${2:slow/400/fast}', function() { + ${3://Stuff to do *after* the animation takes place}; +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet new file mode 100644 index 00000000..986437ed --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet @@ -0,0 +1,3 @@ +${1:obj}.select(function() { + ${2:// Act on the event} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet new file mode 100644 index 00000000..31819b1e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet @@ -0,0 +1 @@ +${1:obj}.show('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet new file mode 100644 index 00000000..6dc5bacc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet @@ -0,0 +1,3 @@ +${1:obj}.show('${2:slow/400/fast}', function() { + ${3://Stuff to do *after* the animation takes place} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet new file mode 100644 index 00000000..014f1f79 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet @@ -0,0 +1 @@ +${1:obj}.siblings('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet new file mode 100644 index 00000000..1ba15439 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet @@ -0,0 +1 @@ +${1:obj}.size()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet new file mode 100644 index 00000000..daba37d2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet @@ -0,0 +1 @@ +${1:obj}.slideToggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet new file mode 100644 index 00000000..ae98d83e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet @@ -0,0 +1,3 @@ +${1:obj}.submit(function() { + ${2:// Act on the event once} +}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet new file mode 100644 index 00000000..d844a68e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet @@ -0,0 +1 @@ +${1:obj}.slideUp('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet new file mode 100644 index 00000000..5f667c07 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet @@ -0,0 +1 @@ +${1:obj}.text(${2:'some text'})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet new file mode 100644 index 00000000..b3cee8d3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet @@ -0,0 +1 @@ +$(this)${1} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet new file mode 100644 index 00000000..54f5f17a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet @@ -0,0 +1,6 @@ +${1:obj}.toggle(function() { + ${2:// Stuff to do every *odd* time the element is clicked;} +}, function() { + ${3:// Stuff to do every *even* time the element is clicked;} +}); +${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet new file mode 100644 index 00000000..023a4b7d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet @@ -0,0 +1 @@ +${1:obj}.toggleClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet new file mode 100644 index 00000000..265a62d0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet @@ -0,0 +1 @@ +${1:obj}.toggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet new file mode 100644 index 00000000..f7105e08 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet @@ -0,0 +1 @@ +${1:obj}.trigger('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet new file mode 100644 index 00000000..0fe423d5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet @@ -0,0 +1 @@ +${1:obj}.unbind('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet new file mode 100644 index 00000000..cafe0b0b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet @@ -0,0 +1 @@ +${1:obj}.val('${2:text}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet new file mode 100644 index 00000000..415631c6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet @@ -0,0 +1 @@ +${1:obj}.width(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet new file mode 100644 index 00000000..55df53ff --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet @@ -0,0 +1 @@ +${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript/anon.snippet b/sources_non_forked/snipmate-snippets/javascript/anon.snippet new file mode 100644 index 00000000..d486c430 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/anon.snippet @@ -0,0 +1 @@ +function(${1}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/for.snippet b/sources_non_forked/snipmate-snippets/javascript/for.snippet new file mode 100644 index 00000000..3933153f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/for.snippet @@ -0,0 +1,3 @@ +for (var <+i+>=0; <+i+> < <+<+Things+>.length+>; <+i+>++) { +<+<+Things+>[<+i+>]+> +}; diff --git a/sources_non_forked/snipmate-snippets/javascript/fun.snippet b/sources_non_forked/snipmate-snippets/javascript/fun.snippet new file mode 100644 index 00000000..064b9593 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/fun.snippet @@ -0,0 +1,3 @@ +function ${1:function_name} (${2:argument}) { + ${3:// body} +} diff --git a/sources_non_forked/snipmate-snippets/javascript/if.snippet b/sources_non_forked/snipmate-snippets/javascript/if.snippet new file mode 100644 index 00000000..931b9f17 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/if.snippet @@ -0,0 +1 @@ +if (${1:true}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/ife.snippet b/sources_non_forked/snipmate-snippets/javascript/ife.snippet new file mode 100644 index 00000000..6b172d07 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/ife.snippet @@ -0,0 +1,4 @@ +if (${1:true}) { + ${2} +} else { +}; diff --git a/sources_non_forked/snipmate-snippets/javascript/log.snippet b/sources_non_forked/snipmate-snippets/javascript/log.snippet new file mode 100644 index 00000000..b4cf84fe --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/log.snippet @@ -0,0 +1 @@ +console.log(${1}); diff --git a/sources_non_forked/snipmate-snippets/javascript/met.snippet b/sources_non_forked/snipmate-snippets/javascript/met.snippet new file mode 100644 index 00000000..1c30d617 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/met.snippet @@ -0,0 +1,3 @@ +${1:method_name}: function(${2:attribute}){ + ${3} +}${4:, } diff --git a/sources_non_forked/snipmate-snippets/javascript/proto.snippet b/sources_non_forked/snipmate-snippets/javascript/proto.snippet new file mode 100644 index 00000000..37cd6d49 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/proto.snippet @@ -0,0 +1,3 @@ +${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { + ${4:// body} +}; diff --git a/sources_non_forked/snipmate-snippets/javascript/timeout.snippet b/sources_non_forked/snipmate-snippets/javascript/timeout.snippet new file mode 100644 index 00000000..6ea2842c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/javascript/timeout.snippet @@ -0,0 +1 @@ +setTimeout(function() { ${1} }, ${2:10}); diff --git a/sources_non_forked/snipmate-snippets/objc/I.snippet b/sources_non_forked/snipmate-snippets/objc/I.snippet new file mode 100644 index 00000000..0032f65f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/I.snippet @@ -0,0 +1,6 @@ ++ (void) initialize +{ + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: + ${1}@"value", @"key", + nil]]; +} diff --git a/sources_non_forked/snipmate-snippets/objc/Imp.snippet b/sources_non_forked/snipmate-snippets/objc/Imp.snippet new file mode 100644 index 00000000..91724d3f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/Imp.snippet @@ -0,0 +1 @@ +#import "${1:`Filename()`.h}"${2} diff --git a/sources_non_forked/snipmate-snippets/objc/alloc.snippet b/sources_non_forked/snipmate-snippets/objc/alloc.snippet new file mode 100644 index 00000000..e4d15993 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/alloc.snippet @@ -0,0 +1 @@ +[[${1:foo} alloc] init]${2};${3} diff --git a/sources_non_forked/snipmate-snippets/objc/array.snippet b/sources_non_forked/snipmate-snippets/objc/array.snippet new file mode 100644 index 00000000..45d3ef01 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/array.snippet @@ -0,0 +1 @@ +NSMutableArray *${1:array} = [NSMutable array];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/bez.snippet b/sources_non_forked/snipmate-snippets/objc/bez.snippet new file mode 100644 index 00000000..493aff69 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/bez.snippet @@ -0,0 +1 @@ +NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/cat.snippet b/sources_non_forked/snipmate-snippets/objc/cat.snippet new file mode 100644 index 00000000..fd57aae3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/cat.snippet @@ -0,0 +1,6 @@ +@interface ${1:NSObject} (${2:Category}) +@end + +@implementation $1 ($2) +${3} +@end diff --git a/sources_non_forked/snipmate-snippets/objc/cati.snippet b/sources_non_forked/snipmate-snippets/objc/cati.snippet new file mode 100644 index 00000000..d2852600 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/cati.snippet @@ -0,0 +1,3 @@ +@interface ${1:NSObject} (${2:Category}) +${3} +@end diff --git a/sources_non_forked/snipmate-snippets/objc/cli.snippet b/sources_non_forked/snipmate-snippets/objc/cli.snippet new file mode 100644 index 00000000..fa896224 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/cli.snippet @@ -0,0 +1,5 @@ +@interface ${1:ClassName} : ${2:NSObject} +{${3} +} +${4} +@end diff --git a/sources_non_forked/snipmate-snippets/objc/dict.snippet b/sources_non_forked/snipmate-snippets/objc/dict.snippet new file mode 100644 index 00000000..8b2d7e90 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/dict.snippet @@ -0,0 +1 @@ +NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/forarray.snippet b/sources_non_forked/snipmate-snippets/objc/forarray.snippet new file mode 100644 index 00000000..d32215d0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/forarray.snippet @@ -0,0 +1,7 @@ +unsigned int ${1:object}Count = [${2:array} count]; + +for (unsigned int index = 0; index < $1Count; index++) +{ + ${3:id} $1 = [$2 $1AtIndex:index]; + ${4} +} diff --git a/sources_non_forked/snipmate-snippets/objc/log.snippet b/sources_non_forked/snipmate-snippets/objc/log.snippet new file mode 100644 index 00000000..69f9c067 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/log.snippet @@ -0,0 +1 @@ +NSLog(@"${1}"${2});${3} diff --git a/sources_non_forked/snipmate-snippets/objc/m/class method.snippet b/sources_non_forked/snipmate-snippets/objc/m/class method.snippet new file mode 100644 index 00000000..191ee160 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/m/class method.snippet @@ -0,0 +1,4 @@ ++ (${1:id}) ${2:method} +{${3} + return nil; +} diff --git a/sources_non_forked/snipmate-snippets/objc/m/method.snippet b/sources_non_forked/snipmate-snippets/objc/m/method.snippet new file mode 100644 index 00000000..9f7390e2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/m/method.snippet @@ -0,0 +1,4 @@ +- (${1:id}) ${2:method} +{${3} + ${4:return nil;} +} diff --git a/sources_non_forked/snipmate-snippets/objc/objacc.snippet b/sources_non_forked/snipmate-snippets/objc/objacc.snippet new file mode 100644 index 00000000..840ebfd0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/objacc.snippet @@ -0,0 +1,11 @@ +- (${1:id})${2:thing} +{ + return $2; +} + +- (void) set$2:($1) +{ + $1 old$2 = $2; + $2 = [aValue retain]; + [old$2 release]; +} diff --git a/sources_non_forked/snipmate-snippets/objc/objc.snippet b/sources_non_forked/snipmate-snippets/objc/objc.snippet new file mode 100644 index 00000000..d6671487 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/objc.snippet @@ -0,0 +1,14 @@ +@interface ${1:`Filename('', 'object')`} : ${2:NSObject} +{ +} +@end + +@implementation $1 +- (id) init +{ + if (self = [super init]) + {${3} + } + return self +} +@end diff --git a/sources_non_forked/snipmate-snippets/objc/prop.snippet b/sources_non_forked/snipmate-snippets/objc/prop.snippet new file mode 100644 index 00000000..d77495a6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/prop.snippet @@ -0,0 +1 @@ +@property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4} diff --git a/sources_non_forked/snipmate-snippets/objc/rel.snippet b/sources_non_forked/snipmate-snippets/objc/rel.snippet new file mode 100644 index 00000000..5dea04dd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/rel.snippet @@ -0,0 +1 @@ +[${1:foo} release];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/ret.snippet b/sources_non_forked/snipmate-snippets/objc/ret.snippet new file mode 100644 index 00000000..ee8eba46 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/ret.snippet @@ -0,0 +1 @@ +[${1:foo} retain];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sel.snippet b/sources_non_forked/snipmate-snippets/objc/sel.snippet new file mode 100644 index 00000000..4d4996d1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/sel.snippet @@ -0,0 +1 @@ +@selector(${1:method}:)${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sm.snippet b/sources_non_forked/snipmate-snippets/objc/sm.snippet new file mode 100644 index 00000000..af139a90 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/sm.snippet @@ -0,0 +1,5 @@ +- (${1:id}) ${2:method}:(${3:id})${4:anArgument} +{ + $1 res = [super $2:$4];${5} + return res; +} diff --git a/sources_non_forked/snipmate-snippets/objc/syn.snippet b/sources_non_forked/snipmate-snippets/objc/syn.snippet new file mode 100644 index 00000000..eef7581c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/objc/syn.snippet @@ -0,0 +1 @@ +@synthesize ${1:NSSomeClass};${2} diff --git a/sources_non_forked/snipmate-snippets/php/array.snippet b/sources_non_forked/snipmate-snippets/php/array.snippet new file mode 100644 index 00000000..922542e0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/array.snippet @@ -0,0 +1 @@ +$${1:arrayName} = array('${2}' => ${3});${4} diff --git a/sources_non_forked/snipmate-snippets/php/case.snippet b/sources_non_forked/snipmate-snippets/php/case.snippet new file mode 100644 index 00000000..8f9e4daf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/case.snippet @@ -0,0 +1,3 @@ +case '${1:value}': + ${2:// code...} + break;${3} diff --git a/sources_non_forked/snipmate-snippets/php/class.snippet b/sources_non_forked/snipmate-snippets/php/class.snippet new file mode 100644 index 00000000..4929a955 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/class.snippet @@ -0,0 +1,11 @@ +/** + * ${1} + */ +class ${2:ClassName} +{ + ${3} + function ${4:__construct}(${5:argument}) + { + ${6:// code...} + } +} diff --git a/sources_non_forked/snipmate-snippets/php/classe.snippet b/sources_non_forked/snipmate-snippets/php/classe.snippet new file mode 100644 index 00000000..2f2b0bc3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/classe.snippet @@ -0,0 +1,12 @@ +/** + * ${1} + */ +class ${2:ClassName} extends ${3:AnotherClass} +{ + ${4} + function ${5:__construct}(${6:argument}) + { + ${7:// code...} + } +} + diff --git a/sources_non_forked/snipmate-snippets/php/def.snippet b/sources_non_forked/snipmate-snippets/php/def.snippet new file mode 100644 index 00000000..df0f5ebd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/def.snippet @@ -0,0 +1 @@ +define('${1}'${2});${3} diff --git a/sources_non_forked/snipmate-snippets/php/defd.snippet b/sources_non_forked/snipmate-snippets/php/defd.snippet new file mode 100644 index 00000000..6758cdad --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/defd.snippet @@ -0,0 +1 @@ +${1}defined('${2}')${3} diff --git a/sources_non_forked/snipmate-snippets/php/do.snippet b/sources_non_forked/snipmate-snippets/php/do.snippet new file mode 100644 index 00000000..e7dd5b06 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/do.snippet @@ -0,0 +1,3 @@ +do { + ${2:// code... } +} while (${1:/* condition */});" diff --git a/sources_non_forked/snipmate-snippets/php/doc_cp.snippet b/sources_non_forked/snipmate-snippets/php/doc_cp.snippet new file mode 100644 index 00000000..d6d1b3fc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/doc_cp.snippet @@ -0,0 +1,6 @@ +/** + * ${1:undocumented class} + * + * @package ${2:default} + * @author ${3:`g:snips_author`} + **/${4} diff --git a/sources_non_forked/snipmate-snippets/php/doc_f.snippet b/sources_non_forked/snipmate-snippets/php/doc_f.snippet new file mode 100644 index 00000000..a9adbb07 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/doc_f.snippet @@ -0,0 +1,8 @@ +/** + * $2 + * @return ${4:void} + * @author ${5:`g:snips_author`} + **/ +${1:public }function ${2:someFunc}(${3}) +{${6} +} diff --git a/sources_non_forked/snipmate-snippets/php/doc_h.snippet b/sources_non_forked/snipmate-snippets/php/doc_h.snippet new file mode 100644 index 00000000..a0c12e01 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/doc_h.snippet @@ -0,0 +1,10 @@ +/** + * ${1} + * + * @author ${2:`g:snips_author`} + * @version ${3:$Id$} + * @copyright ${4:$2}, `strftime('%d %B, %Y')` + * @package ${5:default} + **/ +/** + * Define DocBlock *// diff --git a/sources_non_forked/snipmate-snippets/php/doc_i.snippet b/sources_non_forked/snipmate-snippets/php/doc_i.snippet new file mode 100644 index 00000000..e62eab72 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/doc_i.snippet @@ -0,0 +1,8 @@ +/** + * $1 + * @package ${2:default} + * @author ${3:`g:snips_author`} + **/ +interface ${1:someClass} +{${4} +} // END interface $1" diff --git a/sources_non_forked/snipmate-snippets/php/ec.snippet b/sources_non_forked/snipmate-snippets/php/ec.snippet new file mode 100644 index 00000000..489d759b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/ec.snippet @@ -0,0 +1 @@ +echo "${1:string}"${2}; diff --git a/sources_non_forked/snipmate-snippets/php/else.snippet b/sources_non_forked/snipmate-snippets/php/else.snippet new file mode 100644 index 00000000..b910e982 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/else.snippet @@ -0,0 +1,3 @@ +else { + ${1:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/elseif.snippet b/sources_non_forked/snipmate-snippets/php/elseif.snippet new file mode 100644 index 00000000..a57dec80 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/elseif.snippet @@ -0,0 +1,3 @@ +elseif (${1:/* condition */}) { + ${2:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/for.snippet b/sources_non_forked/snipmate-snippets/php/for.snippet new file mode 100644 index 00000000..e9bc52aa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/for.snippet @@ -0,0 +1,3 @@ +for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/foreach.snippet b/sources_non_forked/snipmate-snippets/php/foreach.snippet new file mode 100644 index 00000000..5fe47e5b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/foreach.snippet @@ -0,0 +1,3 @@ +foreach ($${1:variable} as $${2:key}){ + ${3:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/foreachk.snippet b/sources_non_forked/snipmate-snippets/php/foreachk.snippet new file mode 100644 index 00000000..f78d57ae --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/foreachk.snippet @@ -0,0 +1,3 @@ +foreach ($${1:variable} as $${2:key} => $${3:value}){ + ${4:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/fun.snippet b/sources_non_forked/snipmate-snippets/php/fun.snippet new file mode 100644 index 00000000..0f5d3534 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/fun.snippet @@ -0,0 +1,4 @@ +${1:public }function ${2:FunctionName}(${3}) +{ + ${4:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/get.snippet b/sources_non_forked/snipmate-snippets/php/get.snippet new file mode 100644 index 00000000..af32e0a5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/get.snippet @@ -0,0 +1 @@ +$_GET['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/globals.snippet b/sources_non_forked/snipmate-snippets/php/globals.snippet new file mode 100644 index 00000000..6f5b04f3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/globals.snippet @@ -0,0 +1 @@ +$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} diff --git a/sources_non_forked/snipmate-snippets/php/if.snippet b/sources_non_forked/snipmate-snippets/php/if.snippet new file mode 100644 index 00000000..69ac0bd6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/if.snippet @@ -0,0 +1,3 @@ +if (${1:/* condition */}) { + ${2:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/php/ife.snippet b/sources_non_forked/snipmate-snippets/php/ife.snippet new file mode 100644 index 00000000..b8621c1b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/ife.snippet @@ -0,0 +1,4 @@ +if (${1:/* condition */}) { + ${2:// code...} +} else { +} diff --git a/sources_non_forked/snipmate-snippets/php/inc.snippet b/sources_non_forked/snipmate-snippets/php/inc.snippet new file mode 100644 index 00000000..8df3966c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/inc.snippet @@ -0,0 +1 @@ +include '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/inc1.snippet b/sources_non_forked/snipmate-snippets/php/inc1.snippet new file mode 100644 index 00000000..ba262818 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/inc1.snippet @@ -0,0 +1 @@ +include_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/log.snippet b/sources_non_forked/snipmate-snippets/php/log.snippet new file mode 100644 index 00000000..2b8dcc4b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/log.snippet @@ -0,0 +1 @@ +error_log(var_export(${1}, true));${2} diff --git a/sources_non_forked/snipmate-snippets/php/php.snippet b/sources_non_forked/snipmate-snippets/php/php.snippet new file mode 100644 index 00000000..ed2ed1ce --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/php.snippet @@ -0,0 +1,3 @@ + diff --git a/sources_non_forked/snipmate-snippets/php/post.snippet b/sources_non_forked/snipmate-snippets/php/post.snippet new file mode 100644 index 00000000..2de7aa5f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/post.snippet @@ -0,0 +1 @@ +$_POST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/req.snippet b/sources_non_forked/snipmate-snippets/php/req.snippet new file mode 100644 index 00000000..c03ea36f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/req.snippet @@ -0,0 +1 @@ +require '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/req1.snippet b/sources_non_forked/snipmate-snippets/php/req1.snippet new file mode 100644 index 00000000..e909c3bc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/req1.snippet @@ -0,0 +1 @@ +require_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/request.snippet b/sources_non_forked/snipmate-snippets/php/request.snippet new file mode 100644 index 00000000..9a839b1b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/request.snippet @@ -0,0 +1 @@ +$_REQUEST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/session.snippet b/sources_non_forked/snipmate-snippets/php/session.snippet new file mode 100644 index 00000000..5e3e11b9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/session.snippet @@ -0,0 +1 @@ +$_SESSION['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/switch.snippet b/sources_non_forked/snipmate-snippets/php/switch.snippet new file mode 100644 index 00000000..7fc47c63 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/switch.snippet @@ -0,0 +1,9 @@ +switch ($${1:variable}) { + case '${2:value}': + ${3:// code...} + break; + ${5} + default: + ${4:// code...} + break; +} diff --git a/sources_non_forked/snipmate-snippets/php/t.snippet b/sources_non_forked/snipmate-snippets/php/t.snippet new file mode 100644 index 00000000..e8deae52 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/t.snippet @@ -0,0 +1 @@ +$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} diff --git a/sources_non_forked/snipmate-snippets/php/try.snippet b/sources_non_forked/snipmate-snippets/php/try.snippet new file mode 100644 index 00000000..66a7f651 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/try.snippet @@ -0,0 +1,6 @@ +try { + ${1:// code...} +} catch (${2:Exception} $e) { + ${3:// code...} +} + diff --git a/sources_non_forked/snipmate-snippets/php/var.snippet b/sources_non_forked/snipmate-snippets/php/var.snippet new file mode 100644 index 00000000..1f8cd08e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/var.snippet @@ -0,0 +1 @@ +var_export(${1});${2} diff --git a/sources_non_forked/snipmate-snippets/php/wh.snippet b/sources_non_forked/snipmate-snippets/php/wh.snippet new file mode 100644 index 00000000..36ae0ffc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/php/wh.snippet @@ -0,0 +1,3 @@ +while (${1:/* condition */}) { + ${2:// code...} +} diff --git a/sources_non_forked/snipmate-snippets/po/msg.snippet b/sources_non_forked/snipmate-snippets/po/msg.snippet new file mode 100644 index 00000000..2ad6638a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/po/msg.snippet @@ -0,0 +1,2 @@ +msgid "${1}" +msgstr "${2}"${3} diff --git a/sources_non_forked/snipmate-snippets/python/class.snippet b/sources_non_forked/snipmate-snippets/python/class.snippet new file mode 100644 index 00000000..d9e2b8e8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/class.snippet @@ -0,0 +1,2 @@ +class ${1:``Snippet_PythonClassNameFromFilename()``}(${2:data}): +${3} diff --git a/sources_non_forked/snipmate-snippets/python/def.snippet b/sources_non_forked/snipmate-snippets/python/def.snippet new file mode 100644 index 00000000..c7cc9d38 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/def.snippet @@ -0,0 +1,2 @@ +def ${1:name}(${2:data}): +${3} diff --git a/sources_non_forked/snipmate-snippets/python/for.snippet b/sources_non_forked/snipmate-snippets/python/for.snippet new file mode 100644 index 00000000..fb69c05f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/for.snippet @@ -0,0 +1,3 @@ +for ${1:var} in ${2:type}: +${3:pass} +${4} diff --git a/sources_non_forked/snipmate-snippets/python/from.snippet b/sources_non_forked/snipmate-snippets/python/from.snippet new file mode 100644 index 00000000..98d0d825 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/from.snippet @@ -0,0 +1,2 @@ +from ${1:module} import ${2:name} +${3} diff --git a/sources_non_forked/snipmate-snippets/python/get.snippet b/sources_non_forked/snipmate-snippets/python/get.snippet new file mode 100644 index 00000000..bc0bf63d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/get.snippet @@ -0,0 +1,3 @@ +def get_${1:name}(self): +return self._$1 +${2} diff --git a/sources_non_forked/snipmate-snippets/python/ifmain.snippet b/sources_non_forked/snipmate-snippets/python/ifmain.snippet new file mode 100644 index 00000000..f6e7a262 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/ifmain.snippet @@ -0,0 +1,2 @@ +if __name__ == '__main__': +${1} diff --git a/sources_non_forked/snipmate-snippets/python/import.snippet b/sources_non_forked/snipmate-snippets/python/import.snippet new file mode 100644 index 00000000..58c9acdc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/import.snippet @@ -0,0 +1,2 @@ +import ${1:module} +${2} diff --git a/sources_non_forked/snipmate-snippets/python/init.snippet b/sources_non_forked/snipmate-snippets/python/init.snippet new file mode 100644 index 00000000..c1a4f0fa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/init.snippet @@ -0,0 +1,2 @@ +def __init__(self, ${1:args}): +${2} diff --git a/sources_non_forked/snipmate-snippets/python/set.snippet b/sources_non_forked/snipmate-snippets/python/set.snippet new file mode 100644 index 00000000..6ab0b5aa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/set.snippet @@ -0,0 +1 @@ +def set_${1:name}(self, ${2:value}): diff --git a/sources_non_forked/snipmate-snippets/python/try.snippet b/sources_non_forked/snipmate-snippets/python/try.snippet new file mode 100644 index 00000000..fd5f6e59 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/python/try.snippet @@ -0,0 +1,4 @@ +try: +${1} +except ${2:Exception} +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet new file mode 100644 index 00000000..05cc3e8e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet @@ -0,0 +1 @@ +Factory(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet new file mode 100644 index 00000000..299c0335 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet @@ -0,0 +1 @@ +Factory.build(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet new file mode 100644 index 00000000..41d1503c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet @@ -0,0 +1,4 @@ +Factory.define(:${1:model}) do |${2:f}| + ${3} +end +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet new file mode 100644 index 00000000..7232308c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet @@ -0,0 +1 @@ +Factory.next(:${1:sequence-name})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet new file mode 100644 index 00000000..13fd5b9d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet @@ -0,0 +1,4 @@ +Factory.sequence :${1:sequence-name} do |${2:m}| + ${3} +end +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet new file mode 100644 index 00000000..a5a7d34e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet @@ -0,0 +1 @@ +assert_redirected_to ${1::action => "${2:index}"} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet new file mode 100644 index 00000000..2c9bfef0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet @@ -0,0 +1 @@ +assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>, <+@<+child+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet new file mode 100644 index 00000000..becd79b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet @@ -0,0 +1 @@ +assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet new file mode 100644 index 00000000..55b9204a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet @@ -0,0 +1 @@ +assert_redirected_to <+<+model+>_path(<+@<+model+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet new file mode 100644 index 00000000..1d1d203d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet @@ -0,0 +1 @@ +assert_redirected_to <+<+model+>s_path+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet new file mode 100644 index 00000000..35ab7301 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet @@ -0,0 +1,3 @@ +assert_difference "${1:Model}.${2:count}", $1 do + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet new file mode 100644 index 00000000..c5124e04 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet @@ -0,0 +1,3 @@ +assert_no_difference "${1:Model}.${2:count}" do + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet new file mode 100644 index 00000000..d0ac6b26 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet @@ -0,0 +1 @@ +assert_response :${1:success}, @response.body${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet new file mode 100644 index 00000000..6ee13f2d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet @@ -0,0 +1 @@ +assert_rjs :<+replace+>, <+"<+dom id+>"+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet new file mode 100644 index 00000000..4cc696f6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet @@ -0,0 +1 @@ +assert_select '<+path+>'<+, :<+text+> => <+'<+inner_html+>'+>+> <+do<++>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet new file mode 100644 index 00000000..ad25cc90 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet @@ -0,0 +1 @@ +before_filter :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet new file mode 100644 index 00000000..b28e1e62 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet @@ -0,0 +1 @@ +belongs_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet new file mode 100644 index 00000000..3b1ab619 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet @@ -0,0 +1 @@ +cattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet new file mode 100644 index 00000000..e878d3a6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet @@ -0,0 +1,14 @@ +def create + @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) + + respond_to do |wants| + if @$1.save + flash[:notice] = '$2 was successfully created.' + wants.html { redirect_to(@$1) } + wants.xml { render :xml => @$1, :status => :created, :location => @$1 } + else + wants.html { render :action => "new" } + wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + end + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet new file mode 100644 index 00000000..9c340808 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet @@ -0,0 +1,9 @@ +def destroy + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + @$1.destroy + + respond_to do |wants| + wants.html { redirect_to($1s_url) } + wants.xml { head :ok } + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet new file mode 100644 index 00000000..0e80dcb8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet @@ -0,0 +1,3 @@ +def edit + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet new file mode 100644 index 00000000..aa776f9a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet @@ -0,0 +1,8 @@ +def index + @${1:model_class_name} = ${2:ModelClassName}.all + + respond_to do |wants| + wants.html # index.html.erb + wants.xml { render :xml => @$1s } + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet new file mode 100644 index 00000000..0a4762b9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet @@ -0,0 +1,8 @@ +def new + @${1:model_class_name} = ${2:ModelClassName}.new + + respond_to do |wants| + wants.html # new.html.erb + wants.xml { render :xml => @$1 } + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet new file mode 100644 index 00000000..ba745d52 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet @@ -0,0 +1,8 @@ +def show + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + + respond_to do |wants| + wants.html # show.html.erb + wants.xml { render :xml => @$1 } + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet new file mode 100644 index 00000000..0556895c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet @@ -0,0 +1,14 @@ +def update + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + + respond_to do |wants| + if @$1.update_attributes(params[:$1]) + flash[:notice] = '$2 was successfully updated.' + wants.html { redirect_to(@$1) } + wants.xml { head :ok } + else + wants.html { render :action => "edit" } + wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } + end + end +end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet new file mode 100644 index 00000000..af5ec413 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet @@ -0,0 +1 @@ +find(:all<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet new file mode 100644 index 00000000..24ba2da3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet @@ -0,0 +1 @@ +find(:first<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet new file mode 100644 index 00000000..96d68a5f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet @@ -0,0 +1 @@ +find(<+id+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet new file mode 100644 index 00000000..7ee6efec --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet @@ -0,0 +1 @@ +find(:last<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet new file mode 100644 index 00000000..2a069307 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet @@ -0,0 +1 @@ +flash[:${1:notice}] = "${2}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet new file mode 100644 index 00000000..1b27396a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet @@ -0,0 +1 @@ +has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet new file mode 100644 index 00000000..9204df56 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet @@ -0,0 +1 @@ +has_many :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet new file mode 100644 index 00000000..6aadd73b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet @@ -0,0 +1 @@ +has_many :<+object+>s<+, :class_name => "<+object+>", :foreign_key => "<+reference+>_id"+>, :dependent => :destroy<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet new file mode 100644 index 00000000..4128e037 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet @@ -0,0 +1 @@ +has_many :${1:object}, :through => :${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet new file mode 100644 index 00000000..77e14e7a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet @@ -0,0 +1 @@ +has_one :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet new file mode 100644 index 00000000..2a30fae0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet @@ -0,0 +1 @@ +I18n.t('${1:type.key}')${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet new file mode 100644 index 00000000..d97d4829 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet @@ -0,0 +1 @@ +<%= image_submit_tag("<+agree.png+>"<+<+, :id => "<+id+>"+><+, :name => "<+name+>"+><+, :class => "<+class+>"+><+, :disabled => <+false+>+>+>) %> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet new file mode 100644 index 00000000..53360dd5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet @@ -0,0 +1 @@ +RAILS_DEFAULT_LOGGER.${1:debug} ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet new file mode 100644 index 00000000..36236a31 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet @@ -0,0 +1 @@ +logger.debug { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet new file mode 100644 index 00000000..4417ad2e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet @@ -0,0 +1 @@ +logger.error { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet new file mode 100644 index 00000000..1bd419c8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet @@ -0,0 +1 @@ +logger.fatal { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet new file mode 100644 index 00000000..bf508dc1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet @@ -0,0 +1 @@ +logger.info { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet new file mode 100644 index 00000000..447f6886 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet @@ -0,0 +1 @@ +logger.warn { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet new file mode 100644 index 00000000..548d4af0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet @@ -0,0 +1 @@ +add_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet new file mode 100644 index 00000000..b14ec4ca --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet @@ -0,0 +1 @@ +${1:map}.${2:connect} '${3:controller/:action/:id}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet new file mode 100644 index 00000000..9292ffe9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet @@ -0,0 +1 @@ +${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet new file mode 100644 index 00000000..424805b7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet @@ -0,0 +1 @@ +${1:map}.resource :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet new file mode 100644 index 00000000..a18c4df3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet @@ -0,0 +1 @@ +${1:map}.resources :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet new file mode 100644 index 00000000..b3cf7911 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet @@ -0,0 +1,3 @@ +${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| + ${4} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet new file mode 100644 index 00000000..a3b34bb3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet @@ -0,0 +1 @@ +before_save :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet new file mode 100644 index 00000000..74dc7af0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet @@ -0,0 +1 @@ +change_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet new file mode 100644 index 00000000..2915a37f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet @@ -0,0 +1 @@ +t.column :${1:title}, :${2:string} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet new file mode 100644 index 00000000..a71b4731 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet @@ -0,0 +1,3 @@ +change_table :${1:table_name} do |t| + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet new file mode 100644 index 00000000..8a5bd1ff --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet @@ -0,0 +1 @@ +remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet new file mode 100644 index 00000000..8dbe1eab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet @@ -0,0 +1,3 @@ +create_table :${1:table_name} do |t| + t.column :${2:name}, :${3:type} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet new file mode 100644 index 00000000..9f54e0b9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet @@ -0,0 +1,8 @@ +class ${1:`Snippet_MigrationNameFromFilename()`} < ActiveRecord::Migration + def self.up + ${2} + end + + def self.down + end +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet new file mode 100644 index 00000000..1264a595 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet @@ -0,0 +1 @@ +map(&:${1:id}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet new file mode 100644 index 00000000..aaeba258 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet @@ -0,0 +1 @@ +remove_column :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet new file mode 100644 index 00000000..8a5bd1ff --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet @@ -0,0 +1 @@ +remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet new file mode 100644 index 00000000..6e167210 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet @@ -0,0 +1 @@ +rename_column :${1:table}, :${2:old}, :${3:new} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet new file mode 100644 index 00000000..9ef0f8fe --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet @@ -0,0 +1 @@ +mattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet new file mode 100644 index 00000000..cfc42ca4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet @@ -0,0 +1 @@ +named_scope :<+name+><+, :joins => :<+table+>+>, :conditions => <+['<+<+field+> = ?+>', <+true+>]+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet new file mode 100644 index 00000000..c420ef2f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet @@ -0,0 +1 @@ +named_scope :<+name+>, lambda { |<+param+>| { :conditions => <+['<+<+field+> = ?+>', <+param+>]+> } } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet new file mode 100644 index 00000000..14fa54fb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet @@ -0,0 +1 @@ +params[:${1:id}]${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet new file mode 100644 index 00000000..56a9bbf6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet @@ -0,0 +1 @@ +render :action => "${1:action}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet new file mode 100644 index 00000000..0a0b202d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet @@ -0,0 +1 @@ +render :action => "${1:action}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet new file mode 100644 index 00000000..7938f9d6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet @@ -0,0 +1,3 @@ +respond_to do |wants| + wants.${1:html} <+{ <++> }+> +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet new file mode 100644 index 00000000..76fcdb1d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet @@ -0,0 +1 @@ +render :file => "${1:filepath}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet new file mode 100644 index 00000000..c0bb72bf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet @@ -0,0 +1 @@ +render :file => "${1:filepath}", :use_full_path => ${2:false} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet new file mode 100644 index 00000000..17a04048 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet @@ -0,0 +1 @@ +render :inline => "<+<%= 'hello' %>+>" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet new file mode 100644 index 00000000..b1801aa4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet @@ -0,0 +1 @@ +render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet new file mode 100644 index 00000000..b3cd8343 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet @@ -0,0 +1 @@ +render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet new file mode 100644 index 00000000..fece1fcc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet @@ -0,0 +1 @@ +render :json => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet new file mode 100644 index 00000000..53e8340a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet @@ -0,0 +1 @@ +render :layout => "${1:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet new file mode 100644 index 00000000..6c6b0fec --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet @@ -0,0 +1 @@ +render :nothing => ${1:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet new file mode 100644 index 00000000..d1a581f8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet @@ -0,0 +1 @@ +render :nothing => ${1:true}, :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet new file mode 100644 index 00000000..0c5daa25 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet @@ -0,0 +1 @@ +render :partial => "${1:item}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet new file mode 100644 index 00000000..570644b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet @@ -0,0 +1 @@ +render :partial => "<+item+>", :collection => <+@<+item+>s+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet new file mode 100644 index 00000000..6981fbc3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet @@ -0,0 +1 @@ +render :partial => "<+item+>", :locals => { :<+item+> => <+@<+item+>+><++> } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet new file mode 100644 index 00000000..bab9da96 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet @@ -0,0 +1 @@ +render :partial => "<+item+>", :object => <+@<+item+>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet new file mode 100644 index 00000000..aef4c494 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet @@ -0,0 +1 @@ +render :partial => "${1:item}", :status => ${2:500} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet new file mode 100644 index 00000000..c464879c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet @@ -0,0 +1 @@ +render :text => "${1:text to render}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet new file mode 100644 index 00000000..fc78bf14 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet @@ -0,0 +1 @@ +render :text => "${1:text to render}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet new file mode 100644 index 00000000..69618be0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet @@ -0,0 +1 @@ +render :text => "${1:text to render}", :layout => ${2:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet new file mode 100644 index 00000000..04fe409d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet @@ -0,0 +1 @@ +render :text => "${1:text to render}", :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet new file mode 100644 index 00000000..3a2d1ed0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet @@ -0,0 +1,3 @@ +render :update do |${1:page}| + $1.${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet new file mode 100644 index 00000000..e4e721a0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet @@ -0,0 +1 @@ +render :xml => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet new file mode 100644 index 00000000..19847471 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet @@ -0,0 +1 @@ +Digest::SHA1.hexdigest(${1:string}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet new file mode 100644 index 00000000..659aeb0d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet @@ -0,0 +1,15 @@ +class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper + observe $1 + + def after_save(${2:model_class_name}) + expire_cache($2) + end + + def after_destroy($2) + expire_cache($2) + end + + def expire_cache($2) + expire_page + end +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet new file mode 100644 index 00000000..021740df --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet @@ -0,0 +1,2 @@ +t.boolean :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet new file mode 100644 index 00000000..3e6d3c9c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet @@ -0,0 +1,2 @@ +t.binary :<+title+><+, :limit => <+2+>.megabytes+> +<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet new file mode 100644 index 00000000..0932f2c1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet @@ -0,0 +1,2 @@ +t.decimal :<+title+><+<+, :precision => <+10+>+><+, :scale => <+2+>+>+> +<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet new file mode 100644 index 00000000..b716e8b0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet @@ -0,0 +1,2 @@ +t.date :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet new file mode 100644 index 00000000..d060532e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet @@ -0,0 +1,2 @@ +t.datetime :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet new file mode 100644 index 00000000..f09f7904 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet @@ -0,0 +1,2 @@ +t.float :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet new file mode 100644 index 00000000..bcce7271 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet @@ -0,0 +1,2 @@ +t.change :<+name+><+, :<+string+><+, :<+limit+> => <+80+>+>+> +<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet new file mode 100644 index 00000000..7cb011ca --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet @@ -0,0 +1,2 @@ +t.integer :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet new file mode 100644 index 00000000..ffa359f5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet @@ -0,0 +1,2 @@ +t.integer :lock_version, :null => false, :default => 0 +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet new file mode 100644 index 00000000..2b421dd7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet @@ -0,0 +1,2 @@ +t.references :<+taggable+><+, :polymorphic => <+{ :default => '<+Photo+>' }+>+> +<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet new file mode 100644 index 00000000..a7b8473b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet @@ -0,0 +1,2 @@ +t.string :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet new file mode 100644 index 00000000..f28518f4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet @@ -0,0 +1,2 @@ +t.text :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet new file mode 100644 index 00000000..0006c819 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet @@ -0,0 +1,2 @@ +t.time :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet new file mode 100644 index 00000000..e46e844c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet @@ -0,0 +1,2 @@ +t.timestamp :${1:title} +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet new file mode 100644 index 00000000..f009ee62 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet @@ -0,0 +1,2 @@ +t.timestamps +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet new file mode 100644 index 00000000..2d6250ab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet @@ -0,0 +1 @@ +t.remove :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet new file mode 100644 index 00000000..8f70788c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet @@ -0,0 +1,2 @@ +t.rename :<+old_column_name+>, :<+new_column_name+> +<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet new file mode 100644 index 00000000..12867868 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet @@ -0,0 +1 @@ +t.references :${1:model} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet new file mode 100644 index 00000000..064bb7b2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet @@ -0,0 +1 @@ +validates_associated :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet new file mode 100644 index 00000000..4c6c98b6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet @@ -0,0 +1 @@ +validates_acceptance_of :${1:terms} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet new file mode 100644 index 00000000..0aa1a75d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet @@ -0,0 +1 @@ +validates_confirmation_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet new file mode 100644 index 00000000..b6a4c4d5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet @@ -0,0 +1 @@ +validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet new file mode 100644 index 00000000..adc142c7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet @@ -0,0 +1 @@ +validates_format_of :${1:attribute}, :with => /${2:regex}/ diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet new file mode 100644 index 00000000..8ba16d2e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet @@ -0,0 +1 @@ +validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi }) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet new file mode 100644 index 00000000..71d802bd --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet @@ -0,0 +1 @@ +validates_length_of :${1:attribute}, :within => ${2:3}..${3:20} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet new file mode 100644 index 00000000..34bfaa72 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet @@ -0,0 +1 @@ +validates_numericality_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet new file mode 100644 index 00000000..c8fdff9c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet @@ -0,0 +1 @@ +validates_presence_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet new file mode 100644 index 00000000..0c06e655 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet @@ -0,0 +1 @@ +validates_uniqueness_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet new file mode 100644 index 00000000..909c8d59 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet @@ -0,0 +1 @@ +wants.<+js|xml|html+> <+{ <++> }+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet new file mode 100644 index 00000000..41184e9e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet @@ -0,0 +1 @@ +xhr :delete, :${1:destroy}, :id => ${2:1}${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet new file mode 100644 index 00000000..1ae7834e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet @@ -0,0 +1 @@ +xhr :get, :<+show+><+, :id => <+1+>+><++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet new file mode 100644 index 00000000..3681a95f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet @@ -0,0 +1 @@ +xhr :post, :${1:create}, :${2:object} => { ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet new file mode 100644 index 00000000..f046f2ea --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet @@ -0,0 +1 @@ +xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet new file mode 100644 index 00000000..528f1b30 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet @@ -0,0 +1,3 @@ +after(${1::each}) do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet new file mode 100644 index 00000000..7199170c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet @@ -0,0 +1 @@ +any_number_of_times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet new file mode 100644 index 00000000..573addd5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet @@ -0,0 +1 @@ +and_return(${1:value}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet new file mode 100644 index 00000000..ab03deb4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet @@ -0,0 +1 @@ +and_raise(${1:exception}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet new file mode 100644 index 00000000..e313a512 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet @@ -0,0 +1 @@ +and_return { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet new file mode 100644 index 00000000..d230e92c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet @@ -0,0 +1 @@ +and_throw(${1:sym}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet new file mode 100644 index 00000000..34c08d69 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet @@ -0,0 +1 @@ +and_yield(${1:values}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet new file mode 100644 index 00000000..b95128bb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet @@ -0,0 +1 @@ +at_least(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet new file mode 100644 index 00000000..fa5c6060 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet @@ -0,0 +1 @@ +at_most(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet new file mode 100644 index 00000000..f96608c5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet @@ -0,0 +1,3 @@ +before(${1::each}) do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet new file mode 100644 index 00000000..4bd9d239 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet @@ -0,0 +1 @@ +controller_name :${1:controller} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet new file mode 100644 index 00000000..44c75845 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet @@ -0,0 +1,3 @@ +describe "${1:subject}" do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet new file mode 100644 index 00000000..6311aa1d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ${1:`Snippet_RubyClassNameFromFilename()`} do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet new file mode 100644 index 00000000..a9c8ac2b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet @@ -0,0 +1,3 @@ +describe ${1:controller}, "${2:GET|POST|PUT|DELETE} ${3:/some/path}${4}" do + ${5} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet new file mode 100644 index 00000000..b3b3e01a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet @@ -0,0 +1,3 @@ +describe ${1:Type} do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet new file mode 100644 index 00000000..89e9372c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet @@ -0,0 +1,3 @@ +describe ${1:Type}, "${2:description}" do + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet new file mode 100644 index 00000000..2e5a4a01 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet @@ -0,0 +1 @@ +exactly(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet new file mode 100644 index 00000000..728223f0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet @@ -0,0 +1 @@ +it_should_behave_like '${1:do something}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet new file mode 100644 index 00000000..8af38db4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet @@ -0,0 +1,3 @@ +it "${1}" do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet new file mode 100644 index 00000000..963f4041 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet @@ -0,0 +1 @@ +it "should ${1:do something}" do${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet new file mode 100644 index 00000000..2f047710 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet @@ -0,0 +1,24 @@ +class ${1:ReverseTo} + def initialize(${2:param}) + @$2 = $2 + end + + def matches?(actual) + @actual = actual + # Satisfy expectation here. Return false or raise an error if it's not met. + ${3:@actual.reverse.should == @$2} + true + end + + def failure_message + "expected #{@actual.inspect} to ${4} #{@$2.inspect}, but it didn't" + end + + def negative_failure_message + "expected #{@actual.inspect} not to ${5} #{@$2.inspect}, but it did" + end +end + +def ${6:reverse_to}(${7:expected}) + ${8}.new($7) +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet new file mode 100644 index 00000000..b10aa1d5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet @@ -0,0 +1 @@ +mock_model(${1:model})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet new file mode 100644 index 00000000..4ff954f1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet @@ -0,0 +1,2 @@ +${1:var} = mock("${2:mock_name}"${3:, :null_object => true}) +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet new file mode 100644 index 00000000..09f93e07 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet @@ -0,0 +1,3 @@ +Spec::Runner.configure do |config| + config.mock_with :${1:mocha|flexmock|rr} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet new file mode 100644 index 00000000..b2d1a776 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet @@ -0,0 +1 @@ +once diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet new file mode 100644 index 00000000..91cd5b06 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet @@ -0,0 +1 @@ +require File.dirname(__FILE__) + '/../spec_helper' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet new file mode 100644 index 00000000..89d34116 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet @@ -0,0 +1,3 @@ +shared_examples_for "${1:do something}" do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet new file mode 100644 index 00000000..67530e9d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet @@ -0,0 +1,2 @@ +${1:target}.should == ${2:value} +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet new file mode 100644 index 00000000..b909d9c0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet @@ -0,0 +1,2 @@ +${1:target}.should be(${2:result}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet new file mode 100644 index 00000000..9080a3c2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet @@ -0,0 +1,2 @@ +${1:target}.should be_close(${2:result}, ${3:tolerance}) +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet new file mode 100644 index 00000000..98a73893 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet @@ -0,0 +1,2 @@ +${1:target}.should be_instance_of(${2:class}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet new file mode 100644 index 00000000..74bf8520 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet @@ -0,0 +1,2 @@ +${1:target}.should be_a_kind_of(${2:class}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet new file mode 100644 index 00000000..887ef800 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet @@ -0,0 +1,2 @@ +response.should be_redirect +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet new file mode 100644 index 00000000..602074b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet @@ -0,0 +1,2 @@ +response.should be_success +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet new file mode 100644 index 00000000..16206fa1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet @@ -0,0 +1,3 @@ +lambda do + ${1} +end.should change(${2:target}, :${3:method}).from(${4:old_value}).to(${5:new_value}).by(${6:change}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet new file mode 100644 index 00000000..e82d82e7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet @@ -0,0 +1,2 @@ +${1:target}.should match(/${2:regexp}/) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet new file mode 100644 index 00000000..f896a26e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet @@ -0,0 +1,2 @@ +${1:target}.should eql(${2:value}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet new file mode 100644 index 00000000..e3c389e6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet @@ -0,0 +1,2 @@ +${1:target}.should equal(${2:value}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet new file mode 100644 index 00000000..93189cb8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet @@ -0,0 +1,2 @@ +${1:target}.should have(${2:num}).${3:things} +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet new file mode 100644 index 00000000..dabe237a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet @@ -0,0 +1,2 @@ +${1:target}.should have_at_least(${2:num}).${3:things} +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet new file mode 100644 index 00000000..7072add1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet @@ -0,0 +1,2 @@ +${1:target}.should have_at_most(${2:num}).${3:things} +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet new file mode 100644 index 00000000..b8a8997f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet @@ -0,0 +1,2 @@ +${1:target}.should have(${2:n}).records +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet new file mode 100644 index 00000000..b19cbb67 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not == ${2:value} +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet new file mode 100644 index 00000000..a34d62e5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not be(${2:result}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet new file mode 100644 index 00000000..55ac6d3a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not be_close(${2:result}, ${3:tolerance}) +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet new file mode 100644 index 00000000..b6f15267 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not be_instance_of(${2:klass}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet new file mode 100644 index 00000000..0b0cfc7f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not be_a_kind_of(${2:klass}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet new file mode 100644 index 00000000..25519b08 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet @@ -0,0 +1,2 @@ +response.should_not be_redirect +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet new file mode 100644 index 00000000..7d35ab20 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet @@ -0,0 +1,2 @@ +response.should_not be_success +${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet new file mode 100644 index 00000000..7baead27 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet @@ -0,0 +1,3 @@ +lambda do + ${1} +end.should_not change(${2:target}, :${3:method}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet new file mode 100644 index 00000000..68a7451c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not eql(${2:value}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet new file mode 100644 index 00000000..da4f59b9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet @@ -0,0 +1,2 @@ + ${1:target}.should_not equal(${2:value}) + ${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet new file mode 100644 index 00000000..ee7b6043 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not match(/${2:regexp}/) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet new file mode 100644 index 00000000..9f1298b7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet @@ -0,0 +1 @@ +${1:target}.should_not be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet new file mode 100644 index 00000000..98c0fc08 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet @@ -0,0 +1,2 @@ +${1:mock}.should_not_receive(:${2:message})${3} +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet new file mode 100644 index 00000000..fbf9604e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not raise_error(${2:error}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet new file mode 100644 index 00000000..2afb69cc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet @@ -0,0 +1,2 @@ +response.should_not redirect_to(${1:url}) +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet new file mode 100644 index 00000000..c2c5f2cb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not respond_to(:${2:sym}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet new file mode 100644 index 00000000..b73a71c8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet @@ -0,0 +1,2 @@ +${1:target}.should_not satisfy { |${2:obj}| ${3} } +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet new file mode 100644 index 00000000..0353376b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet @@ -0,0 +1,2 @@ +lambda { ${1} }.should_not throw_symbol(:${2:symbol}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet new file mode 100644 index 00000000..9267b612 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet @@ -0,0 +1 @@ +${1:target}.should be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet new file mode 100644 index 00000000..4effa2c1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet @@ -0,0 +1,2 @@ +${1:mock}.should_receive(:${2:message})${3} +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet new file mode 100644 index 00000000..420bbe80 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet @@ -0,0 +1,2 @@ +${1:target}.should raise_error(${2:error}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet new file mode 100644 index 00000000..979c1d6e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet @@ -0,0 +1,2 @@ +response.should redirect_to(${1:url}) +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet new file mode 100644 index 00000000..a796ebd2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet @@ -0,0 +1,2 @@ +${1:target}.should respond_to(:${2:sym}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet new file mode 100644 index 00000000..08eb9419 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet @@ -0,0 +1,2 @@ +${1:target}.should satisfy { |${2:obj}| ${3} } +${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet new file mode 100644 index 00000000..86f55fa3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet @@ -0,0 +1,2 @@ +${1:target}.should throw_symble(:${2:symbol}) +${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet new file mode 100644 index 00000000..9b08c10e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet @@ -0,0 +1,2 @@ +response.should render_template(:${1:template}) +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet new file mode 100644 index 00000000..6ebb6d4a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet @@ -0,0 +1 @@ +twice diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet new file mode 100644 index 00000000..21eda197 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet @@ -0,0 +1,2 @@ +with(${1:args}) +${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet new file mode 100644 index 00000000..0e5a7fd2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet @@ -0,0 +1,5 @@ +context "${1:context}" do + + ${2} + +end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet new file mode 100644 index 00000000..cfd4e59f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet @@ -0,0 +1 @@ +should_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet new file mode 100644 index 00000000..39cfd6f1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet @@ -0,0 +1 @@ +should_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet new file mode 100644 index 00000000..90d25c84 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet @@ -0,0 +1 @@ +should_belong_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet new file mode 100644 index 00000000..2fc48b4a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet @@ -0,0 +1 @@ +should_ensure_length_at_least :${1:field}, ${2:min_length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet new file mode 100644 index 00000000..8bc2bf87 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet @@ -0,0 +1 @@ +should_ensure_length_is :${1:field}, ${2:length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet new file mode 100644 index 00000000..1f0bdc98 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet @@ -0,0 +1 @@ +should_ensure_length_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet new file mode 100644 index 00000000..68b895c1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet @@ -0,0 +1,3 @@ +setup do + ${1} +end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet new file mode 100644 index 00000000..195f7484 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet @@ -0,0 +1 @@ +should_ensure_value_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet new file mode 100644 index 00000000..03c70e24 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet @@ -0,0 +1 @@ +should_have_and_belong_to_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet new file mode 100644 index 00000000..6948aea9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet @@ -0,0 +1 @@ +should_have_class_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet new file mode 100644 index 00000000..d841d650 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet @@ -0,0 +1 @@ +should_have_db_columns :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet new file mode 100644 index 00000000..d6d2b389 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet @@ -0,0 +1 @@ +should_have_indices :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet new file mode 100644 index 00000000..1f442528 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet @@ -0,0 +1 @@ +should_have_instance_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet new file mode 100644 index 00000000..8c98c17e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet @@ -0,0 +1 @@ +should_have_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet new file mode 100644 index 00000000..a652b4f5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet @@ -0,0 +1 @@ +should_have_one :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet new file mode 100644 index 00000000..022015df --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet @@ -0,0 +1 @@ +should_have_read_only_attributes :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet new file mode 100644 index 00000000..236190b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet @@ -0,0 +1 @@ +should_not_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet new file mode 100644 index 00000000..029c5bab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet @@ -0,0 +1 @@ +should_not_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet new file mode 100644 index 00000000..8eccb887 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet @@ -0,0 +1 @@ +should_validate_acceptance_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet new file mode 100644 index 00000000..a90c1cab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet @@ -0,0 +1 @@ +should_validate_numericality_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet new file mode 100644 index 00000000..13598f86 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet @@ -0,0 +1 @@ +should_validate_presence_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet new file mode 100644 index 00000000..6e26912d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet @@ -0,0 +1 @@ +should_validate_uniqueness_of :${1:field}, :scoped_to => ${2:arrayofnames} diff --git a/sources_non_forked/snipmate-snippets/ruby/Md.snippet b/sources_non_forked/snipmate-snippets/ruby/Md.snippet new file mode 100644 index 00000000..1c2c9f10 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/Md.snippet @@ -0,0 +1 @@ +File.open(${1:dump_path}, "wb") { |${2:file}| Marshal.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Ml.snippet b/sources_non_forked/snipmate-snippets/ruby/Ml.snippet new file mode 100644 index 00000000..33c3200c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/Ml.snippet @@ -0,0 +1 @@ +File.open(${1:dump_path}, "rb") { |${2:file}| Marshal.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Pn.snippet b/sources_non_forked/snipmate-snippets/ruby/Pn.snippet new file mode 100644 index 00000000..e2136913 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/Pn.snippet @@ -0,0 +1 @@ +PStore.new(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/Yd.snippet b/sources_non_forked/snipmate-snippets/ruby/Yd.snippet new file mode 100644 index 00000000..e667a081 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/Yd.snippet @@ -0,0 +1 @@ +File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Yl.snippet b/sources_non_forked/snipmate-snippets/ruby/Yl.snippet new file mode 100644 index 00000000..b37d1bb5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/Yl.snippet @@ -0,0 +1 @@ +File.open(${1:path_to_yml}) { |${2:file}| YAML.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/am.snippet b/sources_non_forked/snipmate-snippets/ruby/am.snippet new file mode 100644 index 00000000..91209b9b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/am.snippet @@ -0,0 +1 @@ +alias_method :${1:new_name}, :${2:old_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/as.snippet b/sources_non_forked/snipmate-snippets/ruby/as.snippet new file mode 100644 index 00000000..a8c7f5cb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/as.snippet @@ -0,0 +1 @@ +assert ${1:test}, "${2:failure_message}" diff --git a/sources_non_forked/snipmate-snippets/ruby/asam.snippet b/sources_non_forked/snipmate-snippets/ruby/asam.snippet new file mode 100644 index 00000000..3c95b31c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asam.snippet @@ -0,0 +1 @@ +assert_alias_method ${1:object}, ${2:alias_name}, ${3:original_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asb.snippet b/sources_non_forked/snipmate-snippets/ruby/asb.snippet new file mode 100644 index 00000000..ab1eff71 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asb.snippet @@ -0,0 +1 @@ +assert_boolean ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asc.snippet b/sources_non_forked/snipmate-snippets/ruby/asc.snippet new file mode 100644 index 00000000..c6badc3e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asc.snippet @@ -0,0 +1 @@ +assert_compare ${1:expected}, ${2:operator}, ${3:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/ascd.snippet b/sources_non_forked/snipmate-snippets/ruby/ascd.snippet new file mode 100644 index 00000000..bc77908f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ascd.snippet @@ -0,0 +1 @@ +assert_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/ase.snippet b/sources_non_forked/snipmate-snippets/ruby/ase.snippet new file mode 100644 index 00000000..5f650990 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ase.snippet @@ -0,0 +1 @@ +assert_equal ${1:expected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asem.snippet b/sources_non_forked/snipmate-snippets/ruby/asem.snippet new file mode 100644 index 00000000..46428325 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asem.snippet @@ -0,0 +1 @@ +assert_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asf.snippet b/sources_non_forked/snipmate-snippets/ruby/asf.snippet new file mode 100644 index 00000000..27ff6da5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asf.snippet @@ -0,0 +1 @@ +assert_false ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asfa.snippet b/sources_non_forked/snipmate-snippets/ruby/asfa.snippet new file mode 100644 index 00000000..f45fa53f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asfa.snippet @@ -0,0 +1 @@ +assert_fail_assertion { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asi.snippet b/sources_non_forked/snipmate-snippets/ruby/asi.snippet new file mode 100644 index 00000000..dedf94d2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asi.snippet @@ -0,0 +1 @@ +assert_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asid.snippet b/sources_non_forked/snipmate-snippets/ruby/asid.snippet new file mode 100644 index 00000000..683fb06c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asid.snippet @@ -0,0 +1 @@ +assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:delta_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asie.snippet b/sources_non_forked/snipmate-snippets/ruby/asie.snippet new file mode 100644 index 00000000..f13d0a36 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asie.snippet @@ -0,0 +1 @@ +assert_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asio.snippet b/sources_non_forked/snipmate-snippets/ruby/asio.snippet new file mode 100644 index 00000000..56f0ab7e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asio.snippet @@ -0,0 +1 @@ +assert_instance_of ${1:ExpectedClass}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asko.snippet b/sources_non_forked/snipmate-snippets/ruby/asko.snippet new file mode 100644 index 00000000..555bf138 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asko.snippet @@ -0,0 +1 @@ +assert_kind_of ${1:ExpectedKind}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asm.snippet b/sources_non_forked/snipmate-snippets/ruby/asm.snippet new file mode 100644 index 00000000..9860b4cf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asm.snippet @@ -0,0 +1 @@ +assert_match /${1:expected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asn.snippet b/sources_non_forked/snipmate-snippets/ruby/asn.snippet new file mode 100644 index 00000000..36a2898e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asn.snippet @@ -0,0 +1 @@ +assert_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asncd.snippet b/sources_non_forked/snipmate-snippets/ruby/asncd.snippet new file mode 100644 index 00000000..b4dcd735 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asncd.snippet @@ -0,0 +1 @@ +assert_not_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asne.snippet b/sources_non_forked/snipmate-snippets/ruby/asne.snippet new file mode 100644 index 00000000..91db286a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asne.snippet @@ -0,0 +1 @@ +assert_not_equal ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnem.snippet b/sources_non_forked/snipmate-snippets/ruby/asnem.snippet new file mode 100644 index 00000000..43d07728 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnem.snippet @@ -0,0 +1 @@ +assert_not_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asni.snippet b/sources_non_forked/snipmate-snippets/ruby/asni.snippet new file mode 100644 index 00000000..d450d9ea --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asni.snippet @@ -0,0 +1 @@ +assert_not_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnid.snippet b/sources_non_forked/snipmate-snippets/ruby/asnid.snippet new file mode 100644 index 00000000..23e039ad --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnid.snippet @@ -0,0 +1 @@ +assert_not_in_delta ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnie.snippet b/sources_non_forked/snipmate-snippets/ruby/asnie.snippet new file mode 100644 index 00000000..25eb7515 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnie.snippet @@ -0,0 +1 @@ +assert_not_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnm.snippet b/sources_non_forked/snipmate-snippets/ruby/asnm.snippet new file mode 100644 index 00000000..95dbf247 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnm.snippet @@ -0,0 +1 @@ +assert_no_match /${1:unexpected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnn.snippet b/sources_non_forked/snipmate-snippets/ruby/asnn.snippet new file mode 100644 index 00000000..9227bc8a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnn.snippet @@ -0,0 +1 @@ +assert_not_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnp.snippet b/sources_non_forked/snipmate-snippets/ruby/asnp.snippet new file mode 100644 index 00000000..a540f84d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnp.snippet @@ -0,0 +1 @@ +assert_not_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnr.snippet b/sources_non_forked/snipmate-snippets/ruby/asnr.snippet new file mode 100644 index 00000000..fc9a8204 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnr.snippet @@ -0,0 +1 @@ +assert_nothing_raised { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet new file mode 100644 index 00000000..fb063d28 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet @@ -0,0 +1 @@ +assert_not_respond_to ${1:object}, ${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asns.snippet b/sources_non_forked/snipmate-snippets/ruby/asns.snippet new file mode 100644 index 00000000..509e467a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asns.snippet @@ -0,0 +1 @@ +assert_not_same ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnse.snippet b/sources_non_forked/snipmate-snippets/ruby/asnse.snippet new file mode 100644 index 00000000..befde129 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnse.snippet @@ -0,0 +1 @@ +assert_not_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnt.snippet new file mode 100644 index 00000000..cb633c22 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asnt.snippet @@ -0,0 +1 @@ +assert_nothing_thrown { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby/aso.snippet b/sources_non_forked/snipmate-snippets/ruby/aso.snippet new file mode 100644 index 00000000..5b7faf64 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/aso.snippet @@ -0,0 +1 @@ +assert_operator ${1:left}, :${2:operator}, ${3:right} diff --git a/sources_non_forked/snipmate-snippets/ruby/asp.snippet b/sources_non_forked/snipmate-snippets/ruby/asp.snippet new file mode 100644 index 00000000..c23fd3f6 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asp.snippet @@ -0,0 +1 @@ +assert_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspe.snippet b/sources_non_forked/snipmate-snippets/ruby/aspe.snippet new file mode 100644 index 00000000..3a3eed4f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/aspe.snippet @@ -0,0 +1 @@ +assert_path_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspne.snippet b/sources_non_forked/snipmate-snippets/ruby/aspne.snippet new file mode 100644 index 00000000..f7a8873a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/aspne.snippet @@ -0,0 +1 @@ +assert_path_not_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/asr.snippet b/sources_non_forked/snipmate-snippets/ruby/asr.snippet new file mode 100644 index 00000000..834038d5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asr.snippet @@ -0,0 +1 @@ +assert_raise(${1:Exception}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrko.snippet b/sources_non_forked/snipmate-snippets/ruby/asrko.snippet new file mode 100644 index 00000000..f82820ed --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asrko.snippet @@ -0,0 +1 @@ +assert_raise_kind_of(${1:kinds...}) { ${2:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrm.snippet b/sources_non_forked/snipmate-snippets/ruby/asrm.snippet new file mode 100644 index 00000000..f62f208b --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asrm.snippet @@ -0,0 +1 @@ +assert_raise_message ${1:expected_message} diff --git a/sources_non_forked/snipmate-snippets/ruby/asrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asrt.snippet new file mode 100644 index 00000000..ca8e84b7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asrt.snippet @@ -0,0 +1 @@ +assert_respond_to ${1:object}, :${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asse.snippet b/sources_non_forked/snipmate-snippets/ruby/asse.snippet new file mode 100644 index 00000000..4fb9ef9a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/asse.snippet @@ -0,0 +1 @@ +assert_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/ast.snippet b/sources_non_forked/snipmate-snippets/ruby/ast.snippet new file mode 100644 index 00000000..8962cfb7 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ast.snippet @@ -0,0 +1 @@ +assert_throws(:${1:expected}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/astr.snippet b/sources_non_forked/snipmate-snippets/ruby/astr.snippet new file mode 100644 index 00000000..b9d14f6e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/astr.snippet @@ -0,0 +1 @@ +assert_true ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/bm.snippet b/sources_non_forked/snipmate-snippets/ruby/bm.snippet new file mode 100644 index 00000000..681c5621 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/bm.snippet @@ -0,0 +1,4 @@ +TESTS = ${1:10_000} +Benchmark.bmbm do |results| + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/case.snippet b/sources_non_forked/snipmate-snippets/ruby/case.snippet new file mode 100644 index 00000000..085a45db --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/case.snippet @@ -0,0 +1,5 @@ +case ${1} +when ${2} +else + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/class.snippet b/sources_non_forked/snipmate-snippets/ruby/class.snippet new file mode 100644 index 00000000..cb396704 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/class.snippet @@ -0,0 +1,3 @@ +class ${1:`Snippet_RubyClassNameFromFilename()`}${2} + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/classe.snippet b/sources_non_forked/snipmate-snippets/ruby/classe.snippet new file mode 100644 index 00000000..f683c688 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/classe.snippet @@ -0,0 +1 @@ +class ${1:ErrorClassName} < ${2:StandardError}; end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby/def.snippet b/sources_non_forked/snipmate-snippets/ruby/def.snippet new file mode 100644 index 00000000..ad9bc8cf --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/def.snippet @@ -0,0 +1,3 @@ +def ${1:name} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/defi.snippet b/sources_non_forked/snipmate-snippets/ruby/defi.snippet new file mode 100644 index 00000000..12c354c8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/defi.snippet @@ -0,0 +1,3 @@ +def initialize${1} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/defmm.snippet b/sources_non_forked/snipmate-snippets/ruby/defmm.snippet new file mode 100644 index 00000000..e3b263a8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/defmm.snippet @@ -0,0 +1,3 @@ +def method_missing(meth, *args, &blk) + ${1} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/defs.snippet b/sources_non_forked/snipmate-snippets/ruby/defs.snippet new file mode 100644 index 00000000..837733f2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/defs.snippet @@ -0,0 +1,3 @@ +def self.${1:class_method_name} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/deft.snippet b/sources_non_forked/snipmate-snippets/ruby/deft.snippet new file mode 100644 index 00000000..9c2adbff --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/deft.snippet @@ -0,0 +1,3 @@ +def test_${1:case_name} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/detect.snippet b/sources_non_forked/snipmate-snippets/ruby/detect.snippet new file mode 100644 index 00000000..5fc24aaa --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/detect.snippet @@ -0,0 +1 @@ +detect { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/detecto.snippet b/sources_non_forked/snipmate-snippets/ruby/detecto.snippet new file mode 100644 index 00000000..904b2a67 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/detecto.snippet @@ -0,0 +1,3 @@ +detect do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/dglob.snippet b/sources_non_forked/snipmate-snippets/ruby/dglob.snippet new file mode 100644 index 00000000..ca326ade --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/dglob.snippet @@ -0,0 +1 @@ +Dir.glob(${1:"<+dir}"+>) { |${2:file}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/do.snippet b/sources_non_forked/snipmate-snippets/ruby/do.snippet new file mode 100644 index 00000000..596c11a9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/do.snippet @@ -0,0 +1,3 @@ +do + ${1} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/dop.snippet b/sources_non_forked/snipmate-snippets/ruby/dop.snippet new file mode 100644 index 00000000..9bf1898a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/dop.snippet @@ -0,0 +1,3 @@ +do |${1:param}| + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/ea.snippet b/sources_non_forked/snipmate-snippets/ruby/ea.snippet new file mode 100644 index 00000000..5f7edec0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ea.snippet @@ -0,0 +1 @@ +each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each.snippet b/sources_non_forked/snipmate-snippets/ruby/each.snippet new file mode 100644 index 00000000..5f7edec0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/each.snippet @@ -0,0 +1 @@ +each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet new file mode 100644 index 00000000..f4d3ef11 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet @@ -0,0 +1 @@ +each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet new file mode 100644 index 00000000..e4fb7080 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet @@ -0,0 +1,4 @@ +each_with_index do |${1:element},${2:i}| + ${3:body} +end + diff --git a/sources_non_forked/snipmate-snippets/ruby/eacho.snippet b/sources_non_forked/snipmate-snippets/ruby/eacho.snippet new file mode 100644 index 00000000..7c133426 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/eacho.snippet @@ -0,0 +1,3 @@ +each do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/eado.snippet b/sources_non_forked/snipmate-snippets/ruby/eado.snippet new file mode 100644 index 00000000..7c133426 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/eado.snippet @@ -0,0 +1,3 @@ +each do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/eawi.snippet b/sources_non_forked/snipmate-snippets/ruby/eawi.snippet new file mode 100644 index 00000000..f4d3ef11 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/eawi.snippet @@ -0,0 +1 @@ +each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/eawido.snippet b/sources_non_forked/snipmate-snippets/ruby/eawido.snippet new file mode 100644 index 00000000..e4fb7080 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/eawido.snippet @@ -0,0 +1,4 @@ +each_with_index do |${1:element},${2:i}| + ${3:body} +end + diff --git a/sources_non_forked/snipmate-snippets/ruby/elsif.snippet b/sources_non_forked/snipmate-snippets/ruby/elsif.snippet new file mode 100644 index 00000000..84d8134e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/elsif.snippet @@ -0,0 +1,2 @@ +elsif ${1:condition} + ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet b/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet new file mode 100644 index 00000000..5076ef1a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet @@ -0,0 +1 @@ +File.foreach(${1:"<+path}"+>) { |${2:line}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fopen.snippet b/sources_non_forked/snipmate-snippets/ruby/fopen.snippet new file mode 100644 index 00000000..b630bfeb --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/fopen.snippet @@ -0,0 +1 @@ +File.open(${1:path}, "${2:rwab}") { |${3:file}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fread.snippet b/sources_non_forked/snipmate-snippets/ruby/fread.snippet new file mode 100644 index 00000000..d9e6074c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/fread.snippet @@ -0,0 +1 @@ +File.read(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/http_get.snippet b/sources_non_forked/snipmate-snippets/ruby/http_get.snippet new file mode 100644 index 00000000..cba6d589 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/http_get.snippet @@ -0,0 +1,2 @@ +require 'net/http' +res = Net::HTTP.get URI.parse('${1:url}') diff --git a/sources_non_forked/snipmate-snippets/ruby/http_post.snippet b/sources_non_forked/snipmate-snippets/ruby/http_post.snippet new file mode 100644 index 00000000..3b2036ad --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/http_post.snippet @@ -0,0 +1,2 @@ +require 'net/http' +res = Net::HTTP.post_form URI.parse('${1:url}')${2:, params} diff --git a/sources_non_forked/snipmate-snippets/ruby/if.snippet b/sources_non_forked/snipmate-snippets/ruby/if.snippet new file mode 100644 index 00000000..b2d1e39e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/if.snippet @@ -0,0 +1,3 @@ +if ${1:condition} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/ife.snippet b/sources_non_forked/snipmate-snippets/ruby/ife.snippet new file mode 100644 index 00000000..2a7468df --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ife.snippet @@ -0,0 +1,4 @@ +if ${1:condition} + ${2} +else +end diff --git a/sources_non_forked/snipmate-snippets/ruby/inj.snippet b/sources_non_forked/snipmate-snippets/ruby/inj.snippet new file mode 100644 index 00000000..90dea0d8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/inj.snippet @@ -0,0 +1 @@ +inject(${1:init}) { |${2:total}, ${3:next}| ${4:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injdo.snippet b/sources_non_forked/snipmate-snippets/ruby/injdo.snippet new file mode 100644 index 00000000..d3235e90 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/injdo.snippet @@ -0,0 +1,3 @@ +inject(${1:init}) do |${2:total}, ${3:next}| + ${4:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/inject.snippet b/sources_non_forked/snipmate-snippets/ruby/inject.snippet new file mode 100644 index 00000000..78ad721d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/inject.snippet @@ -0,0 +1 @@ +inject { |${1:total},${2:next}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injecto.snippet b/sources_non_forked/snipmate-snippets/ruby/injecto.snippet new file mode 100644 index 00000000..1631033d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/injecto.snippet @@ -0,0 +1,3 @@ +inject do |${1:total},${2:next}| + ${3:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/ip.snippet b/sources_non_forked/snipmate-snippets/ruby/ip.snippet new file mode 100644 index 00000000..91769768 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ip.snippet @@ -0,0 +1 @@ +ip_addr = request.env['REMOTE_ADDR'] diff --git a/sources_non_forked/snipmate-snippets/ruby/map.snippet b/sources_non_forked/snipmate-snippets/ruby/map.snippet new file mode 100644 index 00000000..b3e7719f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/map.snippet @@ -0,0 +1 @@ +map { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet new file mode 100644 index 00000000..316e7c7c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet @@ -0,0 +1,3 @@ +map do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/mapo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapo.snippet new file mode 100644 index 00000000..316e7c7c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/mapo.snippet @@ -0,0 +1,3 @@ +map do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/mod.snippet b/sources_non_forked/snipmate-snippets/ruby/mod.snippet new file mode 100644 index 00000000..457fd615 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/mod.snippet @@ -0,0 +1,3 @@ +module ${1:`Snippet_RubyClassNameFromFilename()`} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/module.snippet b/sources_non_forked/snipmate-snippets/ruby/module.snippet new file mode 100644 index 00000000..78e025a1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/module.snippet @@ -0,0 +1,14 @@ +module ${1:`Snippet_RubyClassNameFromFilename()`} + module ClassMethods + ${2} + end + + module InstanceMethods + + end + + def self.included(receiver) + receiver.extend ClassMethods + receiver.send :include, InstanceMethods + end +end diff --git a/sources_non_forked/snipmate-snippets/ruby/nam.snippet b/sources_non_forked/snipmate-snippets/ruby/nam.snippet new file mode 100644 index 00000000..19b90a76 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/nam.snippet @@ -0,0 +1,3 @@ +namespace :${1:namespace} do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/ope.snippet b/sources_non_forked/snipmate-snippets/ruby/ope.snippet new file mode 100644 index 00000000..cfe92471 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/ope.snippet @@ -0,0 +1 @@ +open(${1:path}, "${2:rwab}") { |${3:io}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet b/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet new file mode 100644 index 00000000..f4ed9440 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet @@ -0,0 +1 @@ +File.join(File.dirname(__FILE__), *%w[${1:rel_path_here}]) diff --git a/sources_non_forked/snipmate-snippets/ruby/r.snippet b/sources_non_forked/snipmate-snippets/ruby/r.snippet new file mode 100644 index 00000000..f232fc94 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/r.snippet @@ -0,0 +1 @@ +attr_reader :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/reject.snippet b/sources_non_forked/snipmate-snippets/ruby/reject.snippet new file mode 100644 index 00000000..07d2787f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/reject.snippet @@ -0,0 +1 @@ +reject { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet b/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet new file mode 100644 index 00000000..e906bd7e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet @@ -0,0 +1,3 @@ +reject do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/rep.snippet b/sources_non_forked/snipmate-snippets/ruby/rep.snippet new file mode 100644 index 00000000..04b77b0d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/rep.snippet @@ -0,0 +1 @@ +results.report("${1:name}:") { TESTS.times { ${2} } } diff --git a/sources_non_forked/snipmate-snippets/ruby/rw.snippet b/sources_non_forked/snipmate-snippets/ruby/rw.snippet new file mode 100644 index 00000000..1862da33 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/rw.snippet @@ -0,0 +1 @@ +attr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/select.snippet b/sources_non_forked/snipmate-snippets/ruby/select.snippet new file mode 100644 index 00000000..8ab228cc --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/select.snippet @@ -0,0 +1 @@ +select { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/selecto.snippet b/sources_non_forked/snipmate-snippets/ruby/selecto.snippet new file mode 100644 index 00000000..a22a6505 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/selecto.snippet @@ -0,0 +1,3 @@ +select do |${1:element}| + ${2:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/sinc.snippet b/sources_non_forked/snipmate-snippets/ruby/sinc.snippet new file mode 100644 index 00000000..20e2c4c9 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/sinc.snippet @@ -0,0 +1 @@ +class << self; self end diff --git a/sources_non_forked/snipmate-snippets/ruby/sort.snippet b/sources_non_forked/snipmate-snippets/ruby/sort.snippet new file mode 100644 index 00000000..08a67c1a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/sort.snippet @@ -0,0 +1 @@ +sort { |${1:x},${2:y}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/sorto.snippet b/sources_non_forked/snipmate-snippets/ruby/sorto.snippet new file mode 100644 index 00000000..76c38e40 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/sorto.snippet @@ -0,0 +1,3 @@ +sort do |${1:x},${2:y}| + ${3:body} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/tas.snippet b/sources_non_forked/snipmate-snippets/ruby/tas.snippet new file mode 100644 index 00000000..d949a6b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/tas.snippet @@ -0,0 +1,4 @@ +desc "${1:Task description}" +task :${2:task_name}${3: => [:dependent, :tasks]} do + ${4} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/task.snippet b/sources_non_forked/snipmate-snippets/ruby/task.snippet new file mode 100644 index 00000000..d949a6b5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/task.snippet @@ -0,0 +1,4 @@ +desc "${1:Task description}" +task :${2:task_name}${3: => [:dependent, :tasks]} do + ${4} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/tc.snippet b/sources_non_forked/snipmate-snippets/ruby/tc.snippet new file mode 100644 index 00000000..3e28f61a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/tc.snippet @@ -0,0 +1,9 @@ +require "test/unit" + +require "${1:library_file_name}" + +class Test${2:`Snippet_RubyClassNameFromFilename()`} < Test::Unit::TestCase + def test_${3:case_name} + ${4} + end +end diff --git a/sources_non_forked/snipmate-snippets/ruby/unless.snippet b/sources_non_forked/snipmate-snippets/ruby/unless.snippet new file mode 100644 index 00000000..3495d2ba --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/unless.snippet @@ -0,0 +1,3 @@ +unless ${1:condition} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet b/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet new file mode 100644 index 00000000..d190b45e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet @@ -0,0 +1,4 @@ +unless ${1:condition} + ${2} +else +end diff --git a/sources_non_forked/snipmate-snippets/ruby/w.snippet b/sources_non_forked/snipmate-snippets/ruby/w.snippet new file mode 100644 index 00000000..0650e955 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/w.snippet @@ -0,0 +1 @@ +attr_writer :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/while.snippet b/sources_non_forked/snipmate-snippets/ruby/while.snippet new file mode 100644 index 00000000..6e878fa3 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/while.snippet @@ -0,0 +1,3 @@ +while ${1:condition} + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet b/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet new file mode 100644 index 00000000..eeb35802 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet @@ -0,0 +1 @@ +REXML::Document.new(File.read(${1:path})) diff --git a/sources_non_forked/snipmate-snippets/ruby/xpa.snippet b/sources_non_forked/snipmate-snippets/ruby/xpa.snippet new file mode 100644 index 00000000..5bff9508 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/xpa.snippet @@ -0,0 +1,3 @@ +elements.each(${1}) do |${2:node}| + ${3} +end diff --git a/sources_non_forked/snipmate-snippets/ruby/zip.snippet b/sources_non_forked/snipmate-snippets/ruby/zip.snippet new file mode 100644 index 00000000..b2c831ab --- /dev/null +++ b/sources_non_forked/snipmate-snippets/ruby/zip.snippet @@ -0,0 +1 @@ +zip(${1:enums}) { |${2:row}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/sinatra/get.snippet b/sources_non_forked/snipmate-snippets/sinatra/get.snippet new file mode 100644 index 00000000..08f3fd5a --- /dev/null +++ b/sources_non_forked/snipmate-snippets/sinatra/get.snippet @@ -0,0 +1,3 @@ +get '${1:/}' do + ${2} +end diff --git a/sources_non_forked/snipmate-snippets/snippets/cpp.snippets b/sources_non_forked/snipmate-snippets/snippets/cpp.snippets deleted file mode 100644 index c177a15b..00000000 --- a/sources_non_forked/snipmate-snippets/snippets/cpp.snippets +++ /dev/null @@ -1,66 +0,0 @@ -# Read File Into Vector -snippet readfile - std::vector v; - if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { - char buf[1024]; - while (size_t len = fread(buf, 1, sizeof(buf), $2)) - v.insert(v.end(), buf, buf + len); - fclose($2); - }${3} - -# std::map -snippet map - std::map<${1:key}, ${2:value}> ${3}; - -# std::vector -snippet vector - std::vector<${1:char}> ${2}; - -# Namespace -snippet ns - namespace ${1:`Filename('', 'my')`} { - ${2} - } /* namespace $1 */ - -# Class -snippet class - class ${1:`Filename('$1', 'name')`} - { - public: - $1(${2}); - ~$1(); - - private: - ${3:/* data */} - }; - -snippet fori - for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4:/* code */} - } - -# auto iterator -snippet itera - for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { - ${2:std::cout << *$1 << std::endl;} - } - -# iterator -snippet iter - for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { - ${6} - } - -# member function implementations -snippet mfun - ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { - ${5:return}; - } -snippet scout - std::cout << ${1} << std::endl; -snippet cout - cout << ${1} << endl; -snippet scin - std::cin >> ${1}; -snippet cin - cin >> ${1}; diff --git a/sources_non_forked/snipmate-snippets/snippets/sh.snippets b/sources_non_forked/snipmate-snippets/snippets/sh.snippets deleted file mode 100644 index 508056c8..00000000 --- a/sources_non_forked/snipmate-snippets/snippets/sh.snippets +++ /dev/null @@ -1,43 +0,0 @@ -# Shebang. Executing bash via /usr/bin/env makes scripts more portable. -snippet #! - #!/usr/bin/env bash - -snippet if - if [[ ${1:condition} ]]; then - ${2:#statements} - fi -snippet elif - elif [[ ${1:condition} ]]; then - ${2:#statements} -snippet for - for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${3:#statements} - done -snippet fori - for ${1:needle} in ${2:haystack} ; do - ${3:#statements} - done -snippet wh - while [[ ${1:condition} ]]; do - ${2:#statements} - done -snippet until - until [[ ${1:condition} ]]; do - ${2:#statements} - done -snippet case - case ${1:word} in - ${2:pattern}) - ${3};; - esac -snippet go - while getopts '${1:o}' ${2:opts} - do - case $$2 in - ${3:o0}) - ${4:#staments};; - esac - done -# Set SCRIPT_DIR variable to directory script is located. -snippet sdir - SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/sources_non_forked/snipmate-snippets/sshconfig/host.snippet b/sources_non_forked/snipmate-snippets/sshconfig/host.snippet new file mode 100644 index 00000000..5992a2d0 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/sshconfig/host.snippet @@ -0,0 +1,3 @@ +Host ${1:name} + Hostname ${2:example.com} + User ${3:username} diff --git a/sources_non_forked/snipmate-snippets/support_functions.vim b/sources_non_forked/snipmate-snippets/support_functions.vim new file mode 100644 index 00000000..a09e81da --- /dev/null +++ b/sources_non_forked/snipmate-snippets/support_functions.vim @@ -0,0 +1,115 @@ +"ruby {{{1 +function! Snippet_RubyClassNameFromFilename(...) + let name = expand("%:t:r") + if len(name) == 0 + if a:0 == 0 + let name = 'MyClass' + else + let name = a:1 + endif + endif + return Snippet_Camelcase(substitute(name, '_spec$', '', '')) +endfunction + +function! Snippet_MigrationNameFromFilename(...) + let name = substitute(expand("%:t:r"), '^.\{-}_', '', '') + if len(name) == 0 + if a:0 == 0 + let name = 'MyClass' + else + let name = a:1 + endif + endif + return Snippet_Camelcase(name) +endfunction + + +"python {{{1 +function! Snippet_PythonClassNameFromFilename(...) + let name = expand("%:t:r") + if len(name) == 0 + if a:0 == 0 + let name = 'MyClass' + else + let name = a:1 + endif + endif + return Snippet_Camelcase(name) +endfunction + +"php {{{1 +function! Snippet_PHPClassNameFromFilename(...) + let name = expand("%:t:r:r") + if len(name) == 0 + if a:0 == 0 + let name = 'MyClass' + else + let name = a:1 + endif + endif + return name +endfunction + +"java {{{1 +function! Snippet_JavaClassNameFromFilename(...) + let name = expand("%:t:r") + if len(name) == 0 + if a:0 == 0 + let name = 'MyClass' + else + let name = a:1 + endif + endif + return name +endfunction + +function! Snippet_JavaInstanceVarType(name) + let oldview = winsaveview() + if searchdecl(a:name) == 0 + normal! B + let old_reg = @" + normal! yaW + let type = @" + let @" = old_reg + call winrestview(oldview) + let type = substitute(type, '\s\+$', '', '') + + "searchdecl treats 'return foo;' as a declaration of foo + if type != 'return' + return type + endif + endif + return "<+type+>" +endfunction + + +"global {{{1 +function! s:start_comment() + return substitute(&commentstring, '^\([^ ]*\)\s*%s\(.*\)$', '\1', '') +endfunction + +function! s:end_comment() + return substitute(&commentstring, '^.*%s\(.*\)$', '\1', '') +endfunction + +function! Snippet_Modeline() + return s:start_comment() . " vim: set ${1:settings}:" . s:end_comment() +endfunction + +function! Snippet_Camelcase(s) + "upcase the first letter + let toReturn = substitute(a:s, '^\(.\)', '\=toupper(submatch(1))', '') + "turn all '_x' into 'X' + return substitute(toReturn, '_\(.\)', '\=toupper(submatch(1))', 'g') +endfunction + +function! Snippet_Underscore(s) + "down the first letter + let toReturn = substitute(a:s, '^\(.\)', '\=tolower(submatch(1))', '') + "turn all 'X' into '_x' + return substitute(toReturn, '\([A-Z]\)', '\=tolower("_".submatch(1))', 'g') +endfunction + + +" modeline {{{1 +" vim: set fdm=marker: diff --git a/sources_non_forked/snipmate-snippets/vim/au.snippet b/sources_non_forked/snipmate-snippets/vim/au.snippet new file mode 100644 index 00000000..d59720a5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/au.snippet @@ -0,0 +1 @@ +autocmd ${1:events} ${2:pattern} ${3:command} diff --git a/sources_non_forked/snipmate-snippets/vim/com.snippet b/sources_non_forked/snipmate-snippets/vim/com.snippet new file mode 100644 index 00000000..b8eeb5b4 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/com.snippet @@ -0,0 +1 @@ +command! -nargs=${1:number_of_args} ${2:other_params} ${2:name} ${2:command} diff --git a/sources_non_forked/snipmate-snippets/vim/func.snippet b/sources_non_forked/snipmate-snippets/vim/func.snippet new file mode 100644 index 00000000..8591a835 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/func.snippet @@ -0,0 +1,8 @@ +"Function: $1 +"Desc: ${3:description} +" +"Arguments: +"${4} +function! ${1:name}(${2}) + ${5} +endfunction diff --git a/sources_non_forked/snipmate-snippets/vim/if.snippet b/sources_non_forked/snipmate-snippets/vim/if.snippet new file mode 100644 index 00000000..336e7a00 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/if.snippet @@ -0,0 +1,3 @@ +if ${1} + ${2} +endif diff --git a/sources_non_forked/snipmate-snippets/vim/ife.snippet b/sources_non_forked/snipmate-snippets/vim/ife.snippet new file mode 100644 index 00000000..c5d16939 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/ife.snippet @@ -0,0 +1,4 @@ +if ${1} + ${2} +else +endif diff --git a/sources_non_forked/snipmate-snippets/vim/log.snippet b/sources_non_forked/snipmate-snippets/vim/log.snippet new file mode 100644 index 00000000..5a867549 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/log.snippet @@ -0,0 +1 @@ +echomsg ${1} diff --git a/sources_non_forked/snipmate-snippets/vim/try.snippet b/sources_non_forked/snipmate-snippets/vim/try.snippet new file mode 100644 index 00000000..cd4c0e72 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/vim/try.snippet @@ -0,0 +1,4 @@ +try + ${2} +catch /${1}/ +endtry diff --git a/sources_non_forked/snipmate-snippets/xslt/call.snippet b/sources_non_forked/snipmate-snippets/xslt/call.snippet new file mode 100644 index 00000000..2fe4f9d1 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/call.snippet @@ -0,0 +1,3 @@ + + ${2} + diff --git a/sources_non_forked/snipmate-snippets/xslt/choose.snippet b/sources_non_forked/snipmate-snippets/xslt/choose.snippet new file mode 100644 index 00000000..1a877543 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/choose.snippet @@ -0,0 +1,7 @@ + + + ${2} + + + + diff --git a/sources_non_forked/snipmate-snippets/xslt/mat.snippet b/sources_non_forked/snipmate-snippets/xslt/mat.snippet new file mode 100644 index 00000000..a566e0ec --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/mat.snippet @@ -0,0 +1,3 @@ + + ${2} + diff --git a/sources_non_forked/snipmate-snippets/xslt/out.snippet b/sources_non_forked/snipmate-snippets/xslt/out.snippet new file mode 100644 index 00000000..88e70c21 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/out.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/xslt/param.snippet b/sources_non_forked/snipmate-snippets/xslt/param.snippet new file mode 100644 index 00000000..f4f9a504 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/param.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/xslt/sty.snippet b/sources_non_forked/snipmate-snippets/xslt/sty.snippet new file mode 100644 index 00000000..f6751c74 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/sty.snippet @@ -0,0 +1,3 @@ + + ${1} + diff --git a/sources_non_forked/snipmate-snippets/xslt/tem.snippet b/sources_non_forked/snipmate-snippets/xslt/tem.snippet new file mode 100644 index 00000000..bcd86d6d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/tem.snippet @@ -0,0 +1,3 @@ + + ${2} + diff --git a/sources_non_forked/snipmate-snippets/xslt/value.snippet b/sources_non_forked/snipmate-snippets/xslt/value.snippet new file mode 100644 index 00000000..9128cc6d --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/value.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/xslt/var.snippet b/sources_non_forked/snipmate-snippets/xslt/var.snippet new file mode 100644 index 00000000..d21b77c8 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/var.snippet @@ -0,0 +1,3 @@ + + ${2} + diff --git a/sources_non_forked/snipmate-snippets/xslt/wparam.snippet b/sources_non_forked/snipmate-snippets/xslt/wparam.snippet new file mode 100644 index 00000000..2284b71c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/wparam.snippet @@ -0,0 +1 @@ + diff --git a/sources_non_forked/snipmate-snippets/xslt/xdec.snippet b/sources_non_forked/snipmate-snippets/xslt/xdec.snippet new file mode 100644 index 00000000..f1e44209 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/xslt/xdec.snippet @@ -0,0 +1,2 @@ + + ${2} diff --git a/sources_non_forked/snipmate-snippets/zend/assert.snippet b/sources_non_forked/snipmate-snippets/zend/assert.snippet new file mode 100644 index 00000000..ca928f25 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/assert.snippet @@ -0,0 +1 @@ +$this->assertTrue(${1:somevar}, '${2:sometext}'); diff --git a/sources_non_forked/snipmate-snippets/zend/boolcol.snippet b/sources_non_forked/snipmate-snippets/zend/boolcol.snippet new file mode 100644 index 00000000..715fe19c --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/boolcol.snippet @@ -0,0 +1 @@ +$this->hasColumn('${1:active}', '${2:boolean}', ${3:1}, array('default' => '${4:1}','notnull' => true)); diff --git a/sources_non_forked/snipmate-snippets/zend/clac.snippet b/sources_non_forked/snipmate-snippets/zend/clac.snippet new file mode 100644 index 00000000..80972a11 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/clac.snippet @@ -0,0 +1,20 @@ +_flashMessenger->addMessage("${1}", '${2:error}'); diff --git a/sources_non_forked/snipmate-snippets/zend/getconf.snippet b/sources_non_forked/snipmate-snippets/zend/getconf.snippet new file mode 100644 index 00000000..10f2b202 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/getconf.snippet @@ -0,0 +1 @@ +$${1:conf} = Zend_Registry::get('${2:config}')->${3:general}; diff --git a/sources_non_forked/snipmate-snippets/zend/input.snippet b/sources_non_forked/snipmate-snippets/zend/input.snippet new file mode 100644 index 00000000..3c4ed27e --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/input.snippet @@ -0,0 +1,4 @@ +formInput(array( 'type' => '${1:hidden}', + 'name' => '${2}', + 'value' => ${3:}, + 'id' => '${4:}' )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/inputarr.snippet b/sources_non_forked/snipmate-snippets/zend/inputarr.snippet new file mode 100644 index 00000000..8e97bee5 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/inputarr.snippet @@ -0,0 +1,6 @@ +formInput(array( 'type' => '${1:dropdown}', + 'name' => '${2}', + 'label' => '${3:}', + 'errors' => ${4:}, + 'value' => ${5:}, + 'valueList' => ${6:} )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/intcol.snippet b/sources_non_forked/snipmate-snippets/zend/intcol.snippet new file mode 100644 index 00000000..caacaa61 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/intcol.snippet @@ -0,0 +1 @@ +$this->hasColumn('${1:id}', '${2:integer}', ${3:11}, array(${4:'notnull' => true)}); diff --git a/sources_non_forked/snipmate-snippets/zend/lib.snippet b/sources_non_forked/snipmate-snippets/zend/lib.snippet new file mode 100644 index 00000000..683e22ef --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/lib.snippet @@ -0,0 +1,5 @@ +hasColumn('id', 'integer', 4, array('notnull' => true, + 'primary' => true, + 'autoincrement' => true)); + ${3} + } + +} diff --git a/sources_non_forked/snipmate-snippets/zend/navi.snippet b/sources_non_forked/snipmate-snippets/zend/navi.snippet new file mode 100644 index 00000000..2724ff9f --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/navi.snippet @@ -0,0 +1 @@ +$this->view->navigationActive = array('topnavi' => '${1:home}','subnavi' => '${2:index}'); diff --git a/sources_non_forked/snipmate-snippets/zend/route.snippet b/sources_non_forked/snipmate-snippets/zend/route.snippet new file mode 100644 index 00000000..cdf834b2 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/route.snippet @@ -0,0 +1 @@ +$this->_redirector->gotoRoute(array('controller' => '${1}', 'action' => '${2:index}', 'id' => '${3:}'), '${4:admin_action}'); diff --git a/sources_non_forked/snipmate-snippets/zend/rp.snippet b/sources_non_forked/snipmate-snippets/zend/rp.snippet new file mode 100644 index 00000000..b5dcd1ff --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/rp.snippet @@ -0,0 +1,2 @@ +partial('${1:somefile}.phtml', + array(${2}))?> diff --git a/sources_non_forked/snipmate-snippets/zend/strcol.snippet b/sources_non_forked/snipmate-snippets/zend/strcol.snippet new file mode 100644 index 00000000..98d3cf34 --- /dev/null +++ b/sources_non_forked/snipmate-snippets/zend/strcol.snippet @@ -0,0 +1 @@ +$this->hasColumn('${1:title}', '${2:string}', ${3:255}, array(${4:'notnull' => true})); diff --git a/sources_non_forked/taglist.vim/README b/sources_non_forked/taglist.vim/README new file mode 100644 index 00000000..56bf86fb --- /dev/null +++ b/sources_non_forked/taglist.vim/README @@ -0,0 +1,18 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=273 + +The "Tag List" plugin is a source code browser plugin for Vim and +provides an overview of the structure of source code files and allows +you to efficiently browse through source code files for different +programming languages. You can visit the taglist plugin home page for +more information: + + http://vim-taglist.sourceforge.net + +You can subscribe to the taglist mailing list to post your questions +or suggestions for improvement or to report bugs. Visit the following +page for subscribing to the mailing list: + + http://groups.yahoo.com/group/taglist/ + +For more information about using this plugin, after installing the +taglist plugin, use the ":help taglist" command. diff --git a/sources_non_forked/taglist.vim/doc/taglist.txt b/sources_non_forked/taglist.vim/doc/taglist.txt new file mode 100644 index 00000000..6a62b396 --- /dev/null +++ b/sources_non_forked/taglist.vim/doc/taglist.txt @@ -0,0 +1,1501 @@ +*taglist.txt* Plugin for browsing source code + +Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +For Vim version 6.0 and above +Last change: 2007 May 24 + +1. Overview |taglist-intro| +2. Taglist on the internet |taglist-internet| +3. Requirements |taglist-requirements| +4. Installation |taglist-install| +5. Usage |taglist-using| +6. Options |taglist-options| +7. Commands |taglist-commands| +8. Global functions |taglist-functions| +9. Extending |taglist-extend| +10. FAQ |taglist-faq| +11. License |taglist-license| +12. Todo |taglist-todo| + +============================================================================== + *taglist-intro* +1. Overview~ + +The "Tag List" plugin is a source code browser plugin for Vim. This plugin +allows you to efficiently browse through source code files for different +programming languages. The "Tag List" plugin provides the following features: + + * Displays the tags (functions, classes, structures, variables, etc.) + defined in a file in a vertically or horizontally split Vim window. + * In GUI Vim, optionally displays the tags in the Tags drop-down menu and + in the popup menu. + * Automatically updates the taglist window as you switch between + files/buffers. As you open new files, the tags defined in the new files + are added to the existing file list and the tags defined in all the + files are displayed grouped by the filename. + * When a tag name is selected from the taglist window, positions the + cursor at the definition of the tag in the source file. + * Automatically highlights the current tag name. + * Groups the tags by their type and displays them in a foldable tree. + * Can display the prototype and scope of a tag. + * Can optionally display the tag prototype instead of the tag name in the + taglist window. + * The tag list can be sorted either by name or by chronological order. + * Supports the following language files: Assembly, ASP, Awk, Beta, C, + C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, + Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, + SML, Sql, TCL, Verilog, Vim and Yacc. + * Can be easily extended to support new languages. Support for + existing languages can be modified easily. + * Provides functions to display the current tag name in the Vim status + line or the window title bar. + * The list of tags and files in the taglist can be saved and + restored across Vim sessions. + * Provides commands to get the name and prototype of the current tag. + * Runs in both console/terminal and GUI versions of Vim. + * Works with the winmanager plugin. Using the winmanager plugin, you + can use Vim plugins like the file explorer, buffer explorer and the + taglist plugin at the same time like an IDE. + * Can be used in both Unix and MS-Windows systems. + +============================================================================== + *taglist-internet* +2. Taglist on the internet~ + +The home page of the taglist plugin is at: +> + http://vim-taglist.sourceforge.net/ +< +You can subscribe to the taglist mailing list to post your questions or +suggestions for improvement or to send bug reports. Visit the following page +for subscribing to the mailing list: +> + http://groups.yahoo.com/group/taglist +< +============================================================================== + *taglist-requirements* +3. Requirements~ + +The taglist plugin requires the following: + + * Vim version 6.0 and above + * Exuberant ctags 5.0 and above + +The taglist plugin will work on all the platforms where the exuberant ctags +utility and Vim are supported (this includes MS-Windows and Unix based +systems). + +The taglist plugin relies on the exuberant ctags utility to dynamically +generate the tag listing. The exuberant ctags utility must be installed in +your system to use this plugin. The exuberant ctags utility is shipped with +most of the Linux distributions. You can download the exuberant ctags utility +from +> + http://ctags.sourceforge.net +< +The taglist plugin doesn't use or create a tags file and there is no need to +create a tags file to use this plugin. The taglist plugin will not work with +the GNU ctags or the Unix ctags utility. + +This plugin relies on the Vim "filetype" detection mechanism to determine the +type of the current file. You have to turn on the Vim filetype detection by +adding the following line to your .vimrc file: +> + filetype on +< +The taglist plugin will not work if you run Vim in the restricted mode (using +the -Z command-line argument). + +The taglist plugin uses the Vim system() function to invoke the exuberant +ctags utility. If Vim is compiled without the system() function then you +cannot use the taglist plugin. Some of the Linux distributions (Suse) compile +Vim without the system() function for security reasons. + +============================================================================== + *taglist-install* +4. Installation~ + +1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the + $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should + have the following two files (the directory structure should be preserved): + + plugin/taglist.vim - main taglist plugin file + doc/taglist.txt - documentation (help) file + + Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more + details about installing Vim plugins. +2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc + directory, start Vim and run the ":helptags ." command to process the + taglist help file. Without this step, you cannot jump to the taglist help + topics. +3. If the exuberant ctags utility is not present in one of the directories in + the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to + point to the location of the exuberant ctags utility (not to the directory) + in the .vimrc file. +4. If you are running a terminal/console version of Vim and the terminal + doesn't support changing the window width then set the + 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. +5. Restart Vim. +6. You can now use the ":TlistToggle" command to open/close the taglist + window. You can use the ":help taglist" command to get more information + about using the taglist plugin. + +To uninstall the taglist plugin, remove the plugin/taglist.vim and +doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory. + +============================================================================== + *taglist-using* +5. Usage~ + +The taglist plugin can be used in several different ways. + +1. You can keep the taglist window open during the entire editing session. On + opening the taglist window, the tags defined in all the files in the Vim + buffer list will be displayed in the taglist window. As you edit files, the + tags defined in them will be added to the taglist window. You can select a + tag from the taglist window and jump to it. The current tag will be + highlighted in the taglist window. You can close the taglist window when + you no longer need the window. +2. You can configure the taglist plugin to process the tags defined in all the + edited files always. In this configuration, even if the taglist window is + closed and the taglist menu is not displayed, the taglist plugin will + processes the tags defined in newly edited files. You can then open the + taglist window only when you need to select a tag and then automatically + close the taglist window after selecting the tag. +3. You can configure the taglist plugin to display only the tags defined in + the current file in the taglist window. By default, the taglist plugin + displays the tags defined in all the files in the Vim buffer list. As you + switch between files, the taglist window will be refreshed to display only + the tags defined in the current file. +4. In GUI Vim, you can use the Tags pull-down and popup menu created by the + taglist plugin to display the tags defined in the current file and select a + tag to jump to it. You can use the menu without opening the taglist window. + By default, the Tags menu is disabled. +5. You can configure the taglist plugin to display the name of the current tag + in the Vim window status line or in the Vim window title bar. For this to + work without the taglist window or menu, you need to configure the taglist + plugin to process the tags defined in a file always. +6. You can save the tags defined in multiple files to a taglist session file + and load it when needed. You can also configure the taglist plugin to not + update the taglist window when editing new files. You can then manually add + files to the taglist window. + +Opening the taglist window~ +You can open the taglist window using the ":TlistOpen" or the ":TlistToggle" +commands. The ":TlistOpen" command opens the taglist window and jumps to it. +The ":TlistToggle" command opens or closes (toggle) the taglist window and the +cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen' +variable is set to 1, then the ":TlistToggle" command opens the taglist window +and moves the cursor to the taglist window. + +You can map a key to invoke these commands. For example, the following command +creates a normal mode mapping for the key to toggle the taglist window. +> + nnoremap :TlistToggle +< +Add the above mapping to your ~/.vimrc or $HOME/_vimrc file. + +To automatically open the taglist window on Vim startup, set the +'Tlist_Auto_Open' variable to 1. + +You can also open the taglist window on startup using the following command +line: +> + $ vim +TlistOpen +< +Closing the taglist window~ +You can close the taglist window from the taglist window by pressing 'q' or +using the Vim ":q" command. You can also use any of the Vim window commands to +close the taglist window. Invoking the ":TlistToggle" command when the taglist +window is opened, closes the taglist window. You can also use the +":TlistClose" command to close the taglist window. + +To automatically close the taglist window when a tag or file is selected, you +can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the +taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1. + +Jumping to a tag or a file~ +You can select a tag in the taglist window either by pressing the key +or by double clicking the tag name using the mouse. To jump to a tag on a +single mouse click set the 'Tlist_Use_SingleClick' variable to 1. + +If the selected file is already opened in a window, then the cursor is moved +to that window. If the file is not currently opened in a window then the file +is opened in the window used by the taglist plugin to show the previously +selected file. If there are no usable windows, then the file is opened in a +new window. The file is not opened in special windows like the quickfix +window, preview window and windows containing buffer with the 'buftype' option +set. + +To jump to the tag in a new window, press the 'o' key. To open the file in the +previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump +to the tag but still keep the cursor in the taglist window (preview). + +To open the selected file in a tab, use the 't' key. If the file is already +present in a tab then the cursor is moved to that tab otherwise the file is +opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist +window is automatically opened in the newly created tab. + +Instead of jumping to a tag, you can open a file by pressing the key +or by double clicking the file name using the mouse. + +In the taglist window, you can use the [[ or key to jump to the +beginning of the previous file. You can use the ]] or key to jump to the +beginning of the next file. When you reach the first or last file, the search +wraps around and the jumps to the next/previous file. + +Highlighting the current tag~ +The taglist plugin automatically highlights the name of the current tag in the +taglist window. The Vim |CursorHold| autocmd event is used for this. If the +current tag name is not visible in the taglist window, then the taglist window +contents are scrolled to make that tag name visible. You can also use the +":TlistHighlightTag" command to force the highlighting of the current tag. + +The tag name is highlighted if no activity is performed for |'updatetime'| +milliseconds. The default value for this Vim option is 4 seconds. To avoid +unexpected problems, you should not set the |'updatetime'| option to a very +low value. + +To disable the automatic highlighting of the current tag name in the taglist +window, set the 'Tlist_Auto_Highlight_Tag' variable to zero. + +When entering a Vim buffer/window, the taglist plugin automatically highlights +the current tag in that buffer/window. If you like to disable the automatic +highlighting of the current tag when entering a buffer, set the +'Tlist_Highlight_Tag_On_BufEnter' variable to zero. + +Adding files to the taglist~ +When the taglist window is opened, all the files in the Vim buffer list are +processed and the supported files are added to the taglist. When you edit a +file in Vim, the taglist plugin automatically processes this file and adds it +to the taglist. If you close the taglist window, the tag information in the +taglist is retained. + +To process files even when the taglist window is not open, set the +'Tlist_Process_File_Always' variable to 1. + +You can manually add multiple files to the taglist without opening them using +the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands. + +For example, to add all the C files in the /my/project/dir directory to the +taglist, you can use the following command: +> + :TlistAddFiles /my/project/dir/*.c +< +Note that when adding several files with a large number of tags or a large +number of files, it will take several seconds to several minutes for the +taglist plugin to process all the files. You should not interrupt the taglist +plugin by pressing . + +You can recursively add multiple files from a directory tree using the +":TlistAddFilesRecursive" command: +> + :TlistAddFilesRecursive /my/project/dir *.c +< +This command takes two arguments. The first argument specifies the directory +from which to recursively add the files. The second optional argument +specifies the wildcard matching pattern for selecting the files to add. The +default pattern is * and all the files are added. + +Displaying tags for only one file~ +The taglist window displays the tags for all the files in the Vim buffer list +and all the manually added files. To display the tags for only the current +active buffer, set the 'Tlist_Show_One_File' variable to 1. + +Removing files from the taglist~ +You can remove a file from the taglist window, by pressing the 'd' key when the +cursor is on one of the tags listed for the file in the taglist window. The +removed file will no longer be displayed in the taglist window in the current +Vim session. To again display the tags for the file, open the file in a Vim +window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command +to add the file to the taglist. + +When a buffer is removed from the Vim buffer list using the ":bdelete" or the +":bwipeout" command, the taglist is updated to remove the stored information +for this buffer. + +Updating the tags displayed for a file~ +The taglist plugin keeps track of the modification time of a file. When the +modification time changes (the file is modified), the taglist plugin +automatically updates the tags listed for that file. The modification time of +a file is checked when you enter a window containing that file or when you +load that file. + +You can also update or refresh the tags displayed for a file by pressing the +"u" key in the taglist window. If an existing file is modified, after the file +is saved, the taglist plugin automatically updates the tags displayed for the +file. + +You can also use the ":TlistUpdate" command to update the tags for the current +buffer after you made some changes to it. You should save the modified buffer +before you update the taglist window. Otherwise the listed tags will not +include the new tags created in the buffer. + +If you have deleted the tags displayed for a file in the taglist window using +the 'd' key, you can again display the tags for that file using the +":TlistUpdate" command. + +Controlling the taglist updates~ +To disable the automatic processing of new files or modified files, you can +set the 'Tlist_Auto_Update' variable to zero. When this variable is set to +zero, the taglist is updated only when you use the ":TlistUpdate" command or +the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use +this option to control which files are added to the taglist. + +You can use the ":TlistLock" command to lock the taglist contents. After this +command is executed, new files are not automatically added to the taglist. +When the taglist is locked, you can use the ":TlistUpdate" command to add the +current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to +add new files to the taglist. To unlock the taglist, use the ":TlistUnlock" +command. + +Displaying the tag prototype~ +To display the prototype of the tag under the cursor in the taglist window, +press the space bar. If you place the cursor on a tag name in the taglist +window, then the tag prototype is displayed at the Vim status line after +|'updatetime'| milliseconds. The default value for the |'updatetime'| Vim +option is 4 seconds. + +You can get the name and prototype of a tag without opening the taglist window +and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype" +commands. These commands will work only if the current file is already present +in the taglist. To use these commands without opening the taglist window, set +the 'Tlist_Process_File_Always' variable to 1. + +You can use the ":TlistShowTag" command to display the name of the tag at or +before the specified line number in the specified file. If the file name and +line number are not supplied, then this command will display the name of the +current tag. For example, +> + :TlistShowTag + :TlistShowTag myfile.java 100 +< +You can use the ":TlistShowPrototype" command to display the prototype of the +tag at or before the specified line number in the specified file. If the file +name and the line number are not supplied, then this command will display the +prototype of the current tag. For example, +> + :TlistShowPrototype + :TlistShowPrototype myfile.c 50 +< +In the taglist window, when the mouse is moved over a tag name, the tag +prototype is displayed in a balloon. This works only in GUI versions where +balloon evaluation is supported. + +Taglist window contents~ +The taglist window contains the tags defined in various files in the taglist +grouped by the filename and by the tag type (variable, function, class, etc.). +For tags with scope information (like class members, structures inside +structures, etc.), the scope information is displayed in square brackets "[]" +after the tag name. + +The contents of the taglist buffer/window are managed by the taglist plugin. +The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim +|'modifiable'| option is turned off for the taglist buffer. You should not +manually edit the taglist buffer, by setting the |'modifiable'| flag. If you +manually edit the taglist buffer contents, then the taglist plugin will be out +of sync with the taglist buffer contents and the plugin will no longer work +correctly. To redisplay the taglist buffer contents again, close the taglist +window and reopen it. + +Opening and closing the tag and file tree~ +In the taglist window, the tag names are displayed as a foldable tree using +the Vim folding support. You can collapse the tree using the '-' key or using +the Vim |zc| fold command. You can open the tree using the '+' key or using +the Vim |zo| fold command. You can open all the folds using the '*' key or +using the Vim |zR| fold command. You can also use the mouse to open/close the +folds. You can close all the folds using the '=' key. You should not manually +create or delete the folds in the taglist window. + +To automatically close the fold for the inactive files/buffers and open only +the fold for the current buffer in the taglist window, set the +'Tlist_File_Fold_Auto_Close' variable to 1. + +Sorting the tags for a file~ +The tags displayed in the taglist window can be sorted either by their name or +by their chronological order. The default sorting method is by the order in +which the tags appear in a file. You can change the default sort method by +setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can +sort the tags by their name by pressing the "s" key in the taglist window. You +can again sort the tags by their chronological order using the "s" key. Each +file in the taglist window can be sorted using different order. + +Zooming in and out of the taglist window~ +You can press the 'x' key in the taglist window to maximize the taglist +window width/height. The window will be maximized to the maximum possible +width/height without closing the other existing windows. You can again press +'x' to restore the taglist window to the default width/height. + + *taglist-session* +Taglist Session~ +A taglist session refers to the group of files and their tags stored in the +taglist in a Vim session. + +You can save and restore a taglist session (and all the displayed tags) using +the ":TlistSessionSave" and ":TlistSessionLoad" commands. + +To save the information about the tags and files in the taglist to a file, use +the ":TlistSessionSave" command and specify the filename: +> + :TlistSessionSave +< +To load a saved taglist session, use the ":TlistSessionLoad" command: > + + :TlistSessionLoad +< +When you load a taglist session file, the tags stored in the file will be +added to the tags already stored in the taglist. + +The taglist session feature can be used to save the tags for large files or a +group of frequently used files (like a project). By using the taglist session +file, you can minimize the amount to time it takes to load/refresh the taglist +for multiple files. + +You can create more than one taglist session file for multiple groups of +files. + +Displaying the tag name in the Vim status line or the window title bar~ +You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist +plugin to display the current tag name in the Vim status line or the window +title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line() +function to display the current tag prototype in the Vim status line or the +window title bar. + +For example, the following command can be used to display the current tag name +in the status line: +> + :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%) +< +The following command can be used to display the current tag name in the +window title bar: +> + :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%) +< +Note that the current tag name can be displayed only after the file is +processed by the taglist plugin. For this, you have to either set the +'Tlist_Process_File_Always' variable to 1 or open the taglist window or use +the taglist menu. For more information about configuring the Vim status line, +refer to the documentation for the Vim |'statusline'| option. + +Changing the taglist window highlighting~ +The following Vim highlight groups are defined and used to highlight the +various entities in the taglist window: + + TagListTagName - Used for tag names + TagListTagScope - Used for tag scope + TagListTitle - Used for tag titles + TagListComment - Used for comments + TagListFileName - Used for filenames + +By default, these highlight groups are linked to the standard Vim highlight +groups. If you want to change the colors used for these highlight groups, +prefix the highlight group name with 'My' and define it in your .vimrc or +.gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle, +MyTagListComment and MyTagListFileName. For example, to change the colors +used for tag names, you can use the following command: +> + :highlight MyTagListTagName guifg=blue ctermfg=blue +< +Controlling the taglist window~ +To use a horizontally split taglist window, instead of a vertically split +window, set the 'Tlist_Use_Horiz_Window' variable to 1. + +To use a vertically split taglist window on the rightmost side of the Vim +window, set the 'Tlist_Use_Right_Window' variable to 1. + +You can specify the width of the vertically split taglist window, by setting +the 'Tlist_WinWidth' variable. You can specify the height of the horizontally +split taglist window, by setting the 'Tlist_WinHeight' variable. + +When opening a vertically split taglist window, the Vim window width is +increased to accommodate the new taglist window. When the taglist window is +closed, the Vim window is reduced. To disable this, set the +'Tlist_Inc_Winwidth' variable to zero. + +To reduce the number of empty lines in the taglist window, set the +'Tlist_Compact_Format' variable to 1. + +To not display the Vim fold column in the taglist window, set the +'Tlist_Enable_Fold_Column' variable to zero. + +To display the tag prototypes instead of the tag names in the taglist window, +set the 'Tlist_Display_Prototype' variable to 1. + +To not display the scope of the tags next to the tag names, set the +'Tlist_Display_Tag_Scope' variable to zero. + + *taglist-keys* +Taglist window key list~ +The following table lists the description of the keys that can be used +in the taglist window. + + Key Description~ + + Jump to the location where the tag under cursor is + defined. + o Jump to the location where the tag under cursor is + defined in a new window. + P Jump to the tag in the previous (Ctrl-W_p) window. + p Display the tag definition in the file window and + keep the cursor in the taglist window itself. + t Jump to the tag in a new tab. If the file is already + opened in a tab, move to that tab. + Ctrl-t Jump to the tag in a new tab. + Display the prototype of the tag under the cursor. + For file names, display the full path to the file, + file type and the number of tags. For tag types, display the + tag type and the number of tags. + u Update the tags listed in the taglist window + s Change the sort order of the tags (by name or by order) + d Remove the tags for the file under the cursor + x Zoom-in or Zoom-out the taglist window + + Open a fold + - Close a fold + * Open all folds + = Close all folds + [[ Jump to the beginning of the previous file + Jump to the beginning of the previous file + ]] Jump to the beginning of the next file + Jump to the beginning of the next file + q Close the taglist window + Display help + +The above keys will work in both the normal mode and the insert mode. + + *taglist-menu* +Taglist menu~ +When using GUI Vim, the taglist plugin can display the tags defined in the +current file in the drop-down menu and the popup menu. By default, this +feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu' +variable to 1. + +You can jump to a tag by selecting the tag name from the menu. You can use the +taglist menu independent of the taglist window i.e. you don't need to open the +taglist window to get the taglist menu. + +When you switch between files/buffers, the taglist menu is automatically +updated to display the tags defined in the current file/buffer. + +The tags are grouped by their type (variables, functions, classes, methods, +etc.) and displayed as a separate sub-menu for each type. If all the tags +defined in a file are of the same type (e.g. functions), then the sub-menu is +not used. + +If the number of items in a tag type submenu exceeds the value specified by +the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into +multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25. +The first and last tag names in the submenu are used to form the submenu name. +The menu items are prefixed by alpha-numeric characters for easy selection by +keyboard. + +If the popup menu support is enabled (the |'mousemodel'| option contains +"popup"), then the tags menu is added to the popup menu. You can access +the popup menu by right clicking on the GUI window. + +You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry. +You can sort the tags listed in the menu either by name or by order by +selecting the 'Tags->Sort menu by->Name/Order' menu entry. + +You can tear-off the Tags menu and keep it on the side of the Vim window +for quickly locating the tags. + +Using the taglist plugin with the winmanager plugin~ +You can use the taglist plugin with the winmanager plugin. This will allow you +to use the file explorer, buffer explorer and the taglist plugin at the same +time in different windows. To use the taglist plugin with the winmanager +plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example, +to use the file explorer plugin and the taglist plugin at the same time, use +the following setting: > + + let winManagerWindowLayout = 'FileExplorer|TagList' +< +Getting help~ +If you have installed the taglist help file (this file), then you can use the +Vim ":help taglist-" command to get help on the various taglist +topics. + +You can press the key in the taglist window to display the help +information about using the taglist window. If you again press the key, +the help information is removed from the taglist window. + + *taglist-debug* +Debugging the taglist plugin~ +You can use the ":TlistDebug" command to enable logging of the debug messages +from the taglist plugin. To display the logged debug messages, you can use the +":TlistMessages" command. To disable the logging of the debug messages, use +the ":TlistUndebug" command. + +You can specify a file name to the ":TlistDebug" command to log the debug +messages to a file. Otherwise, the debug messages are stored in a script-local +variable. In the later case, to minimize memory usage, only the last 3000 +characters from the debug messages are stored. + +============================================================================== + *taglist-options* +6. Options~ + +A number of Vim variables control the behavior of the taglist plugin. These +variables are initialized to a default value. By changing these variables you +can change the behavior of the taglist plugin. You need to change these +settings only if you want to change the behavior of the taglist plugin. You +should use the |:let| command in your .vimrc file to change the setting of any +of these variables. + +The configurable taglist variables are listed below. For a detailed +description of these variables refer to the text below this table. + +|'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the + taglist. +|'Tlist_Auto_Open'| Open the taglist window when Vim starts. +|'Tlist_Auto_Update'| Automatically update the taglist to include + newly edited files. +|'Tlist_Close_On_Select'| Close the taglist window when a file or tag is + selected. +|'Tlist_Compact_Format'| Remove extra information and blank lines from + the taglist window. +|'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility. +|'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist + window. +|'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name. +|'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist + window. +|'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window. +|'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers. +|'Tlist_GainFocus_On_ToggleOpen'| + Jump to taglist window on open. +|'Tlist_Highlight_Tag_On_BufEnter'| + On entering a buffer, automatically highlight + the current tag. +|'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate + the taglist window. +|'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu. +|'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry. +|'Tlist_Process_File_Always'| Process files even when the taglist window is + closed. +|'Tlist_Show_Menu'| Display the tags menu. +|'Tlist_Show_One_File'| Show tags for the current buffer only. +|'Tlist_Sort_Type'| Sort method used for arranging the tags. +|'Tlist_Use_Horiz_Window'| Use a horizontally split window for the + taglist window. +|'Tlist_Use_Right_Window'| Place the taglist window on the right side. +|'Tlist_Use_SingleClick'| Single click on a tag jumps to it. +|'Tlist_WinHeight'| Horizontally split taglist window height. +|'Tlist_WinWidth'| Vertically split taglist window width. + + *'Tlist_Auto_Highlight_Tag'* +Tlist_Auto_Highlight_Tag~ +The taglist plugin will automatically highlight the current tag in the taglist +window. If you want to disable this, then you can set the +'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current +tag highlighting is disabled, the tags for a new file will still be added to +the taglist window. +> + let Tlist_Auto_Highlight_Tag = 0 +< +With the above variable set to 1, you can use the ":TlistHighlightTag" command +to highlight the current tag. + + *'Tlist_Auto_Open'* +Tlist_Auto_Open~ +To automatically open the taglist window, when you start Vim, you can set the +'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and +the taglist window will not be opened automatically on Vim startup. +> + let Tlist_Auto_Open = 1 +< +The taglist window is opened only when a supported type of file is opened on +Vim startup. For example, if you open text files, then the taglist window will +not be opened. + + *'Tlist_Auto_Update'* +Tlist_Auto_Update~ +When a new file is edited, the tags defined in the file are automatically +processed and added to the taglist. To stop adding new files to the taglist, +set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set +to 1. +> + let Tlist_Auto_Update = 0 +< +With the above variable set to 1, you can use the ":TlistUpdate" command to +add the tags defined in the current file to the taglist. + + *'Tlist_Close_On_Select'* +Tlist_Close_On_Select~ +If you want to close the taglist window when a file or tag is selected, then +set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is +set zero and when you select a tag or file from the taglist window, the window +is not closed. +> + let Tlist_Close_On_Select = 1 +< + *'Tlist_Compact_Format'* +Tlist_Compact_Format~ +By default, empty lines are used to separate different tag types displayed for +a file and the tags displayed for different files in the taglist window. If +you want to display as many tags as possible in the taglist window, you can +set the 'Tlist_Compact_Format' variable to 1 to get a compact display. +> + let Tlist_Compact_Format = 1 +< + *'Tlist_Ctags_Cmd'* +Tlist_Ctags_Cmd~ +The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant +ctags utility. If exuberant ctags is present in any one of the directories in +the PATH environment variable, then there is no need to set this variable. + +The exuberant ctags tool can be installed under different names. When the +taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it +checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in +the PATH environment variable. If any one of the named executable is found, +then the Tlist_Ctags_Cmd variable is set to that name. + +If exuberant ctags is not present in one of the directories specified in the +PATH environment variable, then set this variable to point to the location of +the ctags utility in your system. Note that this variable should point to the +fully qualified exuberant ctags location and NOT to the directory in which +exuberant ctags is installed. If the exuberant ctags tool is not found in +either PATH or in the specified location, then the taglist plugin will not be +loaded. Examples: +> + let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe' + let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' +< + *'Tlist_Display_Prototype'* +Tlist_Display_Prototype~ +By default, only the tag name will be displayed in the taglist window. If you +like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype' +variable to 1. By default, this variable is set to zero and only tag names +will be displayed. +> + let Tlist_Display_Prototype = 1 +< + *'Tlist_Display_Tag_Scope'* +Tlist_Display_Tag_Scope~ +By default, the scope of a tag (like a C++ class) will be displayed in +square brackets next to the tag name. If you don't want the tag scopes +to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default, +this variable is set to 1 and the tag scopes will be displayed. +> + let Tlist_Display_Tag_Scope = 0 +< + *'Tlist_Enable_Fold_Column'* +Tlist_Enable_Fold_Column~ +By default, the Vim fold column is enabled and displayed in the taglist +window. If you wish to disable this (for example, when you are working with a +narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column' +variable to zero. +> + let Tlist_Enable_Fold_Column = 1 +< + *'Tlist_Exit_OnlyWindow'* +Tlist_Exit_OnlyWindow~ +If you want to exit Vim if only the taglist window is currently opened, then +set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is +set to zero and the Vim instance will not be closed if only the taglist window +is present. +> + let Tlist_Exit_OnlyWindow = 1 +< + *'Tlist_File_Fold_Auto_Close'* +Tlist_File_Fold_Auto_Close~ +By default, the tags tree displayed in the taglist window for all the files is +opened. You can close/fold the tags tree for the files manually. To +automatically close the tags tree for inactive files, you can set the +'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1, +the tags tree for the current buffer is automatically opened and for all the +other buffers is closed. +> + let Tlist_File_Fold_Auto_Close = 1 +< + *'Tlist_GainFocus_On_ToggleOpen'* +Tlist_GainFocus_On_ToggleOpen~ +When the taglist window is opened using the ':TlistToggle' command, this +option controls whether the cursor is moved to the taglist window or remains +in the current window. By default, this option is set to 0 and the cursor +remains in the current window. When this variable is set to 1, the cursor +moves to the taglist window after opening the taglist window. +> + let Tlist_GainFocus_On_ToggleOpen = 1 +< + *'Tlist_Highlight_Tag_On_BufEnter'* +Tlist_Highlight_Tag_On_BufEnter~ +When you enter a Vim buffer/window, the current tag in that buffer/window is +automatically highlighted in the taglist window. If the current tag name is +not visible in the taglist window, then the taglist window contents are +scrolled to make that tag name visible. If you like to disable the automatic +highlighting of the current tag when entering a buffer, you can set the +'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for +this variable is 1. +> + let Tlist_Highlight_Tag_On_BufEnter = 0 +< + *'Tlist_Inc_Winwidth'* +Tlist_Inc_Winwidth~ +By default, when the width of the window is less than 100 and a new taglist +window is opened vertically, then the window width is increased by the value +set in the 'Tlist_WinWidth' variable to accommodate the new window. The value +of this variable is used only if you are using a vertically split taglist +window. + +If your terminal doesn't support changing the window width from Vim (older +version of xterm running in a Unix system) or if you see any weird problems in +the screen due to the change in the window width or if you prefer not to +adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero. +CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command +window then you must set this variable to zero, otherwise the system may hang +due to a Vim limitation (explained in :help win32-problems) +> + let Tlist_Inc_Winwidth = 0 +< + *'Tlist_Max_Submenu_Items'* +Tlist_Max_Submenu_Items~ +If a file contains too many tags of a particular type (function, variable, +class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items' +variable, then the menu for that tag type will be split into multiple +sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is +25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable: +> + let Tlist_Max_Submenu_Items = 20 +< +The name of the submenu is formed using the names of the first and the last +tag entries in that submenu. + + *'Tlist_Max_Tag_Length'* +Tlist_Max_Tag_Length~ +Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be +used to form the tag type submenu name. The default value for this variable is +10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or +less characters: +> + let Tlist_Max_Tag_Length = 10 +< + *'Tlist_Process_File_Always'* +Tlist_Process_File_Always~ +By default, the taglist plugin will generate and process the tags defined in +the newly opened files only when the taglist window is opened or when the +taglist menu is enabled. When the taglist window is closed, the taglist plugin +will stop processing the tags for newly opened files. + +You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list +of tags for new files even when the taglist window is closed and the taglist +menu is disabled. +> + let Tlist_Process_File_Always = 1 +< +To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the +taglist window and the taglist menu, you should set this variable to 1. + + *'Tlist_Show_Menu'* +Tlist_Show_Menu~ +When using GUI Vim, you can display the tags defined in the current file in a +menu named "Tags". By default, this feature is turned off. To turn on this +feature, set the 'Tlist_Show_Menu' variable to 1: +> + let Tlist_Show_Menu = 1 +< + *'Tlist_Show_One_File'* +Tlist_Show_One_File~ +By default, the taglist plugin will display the tags defined in all the loaded +buffers in the taglist window. If you prefer to display the tags defined only +in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When +this variable is set to 1, as you switch between buffers, the taglist window +will be refreshed to display the tags for the current buffer and the tags for +the previous buffer will be removed. +> + let Tlist_Show_One_File = 1 +< + *'Tlist_Sort_Type'* +Tlist_Sort_Type~ +The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the +taglist window. The tags can be sorted either alphabetically by their name or +by the order of their appearance in the file (chronological order). By +default, the tag names will be listed by the order in which they are defined +in the file. You can change the sort type (from name to order or from order to +name) by pressing the "s" key in the taglist window. You can also change the +default sort order by setting 'Tlist_Sort_Type' to "name" or "order": +> + let Tlist_Sort_Type = "name" +< + *'Tlist_Use_Horiz_Window'* +Tlist_Use_Horiz_Window~ +Be default, the tag names are displayed in a vertically split window. If you +prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window' +variable to 1. If you are running MS-Windows version of Vim in a MS-DOS +command window, then you should use a horizontally split window instead of a +vertically split window. Also, if you are using an older version of xterm in a +Unix system that doesn't support changing the xterm window width, you should +use a horizontally split window. +> + let Tlist_Use_Horiz_Window = 1 +< + *'Tlist_Use_Right_Window'* +Tlist_Use_Right_Window~ +By default, the vertically split taglist window will appear on the left hand +side. If you prefer to open the window on the right hand side, you can set the +'Tlist_Use_Right_Window' variable to 1: +> + let Tlist_Use_Right_Window = 1 +< + *'Tlist_Use_SingleClick'* +Tlist_Use_SingleClick~ +By default, when you double click on the tag name using the left mouse +button, the cursor will be positioned at the definition of the tag. You +can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when +you single click on the tag name using the mouse. By default this variable +is set to zero. +> + let Tlist_Use_SingleClick = 1 +< +Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize +the taglist window using the mouse, then Vim will crash. This problem is fixed +in Vim 6.3 and above. In the meantime, instead of resizing the taglist window +using the mouse, you can use normal Vim window resizing commands to resize the +taglist window. + + *'Tlist_WinHeight'* +Tlist_WinHeight~ +The default height of the horizontally split taglist window is 10. This can be +changed by modifying the 'Tlist_WinHeight' variable: +> + let Tlist_WinHeight = 20 +< +The |'winfixheight'| option is set for the taglist window, to maintain the +height of the taglist window, when new Vim windows are opened and existing +windows are closed. + + *'Tlist_WinWidth'* +Tlist_WinWidth~ +The default width of the vertically split taglist window is 30. This can be +changed by modifying the 'Tlist_WinWidth' variable: +> + let Tlist_WinWidth = 20 +< +Note that the value of the |'winwidth'| option setting determines the minimum +width of the current window. If you set the 'Tlist_WinWidth' variable to a +value less than that of the |'winwidth'| option setting, then Vim will use the +value of the |'winwidth'| option. + +When new Vim windows are opened and existing windows are closed, the taglist +plugin will try to maintain the width of the taglist window to the size +specified by the 'Tlist_WinWidth' variable. + +============================================================================== + *taglist-commands* +7. Commands~ + +The taglist plugin provides the following ex-mode commands: + +|:TlistAddFiles| Add multiple files to the taglist. +|:TlistAddFilesRecursive| + Add files recursively to the taglist. +|:TlistClose| Close the taglist window. +|:TlistDebug| Start logging of taglist debug messages. +|:TlistLock| Stop adding new files to the taglist. +|:TlistMessages| Display the logged taglist plugin debug messages. +|:TlistOpen| Open and jump to the taglist window. +|:TlistSessionSave| Save the information about files and tags in the + taglist to a session file. +|:TlistSessionLoad| Load the information about files and tags stored + in a session file to taglist. +|:TlistShowPrototype| Display the prototype of the tag at or before the + specified line number. +|:TlistShowTag| Display the name of the tag defined at or before the + specified line number. +|:TlistHighlightTag| Highlight the current tag in the taglist window. +|:TlistToggle| Open or close (toggle) the taglist window. +|:TlistUndebug| Stop logging of taglist debug messages. +|:TlistUnlock| Start adding new files to the taglist. +|:TlistUpdate| Update the tags for the current buffer. + + *:TlistAddFiles* +:TlistAddFiles {file(s)} [file(s) ...] + Add one or more specified files to the taglist. You can + specify multiple filenames using wildcards. To specify a + file name with space character, you should escape the space + character with a backslash. + Examples: +> + :TlistAddFiles *.c *.cpp + :TlistAddFiles file1.html file2.html +< + If you specify a large number of files, then it will take some + time for the taglist plugin to process all of them. The + specified files will not be edited in a Vim window and will + not be added to the Vim buffer list. + + *:TlistAddFilesRecursive* +:TlistAddFilesRecursive {directory} [ {pattern} ] + Add files matching {pattern} recursively from the specified + {directory} to the taglist. If {pattern} is not specified, + then '*' is assumed. To specify the current directory, use "." + for {directory}. To specify a directory name with space + character, you should escape the space character with a + backslash. + Examples: +> + :TlistAddFilesRecursive myproject *.java + :TlistAddFilesRecursive smallproject +< + If large number of files are present in the specified + directory tree, then it will take some time for the taglist + plugin to process all of them. + + *:TlistClose* +:TlistClose Close the taglist window. This command can be used from any + one of the Vim windows. + + *:TlistDebug* +:TlistDebug [filename] + Start logging of debug messages from the taglist plugin. + If {filename} is specified, then the debug messages are stored + in the specified file. Otherwise, the debug messages are + stored in a script local variable. If the file {filename} is + already present, then it is overwritten. + + *:TlistLock* +:TlistLock + Lock the taglist and don't process new files. After this + command is executed, newly edited files will not be added to + the taglist. + + *:TlistMessages* +:TlistMessages + Display the logged debug messages from the taglist plugin + in a window. This command works only when logging to a + script-local variable. + + *:TlistOpen* +:TlistOpen Open and jump to the taglist window. Creates the taglist + window, if the window is not opened currently. After executing + this command, the cursor is moved to the taglist window. When + the taglist window is opened for the first time, all the files + in the buffer list are processed and the tags defined in them + are displayed in the taglist window. + + *:TlistSessionSave* +:TlistSessionSave {filename} + Saves the information about files and tags in the taglist to + the specified file. This command can be used to save and + restore the taglist contents across Vim sessions. + + *:TlistSessionLoad* +:TlistSessionLoad {filename} + Load the information about files and tags stored in the + specified session file to the taglist. + + *:TlistShowPrototype* +:TlistShowPrototype [filename] [linenumber] + Display the prototype of the tag at or before the specified + line number. If the file name and the line number are not + specified, then the current file name and line number are + used. A tag spans multiple lines starting from the line where + it is defined to the line before the next tag. This command + displays the prototype for the tag for any line number in this + range. + + *:TlistShowTag* +:TlistShowTag [filename] [linenumber] + Display the name of the tag defined at or before the specified + line number. If the file name and the line number are not + specified, then the current file name and line number are + used. A tag spans multiple lines starting from the line where + it is defined to the line before the next tag. This command + displays the tag name for any line number in this range. + + *:TlistHighlightTag* +:TlistHighlightTag + Highlight the current tag in the taglist window. By default, + the taglist plugin periodically updates the taglist window to + highlight the current tag. This command can be used to force + the taglist plugin to highlight the current tag. + + *:TlistToggle* +:TlistToggle Open or close (toggle) the taglist window. Opens the taglist + window, if the window is not opened currently. Closes the + taglist window, if the taglist window is already opened. When + the taglist window is opened for the first time, all the files + in the buffer list are processed and the tags are displayed in + the taglist window. After executing this command, the cursor + is not moved from the current window to the taglist window. + + *:TlistUndebug* +:TlistUndebug + Stop logging of debug messages from the taglist plugin. + + *:TlistUnlock* +:TlistUnlock + Unlock the taglist and start processing newly edited files. + + *:TlistUpdate* +:TlistUpdate Update the tags information for the current buffer. This + command can be used to re-process the current file/buffer and + get the tags information. As the taglist plugin uses the file + saved in the disk (instead of the file displayed in a Vim + buffer), you should save a modified buffer before you update + the taglist. Otherwise the listed tags will not include the + new tags created in the buffer. You can use this command even + when the taglist window is not opened. + +============================================================================== + *taglist-functions* +8. Global functions~ + +The taglist plugin provides several global functions that can be used from +other Vim plugins to interact with the taglist plugin. These functions are +described below. + +|Tlist_Update_File_Tags()| Update the tags for the specified file +|Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or + before the specified line number in the + specified file. +|Tlist_Get_Tagname_By_Line()| Return the name of the tag at or + before the specified line number in + the specified file. +|Tlist_Set_App()| Set the name of the application + controlling the taglist window. + + *Tlist_Update_File_Tags()* +Tlist_Update_File_Tags({filename}, {filetype}) + Update the tags for the file {filename}. The second argument + specifies the Vim filetype for the file. If the taglist plugin + has not processed the file previously, then the exuberant + ctags tool is invoked to generate the tags for the file. + + *Tlist_Get_Tag_Prototype_By_Line()* +Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}]) + Return the prototype of the tag at or before the specified + line number in the specified file. If the filename and line + number are not specified, then the current buffer name and the + current line number are used. + + *Tlist_Get_Tagname_By_Line()* +Tlist_Get_Tagname_By_Line([{filename}, {linenumber}]) + Return the name of the tag at or before the specified line + number in the specified file. If the filename and line number + are not specified, then the current buffer name and the + current line number are used. + + *Tlist_Set_App()* +Tlist_Set_App({appname}) + Set the name of the plugin that controls the taglist plugin + window and buffer. This can be used to integrate the taglist + plugin with other Vim plugins. + + For example, the winmanager plugin and the Cream package use + this function and specify the appname as "winmanager" and + "cream" respectively. + + By default, the taglist plugin is a stand-alone plugin and + controls the taglist window and buffer. If the taglist window + is controlled by an external plugin, then the appname should + be set appropriately. + +============================================================================== + *taglist-extend* +9. Extending~ + +The taglist plugin supports all the languages supported by the exuberant ctags +tool, which includes the following languages: Assembly, ASP, Awk, Beta, C, +C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua, +Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql, +TCL, Verilog, Vim and Yacc. + +You can extend the taglist plugin to add support for new languages and also +modify the support for the above listed languages. + +You should NOT make modifications to the taglist plugin script file to add +support for new languages. You will lose these changes when you upgrade to the +next version of the taglist plugin. Instead you should follow the below +described instructions to extend the taglist plugin. + +You can extend the taglist plugin by setting variables in the .vimrc or _vimrc +file. The name of these variables depends on the language name and is +described below. + +Modifying support for an existing language~ +To modify the support for an already supported language, you have to set the +tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx +with the Vim filetype name for the language file. For example, to modify the +support for the perl language files, you have to set the tlist_perl_settings +variable. To modify the support for java files, you have to set the +tlist_java_settings variable. + +To determine the filetype name used by Vim for a file, use the following +command in the buffer containing the file: + + :set filetype + +The above command will display the Vim filetype for the current buffer. + +The format of the value set in the tlist_xxx_settings variable is + + ;flag1:name1;flag2:name2;flag3:name3 + +The different fields in the value are separated by the ';' character. + +The first field 'language_name' is the name used by exuberant ctags to refer +to this language file. This name can be different from the file type name used +by Vim. For example, for C++, the language name used by ctags is 'c++' but the +filetype name used by Vim is 'cpp'. To get the list of language names +supported by exuberant ctags, use the following command: + + $ ctags --list-maps=all + +The remaining fields follow the format "flag:name". The sub-field 'flag' is +the language specific flag used by exuberant ctags to generate the +corresponding tags. For example, for the C language, to list only the +functions, the 'f' flag is used. To get the list of flags supported by +exuberant ctags for the various languages use the following command: + + $ ctags --list-kinds=all + +The sub-field 'name' specifies the title text to use for displaying the tags +of a particular type. For example, 'name' can be set to 'functions'. This +field can be set to any text string name. + +For example, to list only the classes and functions defined in a C++ language +file, add the following line to your .vimrc file: + + let tlist_cpp_settings = 'c++;c:class;f:function' + +In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name +used by the exuberant ctags tool. 'c' and 'f' are the flags passed to +exuberant ctags to list C++ classes and functions and 'class' is the title +used for the class tags and 'function' is the title used for the function tags +in the taglist window. + +For example, to display only functions defined in a C file and to use "My +Functions" as the title for the function tags, use + + let tlist_c_settings = 'c;f:My Functions' + +When you set the tlist_xxx_settings variable, you will override the default +setting used by the taglist plugin for the 'xxx' language. You cannot add to +the default options used by the taglist plugin for a particular file type. To +add to the options used by the taglist plugin for a language, copy the option +values from the taglist plugin file to your .vimrc file and modify it. + +Adding support for a new language~ +If you want to add support for a new language to the taglist plugin, you need +to first extend the exuberant ctags tool. For more information about extending +exuberant ctags, visit the following page: + + http://ctags.sourceforge.net/EXTENDING.html + +To add support for a new language, set the tlist_xxx_settings variable in the +~/.vimrc file appropriately as described above. Replace 'xxx' in the variable +name with the Vim filetype name for the new language. + +For example, to extend the taglist plugin to support the latex language, you +can use the following line (assuming, you have already extended exuberant +ctags to support the latex language): + + let tlist_tex_settings='latex;b:bibitem;c:command;l:label' + +With the above line, when you edit files of filetype "tex" in Vim, the taglist +plugin will invoke the exuberant ctags tool passing the "latex" filetype and +the flags b, c and l to generate the tags. The text heading 'bibitem', +'command' and 'label' will be used in the taglist window for the tags which +are generated for the flags b, c and l respectively. + +============================================================================== + *taglist-faq* +10. Frequently Asked Questions~ + +Q. The taglist plugin doesn't work. The taglist window is empty and the tags + defined in a file are not displayed. +A. Are you using Vim version 6.0 and above? The taglist plugin relies on the + features supported by Vim version 6.0 and above. You can use the following + command to get the Vim version: +> + $ vim --version +< + Are you using exuberant ctags version 5.0 and above? The taglist plugin + relies on the features supported by exuberant ctags and will not work with + GNU ctags or the Unix ctags utility. You can use the following command to + determine whether the ctags installed in your system is exuberant ctags: +> + $ ctags --version +< + Is exuberant ctags present in one of the directories in your PATH? If not, + you need to set the Tlist_Ctags_Cmd variable to point to the location of + exuberant ctags. Use the following Vim command to verify that this is setup + correctly: +> + :echo system(Tlist_Ctags_Cmd . ' --version') +< + The above command should display the version information for exuberant + ctags. + + Did you turn on the Vim filetype detection? The taglist plugin relies on + the filetype detected by Vim and passes the filetype to the exuberant ctags + utility to parse the tags. Check the output of the following Vim command: +> + :filetype +< + The output of the above command should contain "filetype detection:ON". + To turn on the filetype detection, add the following line to the .vimrc or + _vimrc file: +> + filetype on +< + Is your version of Vim compiled with the support for the system() function? + The following Vim command should display 1: +> + :echo exists('*system') +< + In some Linux distributions (particularly Suse Linux), the default Vim + installation is built without the support for the system() function. The + taglist plugin uses the system() function to invoke the exuberant ctags + utility. You need to rebuild Vim after enabling the support for the + system() function. If you use the default build options, the system() + function will be supported. + + Do you have the |'shellslash'| option set? You can try disabling the + |'shellslash'| option. When the taglist plugin invokes the exuberant ctags + utility with the path to the file, if the incorrect slashes are used, then + you will see errors. + + Check the shell related Vim options values using the following command: +> + :set shell? shellcmdflag? shellpipe? + :set shellquote? shellredir? shellxquote? +< + If these options are set in your .vimrc or _vimrc file, try removing those + lines. + + Are you using a Unix shell in a MS-Windows environment? For example, + the Unix shell from the MKS-toolkit. Do you have the SHELL environment + set to point to this shell? You can try resetting the SHELL environment + variable. + + If you are using a Unix shell on MS-Windows, you should try to use + exuberant ctags that is compiled for Unix-like environments so that + exuberant ctags will understand path names with forward slash characters. + + Is your filetype supported by the exuberant ctags utility? The file types + supported by the exuberant ctags utility are listed in the ctags help. If a + file type is not supported, you have to extend exuberant ctags. You can use + the following command to list the filetypes supported by exuberant ctags: +> + ctags --list-languages +< + Run the following command from the shell prompt and check whether the tags + defined in your file are listed in the output from exuberant ctags: +> + ctags -f - --format=2 --excmd=pattern --fields=nks +< + If you see your tags in the output from the above command, then the + exuberant ctags utility is properly parsing your file. + + Do you have the .ctags or _ctags or the ctags.cnf file in your home + directory for specifying default options or for extending exuberant ctags? + If you do have this file, check the options in this file and make sure + these options are not interfering with the operation of the taglist plugin. + + If you are using MS-Windows, check the value of the TEMP and TMP + environment variables. If these environment variables are set to a path + with space characters in the name, then try using the DOS 8.3 short name + for the path or set them to a path without the space characters in the + name. For example, if the temporary directory name is "C:\Documents and + Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to + the following: +> + set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp +< + If exuberant ctags is installed in a directory with space characters in the + name, then try adding the directory to the PATH environment variable or try + setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags + or try copying the exuberant ctags to a path without space characters in + the name. For example, if exuberant ctags is installed in the directory + "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable + as below: +> + let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe' +< + If you are using a cygwin compiled version of exuberant ctags on MS-Windows, + make sure that either you have the cygwin compiled sort utility installed + and available in your PATH or compile exuberant ctags with internal sort + support. Otherwise, when exuberant ctags sorts the tags output by invoking + the sort utility, it may end up invoking the MS-Windows version of + sort.exe, thereby resulting in failure. + +Q. When I try to open the taglist window, I am seeing the following error + message. How do I fix this problem? + + Taglist: Failed to generate tags for /my/path/to/file + ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ... + +A. The taglist plugin will work only with the exuberant ctags tool. You + cannot use the GNU ctags or the Unix ctags program with the taglist plugin. + You will see an error message similar to the one shown above, if you try + use a non-exuberant ctags program with Vim. To fix this problem, either add + the exuberant ctags tool location to the PATH environment variable or set + the 'Tlist_Ctags_Cmd' variable. + +Q. A file has more than one tag with the same name. When I select a tag name + from the taglist window, the cursor is positioned at the incorrect tag + location. +A. The taglist plugin uses the search pattern generated by the exuberant ctags + utility to position the cursor at the location of a tag definition. If a + file has more than one tag with the same name and same prototype, then the + search pattern will be the same. In this case, when searching for the tag + pattern, the cursor may be positioned at the incorrect location. + +Q. I have made some modifications to my file and introduced new + functions/classes/variables. I have not yet saved my file. The taglist + plugin is not displaying the new tags when I update the taglist window. +A. The exuberant ctags utility will process only files that are present in the + disk. To list the tags defined in a file, you have to save the file and + then update the taglist window. + +Q. I have created a ctags file using the exuberant ctags utility for my source + tree. How do I configure the taglist plugin to use this tags file? +A. The taglist plugin doesn't use a tags file stored in disk. For every opened + file, the taglist plugin invokes the exuberant ctags utility to get the + list of tags dynamically. The Vim system() function is used to invoke + exuberant ctags and get the ctags output. This function internally uses a + temporary file to store the output. This file is deleted after the output + from the command is read. So you will never see the file that contains the + output of exuberant ctags. + +Q. When I set the |'updatetime'| option to a low value (less than 1000) and if + I keep pressing a key with the taglist window open, the current buffer + contents are changed. Why is this? +A. The taglist plugin uses the |CursorHold| autocmd to highlight the current + tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds. + If the |'updatetime'| option is set to a low value, then the CursorHold + autocmd will be triggered frequently. As the taglist plugin changes + the focus to the taglist window to highlight the current tag, this could + interfere with the key movement resulting in changing the contents of + the current buffer. The workaround for this problem is to not set the + |'updatetime'| option to a low value. + +============================================================================== + *taglist-license* +11. License~ +Permission is hereby granted to use and distribute the taglist plugin, with or +without modifications, provided that this copyright notice is copied with it. +Like anything else that's free, taglist.vim is provided *as is* and comes with +no warranty of any kind, either expressed or implied. In no event will the +copyright holder be liable for any damamges resulting from the use of this +software. + +============================================================================== + *taglist-todo* +12. Todo~ + +1. Group tags according to the scope and display them. For example, + group all the tags belonging to a C++/Java class +2. Support for displaying tags in a modified (not-yet-saved) file. +3. Automatically open the taglist window only for selected filetypes. + For other filetypes, close the taglist window. +4. When using the shell from the MKS toolkit, the taglist plugin + doesn't work. +5. The taglist plugin doesn't work with files edited remotely using the + netrw plugin. The exuberant ctags utility cannot process files over + scp/rcp/ftp, etc. + +============================================================================== + +vim:tw=78:ts=8:noet:ft=help: diff --git a/sources_non_forked/taglist.vim/doc/tags b/sources_non_forked/taglist.vim/doc/tags new file mode 100644 index 00000000..83e80ba1 --- /dev/null +++ b/sources_non_forked/taglist.vim/doc/tags @@ -0,0 +1,62 @@ +'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'* +'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'* +'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'* +'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'* +'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'* +'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'* +'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'* +'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'* +'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'* +'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'* +'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'* +'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'* +'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'* +'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'* +'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'* +'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'* +'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'* +'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'* +'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'* +'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'* +'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'* +'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'* +'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'* +'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'* +'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'* +:TlistAddFiles taglist.txt /*:TlistAddFiles* +:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive* +:TlistClose taglist.txt /*:TlistClose* +:TlistDebug taglist.txt /*:TlistDebug* +:TlistHighlightTag taglist.txt /*:TlistHighlightTag* +:TlistLock taglist.txt /*:TlistLock* +:TlistMessages taglist.txt /*:TlistMessages* +:TlistOpen taglist.txt /*:TlistOpen* +:TlistSessionLoad taglist.txt /*:TlistSessionLoad* +:TlistSessionSave taglist.txt /*:TlistSessionSave* +:TlistShowPrototype taglist.txt /*:TlistShowPrototype* +:TlistShowTag taglist.txt /*:TlistShowTag* +:TlistToggle taglist.txt /*:TlistToggle* +:TlistUndebug taglist.txt /*:TlistUndebug* +:TlistUnlock taglist.txt /*:TlistUnlock* +:TlistUpdate taglist.txt /*:TlistUpdate* +Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()* +Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()* +Tlist_Set_App() taglist.txt /*Tlist_Set_App()* +Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()* +taglist-commands taglist.txt /*taglist-commands* +taglist-debug taglist.txt /*taglist-debug* +taglist-extend taglist.txt /*taglist-extend* +taglist-faq taglist.txt /*taglist-faq* +taglist-functions taglist.txt /*taglist-functions* +taglist-install taglist.txt /*taglist-install* +taglist-internet taglist.txt /*taglist-internet* +taglist-intro taglist.txt /*taglist-intro* +taglist-keys taglist.txt /*taglist-keys* +taglist-license taglist.txt /*taglist-license* +taglist-menu taglist.txt /*taglist-menu* +taglist-options taglist.txt /*taglist-options* +taglist-requirements taglist.txt /*taglist-requirements* +taglist-session taglist.txt /*taglist-session* +taglist-todo taglist.txt /*taglist-todo* +taglist-using taglist.txt /*taglist-using* +taglist.txt taglist.txt /*taglist.txt* diff --git a/sources_non_forked/taglist.vim/plugin/taglist.vim b/sources_non_forked/taglist.vim/plugin/taglist.vim new file mode 100644 index 00000000..59901f64 --- /dev/null +++ b/sources_non_forked/taglist.vim/plugin/taglist.vim @@ -0,0 +1,4546 @@ +" File: taglist.vim +" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Version: 4.5 +" Last Modified: September 21, 2007 +" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" taglist.vim is provided *as is* and comes with no warranty of any +" kind, either expressed or implied. In no event will the copyright +" holder be liable for any damamges resulting from the use of this +" software. +" +" The "Tag List" plugin is a source code browser plugin for Vim and provides +" an overview of the structure of the programming language files and allows +" you to efficiently browse through source code files for different +" programming languages. You can visit the taglist plugin home page for more +" information: +" +" http://vim-taglist.sourceforge.net +" +" You can subscribe to the taglist mailing list to post your questions +" or suggestions for improvement or to report bugs. Visit the following +" page for subscribing to the mailing list: +" +" http://groups.yahoo.com/group/taglist/ +" +" For more information about using this plugin, after installing the +" taglist plugin, use the ":help taglist" command. +" +" Installation +" ------------ +" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim +" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should +" unzip the following two files (the directory structure should be +" preserved): +" +" plugin/taglist.vim - main taglist plugin file +" doc/taglist.txt - documentation (help) file +" +" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath' +" Vim help pages for more details about installing Vim plugins. +" 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or +" $VIM/vimfiles/doc directory, start Vim and run the ":helptags ." +" command to process the taglist help file. +" 3. If the exuberant ctags utility is not present in your PATH, then set the +" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags +" utility (not to the directory) in the .vimrc file. +" 4. If you are running a terminal/console version of Vim and the +" terminal doesn't support changing the window width then set the +" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. +" 5. Restart Vim. +" 6. You can now use the ":TlistToggle" command to open/close the taglist +" window. You can use the ":help taglist" command to get more +" information about using the taglist plugin. +" +" ****************** Do not modify after this line ************************ + +" Line continuation used here +let s:cpo_save = &cpo +set cpo&vim + +if !exists('loaded_taglist') + " First time loading the taglist plugin + " + " To speed up the loading of Vim, the taglist plugin uses autoload + " mechanism to load the taglist functions. + " Only define the configuration variables, user commands and some + " auto-commands and finish sourcing the file + + " The taglist plugin requires the built-in Vim system() function. If this + " function is not available, then don't load the plugin. + if !exists('*system') + echomsg 'Taglist: Vim system() built-in function is not available. ' . + \ 'Plugin is not loaded.' + let loaded_taglist = 'no' + let &cpo = s:cpo_save + finish + endif + + " Location of the exuberant ctags tool + if !exists('Tlist_Ctags_Cmd') + if executable('exuberant-ctags') + " On Debian Linux, exuberant ctags is installed + " as exuberant-ctags + let Tlist_Ctags_Cmd = 'exuberant-ctags' + elseif executable('exctags') + " On Free-BSD, exuberant ctags is installed as exctags + let Tlist_Ctags_Cmd = 'exctags' + elseif executable('ctags') + let Tlist_Ctags_Cmd = 'ctags' + elseif executable('ctags.exe') + let Tlist_Ctags_Cmd = 'ctags.exe' + elseif executable('tags') + let Tlist_Ctags_Cmd = 'tags' + else + echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . + \ 'not found in PATH. Plugin is not loaded.' + " Skip loading the plugin + let loaded_taglist = 'no' + let &cpo = s:cpo_save + finish + endif + endif + + + " Automatically open the taglist window on Vim startup + if !exists('Tlist_Auto_Open') + let Tlist_Auto_Open = 0 + endif + + " When the taglist window is toggle opened, move the cursor to the + " taglist window + if !exists('Tlist_GainFocus_On_ToggleOpen') + let Tlist_GainFocus_On_ToggleOpen = 0 + endif + + " Process files even when the taglist window is not open + if !exists('Tlist_Process_File_Always') + let Tlist_Process_File_Always = 0 + endif + + if !exists('Tlist_Show_Menu') + let Tlist_Show_Menu = 0 + endif + + " Tag listing sort type - 'name' or 'order' + if !exists('Tlist_Sort_Type') + let Tlist_Sort_Type = 'order' + endif + + " Tag listing window split (horizontal/vertical) control + if !exists('Tlist_Use_Horiz_Window') + let Tlist_Use_Horiz_Window = 0 + endif + + " Open the vertically split taglist window on the left or on the right + " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to + " zero (i.e. only for vertically split windows) + if !exists('Tlist_Use_Right_Window') + let Tlist_Use_Right_Window = 0 + endif + + " Increase Vim window width to display vertically split taglist window. + " For MS-Windows version of Vim running in a MS-DOS window, this must be + " set to 0 otherwise the system may hang due to a Vim limitation. + if !exists('Tlist_Inc_Winwidth') + if (has('win16') || has('win95')) && !has('gui_running') + let Tlist_Inc_Winwidth = 0 + else + let Tlist_Inc_Winwidth = 1 + endif + endif + + " Vertically split taglist window width setting + if !exists('Tlist_WinWidth') + let Tlist_WinWidth = 30 + endif + + " Horizontally split taglist window height setting + if !exists('Tlist_WinHeight') + let Tlist_WinHeight = 10 + endif + + " Display tag prototypes or tag names in the taglist window + if !exists('Tlist_Display_Prototype') + let Tlist_Display_Prototype = 0 + endif + + " Display tag scopes in the taglist window + if !exists('Tlist_Display_Tag_Scope') + let Tlist_Display_Tag_Scope = 1 + endif + + " Use single left mouse click to jump to a tag. By default this is disabled. + " Only double click using the mouse will be processed. + if !exists('Tlist_Use_SingleClick') + let Tlist_Use_SingleClick = 0 + endif + + " Control whether additional help is displayed as part of the taglist or + " not. Also, controls whether empty lines are used to separate the tag + " tree. + if !exists('Tlist_Compact_Format') + let Tlist_Compact_Format = 0 + endif + + " Exit Vim if only the taglist window is currently open. By default, this is + " set to zero. + if !exists('Tlist_Exit_OnlyWindow') + let Tlist_Exit_OnlyWindow = 0 + endif + + " Automatically close the folds for the non-active files in the taglist + " window + if !exists('Tlist_File_Fold_Auto_Close') + let Tlist_File_Fold_Auto_Close = 0 + endif + + " Close the taglist window when a tag is selected + if !exists('Tlist_Close_On_Select') + let Tlist_Close_On_Select = 0 + endif + + " Automatically update the taglist window to display tags for newly + " edited files + if !exists('Tlist_Auto_Update') + let Tlist_Auto_Update = 1 + endif + + " Automatically highlight the current tag + if !exists('Tlist_Auto_Highlight_Tag') + let Tlist_Auto_Highlight_Tag = 1 + endif + + " Automatically highlight the current tag on entering a buffer + if !exists('Tlist_Highlight_Tag_On_BufEnter') + let Tlist_Highlight_Tag_On_BufEnter = 1 + endif + + " Enable fold column to display the folding for the tag tree + if !exists('Tlist_Enable_Fold_Column') + let Tlist_Enable_Fold_Column = 1 + endif + + " Display the tags for only one file in the taglist window + if !exists('Tlist_Show_One_File') + let Tlist_Show_One_File = 0 + endif + + if !exists('Tlist_Max_Submenu_Items') + let Tlist_Max_Submenu_Items = 20 + endif + + if !exists('Tlist_Max_Tag_Length') + let Tlist_Max_Tag_Length = 10 + endif + + " Do not change the name of the taglist title variable. The winmanager + " plugin relies on this name to determine the title for the taglist + " plugin. + let TagList_title = "__Tag_List__" + + " Taglist debug messages + let s:tlist_msg = '' + + " Define the taglist autocommand to automatically open the taglist window + " on Vim startup + if g:Tlist_Auto_Open + autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open() + endif + + " Refresh the taglist + if g:Tlist_Process_File_Always + autocmd BufEnter * call s:Tlist_Refresh() + endif + + if g:Tlist_Show_Menu + autocmd GUIEnter * call s:Tlist_Menu_Init() + endif + + " When the taglist buffer is created when loading a Vim session file, + " the taglist buffer needs to be initialized. The BufFilePost event + " is used to handle this case. + autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load() + + " Define the user commands to manage the taglist window + command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle() + command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open() + " For backwards compatiblity define the Tlist command + command! -nargs=0 -bar Tlist TlistToggle + command! -nargs=+ -complete=file TlistAddFiles + \ call s:Tlist_Add_Files() + command! -nargs=+ -complete=dir TlistAddFilesRecursive + \ call s:Tlist_Add_Files_Recursive() + command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close() + command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File() + command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag( + \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1) + " For backwards compatiblity define the TlistSync command + command! -nargs=0 -bar TlistSync TlistHighlightTag + command! -nargs=* -complete=buffer TlistShowPrototype + \ echo Tlist_Get_Tag_Prototype_By_Line() + command! -nargs=* -complete=buffer TlistShowTag + \ echo Tlist_Get_Tagname_By_Line() + command! -nargs=* -complete=file TlistSessionLoad + \ call s:Tlist_Session_Load() + command! -nargs=* -complete=file TlistSessionSave + \ call s:Tlist_Session_Save() + command! -bar TlistLock let Tlist_Auto_Update=0 + command! -bar TlistUnlock let Tlist_Auto_Update=1 + + " Commands for enabling/disabling debug and to display debug messages + command! -nargs=? -complete=file -bar TlistDebug + \ call s:Tlist_Debug_Enable() + command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable() + command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show() + + " Define autocommands to autoload the taglist plugin when needed. + + " Trick to get the current script ID + map xx xx + let s:tlist_sid = substitute(maparg('xx'), '\(\d\+_\)xx$', + \ '\1', '') + unmap xx + + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined Tlist_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined TagList_* source ' . + \ escape(expand(''), ' ') + + let loaded_taglist = 'fast_load_done' + + if g:Tlist_Show_Menu && has('gui_running') + call s:Tlist_Menu_Init() + endif + + " restore 'cpo' + let &cpo = s:cpo_save + finish +endif + +if !exists('s:tlist_sid') + " Two or more versions of taglist plugin are installed. Don't + " load this version of the plugin. + finish +endif + +unlet! s:tlist_sid + +if loaded_taglist != 'fast_load_done' + " restore 'cpo' + let &cpo = s:cpo_save + finish +endif + +" Taglist plugin functionality is available +let loaded_taglist = 'available' + +"------------------- end of user configurable options -------------------- + +" Default language specific settings for supported file types and tag types +" +" Variable name format: +" +" s:tlist_def_{vim_ftype}_settings +" +" vim_ftype - Filetype detected by Vim +" +" Value format: +" +" ;:;:;... +" +" ctags_ftype - File type supported by exuberant ctags +" flag - Flag supported by exuberant ctags to generate a tag type +" name - Name of the tag type used in the taglist window to display the +" tags of this type +" + +" assembly language +let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type' + +" aspperl language +let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable' + +" aspvbs language +let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable' + +" awk language +let s:tlist_def_awk_settings = 'awk;f:function' + +" beta language +let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern' + +" c language +let s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' . + \ 'v:variable;f:function' + +" c++ language +let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' . + \ 'c:class;g:enum;s:struct;u:union;f:function' + +" c# language +let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' . + \ 'E:event;g:enum;s:struct;i:interface;' . + \ 'p:properties;m:method' + +" cobol language +let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . + \ 'P:program;s:section' + +" eiffel language +let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature' + +" erlang language +let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function' + +" expect (same as tcl) language +let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure' + +" fortran language +let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . + \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . + \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine' + +" HTML language +let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function' + +" java language +let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . + \ 'f:field;m:method' + +" javascript language +let s:tlist_def_javascript_settings = 'javascript;f:function' + +" lisp language +let s:tlist_def_lisp_settings = 'lisp;f:function' + +" lua language +let s:tlist_def_lua_settings = 'lua;f:function' + +" makefiles +let s:tlist_def_make_settings = 'make;m:macro' + +" pascal language +let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure' + +" perl language +let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine' + +" php language +let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function' + +" python language +let s:tlist_def_python_settings = 'python;c:class;m:member;f:function' + +" rexx language +let s:tlist_def_rexx_settings = 'rexx;s:subroutine' + +" ruby language +let s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' . + \ 'm:singleton method' + +" scheme language +let s:tlist_def_scheme_settings = 'scheme;s:set;f:function' + +" shell language +let s:tlist_def_sh_settings = 'sh;f:function' + +" C shell language +let s:tlist_def_csh_settings = 'sh;f:function' + +" Z shell language +let s:tlist_def_zsh_settings = 'sh;f:function' + +" slang language +let s:tlist_def_slang_settings = 'slang;n:namespace;f:function' + +" sml language +let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . + \ 'r:structure;t:type;v:value;f:function' + +" sql language +let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . + \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure' + +" tcl language +let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure' + +" vera language +let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . + \ 'f:function;g:enum;m:member;p:program;' . + \ 'P:prototype;t:task;T:typedef;v:variable;' . + \ 'x:externvar' + +"verilog language +let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . + \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function' + +" vim language +let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function' + +" yacc language +let s:tlist_def_yacc_settings = 'yacc;l:label' + +"------------------- end of language specific options -------------------- + +" Vim window size is changed by the taglist plugin or not +let s:tlist_winsize_chgd = -1 +" Taglist window is maximized or not +let s:tlist_win_maximized = 0 +" Name of files in the taglist +let s:tlist_file_names='' +" Number of files in the taglist +let s:tlist_file_count = 0 +" Number of filetypes supported by taglist +let s:tlist_ftype_count = 0 +" Is taglist part of other plugins like winmanager or cream? +let s:tlist_app_name = "none" +" Are we displaying brief help text +let s:tlist_brief_help = 1 +" List of files removed on user request +let s:tlist_removed_flist = "" +" Index of current file displayed in the taglist window +let s:tlist_cur_file_idx = -1 +" Taglist menu is empty or not +let s:tlist_menu_empty = 1 + +" An autocommand is used to refresh the taglist window when entering any +" buffer. We don't want to refresh the taglist window if we are entering the +" file window from one of the taglist functions. The 'Tlist_Skip_Refresh' +" variable is used to skip the refresh of the taglist window and is set +" and cleared appropriately. +let s:Tlist_Skip_Refresh = 0 + +" Tlist_Window_Display_Help() +function! s:Tlist_Window_Display_Help() + if s:tlist_app_name == "winmanager" + " To handle a bug in the winmanager plugin, add a space at the + " last line + call setline('$', ' ') + endif + + if s:tlist_brief_help + " Add the brief help + call append(0, '" Press to display help text') + else + " Add the extensive help + call append(0, '" : Jump to tag definition') + call append(1, '" o : Jump to tag definition in new window') + call append(2, '" p : Preview the tag definition') + call append(3, '" : Display tag prototype') + call append(4, '" u : Update tag list') + call append(5, '" s : Select sort field') + call append(6, '" d : Remove file from taglist') + call append(7, '" x : Zoom-out/Zoom-in taglist window') + call append(8, '" + : Open a fold') + call append(9, '" - : Close a fold') + call append(10, '" * : Open all folds') + call append(11, '" = : Close all folds') + call append(12, '" [[ : Move to the start of previous file') + call append(13, '" ]] : Move to the start of next file') + call append(14, '" q : Close the taglist window') + call append(15, '" : Remove help text') + endif +endfunction + +" Tlist_Window_Toggle_Help_Text() +" Toggle taglist plugin help text between the full version and the brief +" version +function! s:Tlist_Window_Toggle_Help_Text() + if g:Tlist_Compact_Format + " In compact display mode, do not display help + return + endif + + " Include the empty line displayed after the help text + let brief_help_size = 1 + let full_help_size = 16 + + setlocal modifiable + + " Set report option to a huge value to prevent informational messages + " while deleting the lines + let old_report = &report + set report=99999 + + " Remove the currently highlighted tag. Otherwise, the help text + " might be highlighted by mistake + match none + + " Toggle between brief and full help text + if s:tlist_brief_help + let s:tlist_brief_help = 0 + + " Remove the previous help + exe '1,' . brief_help_size . ' delete _' + + " Adjust the start/end line numbers for the files + call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size) + else + let s:tlist_brief_help = 1 + + " Remove the previous help + exe '1,' . full_help_size . ' delete _' + + " Adjust the start/end line numbers for the files + call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size) + endif + + call s:Tlist_Window_Display_Help() + + " Restore the report option + let &report = old_report + + setlocal nomodifiable +endfunction + +" Taglist debug support +let s:tlist_debug = 0 + +" File for storing the debug messages +let s:tlist_debug_file = '' + +" Tlist_Debug_Enable +" Enable logging of taglist debug messages. +function! s:Tlist_Debug_Enable(...) + let s:tlist_debug = 1 + + " Check whether a valid file name is supplied. + if a:1 != '' + let s:tlist_debug_file = fnamemodify(a:1, ':p') + + " Empty the log file + exe 'redir! > ' . s:tlist_debug_file + redir END + + " Check whether the log file is present/created + if !filewritable(s:tlist_debug_file) + call s:Tlist_Warning_Msg('Taglist: Unable to create log file ' + \ . s:tlist_debug_file) + let s:tlist_debug_file = '' + endif + endif +endfunction + +" Tlist_Debug_Disable +" Disable logging of taglist debug messages. +function! s:Tlist_Debug_Disable(...) + let s:tlist_debug = 0 + let s:tlist_debug_file = '' +endfunction + +" Tlist_Debug_Show +" Display the taglist debug messages in a new window +function! s:Tlist_Debug_Show() + if s:tlist_msg == '' + call s:Tlist_Warning_Msg('Taglist: No debug messages') + return + endif + + " Open a new window to display the taglist debug messages + new taglist_debug.txt + " Delete all the lines (if the buffer already exists) + silent! %delete _ + " Add the messages + silent! put =s:tlist_msg + " Move the cursor to the first line + normal! gg +endfunction + +" Tlist_Log_Msg +" Log the supplied debug message along with the time +function! s:Tlist_Log_Msg(msg) + if s:tlist_debug + if s:tlist_debug_file != '' + exe 'redir >> ' . s:tlist_debug_file + silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n" + redir END + else + " Log the message into a variable + " Retain only the last 3000 characters + let len = strlen(s:tlist_msg) + if len > 3000 + let s:tlist_msg = strpart(s:tlist_msg, len - 3000) + endif + let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' . + \ a:msg . "\n" + endif + endif +endfunction + +" Tlist_Warning_Msg() +" Display a message using WarningMsg highlight group +function! s:Tlist_Warning_Msg(msg) + echohl WarningMsg + echomsg a:msg + echohl None +endfunction + +" Last returned file index for file name lookup. +" Used to speed up file lookup +let s:tlist_file_name_idx_cache = -1 + +" Tlist_Get_File_Index() +" Return the index of the specified filename +function! s:Tlist_Get_File_Index(fname) + if s:tlist_file_count == 0 || a:fname == '' + return -1 + endif + + " If the new filename is same as the last accessed filename, then + " return that index + if s:tlist_file_name_idx_cache != -1 && + \ s:tlist_file_name_idx_cache < s:tlist_file_count + if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname + " Same as the last accessed file + return s:tlist_file_name_idx_cache + endif + endif + + " First, check whether the filename is present + let s_fname = a:fname . "\n" + let i = stridx(s:tlist_file_names, s_fname) + if i == -1 + let s:tlist_file_name_idx_cache = -1 + return -1 + endif + + " Second, compute the file name index + let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g') + let s:tlist_file_name_idx_cache = strlen(nl_txt) + return s:tlist_file_name_idx_cache +endfunction + +" Last returned file index for line number lookup. +" Used to speed up file lookup +let s:tlist_file_lnum_idx_cache = -1 + +" Tlist_Window_Get_File_Index_By_Linenum() +" Return the index of the filename present in the specified line number +" Line number refers to the line number in the taglist window +function! s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')') + + " First try to see whether the new line number is within the range + " of the last returned file + if s:tlist_file_lnum_idx_cache != -1 && + \ s:tlist_file_lnum_idx_cache < s:tlist_file_count + if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start && + \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end + return s:tlist_file_lnum_idx_cache + endif + endif + + let fidx = -1 + + if g:Tlist_Show_One_File + " Displaying only one file in the taglist window. Check whether + " the line is within the tags displayed for that file + if s:tlist_cur_file_idx != -1 + if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start + \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end + let fidx = s:tlist_cur_file_idx + endif + + endif + else + " Do a binary search in the taglist + let left = 0 + let right = s:tlist_file_count - 1 + + while left < right + let mid = (left + right) / 2 + + if a:lnum >= s:tlist_{mid}_start && a:lnum <= s:tlist_{mid}_end + let s:tlist_file_lnum_idx_cache = mid + return mid + endif + + if a:lnum < s:tlist_{mid}_start + let right = mid - 1 + else + let left = mid + 1 + endif + endwhile + + if left >= 0 && left < s:tlist_file_count + \ && a:lnum >= s:tlist_{left}_start + \ && a:lnum <= s:tlist_{left}_end + let fidx = left + endif + endif + + let s:tlist_file_lnum_idx_cache = fidx + + return fidx +endfunction + +" Tlist_Exe_Cmd_No_Acmds +" Execute the specified Ex command after disabling autocommands +function! s:Tlist_Exe_Cmd_No_Acmds(cmd) + let old_eventignore = &eventignore + set eventignore=all + exe a:cmd + let &eventignore = old_eventignore +endfunction + +" Tlist_Skip_File() +" Check whether tag listing is supported for the specified file +function! s:Tlist_Skip_File(filename, ftype) + " Skip buffers with no names and buffers with filetype not set + if a:filename == '' || a:ftype == '' + return 1 + endif + + " Skip files which are not supported by exuberant ctags + " First check whether default settings for this filetype are available. + " If it is not available, then check whether user specified settings are + " available. If both are not available, then don't list the tags for this + " filetype + let var = 's:tlist_def_' . a:ftype . '_settings' + if !exists(var) + let var = 'g:tlist_' . a:ftype . '_settings' + if !exists(var) + return 1 + endif + endif + + " Skip files which are not readable or files which are not yet stored + " to the disk + if !filereadable(a:filename) + return 1 + endif + + return 0 +endfunction + +" Tlist_User_Removed_File +" Returns 1 if a file is removed by a user from the taglist +function! s:Tlist_User_Removed_File(filename) + return stridx(s:tlist_removed_flist, a:filename . "\n") != -1 +endfunction + +" Tlist_Update_Remove_List +" Update the list of user removed files from the taglist +" add == 1, add the file to the removed list +" add == 0, delete the file from the removed list +function! s:Tlist_Update_Remove_List(filename, add) + if a:add + let s:tlist_removed_flist = s:tlist_removed_flist . a:filename . "\n" + else + let idx = stridx(s:tlist_removed_flist, a:filename . "\n") + let text_before = strpart(s:tlist_removed_flist, 0, idx) + let rem_text = strpart(s:tlist_removed_flist, idx) + let next_idx = stridx(rem_text, "\n") + let text_after = strpart(rem_text, next_idx + 1) + + let s:tlist_removed_flist = text_before . text_after + endif +endfunction + +" Tlist_FileType_Init +" Initialize the ctags arguments and tag variable for the specified +" file type +function! s:Tlist_FileType_Init(ftype) + call s:Tlist_Log_Msg('Tlist_FileType_Init (' . a:ftype . ')') + " If the user didn't specify any settings, then use the default + " ctags args. Otherwise, use the settings specified by the user + let var = 'g:tlist_' . a:ftype . '_settings' + if exists(var) + " User specified ctags arguments + let settings = {var} . ';' + else + " Default ctags arguments + let var = 's:tlist_def_' . a:ftype . '_settings' + if !exists(var) + " No default settings for this file type. This filetype is + " not supported + return 0 + endif + let settings = s:tlist_def_{a:ftype}_settings . ';' + endif + + let msg = 'Taglist: Invalid ctags option setting - ' . settings + + " Format of the option that specifies the filetype and ctags arugments: + " + " ;flag1:name1;flag2:name2;flag3:name3 + " + + " Extract the file type to pass to ctags. This may be different from the + " file type detected by Vim + let pos = stridx(settings, ';') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let ctags_ftype = strpart(settings, 0, pos) + if ctags_ftype == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + " Make sure a valid filetype is supplied. If the user didn't specify a + " valid filetype, then the ctags option settings may be treated as the + " filetype + if ctags_ftype =~ ':' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + + " Remove the file type from settings + let settings = strpart(settings, pos + 1) + if settings == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + + " Process all the specified ctags flags. The format is + " flag1:name1;flag2:name2;flag3:name3 + let ctags_flags = '' + let cnt = 0 + while settings != '' + " Extract the flag + let pos = stridx(settings, ':') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let flag = strpart(settings, 0, pos) + if flag == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + " Remove the flag from settings + let settings = strpart(settings, pos + 1) + + " Extract the tag type name + let pos = stridx(settings, ';') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let name = strpart(settings, 0, pos) + if name == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let settings = strpart(settings, pos + 1) + + let cnt = cnt + 1 + + let s:tlist_{a:ftype}_{cnt}_name = flag + let s:tlist_{a:ftype}_{cnt}_fullname = name + let ctags_flags = ctags_flags . flag + endwhile + + let s:tlist_{a:ftype}_ctags_args = '--language-force=' . ctags_ftype . + \ ' --' . ctags_ftype . '-types=' . ctags_flags + let s:tlist_{a:ftype}_count = cnt + let s:tlist_{a:ftype}_ctags_flags = ctags_flags + + " Save the filetype name + let s:tlist_ftype_{s:tlist_ftype_count}_name = a:ftype + let s:tlist_ftype_count = s:tlist_ftype_count + 1 + + return 1 +endfunction + +" Tlist_Detect_Filetype +" Determine the filetype for the specified file using the filetypedetect +" autocmd. +function! s:Tlist_Detect_Filetype(fname) + " Ignore the filetype autocommands + let old_eventignore = &eventignore + set eventignore=FileType + + " Save the 'filetype', as this will be changed temporarily + let old_filetype = &filetype + + " Run the filetypedetect group of autocommands to determine + " the filetype + exe 'doautocmd filetypedetect BufRead ' . a:fname + + " Save the detected filetype + let ftype = &filetype + + " Restore the previous state + let &filetype = old_filetype + let &eventignore = old_eventignore + + return ftype +endfunction + +" Tlist_Get_Buffer_Filetype +" Get the filetype for the specified buffer +function! s:Tlist_Get_Buffer_Filetype(bnum) + let buf_ft = getbufvar(a:bnum, '&filetype') + + if bufloaded(a:bnum) + " For loaded buffers, the 'filetype' is already determined + return buf_ft + endif + + " For unloaded buffers, if the 'filetype' option is set, return it + if buf_ft != '' + return buf_ft + endif + + " Skip non-existent buffers + if !bufexists(a:bnum) + return '' + endif + + " For buffers whose filetype is not yet determined, try to determine + " the filetype + let bname = bufname(a:bnum) + + return s:Tlist_Detect_Filetype(bname) +endfunction + +" Tlist_Discard_TagInfo +" Discard the stored tag information for a file +function! s:Tlist_Discard_TagInfo(fidx) + call s:Tlist_Log_Msg('Tlist_Discard_TagInfo (' . + \ s:tlist_{a:fidx}_filename . ')') + let ftype = s:tlist_{a:fidx}_filetype + + " Discard information about the tags defined in the file + let i = 1 + while i <= s:tlist_{a:fidx}_tag_count + let fidx_i = 's:tlist_' . a:fidx . '_' . i + unlet! {fidx_i}_tag + unlet! {fidx_i}_tag_name + unlet! {fidx_i}_tag_type + unlet! {fidx_i}_ttype_idx + unlet! {fidx_i}_tag_proto + unlet! {fidx_i}_tag_searchpat + unlet! {fidx_i}_tag_linenum + let i = i + 1 + endwhile + + let s:tlist_{a:fidx}_tag_count = 0 + + " Discard information about tag type groups + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + if s:tlist_{a:fidx}_{ttype} != '' + let fidx_ttype = 's:tlist_' . a:fidx . '_' . ttype + let {fidx_ttype} = '' + let {fidx_ttype}_offset = 0 + let cnt = {fidx_ttype}_count + let {fidx_ttype}_count = 0 + let j = 1 + while j <= cnt + unlet! {fidx_ttype}_{j} + let j = j + 1 + endwhile + endif + let i = i + 1 + endwhile + + " Discard the stored menu command also + let s:tlist_{a:fidx}_menu_cmd = '' +endfunction + +" Tlist_Window_Update_Line_Offsets +" Update the line offsets for tags for files starting from start_idx +" and displayed in the taglist window by the specified offset +function! s:Tlist_Window_Update_Line_Offsets(start_idx, increment, offset) + let i = a:start_idx + + while i < s:tlist_file_count + if s:tlist_{i}_visible + " Update the start/end line number only if the file is visible + if a:increment + let s:tlist_{i}_start = s:tlist_{i}_start + a:offset + let s:tlist_{i}_end = s:tlist_{i}_end + a:offset + else + let s:tlist_{i}_start = s:tlist_{i}_start - a:offset + let s:tlist_{i}_end = s:tlist_{i}_end - a:offset + endif + endif + let i = i + 1 + endwhile +endfunction + +" Tlist_Discard_FileInfo +" Discard the stored information for a file +function! s:Tlist_Discard_FileInfo(fidx) + call s:Tlist_Log_Msg('Tlist_Discard_FileInfo (' . + \ s:tlist_{a:fidx}_filename . ')') + call s:Tlist_Discard_TagInfo(a:fidx) + + let ftype = s:tlist_{a:fidx}_filetype + + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + unlet! s:tlist_{a:fidx}_{ttype} + unlet! s:tlist_{a:fidx}_{ttype}_offset + unlet! s:tlist_{a:fidx}_{ttype}_count + let i = i + 1 + endwhile + + unlet! s:tlist_{a:fidx}_filename + unlet! s:tlist_{a:fidx}_sort_type + unlet! s:tlist_{a:fidx}_filetype + unlet! s:tlist_{a:fidx}_mtime + unlet! s:tlist_{a:fidx}_start + unlet! s:tlist_{a:fidx}_end + unlet! s:tlist_{a:fidx}_valid + unlet! s:tlist_{a:fidx}_visible + unlet! s:tlist_{a:fidx}_tag_count + unlet! s:tlist_{a:fidx}_menu_cmd +endfunction + +" Tlist_Window_Remove_File_From_Display +" Remove the specified file from display +function! s:Tlist_Window_Remove_File_From_Display(fidx) + call s:Tlist_Log_Msg('Tlist_Window_Remove_File_From_Display (' . + \ s:tlist_{a:fidx}_filename . ')') + " If the file is not visible then no need to remove it + if !s:tlist_{a:fidx}_visible + return + endif + + " Remove the tags displayed for the specified file from the window + let start = s:tlist_{a:fidx}_start + " Include the empty line after the last line also + if g:Tlist_Compact_Format + let end = s:tlist_{a:fidx}_end + else + let end = s:tlist_{a:fidx}_end + 1 + endif + + setlocal modifiable + exe 'silent! ' . start . ',' . end . 'delete _' + setlocal nomodifiable + + " Correct the start and end line offsets for all the files following + " this file, as the tags for this file are removed + call s:Tlist_Window_Update_Line_Offsets(a:fidx + 1, 0, end - start + 1) +endfunction + +" Tlist_Remove_File +" Remove the file under the cursor or the specified file index +" user_request - User requested to remove the file from taglist +function! s:Tlist_Remove_File(file_idx, user_request) + let fidx = a:file_idx + + if fidx == -1 + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + endif + call s:Tlist_Log_Msg('Tlist_Remove_File (' . + \ s:tlist_{fidx}_filename . ', ' . a:user_request . ')') + + let save_winnr = winnr() + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Taglist window is open, remove the file from display + + if save_winnr != winnum + let old_eventignore = &eventignore + set eventignore=all + exe winnum . 'wincmd w' + endif + + call s:Tlist_Window_Remove_File_From_Display(fidx) + + if save_winnr != winnum + exe save_winnr . 'wincmd w' + let &eventignore = old_eventignore + endif + endif + + let fname = s:tlist_{fidx}_filename + + if a:user_request + " As the user requested to remove the file from taglist, + " add it to the removed list + call s:Tlist_Update_Remove_List(fname, 1) + endif + + " Remove the file name from the taglist list of filenames + let idx = stridx(s:tlist_file_names, fname . "\n") + let text_before = strpart(s:tlist_file_names, 0, idx) + let rem_text = strpart(s:tlist_file_names, idx) + let next_idx = stridx(rem_text, "\n") + let text_after = strpart(rem_text, next_idx + 1) + let s:tlist_file_names = text_before . text_after + + call s:Tlist_Discard_FileInfo(fidx) + + " Shift all the file variables by one index + let i = fidx + 1 + + while i < s:tlist_file_count + let j = i - 1 + + let s:tlist_{j}_filename = s:tlist_{i}_filename + let s:tlist_{j}_sort_type = s:tlist_{i}_sort_type + let s:tlist_{j}_filetype = s:tlist_{i}_filetype + let s:tlist_{j}_mtime = s:tlist_{i}_mtime + let s:tlist_{j}_start = s:tlist_{i}_start + let s:tlist_{j}_end = s:tlist_{i}_end + let s:tlist_{j}_valid = s:tlist_{i}_valid + let s:tlist_{j}_visible = s:tlist_{i}_visible + let s:tlist_{j}_tag_count = s:tlist_{i}_tag_count + let s:tlist_{j}_menu_cmd = s:tlist_{i}_menu_cmd + + let k = 1 + while k <= s:tlist_{j}_tag_count + let s:tlist_{j}_{k}_tag = s:tlist_{i}_{k}_tag + let s:tlist_{j}_{k}_tag_name = s:tlist_{i}_{k}_tag_name + let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k) + let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx + let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k) + let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k) + let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k) + let k = k + 1 + endwhile + + let ftype = s:tlist_{i}_filetype + + let k = 1 + while k <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{k}_name + let s:tlist_{j}_{ttype} = s:tlist_{i}_{ttype} + let s:tlist_{j}_{ttype}_offset = s:tlist_{i}_{ttype}_offset + let s:tlist_{j}_{ttype}_count = s:tlist_{i}_{ttype}_count + if s:tlist_{j}_{ttype} != '' + let l = 1 + while l <= s:tlist_{j}_{ttype}_count + let s:tlist_{j}_{ttype}_{l} = s:tlist_{i}_{ttype}_{l} + let l = l + 1 + endwhile + endif + let k = k + 1 + endwhile + + " As the file and tag information is copied to the new index, + " discard the previous information + call s:Tlist_Discard_FileInfo(i) + + let i = i + 1 + endwhile + + " Reduce the number of files displayed + let s:tlist_file_count = s:tlist_file_count - 1 + + if g:Tlist_Show_One_File + " If the tags for only one file is displayed and if we just + " now removed that file, then invalidate the current file idx + if s:tlist_cur_file_idx == fidx + let s:tlist_cur_file_idx = -1 + endif + endif +endfunction + +" Tlist_Window_Goto_Window +" Goto the taglist window +function! s:Tlist_Window_Goto_Window() + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + if winnr() != winnum + call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') + endif + endif +endfunction + +" Tlist_Window_Create +" Create a new taglist window. If it is already open, jump to it +function! s:Tlist_Window_Create() + call s:Tlist_Log_Msg('Tlist_Window_Create()') + " If the window is open, jump to it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Jump to the existing window + if winnr() != winnum + exe winnum . 'wincmd w' + endif + return + endif + + " If used with winmanager don't open windows. Winmanager will handle + " the window/buffer management + if s:tlist_app_name == "winmanager" + return + endif + + " Create a new window. If user prefers a horizontal window, then open + " a horizontally split window. Otherwise open a vertically split + " window + if g:Tlist_Use_Horiz_Window + " Open a horizontally split window + let win_dir = 'botright' + " Horizontal window height + let win_size = g:Tlist_WinHeight + else + if s:tlist_winsize_chgd == -1 + " Open a vertically split window. Increase the window size, if + " needed, to accomodate the new window + if g:Tlist_Inc_Winwidth && + \ &columns < (80 + g:Tlist_WinWidth) + " Save the original window position + let s:tlist_pre_winx = getwinposx() + let s:tlist_pre_winy = getwinposy() + + " one extra column is needed to include the vertical split + let &columns= &columns + g:Tlist_WinWidth + 1 + + let s:tlist_winsize_chgd = 1 + else + let s:tlist_winsize_chgd = 0 + endif + endif + + if g:Tlist_Use_Right_Window + " Open the window at the rightmost place + let win_dir = 'botright vertical' + else + " Open the window at the leftmost place + let win_dir = 'topleft vertical' + endif + let win_size = g:Tlist_WinWidth + endif + + " If the tag listing temporary buffer already exists, then reuse it. + " Otherwise create a new buffer + let bufnum = bufnr(g:TagList_title) + if bufnum == -1 + " Create a new buffer + let wcmd = g:TagList_title + else + " Edit the existing buffer + let wcmd = '+buffer' . bufnum + endif + + " Create the taglist window + exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd + + " Save the new window position + let s:tlist_winx = getwinposx() + let s:tlist_winy = getwinposy() + + " Initialize the taglist window + call s:Tlist_Window_Init() +endfunction + +" Tlist_Window_Zoom +" Zoom (maximize/minimize) the taglist window +function! s:Tlist_Window_Zoom() + if s:tlist_win_maximized + " Restore the window back to the previous size + if g:Tlist_Use_Horiz_Window + exe 'resize ' . g:Tlist_WinHeight + else + exe 'vert resize ' . g:Tlist_WinWidth + endif + let s:tlist_win_maximized = 0 + else + " Set the window size to the maximum possible without closing other + " windows + if g:Tlist_Use_Horiz_Window + resize + else + vert resize + endif + let s:tlist_win_maximized = 1 + endif +endfunction + +" Tlist_Ballon_Expr +" When the mouse cursor is over a tag in the taglist window, display the +" tag prototype (balloon) +function! Tlist_Ballon_Expr() + " Get the file index + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(v:beval_lnum) + if fidx == -1 + return '' + endif + + " Get the tag output line for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, v:beval_lnum) + if tidx == 0 + return '' + endif + + " Get the tag search pattern and display it + return s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Window_Check_Width +" Check the width of the taglist window. For horizontally split windows, the +" 'winfixheight' option is used to fix the height of the window. For +" vertically split windows, Vim doesn't support the 'winfixwidth' option. So +" need to handle window width changes from this function. +function! s:Tlist_Window_Check_Width() + let tlist_winnr = bufwinnr(g:TagList_title) + if tlist_winnr == -1 + return + endif + + let width = winwidth(tlist_winnr) + if width != g:Tlist_WinWidth + call s:Tlist_Log_Msg("Tlist_Window_Check_Width: Changing window " . + \ "width from " . width . " to " . g:Tlist_WinWidth) + let save_winnr = winnr() + if save_winnr != tlist_winnr + call s:Tlist_Exe_Cmd_No_Acmds(tlist_winnr . 'wincmd w') + endif + exe 'vert resize ' . g:Tlist_WinWidth + if save_winnr != tlist_winnr + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + endif +endfunction + +" Tlist_Window_Exit_Only_Window +" If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the +" taglist window is present. +function! s:Tlist_Window_Exit_Only_Window() + " Before quitting Vim, delete the taglist buffer so that + " the '0 mark is correctly set to the previous buffer. + if v:version < 700 + if winbufnr(2) == -1 + bdelete + quit + endif + else + if winbufnr(2) == -1 + if tabpagenr('$') == 1 + " Only one tag page is present + bdelete + quit + else + " More than one tab page is present. Close only the current + " tab page + close + endif + endif + endif +endfunction + +" Tlist_Window_Init +" Set the default options for the taglist window +function! s:Tlist_Window_Init() + call s:Tlist_Log_Msg('Tlist_Window_Init()') + + " The 'readonly' option should not be set for the taglist buffer. + " If Vim is started as "view/gview" or if the ":view" command is + " used, then the 'readonly' option is set for all the buffers. + " Unset it for the taglist buffer + setlocal noreadonly + + " Set the taglist buffer filetype to taglist + setlocal filetype=taglist + + " Define taglist window element highlighting + syntax match TagListComment '^" .*' + syntax match TagListFileName '^[^" ].*$' + syntax match TagListTitle '^ \S.*$' + syntax match TagListTagScope '\s\[.\{-\}\]$' + + " Define the highlighting only if colors are supported + if has('gui_running') || &t_Co > 2 + " Colors to highlight various taglist window elements + " If user defined highlighting group exists, then use them. + " Otherwise, use default highlight groups. + if hlexists('MyTagListTagName') + highlight link TagListTagName MyTagListTagName + else + highlight default link TagListTagName Search + endif + " Colors to highlight comments and titles + if hlexists('MyTagListComment') + highlight link TagListComment MyTagListComment + else + highlight clear TagListComment + highlight default link TagListComment Comment + endif + if hlexists('MyTagListTitle') + highlight link TagListTitle MyTagListTitle + else + highlight clear TagListTitle + highlight default link TagListTitle Title + endif + if hlexists('MyTagListFileName') + highlight link TagListFileName MyTagListFileName + else + highlight clear TagListFileName + highlight default TagListFileName guibg=Grey ctermbg=darkgray + \ guifg=white ctermfg=white + endif + if hlexists('MyTagListTagScope') + highlight link TagListTagScope MyTagListTagScope + else + highlight clear TagListTagScope + highlight default link TagListTagScope Identifier + endif + else + highlight default TagListTagName term=reverse cterm=reverse + endif + + " Folding related settings + setlocal foldenable + setlocal foldminlines=0 + setlocal foldmethod=manual + setlocal foldlevel=9999 + if g:Tlist_Enable_Fold_Column + setlocal foldcolumn=3 + else + setlocal foldcolumn=0 + endif + setlocal foldtext=v:folddashes.getline(v:foldstart) + + if s:tlist_app_name != "winmanager" + " Mark buffer as scratch + silent! setlocal buftype=nofile + if s:tlist_app_name == "none" + silent! setlocal bufhidden=delete + endif + silent! setlocal noswapfile + " Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted + " buffers. So if the taglist buffer is unlisted, multiple taglist + " windows will be opened. This bug is fixed in Vim 6.1 and above + if v:version >= 601 + silent! setlocal nobuflisted + endif + endif + + silent! setlocal nowrap + + " If the 'number' option is set in the source window, it will affect the + " taglist window. So forcefully disable 'number' option for the taglist + " window + silent! setlocal nonumber + + " Use fixed height when horizontally split window is used + if g:Tlist_Use_Horiz_Window + if v:version >= 602 + set winfixheight + endif + endif + if !g:Tlist_Use_Horiz_Window && v:version >= 700 + set winfixwidth + endif + + " Setup balloon evaluation to display tag prototype + if v:version >= 700 && has('balloon_eval') + setlocal balloonexpr=Tlist_Ballon_Expr() + set ballooneval + endif + + " Setup the cpoptions properly for the maps to work + let old_cpoptions = &cpoptions + set cpoptions&vim + + " Create buffer local mappings for jumping to the tags and sorting the list + nnoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + nnoremap o + \ :call Tlist_Window_Jump_To_Tag('newwin') + nnoremap p + \ :call Tlist_Window_Jump_To_Tag('preview') + nnoremap P + \ :call Tlist_Window_Jump_To_Tag('prevwin') + if v:version >= 700 + nnoremap t + \ :call Tlist_Window_Jump_To_Tag('checktab') + nnoremap + \ :call Tlist_Window_Jump_To_Tag('newtab') + endif + nnoremap <2-LeftMouse> + \ :call Tlist_Window_Jump_To_Tag('useopen') + nnoremap s + \ :call Tlist_Change_Sort('cmd', 'toggle', '') + nnoremap + :silent! foldopen + nnoremap - :silent! foldclose + nnoremap * :silent! %foldopen! + nnoremap = :silent! %foldclose + nnoremap :silent! foldopen + nnoremap :silent! foldclose + nnoremap :silent! %foldopen! + nnoremap :call Tlist_Window_Show_Info() + nnoremap u :call Tlist_Window_Update_File() + nnoremap d :call Tlist_Remove_File(-1, 1) + nnoremap x :call Tlist_Window_Zoom() + nnoremap [[ :call Tlist_Window_Move_To_File(-1) + nnoremap :call Tlist_Window_Move_To_File(-1) + nnoremap ]] :call Tlist_Window_Move_To_File(1) + nnoremap :call Tlist_Window_Move_To_File(1) + nnoremap :call Tlist_Window_Toggle_Help_Text() + nnoremap q :close + + " Insert mode mappings + inoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + " Windows needs return + inoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + inoremap o + \ :call Tlist_Window_Jump_To_Tag('newwin') + inoremap p + \ :call Tlist_Window_Jump_To_Tag('preview') + inoremap P + \ :call Tlist_Window_Jump_To_Tag('prevwin') + if v:version >= 700 + inoremap t + \ :call Tlist_Window_Jump_To_Tag('checktab') + inoremap + \ :call Tlist_Window_Jump_To_Tag('newtab') + endif + inoremap <2-LeftMouse> + \ :call Tlist_Window_Jump_To_Tag('useopen') + inoremap s + \ :call Tlist_Change_Sort('cmd', 'toggle', '') + inoremap + :silent! foldopen + inoremap - :silent! foldclose + inoremap * :silent! %foldopen! + inoremap = :silent! %foldclose + inoremap :silent! foldopen + inoremap :silent! foldclose + inoremap :silent! %foldopen! + inoremap :call + \ Tlist_Window_Show_Info() + inoremap u + \ :call Tlist_Window_Update_File() + inoremap d :call Tlist_Remove_File(-1, 1) + inoremap x :call Tlist_Window_Zoom() + inoremap [[ :call Tlist_Window_Move_To_File(-1) + inoremap :call Tlist_Window_Move_To_File(-1) + inoremap ]] :call Tlist_Window_Move_To_File(1) + inoremap :call Tlist_Window_Move_To_File(1) + inoremap :call Tlist_Window_Toggle_Help_Text() + inoremap q :close + + " Map single left mouse click if the user wants this functionality + if g:Tlist_Use_SingleClick == 1 + " Contributed by Bindu Wavell + " attempt to perform single click mapping, it would be much + " nicer if we could nnoremap ... however vim does + " not fire the when you use the mouse + " to enter a buffer. + let clickmap = ':if bufname("%") =~ "__Tag_List__" ' . + \ 'call Tlist_Window_Jump_To_Tag("useopen") ' . + \ ' endif ' + if maparg('', 'n') == '' + " no mapping for leftmouse + exe ':nnoremap ' . clickmap + else + " we have a mapping + let mapcmd = ':nnoremap ' + let mapcmd = mapcmd . substitute(substitute( + \ maparg('', 'n'), '|', '', 'g'), + \ '\c^', '', '') + let mapcmd = mapcmd . clickmap + exe mapcmd + endif + endif + + " Define the taglist autocommands + augroup TagListAutoCmds + autocmd! + " Display the tag prototype for the tag under the cursor. + autocmd CursorHold __Tag_List__ call s:Tlist_Window_Show_Info() + " Highlight the current tag periodically + autocmd CursorHold * silent call s:Tlist_Window_Highlight_Tag( + \ fnamemodify(bufname('%'), ':p'), line('.'), 1, 0) + + " Adjust the Vim window width when taglist window is closed + autocmd BufUnload __Tag_List__ call s:Tlist_Post_Close_Cleanup() + " Close the fold for this buffer when leaving the buffer + if g:Tlist_File_Fold_Auto_Close + autocmd BufEnter * silent + \ call s:Tlist_Window_Open_File_Fold(expand('')) + endif + " Exit Vim itself if only the taglist window is present (optional) + if g:Tlist_Exit_OnlyWindow + autocmd BufEnter __Tag_List__ nested + \ call s:Tlist_Window_Exit_Only_Window() + endif + if s:tlist_app_name != "winmanager" && + \ !g:Tlist_Process_File_Always && + \ (!has('gui_running') || !g:Tlist_Show_Menu) + " Auto refresh the taglist window + autocmd BufEnter * call s:Tlist_Refresh() + endif + + if !g:Tlist_Use_Horiz_Window + if v:version < 700 + autocmd WinEnter * call s:Tlist_Window_Check_Width() + endif + endif + if v:version >= 700 + autocmd TabEnter * silent call s:Tlist_Refresh_Folds() + endif + augroup end + + " Restore the previous cpoptions settings + let &cpoptions = old_cpoptions +endfunction + +" Tlist_Window_Refresh +" Display the tags for all the files in the taglist window +function! s:Tlist_Window_Refresh() + call s:Tlist_Log_Msg('Tlist_Window_Refresh()') + " Set report option to a huge value to prevent informational messages + " while deleting the lines + let old_report = &report + set report=99999 + + " Mark the buffer as modifiable + setlocal modifiable + + " Delete the contents of the buffer to the black-hole register + silent! %delete _ + + " As we have cleared the taglist window, mark all the files + " as not visible + let i = 0 + while i < s:tlist_file_count + let s:tlist_{i}_visible = 0 + let i = i + 1 + endwhile + + if g:Tlist_Compact_Format == 0 + " Display help in non-compact mode + call s:Tlist_Window_Display_Help() + endif + + " Mark the buffer as not modifiable + setlocal nomodifiable + + " Restore the report option + let &report = old_report + + " If the tags for only one file should be displayed in the taglist + " window, then no need to add the tags here. The bufenter autocommand + " will add the tags for that file. + if g:Tlist_Show_One_File + return + endif + + " List all the tags for the previously processed files + " Do this only if taglist is configured to display tags for more than + " one file. Otherwise, when Tlist_Show_One_File is configured, + " tags for the wrong file will be displayed. + let i = 0 + while i < s:tlist_file_count + call s:Tlist_Window_Refresh_File(s:tlist_{i}_filename, + \ s:tlist_{i}_filetype) + let i = i + 1 + endwhile + + if g:Tlist_Auto_Update + " Add and list the tags for all buffers in the Vim buffer list + let i = 1 + let last_bufnum = bufnr('$') + while i <= last_bufnum + if buflisted(i) + let fname = fnamemodify(bufname(i), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype(i) + " If the file doesn't support tag listing, skip it + if !s:Tlist_Skip_File(fname, ftype) + call s:Tlist_Window_Refresh_File(fname, ftype) + endif + endif + let i = i + 1 + endwhile + endif + + " If Tlist_File_Fold_Auto_Close option is set, then close all the folds + if g:Tlist_File_Fold_Auto_Close + " Close all the folds + silent! %foldclose + endif + + " Move the cursor to the top of the taglist window + normal! gg +endfunction + +" Tlist_Post_Close_Cleanup() +" Close the taglist window and adjust the Vim window width +function! s:Tlist_Post_Close_Cleanup() + call s:Tlist_Log_Msg('Tlist_Post_Close_Cleanup()') + " Mark all the files as not visible + let i = 0 + while i < s:tlist_file_count + let s:tlist_{i}_visible = 0 + let i = i + 1 + endwhile + + " Remove the taglist autocommands + silent! autocmd! TagListAutoCmds + + " Clear all the highlights + match none + + silent! syntax clear TagListTitle + silent! syntax clear TagListComment + silent! syntax clear TagListTagScope + + " Remove the left mouse click mapping if it was setup initially + if g:Tlist_Use_SingleClick + if hasmapto('') + nunmap + endif + endif + + if s:tlist_app_name != "winmanager" + if g:Tlist_Use_Horiz_Window || g:Tlist_Inc_Winwidth == 0 || + \ s:tlist_winsize_chgd != 1 || + \ &columns < (80 + g:Tlist_WinWidth) + " No need to adjust window width if using horizontally split taglist + " window or if columns is less than 101 or if the user chose not to + " adjust the window width + else + " If the user didn't manually move the window, then restore the window + " position to the pre-taglist position + if s:tlist_pre_winx != -1 && s:tlist_pre_winy != -1 && + \ getwinposx() == s:tlist_winx && + \ getwinposy() == s:tlist_winy + exe 'winpos ' . s:tlist_pre_winx . ' ' . s:tlist_pre_winy + endif + + " Adjust the Vim window width + let &columns= &columns - (g:Tlist_WinWidth + 1) + endif + endif + + let s:tlist_winsize_chgd = -1 + + " Reset taglist state variables + if s:tlist_app_name == "winmanager" + let s:tlist_app_name = "none" + endif + let s:tlist_window_initialized = 0 +endfunction + +" Tlist_Window_Refresh_File() +" List the tags defined in the specified file in a Vim window +function! s:Tlist_Window_Refresh_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Window_Refresh_File (' . a:filename . ')') + " First check whether the file already exists + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx != -1 + let file_listed = 1 + else + let file_listed = 0 + endif + + if !file_listed + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(a:filename) + return + endif + endif + + if file_listed && s:tlist_{fidx}_visible + " Check whether the file tags are currently valid + if s:tlist_{fidx}_valid + " Goto the first line in the file + exe s:tlist_{fidx}_start + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + endif + return + endif + + " Discard and remove the tags for this file from display + call s:Tlist_Discard_TagInfo(fidx) + call s:Tlist_Window_Remove_File_From_Display(fidx) + endif + + " Process and generate a list of tags defined in the file + if !file_listed || !s:tlist_{fidx}_valid + let ret_fidx = s:Tlist_Process_File(a:filename, a:ftype) + if ret_fidx == -1 + return + endif + let fidx = ret_fidx + endif + + " Set report option to a huge value to prevent informational messages + " while adding lines to the taglist window + let old_report = &report + set report=99999 + + if g:Tlist_Show_One_File + " Remove the previous file + if s:tlist_cur_file_idx != -1 + call s:Tlist_Window_Remove_File_From_Display(s:tlist_cur_file_idx) + let s:tlist_{s:tlist_cur_file_idx}_visible = 0 + let s:tlist_{s:tlist_cur_file_idx}_start = 0 + let s:tlist_{s:tlist_cur_file_idx}_end = 0 + endif + let s:tlist_cur_file_idx = fidx + endif + + " Mark the buffer as modifiable + setlocal modifiable + + " Add new files to the end of the window. For existing files, add them at + " the same line where they were previously present. If the file is not + " visible, then add it at the end + if s:tlist_{fidx}_start == 0 || !s:tlist_{fidx}_visible + if g:Tlist_Compact_Format + let s:tlist_{fidx}_start = line('$') + else + let s:tlist_{fidx}_start = line('$') + 1 + endif + endif + + let s:tlist_{fidx}_visible = 1 + + " Goto the line where this file should be placed + if g:Tlist_Compact_Format + exe s:tlist_{fidx}_start + else + exe s:tlist_{fidx}_start - 1 + endif + + let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' . + \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')' + if g:Tlist_Compact_Format == 0 + silent! put =txt + else + silent! put! =txt + " Move to the next line + exe line('.') + 1 + endif + let file_start = s:tlist_{fidx}_start + + " Add the tag names grouped by tag type to the buffer with a title + let i = 1 + let ttype_cnt = s:tlist_{a:ftype}_count + while i <= ttype_cnt + let ttype = s:tlist_{a:ftype}_{i}_name + " Add the tag type only if there are tags for that type + let fidx_ttype = 's:tlist_' . fidx . '_' . ttype + let ttype_txt = {fidx_ttype} + if ttype_txt != '' + let txt = ' ' . s:tlist_{a:ftype}_{i}_fullname + if g:Tlist_Compact_Format == 0 + let ttype_start_lnum = line('.') + 1 + silent! put =txt + else + let ttype_start_lnum = line('.') + silent! put! =txt + endif + silent! put =ttype_txt + + let {fidx_ttype}_offset = ttype_start_lnum - file_start + + " create a fold for this tag type + let fold_start = ttype_start_lnum + let fold_end = fold_start + {fidx_ttype}_count + exe fold_start . ',' . fold_end . 'fold' + + " Adjust the cursor position + if g:Tlist_Compact_Format == 0 + exe ttype_start_lnum + {fidx_ttype}_count + else + exe ttype_start_lnum + {fidx_ttype}_count + 1 + endif + + if g:Tlist_Compact_Format == 0 + " Separate the tag types by a empty line + silent! put ='' + endif + endif + let i = i + 1 + endwhile + + if s:tlist_{fidx}_tag_count == 0 + if g:Tlist_Compact_Format == 0 + silent! put ='' + endif + endif + + let s:tlist_{fidx}_end = line('.') - 1 + + " Create a fold for the entire file + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' + exe 'silent! ' . s:tlist_{fidx}_start . ',' . + \ s:tlist_{fidx}_end . 'foldopen!' + + " Goto the starting line for this file, + exe s:tlist_{fidx}_start + + if s:tlist_app_name == "winmanager" + " To handle a bug in the winmanager plugin, add a space at the + " last line + call setline('$', ' ') + endif + + " Mark the buffer as not modifiable + setlocal nomodifiable + + " Restore the report option + let &report = old_report + + " Update the start and end line numbers for all the files following this + " file + let start = s:tlist_{fidx}_start + " include the empty line after the last line + if g:Tlist_Compact_Format + let end = s:tlist_{fidx}_end + else + let end = s:tlist_{fidx}_end + 1 + endif + call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1) + + " Now that we have updated the taglist window, update the tags + " menu (if present) + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(1) + endif +endfunction + +" Tlist_Init_File +" Initialize the variables for a new file +function! s:Tlist_Init_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')') + " Add new files at the end of the list + let fidx = s:tlist_file_count + let s:tlist_file_count = s:tlist_file_count + 1 + " Add the new file name to the taglist list of file names + let s:tlist_file_names = s:tlist_file_names . a:filename . "\n" + + " Initialize the file variables + let s:tlist_{fidx}_filename = a:filename + let s:tlist_{fidx}_sort_type = g:Tlist_Sort_Type + let s:tlist_{fidx}_filetype = a:ftype + let s:tlist_{fidx}_mtime = -1 + let s:tlist_{fidx}_start = 0 + let s:tlist_{fidx}_end = 0 + let s:tlist_{fidx}_valid = 0 + let s:tlist_{fidx}_visible = 0 + let s:tlist_{fidx}_tag_count = 0 + let s:tlist_{fidx}_menu_cmd = '' + + " Initialize the tag type variables + let i = 1 + while i <= s:tlist_{a:ftype}_count + let ttype = s:tlist_{a:ftype}_{i}_name + let s:tlist_{fidx}_{ttype} = '' + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = 0 + let i = i + 1 + endwhile + + return fidx +endfunction + +" Tlist_Get_Tag_Type_By_Tag +" Return the tag type for the specified tag index +function! s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) + let ttype_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_type' + + " Already parsed and have the tag name + if exists(ttype_var) + return {ttype_var} + endif + + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let {ttype_var} = s:Tlist_Extract_Tagtype(tag_line) + + return {ttype_var} +endfunction + +" Tlist_Get_Tag_Prototype +function! s:Tlist_Get_Tag_Prototype(fidx, tidx) + let tproto_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_proto' + + " Already parsed and have the tag prototype + if exists(tproto_var) + return {tproto_var} + endif + + " Parse and extract the tag prototype + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = stridx(tag_line, '/^') + 2 + let end = stridx(tag_line, '/;"' . "\t") + if tag_line[end - 1] == '$' + let end = end -1 + endif + let tag_proto = strpart(tag_line, start, end - start) + let {tproto_var} = substitute(tag_proto, '\s*', '', '') + + return {tproto_var} +endfunction + +" Tlist_Get_Tag_SearchPat +function! s:Tlist_Get_Tag_SearchPat(fidx, tidx) + let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat' + + " Already parsed and have the tag search pattern + if exists(tpat_var) + return {tpat_var} + endif + + " Parse and extract the tag search pattern + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = stridx(tag_line, '/^') + 2 + let end = stridx(tag_line, '/;"' . "\t") + if tag_line[end - 1] == '$' + let end = end -1 + endif + let {tpat_var} = '\V\^' . strpart(tag_line, start, end - start) . + \ (tag_line[end] == '$' ? '\$' : '') + + return {tpat_var} +endfunction + +" Tlist_Get_Tag_Linenum +" Return the tag line number, given the tag index +function! s:Tlist_Get_Tag_Linenum(fidx, tidx) + let tline_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_linenum' + + " Already parsed and have the tag line number + if exists(tline_var) + return {tline_var} + endif + + " Parse and extract the tag line number + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = strridx(tag_line, 'line:') + 5 + let end = strridx(tag_line, "\t") + if end < start + let {tline_var} = strpart(tag_line, start) + 0 + else + let {tline_var} = strpart(tag_line, start, end - start) + 0 + endif + + return {tline_var} +endfunction + +" Tlist_Parse_Tagline +" Parse a tag line from the ctags output. Separate the tag output based on the +" tag type and store it in the tag type variable. +" The format of each line in the ctags output is: +" +" tag_namefile_nameex_cmd;"extension_fields +" +function! s:Tlist_Parse_Tagline(tag_line) + if a:tag_line == '' + " Skip empty lines + return + endif + + " Extract the tag type + let ttype = s:Tlist_Extract_Tagtype(a:tag_line) + + " Make sure the tag type is a valid and supported one + if ttype == '' || stridx(s:ctags_flags, ttype) == -1 + " Line is not in proper tags format or Tag type is not supported + return + endif + + " Update the total tag count + let s:tidx = s:tidx + 1 + + " The following variables are used to optimize this code. Vim is slow in + " using curly brace names. To reduce the amount of processing needed, the + " curly brace variables are pre-processed here + let fidx_tidx = 's:tlist_' . s:fidx . '_' . s:tidx + let fidx_ttype = 's:tlist_' . s:fidx . '_' . ttype + + " Update the count of this tag type + let ttype_idx = {fidx_ttype}_count + 1 + let {fidx_ttype}_count = ttype_idx + + " Store the ctags output for this tag + let {fidx_tidx}_tag = a:tag_line + + " Store the tag index and the tag type index (back pointers) + let {fidx_ttype}_{ttype_idx} = s:tidx + let {fidx_tidx}_ttype_idx = ttype_idx + + " Extract the tag name + let tag_name = strpart(a:tag_line, 0, stridx(a:tag_line, "\t")) + + " Extract the tag scope/prototype + if g:Tlist_Display_Prototype + let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(s:fidx, s:tidx) + else + let ttxt = ' ' . tag_name + + " Add the tag scope, if it is available and is configured. Tag + " scope is the last field after the 'line:\t' field + if g:Tlist_Display_Tag_Scope + let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line) + if tag_scope != '' + let ttxt = ttxt . ' [' . tag_scope . ']' + endif + endif + endif + + " Add this tag to the tag type variable + let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" + + " Save the tag name + let {fidx_tidx}_tag_name = tag_name +endfunction + +" Tlist_Process_File +" Get the list of tags defined in the specified file and store them +" in Vim variables. Returns the file index where the tags are stored. +function! s:Tlist_Process_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Process_File (' . a:filename . ', ' . + \ a:ftype . ')') + " Check whether this file is supported + if s:Tlist_Skip_File(a:filename, a:ftype) + return -1 + endif + + " If the tag types for this filetype are not yet created, then create + " them now + let var = 's:tlist_' . a:ftype . '_count' + if !exists(var) + if s:Tlist_FileType_Init(a:ftype) == 0 + return -1 + endif + endif + + " If this file is already processed, then use the cached values + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + " First time, this file is loaded + let fidx = s:Tlist_Init_File(a:filename, a:ftype) + else + " File was previously processed. Discard the tag information + call s:Tlist_Discard_TagInfo(fidx) + endif + + let s:tlist_{fidx}_valid = 1 + + " Exuberant ctags arguments to generate a tag list + let ctags_args = ' -f - --format=2 --excmd=pattern --fields=nks ' + + " Form the ctags argument depending on the sort type + if s:tlist_{fidx}_sort_type == 'name' + let ctags_args = ctags_args . '--sort=yes' + else + let ctags_args = ctags_args . '--sort=no' + endif + + " Add the filetype specific arguments + let ctags_args = ctags_args . ' ' . s:tlist_{a:ftype}_ctags_args + + " Ctags command to produce output with regexp for locating the tags + let ctags_cmd = g:Tlist_Ctags_Cmd . ctags_args + let ctags_cmd = ctags_cmd . ' "' . a:filename . '"' + + if &shellxquote == '"' + " Double-quotes within double-quotes will not work in the + " command-line.If the 'shellxquote' option is set to double-quotes, + " then escape the double-quotes in the ctags command-line. + let ctags_cmd = escape(ctags_cmd, '"') + endif + + " In Windows 95, if not using cygwin, disable the 'shellslash' + " option. Otherwise, this will cause problems when running the + " ctags command. + if has('win95') && !has('win32unix') + let old_shellslash = &shellslash + set noshellslash + endif + + if has('win32') && !has('win32unix') && !has('win95') + \ && (&shell =~ 'cmd.exe') + " Windows does not correctly deal with commands that have more than 1 + " set of double quotes. It will strip them all resulting in: + " 'C:\Program' is not recognized as an internal or external command + " operable program or batch file. To work around this, place the + " command inside a batch file and call the batch file. + " Do this only on Win2K, WinXP and above. + " Contributed by: David Fishburn. + let s:taglist_tempfile = fnamemodify(tempname(), ':h') . + \ '\taglist.cmd' + exe 'redir! > ' . s:taglist_tempfile + silent echo ctags_cmd + redir END + + call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd) + let ctags_cmd = '"' . s:taglist_tempfile . '"' + endif + + call s:Tlist_Log_Msg('Cmd: ' . ctags_cmd) + + " Run ctags and get the tag list + let cmd_output = system(ctags_cmd) + + " Restore the value of the 'shellslash' option. + if has('win95') && !has('win32unix') + let &shellslash = old_shellslash + endif + + if exists('s:taglist_tempfile') + " Delete the temporary cmd file created on MS-Windows + call delete(s:taglist_tempfile) + endif + + " Handle errors + if v:shell_error + let msg = "Taglist: Failed to generate tags for " . a:filename + call s:Tlist_Warning_Msg(msg) + if cmd_output != '' + call s:Tlist_Warning_Msg(cmd_output) + endif + return fidx + endif + + " Store the modification time for the file + let s:tlist_{fidx}_mtime = getftime(a:filename) + + " No tags for current file + if cmd_output == '' + call s:Tlist_Log_Msg('No tags defined in ' . a:filename) + return fidx + endif + + call s:Tlist_Log_Msg('Generated tags information for ' . a:filename) + + if v:version > 601 + " The following script local variables are used by the + " Tlist_Parse_Tagline() function. + let s:ctags_flags = s:tlist_{a:ftype}_ctags_flags + let s:fidx = fidx + let s:tidx = 0 + + " Process the ctags output one line at a time. The substitute() + " command is used to parse the tag lines instead of using the + " matchstr()/stridx()/strpart() functions for performance reason + call substitute(cmd_output, "\\([^\n]\\+\\)\n", + \ '\=s:Tlist_Parse_Tagline(submatch(1))', 'g') + + " Save the number of tags for this file + let s:tlist_{fidx}_tag_count = s:tidx + + " The following script local variables are no longer needed + unlet! s:ctags_flags + unlet! s:tidx + unlet! s:fidx + else + " Due to a bug in Vim earlier than version 6.1, + " we cannot use substitute() to parse the ctags output. + " Instead the slow str*() functions are used + let ctags_flags = s:tlist_{a:ftype}_ctags_flags + let tidx = 0 + + while cmd_output != '' + " Extract one line at a time + let idx = stridx(cmd_output, "\n") + let one_line = strpart(cmd_output, 0, idx) + " Remove the line from the tags output + let cmd_output = strpart(cmd_output, idx + 1) + + if one_line == '' + " Line is not in proper tags format + continue + endif + + " Extract the tag type + let ttype = s:Tlist_Extract_Tagtype(one_line) + + " Make sure the tag type is a valid and supported one + if ttype == '' || stridx(ctags_flags, ttype) == -1 + " Line is not in proper tags format or Tag type is not + " supported + continue + endif + + " Update the total tag count + let tidx = tidx + 1 + + " The following variables are used to optimize this code. Vim is + " slow in using curly brace names. To reduce the amount of + " processing needed, the curly brace variables are pre-processed + " here + let fidx_tidx = 's:tlist_' . fidx . '_' . tidx + let fidx_ttype = 's:tlist_' . fidx . '_' . ttype + + " Update the count of this tag type + let ttype_idx = {fidx_ttype}_count + 1 + let {fidx_ttype}_count = ttype_idx + + " Store the ctags output for this tag + let {fidx_tidx}_tag = one_line + + " Store the tag index and the tag type index (back pointers) + let {fidx_ttype}_{ttype_idx} = tidx + let {fidx_tidx}_ttype_idx = ttype_idx + + " Extract the tag name + let tag_name = strpart(one_line, 0, stridx(one_line, "\t")) + + " Extract the tag scope/prototype + if g:Tlist_Display_Prototype + let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(fidx, tidx) + else + let ttxt = ' ' . tag_name + + " Add the tag scope, if it is available and is configured. Tag + " scope is the last field after the 'line:\t' field + if g:Tlist_Display_Tag_Scope + let tag_scope = s:Tlist_Extract_Tag_Scope(one_line) + if tag_scope != '' + let ttxt = ttxt . ' [' . tag_scope . ']' + endif + endif + endif + + " Add this tag to the tag type variable + let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" + + " Save the tag name + let {fidx_tidx}_tag_name = tag_name + endwhile + + " Save the number of tags for this file + let s:tlist_{fidx}_tag_count = tidx + endif + + call s:Tlist_Log_Msg('Processed ' . s:tlist_{fidx}_tag_count . + \ ' tags in ' . a:filename) + + return fidx +endfunction + +" Tlist_Update_File +" Update the tags for a file (if needed) +function! Tlist_Update_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Update_File (' . a:filename . ')') + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(a:filename, a:ftype) + return + endif + + " Convert the file name to a full path + let fname = fnamemodify(a:filename, ':p') + + " First check whether the file already exists + let fidx = s:Tlist_Get_File_Index(fname) + + if fidx != -1 && s:tlist_{fidx}_valid + " File exists and the tags are valid + " Check whether the file was modified after the last tags update + " If it is modified, then update the tags + if s:tlist_{fidx}_mtime == getftime(fname) + return + endif + else + " If the tags were removed previously based on a user request, + " as we are going to update the tags (based on the user request), + " remove the filename from the deleted list + call s:Tlist_Update_Remove_List(fname, 0) + endif + + " If the taglist window is opened, update it + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + " Taglist window is not present. Just update the taglist + " and return + call s:Tlist_Process_File(fname, a:ftype) + else + if g:Tlist_Show_One_File && s:tlist_cur_file_idx != -1 + " If tags for only one file are displayed and we are not + " updating the tags for that file, then no need to + " refresh the taglist window. Otherwise, the taglist + " window should be updated. + if s:tlist_{s:tlist_cur_file_idx}_filename != fname + call s:Tlist_Process_File(fname, a:ftype) + return + endif + endif + + " Save the current window number + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + " Save the cursor position + let save_line = line('.') + let save_col = col('.') + + " Update the taglist window + call s:Tlist_Window_Refresh_File(fname, a:ftype) + + " Restore the cursor position + if v:version >= 601 + call cursor(save_line, save_col) + else + exe save_line + exe 'normal! ' . save_col . '|' + endif + + if winnr() != save_winnr + " Go back to the original window + call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') + endif + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(1) + endif +endfunction + +" Tlist_Window_Close +" Close the taglist window +function! s:Tlist_Window_Close() + call s:Tlist_Log_Msg('Tlist_Window_Close()') + " Make sure the taglist window exists + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Error: Taglist window is not open') + return + endif + + if winnr() == winnum + " Already in the taglist window. Close it and return + if winbufnr(2) != -1 + " If a window other than the taglist window is open, + " then only close the taglist window. + close + endif + else + " Goto the taglist window, close it and then come back to the + " original window + let curbufnr = bufnr('%') + exe winnum . 'wincmd w' + close + " Need to jump back to the original window only if we are not + " already in that window + let winnum = bufwinnr(curbufnr) + if winnr() != winnum + exe winnum . 'wincmd w' + endif + endif +endfunction + +" Tlist_Window_Mark_File_Window +" Mark the current window as the file window to use when jumping to a tag. +" Only if the current window is a non-plugin, non-preview and non-taglist +" window +function! s:Tlist_Window_Mark_File_Window() + if getbufvar('%', '&buftype') == '' && !&previewwindow + let w:tlist_file_window = "yes" + endif +endfunction + +" Tlist_Window_Open +" Open and refresh the taglist window +function! s:Tlist_Window_Open() + call s:Tlist_Log_Msg('Tlist_Window_Open()') + " If the window is open, jump to it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Jump to the existing window + if winnr() != winnum + exe winnum . 'wincmd w' + endif + return + endif + + if s:tlist_app_name == "winmanager" + " Taglist plugin is no longer part of the winmanager app + let s:tlist_app_name = "none" + endif + + " Get the filename and filetype for the specified buffer + let curbuf_name = fnamemodify(bufname('%'), ':p') + let curbuf_ftype = s:Tlist_Get_Buffer_Filetype('%') + let cur_lnum = line('.') + + " Mark the current window as the desired window to open a file when a tag + " is selected. + call s:Tlist_Window_Mark_File_Window() + + " Open the taglist window + call s:Tlist_Window_Create() + + call s:Tlist_Window_Refresh() + + if g:Tlist_Show_One_File + " Add only the current buffer and file + " + " If the file doesn't support tag listing, skip it + if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype) + call s:Tlist_Window_Refresh_File(curbuf_name, curbuf_ftype) + endif + endif + + if g:Tlist_File_Fold_Auto_Close + " Open the fold for the current file, as all the folds in + " the taglist window are closed + let fidx = s:Tlist_Get_File_Index(curbuf_name) + if fidx != -1 + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + endif + endif + + " Highlight the current tag + call s:Tlist_Window_Highlight_Tag(curbuf_name, cur_lnum, 1, 1) +endfunction + +" Tlist_Window_Toggle() +" Open or close a taglist window +function! s:Tlist_Window_Toggle() + call s:Tlist_Log_Msg('Tlist_Window_Toggle()') + " If taglist window is open then close it. + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + call s:Tlist_Window_Close() + return + endif + + call s:Tlist_Window_Open() + + " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not + " set + if !g:Tlist_GainFocus_On_ToggleOpen + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif +endfunction + +" Tlist_Process_Filelist +" Process multiple files. Each filename is separated by "\n" +" Returns the number of processed files +function! s:Tlist_Process_Filelist(file_names) + let flist = a:file_names + + " Enable lazy screen updates + let old_lazyredraw = &lazyredraw + set lazyredraw + + " Keep track of the number of processed files + let fcnt = 0 + + " Process one file at a time + while flist != '' + let nl_idx = stridx(flist, "\n") + let one_file = strpart(flist, 0, nl_idx) + + " Remove the filename from the list + let flist = strpart(flist, nl_idx + 1) + + if one_file == '' + continue + endif + + " Skip directories + if isdirectory(one_file) + continue + endif + + let ftype = s:Tlist_Detect_Filetype(one_file) + + echon "\r " + echon "\rProcessing tags for " . fnamemodify(one_file, ':p:t') + + let fcnt = fcnt + 1 + + call Tlist_Update_File(one_file, ftype) + endwhile + + " Clear the displayed informational messages + echon "\r " + + " Restore the previous state + let &lazyredraw = old_lazyredraw + + return fcnt +endfunction + +" Tlist_Process_Dir +" Process the files in a directory matching the specified pattern +function! s:Tlist_Process_Dir(dir_name, pat) + let flist = glob(a:dir_name . '/' . a:pat) . "\n" + + let fcnt = s:Tlist_Process_Filelist(flist) + + let len = strlen(a:dir_name) + if a:dir_name[len - 1] == '\' || a:dir_name[len - 1] == '/' + let glob_expr = a:dir_name . '*' + else + let glob_expr = a:dir_name . '/*' + endif + let all_files = glob(glob_expr) . "\n" + + while all_files != '' + let nl_idx = stridx(all_files, "\n") + let one_file = strpart(all_files, 0, nl_idx) + + let all_files = strpart(all_files, nl_idx + 1) + if one_file == '' + continue + endif + + " Skip non-directory names + if !isdirectory(one_file) + continue + endif + + echon "\r " + echon "\rProcessing files in directory " . fnamemodify(one_file, ':t') + let fcnt = fcnt + s:Tlist_Process_Dir(one_file, a:pat) + endwhile + + return fcnt +endfunction + +" Tlist_Add_Files_Recursive +" Add files recursively from a directory +function! s:Tlist_Add_Files_Recursive(dir, ...) + let dir_name = fnamemodify(a:dir, ':p') + if !isdirectory(dir_name) + call s:Tlist_Warning_Msg('Error: ' . dir_name . ' is not a directory') + return + endif + + if a:0 == 1 + " User specified file pattern + let pat = a:1 + else + " Default file pattern + let pat = '*' + endif + + echon "\r " + echon "\rProcessing files in directory " . fnamemodify(dir_name, ':t') + let fcnt = s:Tlist_Process_Dir(dir_name, pat) + + echon "\rAdded " . fcnt . " files to the taglist" +endfunction + +" Tlist_Add_Files +" Add the specified list of files to the taglist +function! s:Tlist_Add_Files(...) + let flist = '' + let i = 1 + + " Get all the files matching the file patterns supplied as argument + while i <= a:0 + let flist = flist . glob(a:{i}) . "\n" + let i = i + 1 + endwhile + + if flist == '' + call s:Tlist_Warning_Msg('Error: No matching files are found') + return + endif + + let fcnt = s:Tlist_Process_Filelist(flist) + echon "\rAdded " . fcnt . " files to the taglist" +endfunction + +" Tlist_Extract_Tagtype +" Extract the tag type from the tag text +function! s:Tlist_Extract_Tagtype(tag_line) + " The tag type is after the tag prototype field. The prototype field + " ends with the /;"\t string. We add 4 at the end to skip the characters + " in this special string.. + let start = strridx(a:tag_line, '/;"' . "\t") + 4 + let end = strridx(a:tag_line, 'line:') - 1 + let ttype = strpart(a:tag_line, start, end - start) + + return ttype +endfunction + +" Tlist_Extract_Tag_Scope +" Extract the tag scope from the tag text +function! s:Tlist_Extract_Tag_Scope(tag_line) + let start = strridx(a:tag_line, 'line:') + let end = strridx(a:tag_line, "\t") + if end <= start + return '' + endif + + let tag_scope = strpart(a:tag_line, end + 1) + let tag_scope = strpart(tag_scope, stridx(tag_scope, ':') + 1) + + return tag_scope +endfunction + +" Tlist_Refresh() +" Refresh the taglist +function! s:Tlist_Refresh() + call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' . + \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')') + " If we are entering the buffer from one of the taglist functions, then + " no need to refresh the taglist window again. + if s:Tlist_Skip_Refresh + " We still need to update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif + return + endif + + " If part of the winmanager plugin and not configured to process + " tags always and not configured to display the tags menu, then return + if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always + \ && !g:Tlist_Show_Menu + return + endif + + " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help + if &buftype != '' + return + endif + + let filename = fnamemodify(bufname('%'), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype('%') + + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(filename, ftype) + return + endif + + let tlist_win = bufwinnr(g:TagList_title) + + " If the taglist window is not opened and not configured to process + " tags always and not displaying the tags menu, then return + if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu + return + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(filename) + return + endif + + " If the taglist should not be auto updated, then return + if !g:Tlist_Auto_Update + return + endif + endif + + let cur_lnum = line('.') + + if fidx == -1 + " Update the tags for the file + let fidx = s:Tlist_Process_File(filename, ftype) + else + let mtime = getftime(filename) + if s:tlist_{fidx}_mtime != mtime + " Invalidate the tags listed for this file + let s:tlist_{fidx}_valid = 0 + + " Update the taglist and the window + call Tlist_Update_File(filename, ftype) + + " Store the new file modification time + let s:tlist_{fidx}_mtime = mtime + endif + endif + + " Update the taglist window + if tlist_win != -1 + " Disable screen updates + let old_lazyredraw = &lazyredraw + set nolazyredraw + + " Save the current window number + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + if !g:Tlist_Auto_Highlight_Tag || !g:Tlist_Highlight_Tag_On_BufEnter + " Save the cursor position + let save_line = line('.') + let save_col = col('.') + endif + + " Update the taglist window + call s:Tlist_Window_Refresh_File(filename, ftype) + + " Open the fold for the file + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + + if g:Tlist_Highlight_Tag_On_BufEnter && g:Tlist_Auto_Highlight_Tag + if g:Tlist_Show_One_File && s:tlist_cur_file_idx != fidx + " If displaying tags for only one file in the taglist + " window and about to display the tags for a new file, + " then center the current tag line for the new file + let center_tag_line = 1 + else + let center_tag_line = 0 + endif + + " Highlight the current tag + call s:Tlist_Window_Highlight_Tag(filename, cur_lnum, 1, center_tag_line) + else + " Restore the cursor position + if v:version >= 601 + call cursor(save_line, save_col) + else + exe save_line + exe 'normal! ' . save_col . '|' + endif + endif + + " Jump back to the original window + if save_winnr != winnr() + call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') + endif + + " Restore screen updates + let &lazyredraw = old_lazyredraw + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif +endfunction + +" Tlist_Change_Sort() +" Change the sort order of the tag listing +" caller == 'cmd', command used in the taglist window +" caller == 'menu', taglist menu +" action == 'toggle', toggle sort from name to order and vice versa +" action == 'set', set the sort order to sort_type +function! s:Tlist_Change_Sort(caller, action, sort_type) + call s:Tlist_Log_Msg('Tlist_Change_Sort (caller = ' . a:caller . + \ ', action = ' . a:action . ', sort_type = ' . a:sort_type . ')') + if a:caller == 'cmd' + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + " Remove the previous highlighting + match none + elseif a:caller == 'menu' + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx == -1 + return + endif + endif + + if a:action == 'toggle' + let sort_type = s:tlist_{fidx}_sort_type + + " Toggle the sort order from 'name' to 'order' and vice versa + if sort_type == 'name' + let s:tlist_{fidx}_sort_type = 'order' + else + let s:tlist_{fidx}_sort_type = 'name' + endif + else + let s:tlist_{fidx}_sort_type = a:sort_type + endif + + " Invalidate the tags listed for this file + let s:tlist_{fidx}_valid = 0 + + if a:caller == 'cmd' + " Save the current line for later restoration + let curline = '\V\^' . getline('.') . '\$' + + call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, + \ s:tlist_{fidx}_filetype) + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' + + " Go back to the cursor line before the tag list is sorted + call search(curline, 'w') + + call s:Tlist_Menu_Update_File(1) + else + call s:Tlist_Menu_Remove_File() + + call s:Tlist_Refresh() + endif +endfunction + +" Tlist_Update_Current_File() +" Update taglist for the current buffer by regenerating the tag list +" Contributed by WEN Guopeng. +function! s:Tlist_Update_Current_File() + call s:Tlist_Log_Msg('Tlist_Update_Current_File()') + if winnr() == bufwinnr(g:TagList_title) + " In the taglist window. Update the current file + call s:Tlist_Window_Update_File() + else + " Not in the taglist window. Update the current buffer + let filename = fnamemodify(bufname('%'), ':p') + let fidx = s:Tlist_Get_File_Index(filename) + if fidx != -1 + let s:tlist_{fidx}_valid = 0 + endif + let ft = s:Tlist_Get_Buffer_Filetype('%') + call Tlist_Update_File(filename, ft) + endif +endfunction + +" Tlist_Window_Update_File() +" Update the tags displayed in the taglist window +function! s:Tlist_Window_Update_File() + call s:Tlist_Log_Msg('Tlist_Window_Update_File()') + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + " Remove the previous highlighting + match none + + " Save the current line for later restoration + let curline = '\V\^' . getline('.') . '\$' + + let s:tlist_{fidx}_valid = 0 + + " Update the taglist window + call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, + \ s:tlist_{fidx}_filetype) + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' + + " Go back to the tag line before the list is updated + call search(curline, 'w') +endfunction + +" Tlist_Window_Get_Tag_Type_By_Linenum() +" Return the tag type index for the specified line in the taglist window +function! s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) + let ftype = s:tlist_{a:fidx}_filetype + + " Determine to which tag type the current line number belongs to using the + " tag type start line number and the number of tags in a tag type + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + let start_lnum = + \ s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset + let end = start_lnum + s:tlist_{a:fidx}_{ttype}_count + if a:lnum >= start_lnum && a:lnum <= end + break + endif + let i = i + 1 + endwhile + + " Current line doesn't belong to any of the displayed tag types + if i > s:tlist_{ftype}_count + return '' + endif + + return ttype +endfunction + +" Tlist_Window_Get_Tag_Index() +" Return the tag index for the specified line in the taglist window +function! s:Tlist_Window_Get_Tag_Index(fidx, lnum) + let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(a:fidx, a:lnum) + + " Current line doesn't belong to any of the displayed tag types + if ttype == '' + return 0 + endif + + " Compute the index into the displayed tags for the tag type + let ttype_lnum = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset + let tidx = a:lnum - ttype_lnum + if tidx == 0 + return 0 + endif + + " Get the corresponding tag line and return it + return s:tlist_{a:fidx}_{ttype}_{tidx} +endfunction + +" Tlist_Window_Highlight_Line +" Highlight the current line +function! s:Tlist_Window_Highlight_Line() + " Clear previously selected name + match none + + " Highlight the current line + if g:Tlist_Display_Prototype == 0 + let pat = '/\%' . line('.') . 'l\s\+\zs.*/' + else + let pat = '/\%' . line('.') . 'l.*/' + endif + + exe 'match TagListTagName ' . pat +endfunction + +" Tlist_Window_Open_File +" Open the specified file in either a new window or an existing window +" and place the cursor at the specified tag pattern +function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat) + call s:Tlist_Log_Msg('Tlist_Window_Open_File (' . a:filename . ',' . + \ a:win_ctrl . ')') + let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh + let s:Tlist_Skip_Refresh = 1 + + if s:tlist_app_name == "winmanager" + " Let the winmanager edit the file + call WinManagerFileEdit(a:filename, a:win_ctrl == 'newwin') + else + + if a:win_ctrl == 'newtab' + " Create a new tab + exe 'tabnew ' . escape(a:filename, ' ') + " Open the taglist window in the new tab + call s:Tlist_Window_Open() + endif + + if a:win_ctrl == 'checktab' + " Check whether the file is present in any of the tabs. + " If the file is present in the current tab, then use the + " current tab. + if bufwinnr(a:filename) != -1 + let file_present_in_tab = 1 + let i = tabpagenr() + else + let i = 1 + let bnum = bufnr(a:filename) + let file_present_in_tab = 0 + while i <= tabpagenr('$') + if index(tabpagebuflist(i), bnum) != -1 + let file_present_in_tab = 1 + break + endif + let i += 1 + endwhile + endif + + if file_present_in_tab + " Goto the tab containing the file + exe 'tabnext ' . i + else + " Open a new tab + exe 'tabnew ' . escape(a:filename, ' ') + + " Open the taglist window + call s:Tlist_Window_Open() + endif + endif + + let winnum = -1 + if a:win_ctrl == 'prevwin' + " Open the file in the previous window, if it is usable + let cur_win = winnr() + wincmd p + if &buftype == '' && !&previewwindow + exe "edit " . escape(a:filename, ' ') + let winnum = winnr() + else + " Previous window is not usable + exe cur_win . 'wincmd w' + endif + endif + + " Goto the window containing the file. If the window is not there, open a + " new window + if winnum == -1 + let winnum = bufwinnr(a:filename) + endif + + if winnum == -1 + " Locate the previously used window for opening a file + let fwin_num = 0 + let first_usable_win = 0 + + let i = 1 + let bnum = winbufnr(i) + while bnum != -1 + if getwinvar(i, 'tlist_file_window') == 'yes' + let fwin_num = i + break + endif + if first_usable_win == 0 && + \ getbufvar(bnum, '&buftype') == '' && + \ !getwinvar(i, '&previewwindow') + " First non-taglist, non-plugin and non-preview window + let first_usable_win = i + endif + let i = i + 1 + let bnum = winbufnr(i) + endwhile + + " If a previously used window is not found, then use the first + " non-taglist window + if fwin_num == 0 + let fwin_num = first_usable_win + endif + + if fwin_num != 0 + " Jump to the file window + exe fwin_num . "wincmd w" + + " If the user asked to jump to the tag in a new window, then split + " the existing window into two. + if a:win_ctrl == 'newwin' + split + endif + exe "edit " . escape(a:filename, ' ') + else + " Open a new window + if g:Tlist_Use_Horiz_Window + exe 'leftabove split ' . escape(a:filename, ' ') + else + if winbufnr(2) == -1 + " Only the taglist window is present + if g:Tlist_Use_Right_Window + exe 'leftabove vertical split ' . + \ escape(a:filename, ' ') + else + exe 'rightbelow vertical split ' . + \ escape(a:filename, ' ') + endif + + " Go to the taglist window to change the window size to + " the user configured value + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + if g:Tlist_Use_Horiz_Window + exe 'resize ' . g:Tlist_WinHeight + else + exe 'vertical resize ' . g:Tlist_WinWidth + endif + " Go back to the file window + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + else + " A plugin or help window is also present + wincmd w + exe 'leftabove split ' . escape(a:filename, ' ') + endif + endif + endif + " Mark the window, so that it can be reused. + call s:Tlist_Window_Mark_File_Window() + else + if v:version >= 700 + " If the file is opened in more than one window, then check + " whether the last accessed window has the selected file. + " If it does, then use that window. + let lastwin_bufnum = winbufnr(winnr('#')) + if bufnr(a:filename) == lastwin_bufnum + let winnum = winnr('#') + endif + endif + exe winnum . 'wincmd w' + + " If the user asked to jump to the tag in a new window, then split the + " existing window into two. + if a:win_ctrl == 'newwin' + split + endif + endif + endif + + " Jump to the tag + if a:tagpat != '' + " Add the current cursor position to the jump list, so that user can + " jump back using the ' and ` marks. + mark ' + silent call search(a:tagpat, 'w') + + " Bring the line to the middle of the window + normal! z. + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + .foldopen + endif + endif + + " If the user selects to preview the tag then jump back to the + " taglist window + if a:win_ctrl == 'preview' + " Go back to the taglist window + let winnum = bufwinnr(g:TagList_title) + exe winnum . 'wincmd w' + else + " If the user has selected to close the taglist window, when a + " tag is selected, close the taglist window + if g:Tlist_Close_On_Select + call s:Tlist_Window_Goto_Window() + close + + " Go back to the window displaying the selected file + let wnum = bufwinnr(a:filename) + if wnum != -1 && wnum != winnr() + call s:Tlist_Exe_Cmd_No_Acmds(wnum . 'wincmd w') + endif + endif + endif + + let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh +endfunction + +" Tlist_Window_Jump_To_Tag() +" Jump to the location of the current tag +" win_ctrl == useopen - Reuse the existing file window +" win_ctrl == newwin - Open a new window +" win_ctrl == preview - Preview the tag +" win_ctrl == prevwin - Open in previous window +" win_ctrl == newtab - Open in new tab +function! s:Tlist_Window_Jump_To_Tag(win_ctrl) + call s:Tlist_Log_Msg('Tlist_Window_Jump_To_Tag(' . a:win_ctrl . ')') + " Do not process comment lines and empty lines + let curline = getline('.') + if curline =~ '^\s*$' || curline[0] == '"' + return + endif + + " If inside a closed fold, then use the first line of the fold + " and jump to the file. + let lnum = foldclosed('.') + if lnum == -1 + " Jump to the selected tag or file + let lnum = line('.') + else + " Open the closed fold + .foldopen! + endif + + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + if fidx == -1 + return + endif + + " Get the tag output for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) + if tidx != 0 + let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, tidx) + + " Highlight the tagline + call s:Tlist_Window_Highlight_Line() + else + " Selected a line which is not a tag name. Just edit the file + let tagpat = '' + endif + + call s:Tlist_Window_Open_File(a:win_ctrl, s:tlist_{fidx}_filename, tagpat) +endfunction + +" Tlist_Window_Show_Info() +" Display information about the entry under the cursor +function! s:Tlist_Window_Show_Info() + call s:Tlist_Log_Msg('Tlist_Window_Show_Info()') + + " Clear the previously displayed line + echo + + " Do not process comment lines and empty lines + let curline = getline('.') + if curline =~ '^\s*$' || curline[0] == '"' + return + endif + + " If inside a fold, then don't display the prototype + if foldclosed('.') != -1 + return + endif + + let lnum = line('.') + + " Get the file index + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + if fidx == -1 + return + endif + + if lnum == s:tlist_{fidx}_start + " Cursor is on a file name + let fname = s:tlist_{fidx}_filename + if strlen(fname) > 50 + let fname = fnamemodify(fname, ':t') + endif + echo fname . ', Filetype=' . s:tlist_{fidx}_filetype . + \ ', Tag count=' . s:tlist_{fidx}_tag_count + return + endif + + " Get the tag output line for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) + if tidx == 0 + " Cursor is on a tag type + let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) + if ttype == '' + return + endif + + let ttype_name = '' + + let ftype = s:tlist_{fidx}_filetype + let i = 1 + while i <= s:tlist_{ftype}_count + if ttype == s:tlist_{ftype}_{i}_name + let ttype_name = s:tlist_{ftype}_{i}_fullname + break + endif + let i = i + 1 + endwhile + + echo 'Tag type=' . ttype_name . + \ ', Tag count=' . s:tlist_{fidx}_{ttype}_count + return + endif + + " Get the tag search pattern and display it + echo s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Find_Nearest_Tag_Idx +" Find the tag idx nearest to the supplied line number +" Returns -1, if a tag couldn't be found for the specified line number +function! s:Tlist_Find_Nearest_Tag_Idx(fidx, linenum) + let sort_type = s:tlist_{a:fidx}_sort_type + + let left = 1 + let right = s:tlist_{a:fidx}_tag_count + + if sort_type == 'order' + " Tags sorted by order, use a binary search. + " The idea behind this function is taken from the ctags.vim script (by + " Alexey Marinichev) available at the Vim online website. + + " If the current line is the less than the first tag, then no need to + " search + let first_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, 1) + + if a:linenum < first_lnum + return -1 + endif + + while left < right + let middle = (right + left + 1) / 2 + let middle_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, middle) + + if middle_lnum == a:linenum + let left = middle + break + endif + + if middle_lnum > a:linenum + let right = middle - 1 + else + let left = middle + endif + endwhile + else + " Tags sorted by name, use a linear search. (contributed by Dave + " Eggum). + " Look for a tag with a line number less than or equal to the supplied + " line number. If multiple tags are found, then use the tag with the + " line number closest to the supplied line number. IOW, use the tag + " with the highest line number. + let closest_lnum = 0 + let final_left = 0 + while left <= right + let lnum = s:Tlist_Get_Tag_Linenum(a:fidx, left) + + if lnum < a:linenum && lnum > closest_lnum + let closest_lnum = lnum + let final_left = left + elseif lnum == a:linenum + let closest_lnum = lnum + let final_left = left + break + else + let left = left + 1 + endif + endwhile + if closest_lnum == 0 + return -1 + endif + if left >= right + let left = final_left + endif + endif + + return left +endfunction + +" Tlist_Window_Highlight_Tag() +" Highlight the current tag +" cntx == 1, Called by the taglist plugin itself +" cntx == 2, Forced by the user through the TlistHighlightTag command +" center = 1, move the tag line to the center of the taglist window +function! s:Tlist_Window_Highlight_Tag(filename, cur_lnum, cntx, center) + " Highlight the current tag only if the user configured the + " taglist plugin to do so or if the user explictly invoked the + " command to highlight the current tag. + if !g:Tlist_Auto_Highlight_Tag && a:cntx == 1 + return + endif + + if a:filename == '' + return + endif + + " Make sure the taglist window is present + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Error: Taglist window is not open') + return + endif + + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + return + endif + + " If the file is currently not displayed in the taglist window, then retrn + if !s:tlist_{fidx}_visible + return + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return + endif + + " Ignore all autocommands + let old_ei = &eventignore + set eventignore=all + + " Save the original window number + let org_winnr = winnr() + + if org_winnr == winnum + let in_taglist_window = 1 + else + let in_taglist_window = 0 + endif + + " Go to the taglist window + if !in_taglist_window + exe winnum . 'wincmd w' + endif + + " Clear previously selected name + match none + + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, a:cur_lnum) + if tidx == -1 + " Make sure the current tag line is visible in the taglist window. + " Calling the winline() function makes the line visible. Don't know + " of a better way to achieve this. + let lnum = line('.') + + if lnum < s:tlist_{fidx}_start || lnum > s:tlist_{fidx}_end + " Move the cursor to the beginning of the file + exe s:tlist_{fidx}_start + endif + + if foldclosed('.') != -1 + .foldopen + endif + + call winline() + + if !in_taglist_window + exe org_winnr . 'wincmd w' + endif + + " Restore the autocommands + let &eventignore = old_ei + return + endif + + " Extract the tag type + let ttype = s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) + + " Compute the line number + " Start of file + Start of tag type + offset + let lnum = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + + \ s:tlist_{fidx}_{tidx}_ttype_idx + + " Goto the line containing the tag + exe lnum + + " Open the fold + if foldclosed('.') != -1 + .foldopen + endif + + if a:center + " Move the tag line to the center of the taglist window + normal! z. + else + " Make sure the current tag line is visible in the taglist window. + " Calling the winline() function makes the line visible. Don't know + " of a better way to achieve this. + call winline() + endif + + " Highlight the tag name + call s:Tlist_Window_Highlight_Line() + + " Go back to the original window + if !in_taglist_window + exe org_winnr . 'wincmd w' + endif + + " Restore the autocommands + let &eventignore = old_ei + return +endfunction + +" Tlist_Get_Tag_Prototype_By_Line +" Get the prototype for the tag on or before the specified line number in the +" current buffer +function! Tlist_Get_Tag_Prototype_By_Line(...) + if a:0 == 0 + " Arguments are not supplied. Use the current buffer name + " and line number + let filename = bufname('%') + let linenr = line('.') + elseif a:0 == 2 + " Filename and line number are specified + let filename = a:1 + let linenr = a:2 + if linenr !~ '\d\+' + " Invalid line number + return "" + endif + else + " Sufficient arguments are not supplied + let msg = 'Usage: Tlist_Get_Tag_Prototype_By_Line ' . + \ '' + call s:Tlist_Warning_Msg(msg) + return "" + endif + + " Expand the file to a fully qualified name + let filename = fnamemodify(filename, ':p') + if filename == '' + return "" + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + return "" + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return "" + endif + + " Get the tag text using the line number + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) + if tidx == -1 + return "" + endif + + return s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Get_Tagname_By_Line +" Get the tag name on or before the specified line number in the +" current buffer +function! Tlist_Get_Tagname_By_Line(...) + if a:0 == 0 + " Arguments are not supplied. Use the current buffer name + " and line number + let filename = bufname('%') + let linenr = line('.') + elseif a:0 == 2 + " Filename and line number are specified + let filename = a:1 + let linenr = a:2 + if linenr !~ '\d\+' + " Invalid line number + return "" + endif + else + " Sufficient arguments are not supplied + let msg = 'Usage: Tlist_Get_Tagname_By_Line ' + call s:Tlist_Warning_Msg(msg) + return "" + endif + + " Make sure the current file has a name + let filename = fnamemodify(filename, ':p') + if filename == '' + return "" + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + return "" + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return "" + endif + + " Get the tag name using the line number + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) + if tidx == -1 + return "" + endif + + return s:tlist_{fidx}_{tidx}_tag_name +endfunction + +" Tlist_Window_Move_To_File +" Move the cursor to the beginning of the current file or the next file +" or the previous file in the taglist window +" dir == -1, move to start of current or previous function +" dir == 1, move to start of next function +function! s:Tlist_Window_Move_To_File(dir) + if foldlevel('.') == 0 + " Cursor is on a non-folded line (it is not in any of the files) + " Move it to a folded line + if a:dir == -1 + normal! zk + else + " While moving down to the start of the next fold, + " no need to do go to the start of the next file. + normal! zj + return + endif + endif + + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + let cur_lnum = line('.') + + if a:dir == -1 + if cur_lnum > s:tlist_{fidx}_start + " Move to the beginning of the current file + exe s:tlist_{fidx}_start + return + endif + + if fidx != 0 + " Move to the beginning of the previous file + let fidx = fidx - 1 + else + " Cursor is at the first file, wrap around to the last file + let fidx = s:tlist_file_count - 1 + endif + + exe s:tlist_{fidx}_start + return + else + " Move to the beginning of the next file + let fidx = fidx + 1 + + if fidx >= s:tlist_file_count + " Cursor is at the last file, wrap around to the first file + let fidx = 0 + endif + + if s:tlist_{fidx}_start != 0 + exe s:tlist_{fidx}_start + endif + return + endif +endfunction + +" Tlist_Session_Load +" Load a taglist session (information about all the displayed files +" and the tags) from the specified file +function! s:Tlist_Session_Load(...) + if a:0 == 0 || a:1 == '' + call s:Tlist_Warning_Msg('Usage: TlistSessionLoad ') + return + endif + + let sessionfile = a:1 + + if !filereadable(sessionfile) + let msg = 'Taglist: Error - Unable to open file ' . sessionfile + call s:Tlist_Warning_Msg(msg) + return + endif + + " Mark the current window as the file window + call s:Tlist_Window_Mark_File_Window() + + " Source the session file + exe 'source ' . sessionfile + + let new_file_count = g:tlist_file_count + unlet! g:tlist_file_count + + let i = 0 + while i < new_file_count + let ftype = g:tlist_{i}_filetype + unlet! g:tlist_{i}_filetype + + if !exists('s:tlist_' . ftype . '_count') + if s:Tlist_FileType_Init(ftype) == 0 + let i = i + 1 + continue + endif + endif + + let fname = g:tlist_{i}_filename + unlet! g:tlist_{i}_filename + + let fidx = s:Tlist_Get_File_Index(fname) + if fidx != -1 + let s:tlist_{fidx}_visible = 0 + let i = i + 1 + continue + else + " As we are loading the tags from the session file, if this + " file was previously deleted by the user, now we need to + " add it back. So remove the file from the deleted list. + call s:Tlist_Update_Remove_List(fname, 0) + endif + + let fidx = s:Tlist_Init_File(fname, ftype) + + let s:tlist_{fidx}_filename = fname + + let s:tlist_{fidx}_sort_type = g:tlist_{i}_sort_type + unlet! g:tlist_{i}_sort_type + + let s:tlist_{fidx}_filetype = ftype + let s:tlist_{fidx}_mtime = getftime(fname) + + let s:tlist_{fidx}_start = 0 + let s:tlist_{fidx}_end = 0 + + let s:tlist_{fidx}_valid = 1 + + let s:tlist_{fidx}_tag_count = g:tlist_{i}_tag_count + unlet! g:tlist_{i}_tag_count + + let j = 1 + while j <= s:tlist_{fidx}_tag_count + let s:tlist_{fidx}_{j}_tag = g:tlist_{i}_{j}_tag + let s:tlist_{fidx}_{j}_tag_name = g:tlist_{i}_{j}_tag_name + let s:tlist_{fidx}_{j}_ttype_idx = g:tlist_{i}_{j}_ttype_idx + unlet! g:tlist_{i}_{j}_tag + unlet! g:tlist_{i}_{j}_tag_name + unlet! g:tlist_{i}_{j}_ttype_idx + let j = j + 1 + endwhile + + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + + if exists('g:tlist_' . i . '_' . ttype) + let s:tlist_{fidx}_{ttype} = g:tlist_{i}_{ttype} + unlet! g:tlist_{i}_{ttype} + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = g:tlist_{i}_{ttype}_count + unlet! g:tlist_{i}_{ttype}_count + + let k = 1 + while k <= s:tlist_{fidx}_{ttype}_count + let s:tlist_{fidx}_{ttype}_{k} = g:tlist_{i}_{ttype}_{k} + unlet! g:tlist_{i}_{ttype}_{k} + let k = k + 1 + endwhile + else + let s:tlist_{fidx}_{ttype} = '' + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = 0 + endif + + let j = j + 1 + endwhile + + let i = i + 1 + endwhile + + " If the taglist window is open, then update it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + " Refresh the taglist window + call s:Tlist_Window_Refresh() + + " Go back to the original window + if save_winnr != winnr() + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + endif +endfunction + +" Tlist_Session_Save +" Save a taglist session (information about all the displayed files +" and the tags) into the specified file +function! s:Tlist_Session_Save(...) + if a:0 == 0 || a:1 == '' + call s:Tlist_Warning_Msg('Usage: TlistSessionSave ') + return + endif + + let sessionfile = a:1 + + if s:tlist_file_count == 0 + " There is nothing to save + call s:Tlist_Warning_Msg('Warning: Taglist is empty. Nothing to save.') + return + endif + + if filereadable(sessionfile) + let ans = input('Do you want to overwrite ' . sessionfile . ' (Y/N)?') + if ans !=? 'y' + return + endif + + echo "\n" + endif + + let old_verbose = &verbose + set verbose&vim + + exe 'redir! > ' . sessionfile + + silent! echo '" Taglist session file. This file is auto-generated.' + silent! echo '" File information' + silent! echo 'let tlist_file_count = ' . s:tlist_file_count + + let i = 0 + + while i < s:tlist_file_count + " Store information about the file + silent! echo 'let tlist_' . i . "_filename = '" . + \ s:tlist_{i}_filename . "'" + silent! echo 'let tlist_' . i . '_sort_type = "' . + \ s:tlist_{i}_sort_type . '"' + silent! echo 'let tlist_' . i . '_filetype = "' . + \ s:tlist_{i}_filetype . '"' + silent! echo 'let tlist_' . i . '_tag_count = ' . + \ s:tlist_{i}_tag_count + " Store information about all the tags + let j = 1 + while j <= s:tlist_{i}_tag_count + let txt = escape(s:tlist_{i}_{j}_tag, '"\\') + silent! echo 'let tlist_' . i . '_' . j . '_tag = "' . txt . '"' + silent! echo 'let tlist_' . i . '_' . j . '_tag_name = "' . + \ s:tlist_{i}_{j}_tag_name . '"' + silent! echo 'let tlist_' . i . '_' . j . '_ttype_idx' . ' = ' . + \ s:tlist_{i}_{j}_ttype_idx + let j = j + 1 + endwhile + + " Store information about all the tags grouped by their type + let ftype = s:tlist_{i}_filetype + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + if s:tlist_{i}_{ttype}_count != 0 + let txt = escape(s:tlist_{i}_{ttype}, '"\') + let txt = substitute(txt, "\n", "\\\\n", 'g') + silent! echo 'let tlist_' . i . '_' . ttype . ' = "' . + \ txt . '"' + silent! echo 'let tlist_' . i . '_' . ttype . '_count = ' . + \ s:tlist_{i}_{ttype}_count + let k = 1 + while k <= s:tlist_{i}_{ttype}_count + silent! echo 'let tlist_' . i . '_' . ttype . '_' . k . + \ ' = ' . s:tlist_{i}_{ttype}_{k} + let k = k + 1 + endwhile + endif + let j = j + 1 + endwhile + + silent! echo + + let i = i + 1 + endwhile + + redir END + + let &verbose = old_verbose +endfunction + +" Tlist_Buffer_Removed +" A buffer is removed from the Vim buffer list. Remove the tags defined +" for that file +function! s:Tlist_Buffer_Removed(filename) + call s:Tlist_Log_Msg('Tlist_Buffer_Removed (' . a:filename . ')') + + " Make sure a valid filename is supplied + if a:filename == '' + return + endif + + " Get tag list index of the specified file + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + " File not present in the taglist + return + endif + + " Remove the file from the list + call s:Tlist_Remove_File(fidx, 0) +endfunction + +" When a buffer is deleted, remove the file from the taglist +autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand(':p')) + +" Tlist_Window_Open_File_Fold +" Open the fold for the specified file and close the fold for all the +" other files +function! s:Tlist_Window_Open_File_Fold(acmd_bufnr) + call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')') + + " Make sure the taglist window is present + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Taglist: Error - Taglist window is not open') + return + endif + + " Save the original window number + let org_winnr = winnr() + if org_winnr == winnum + let in_taglist_window = 1 + else + let in_taglist_window = 0 + endif + + if in_taglist_window + " When entering the taglist window, no need to update the folds + return + endif + + " Go to the taglist window + if !in_taglist_window + call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') + endif + + " Close all the folds + silent! %foldclose + + " Get tag list index of the specified file + let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') + if filereadable(fname) + let fidx = s:Tlist_Get_File_Index(fname) + if fidx != -1 + " Open the fold for the file + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen" + endif + endif + + " Go back to the original window + if !in_taglist_window + call s:Tlist_Exe_Cmd_No_Acmds(org_winnr . 'wincmd w') + endif +endfunction + +" Tlist_Window_Check_Auto_Open +" Open the taglist window automatically on Vim startup. +" Open the window only when files present in any of the Vim windows support +" tags. +function! s:Tlist_Window_Check_Auto_Open() + let open_window = 0 + + let i = 1 + let buf_num = winbufnr(i) + while buf_num != -1 + let filename = fnamemodify(bufname(buf_num), ':p') + let ft = s:Tlist_Get_Buffer_Filetype(buf_num) + if !s:Tlist_Skip_File(filename, ft) + let open_window = 1 + break + endif + let i = i + 1 + let buf_num = winbufnr(i) + endwhile + + if open_window + call s:Tlist_Window_Toggle() + endif +endfunction + +" Tlist_Refresh_Folds +" Remove and create the folds for all the files displayed in the taglist +" window. Used after entering a tab. If this is not done, then the folds +" are not properly created for taglist windows displayed in multiple tabs. +function! s:Tlist_Refresh_Folds() + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + return + endif + + let save_wnum = winnr() + exe winnum . 'wincmd w' + + " First remove all the existing folds + normal! zE + + " Create the folds for each in the tag list + let fidx = 0 + while fidx < s:tlist_file_count + let ftype = s:tlist_{fidx}_filetype + + " Create the folds for each tag type in a file + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + if s:tlist_{fidx}_{ttype}_count + let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + let e = s + s:tlist_{fidx}_{ttype}_count + exe s . ',' . e . 'fold' + endif + let j = j + 1 + endwhile + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' + exe 'silent! ' . s:tlist_{fidx}_start . ',' . + \ s:tlist_{fidx}_end . 'foldopen!' + let fidx = fidx + 1 + endwhile + + exe save_wnum . 'wincmd w' +endfunction + +function! s:Tlist_Menu_Add_Base_Menu() + call s:Tlist_Log_Msg('Adding the base menu') + + " Add the menu + anoremenu T&ags.Refresh\ menu :call Tlist_Menu_Refresh() + anoremenu T&ags.Sort\ menu\ by.Name + \ :call Tlist_Change_Sort('menu', 'set', 'name') + anoremenu T&ags.Sort\ menu\ by.Order + \ :call Tlist_Change_Sort('menu', 'set', 'order') + anoremenu T&ags.-SEP1- : + + if &mousemodel =~ 'popup' + anoremenu PopUp.T&ags.Refresh\ menu + \ :call Tlist_Menu_Refresh() + anoremenu PopUp.T&ags.Sort\ menu\ by.Name + \ :call Tlist_Change_Sort('menu', 'set', 'name') + anoremenu PopUp.T&ags.Sort\ menu\ by.Order + \ :call Tlist_Change_Sort('menu', 'set', 'order') + anoremenu PopUp.T&ags.-SEP1- : + endif +endfunction + +let s:menu_char_prefix = + \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + +" Tlist_Menu_Get_Tag_Type_Cmd +" Get the menu command for the specified tag type +" fidx - File type index +" ftype - File Type +" add_ttype_name - To add or not to add the tag type name to the menu entries +" ttype_idx - Tag type index +function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx) + " Curly brace variable name optimization + let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx + + let ttype = s:tlist_{ftype_ttype_idx}_name + if a:add_ttype_name + " If the tag type name contains space characters, escape it. This + " will be used to create the menu entries. + let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ') + endif + + " Curly brace variable name optimization + let fidx_ttype = a:fidx . '_' . ttype + + " Number of tag entries for this tag type + let tcnt = s:tlist_{fidx_ttype}_count + if tcnt == 0 " No entries for this tag type + return '' + endif + + let mcmd = '' + + " Create the menu items for the tags. + " Depending on the number of tags of this type, split the menu into + " multiple sub-menus, if needed. + if tcnt > g:Tlist_Max_Submenu_Items + let j = 1 + while j <= tcnt + let final_index = j + g:Tlist_Max_Submenu_Items - 1 + if final_index > tcnt + let final_index = tcnt + endif + + " Extract the first and last tag name and form the + " sub-menu name + let tidx = s:tlist_{fidx_ttype}_{j} + let first_tag = s:tlist_{a:fidx}_{tidx}_tag_name + + let tidx = s:tlist_{fidx_ttype}_{final_index} + let last_tag = s:tlist_{a:fidx}_{tidx}_tag_name + + " Truncate the names, if they are greater than the + " max length + let first_tag = strpart(first_tag, 0, g:Tlist_Max_Tag_Length) + let last_tag = strpart(last_tag, 0, g:Tlist_Max_Tag_Length) + + " Form the menu command prefix + let m_prefix = 'anoremenu T\&ags.' + if a:add_ttype_name + let m_prefix = m_prefix . ttype_fullname . '.' + endif + let m_prefix = m_prefix . first_tag . '\.\.\.' . last_tag . '.' + + " Character prefix used to number the menu items (hotkey) + let m_prefix_idx = 0 + + while j <= final_index + let tidx = s:tlist_{fidx_ttype}_{j} + + let tname = s:tlist_{a:fidx}_{tidx}_tag_name + + let mcmd = mcmd . m_prefix . '\&' . + \ s:menu_char_prefix[m_prefix_idx] . '\.' . + \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . + \ tidx . ')|' + + let m_prefix_idx = m_prefix_idx + 1 + let j = j + 1 + endwhile + endwhile + else + " Character prefix used to number the menu items (hotkey) + let m_prefix_idx = 0 + + let m_prefix = 'anoremenu T\&ags.' + if a:add_ttype_name + let m_prefix = m_prefix . ttype_fullname . '.' + endif + let j = 1 + while j <= tcnt + let tidx = s:tlist_{fidx_ttype}_{j} + + let tname = s:tlist_{a:fidx}_{tidx}_tag_name + + let mcmd = mcmd . m_prefix . '\&' . + \ s:menu_char_prefix[m_prefix_idx] . '\.' . + \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . tidx + \ . ')|' + + let m_prefix_idx = m_prefix_idx + 1 + let j = j + 1 + endwhile + endif + + return mcmd +endfunction + +" Update the taglist menu with the tags for the specified file +function! s:Tlist_Menu_File_Refresh(fidx) + call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename) + " The 'B' flag is needed in the 'cpoptions' option + let old_cpoptions = &cpoptions + set cpoptions&vim + + exe s:tlist_{a:fidx}_menu_cmd + + " Update the popup menu (if enabled) + if &mousemodel =~ 'popup' + let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.', + \ ' PopUp.T\\\&ags.', "g") + exe cmd + endif + + " The taglist menu is not empty now + let s:tlist_menu_empty = 0 + + " Restore the 'cpoptions' settings + let &cpoptions = old_cpoptions +endfunction + +" Tlist_Menu_Update_File +" Add the taglist menu +function! s:Tlist_Menu_Update_File(clear_menu) + if !has('gui_running') + " Not running in GUI mode + return + endif + + call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu) + + " Remove the tags menu + if a:clear_menu + call s:Tlist_Menu_Remove_File() + + endif + + " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help + if &buftype != '' + return + endif + + let filename = fnamemodify(bufname('%'), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype('%') + + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(filename, ftype) + return + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 || !s:tlist_{fidx}_valid + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(filename) + return + endif + + " Process the tags for the file + let fidx = s:Tlist_Process_File(filename, ftype) + if fidx == -1 + return + endif + endif + + let fname = escape(fnamemodify(bufname('%'), ':t'), '.') + if fname != '' + exe 'anoremenu T&ags.' . fname . ' ' + anoremenu T&ags.-SEP2- : + endif + + if !s:tlist_{fidx}_tag_count + return + endif + + if s:tlist_{fidx}_menu_cmd != '' + " Update the menu with the cached command + call s:Tlist_Menu_File_Refresh(fidx) + + return + endif + + " We are going to add entries to the tags menu, so the menu won't be + " empty + let s:tlist_menu_empty = 0 + + let cmd = '' + + " Determine whether the tag type name needs to be added to the menu + " If more than one tag type is present in the taglisting for a file, + " then the tag type name needs to be present + let add_ttype_name = -1 + let i = 1 + while i <= s:tlist_{ftype}_count && add_ttype_name < 1 + let ttype = s:tlist_{ftype}_{i}_name + if s:tlist_{fidx}_{ttype}_count + let add_ttype_name = add_ttype_name + 1 + endif + let i = i + 1 + endwhile + + " Process the tags by the tag type and get the menu command + let i = 1 + while i <= s:tlist_{ftype}_count + let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i) + if mcmd != '' + let cmd = cmd . mcmd + endif + + let i = i + 1 + endwhile + + " Cache the menu command for reuse + let s:tlist_{fidx}_menu_cmd = cmd + + " Update the menu + call s:Tlist_Menu_File_Refresh(fidx) +endfunction + +" Tlist_Menu_Remove_File +" Remove the tags displayed in the tags menu +function! s:Tlist_Menu_Remove_File() + if !has('gui_running') || s:tlist_menu_empty + return + endif + + call s:Tlist_Log_Msg('Removing the tags menu for a file') + + " Cleanup the Tags menu + silent! unmenu T&ags + if &mousemodel =~ 'popup' + silent! unmenu PopUp.T&ags + endif + + " Add a dummy menu item to retain teared off menu + noremenu T&ags.Dummy l + + silent! unmenu! T&ags + if &mousemodel =~ 'popup' + silent! unmenu! PopUp.T&ags + endif + + call s:Tlist_Menu_Add_Base_Menu() + + " Remove the dummy menu item + unmenu T&ags.Dummy + + let s:tlist_menu_empty = 1 +endfunction + +" Tlist_Menu_Refresh +" Refresh the taglist menu +function! s:Tlist_Menu_Refresh() + call s:Tlist_Log_Msg('Refreshing the tags menu') + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx != -1 + " Invalidate the cached menu command + let s:tlist_{fidx}_menu_cmd = '' + endif + + " Update the taglist, menu and window + call s:Tlist_Update_Current_File() +endfunction + +" Tlist_Menu_Jump_To_Tag +" Jump to the selected tag +function! s:Tlist_Menu_Jump_To_Tag(tidx) + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx == -1 + return + endif + + let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx) + if tagpat == '' + return + endif + + " Add the current cursor position to the jump list, so that user can + " jump back using the ' and ` marks. + mark ' + + silent call search(tagpat, 'w') + + " Bring the line to the middle of the window + normal! z. + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + .foldopen + endif +endfunction + +" Tlist_Menu_Init +" Initialize the taglist menu +function! s:Tlist_Menu_Init() + call s:Tlist_Menu_Add_Base_Menu() + + " Automatically add the tags defined in the current file to the menu + augroup TagListMenuCmds + autocmd! + + if !g:Tlist_Process_File_Always + autocmd BufEnter * call s:Tlist_Refresh() + endif + autocmd BufLeave * call s:Tlist_Menu_Remove_File() + augroup end + + call s:Tlist_Menu_Update_File(0) +endfunction + +" Tlist_Vim_Session_Load +" Initialize the taglist window/buffer, which is created when loading +" a Vim session file. +function! s:Tlist_Vim_Session_Load() + call s:Tlist_Log_Msg('Tlist_Vim_Session_Load') + + " Initialize the taglist window + call s:Tlist_Window_Init() + + " Refresh the taglist window + call s:Tlist_Window_Refresh() +endfunction + +" Tlist_Set_App +" Set the name of the external plugin/application to which taglist +" belongs. +" Taglist plugin is part of another plugin like cream or winmanager. +function! Tlist_Set_App(name) + if a:name == "" + return + endif + + let s:tlist_app_name = a:name +endfunction + +" Winmanager integration + +" Initialization required for integration with winmanager +function! TagList_Start() + " If current buffer is not taglist buffer, then don't proceed + if bufname('%') != '__Tag_List__' + return + endif + + call Tlist_Set_App('winmanager') + + " Get the current filename from the winmanager plugin + let bufnum = WinManagerGetLastEditedFile() + if bufnum != -1 + let filename = fnamemodify(bufname(bufnum), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype(bufnum) + endif + + " Initialize the taglist window, if it is not already initialized + if !exists('s:tlist_window_initialized') || !s:tlist_window_initialized + call s:Tlist_Window_Init() + call s:Tlist_Window_Refresh() + let s:tlist_window_initialized = 1 + endif + + " Update the taglist window + if bufnum != -1 + if !s:Tlist_Skip_File(filename, ftype) && g:Tlist_Auto_Update + call s:Tlist_Window_Refresh_File(filename, ftype) + endif + endif +endfunction + +function! TagList_IsValid() + return 0 +endfunction + +function! TagList_WrapUp() + return 0 +endfunction + +" restore 'cpo' +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/sources_non_forked/taglist/doc/taglist.txt b/sources_non_forked/taglist/doc/taglist.txt new file mode 100755 index 00000000..6a62b396 --- /dev/null +++ b/sources_non_forked/taglist/doc/taglist.txt @@ -0,0 +1,1501 @@ +*taglist.txt* Plugin for browsing source code + +Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +For Vim version 6.0 and above +Last change: 2007 May 24 + +1. Overview |taglist-intro| +2. Taglist on the internet |taglist-internet| +3. Requirements |taglist-requirements| +4. Installation |taglist-install| +5. Usage |taglist-using| +6. Options |taglist-options| +7. Commands |taglist-commands| +8. Global functions |taglist-functions| +9. Extending |taglist-extend| +10. FAQ |taglist-faq| +11. License |taglist-license| +12. Todo |taglist-todo| + +============================================================================== + *taglist-intro* +1. Overview~ + +The "Tag List" plugin is a source code browser plugin for Vim. This plugin +allows you to efficiently browse through source code files for different +programming languages. The "Tag List" plugin provides the following features: + + * Displays the tags (functions, classes, structures, variables, etc.) + defined in a file in a vertically or horizontally split Vim window. + * In GUI Vim, optionally displays the tags in the Tags drop-down menu and + in the popup menu. + * Automatically updates the taglist window as you switch between + files/buffers. As you open new files, the tags defined in the new files + are added to the existing file list and the tags defined in all the + files are displayed grouped by the filename. + * When a tag name is selected from the taglist window, positions the + cursor at the definition of the tag in the source file. + * Automatically highlights the current tag name. + * Groups the tags by their type and displays them in a foldable tree. + * Can display the prototype and scope of a tag. + * Can optionally display the tag prototype instead of the tag name in the + taglist window. + * The tag list can be sorted either by name or by chronological order. + * Supports the following language files: Assembly, ASP, Awk, Beta, C, + C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, + Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, + SML, Sql, TCL, Verilog, Vim and Yacc. + * Can be easily extended to support new languages. Support for + existing languages can be modified easily. + * Provides functions to display the current tag name in the Vim status + line or the window title bar. + * The list of tags and files in the taglist can be saved and + restored across Vim sessions. + * Provides commands to get the name and prototype of the current tag. + * Runs in both console/terminal and GUI versions of Vim. + * Works with the winmanager plugin. Using the winmanager plugin, you + can use Vim plugins like the file explorer, buffer explorer and the + taglist plugin at the same time like an IDE. + * Can be used in both Unix and MS-Windows systems. + +============================================================================== + *taglist-internet* +2. Taglist on the internet~ + +The home page of the taglist plugin is at: +> + http://vim-taglist.sourceforge.net/ +< +You can subscribe to the taglist mailing list to post your questions or +suggestions for improvement or to send bug reports. Visit the following page +for subscribing to the mailing list: +> + http://groups.yahoo.com/group/taglist +< +============================================================================== + *taglist-requirements* +3. Requirements~ + +The taglist plugin requires the following: + + * Vim version 6.0 and above + * Exuberant ctags 5.0 and above + +The taglist plugin will work on all the platforms where the exuberant ctags +utility and Vim are supported (this includes MS-Windows and Unix based +systems). + +The taglist plugin relies on the exuberant ctags utility to dynamically +generate the tag listing. The exuberant ctags utility must be installed in +your system to use this plugin. The exuberant ctags utility is shipped with +most of the Linux distributions. You can download the exuberant ctags utility +from +> + http://ctags.sourceforge.net +< +The taglist plugin doesn't use or create a tags file and there is no need to +create a tags file to use this plugin. The taglist plugin will not work with +the GNU ctags or the Unix ctags utility. + +This plugin relies on the Vim "filetype" detection mechanism to determine the +type of the current file. You have to turn on the Vim filetype detection by +adding the following line to your .vimrc file: +> + filetype on +< +The taglist plugin will not work if you run Vim in the restricted mode (using +the -Z command-line argument). + +The taglist plugin uses the Vim system() function to invoke the exuberant +ctags utility. If Vim is compiled without the system() function then you +cannot use the taglist plugin. Some of the Linux distributions (Suse) compile +Vim without the system() function for security reasons. + +============================================================================== + *taglist-install* +4. Installation~ + +1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the + $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should + have the following two files (the directory structure should be preserved): + + plugin/taglist.vim - main taglist plugin file + doc/taglist.txt - documentation (help) file + + Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more + details about installing Vim plugins. +2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc + directory, start Vim and run the ":helptags ." command to process the + taglist help file. Without this step, you cannot jump to the taglist help + topics. +3. If the exuberant ctags utility is not present in one of the directories in + the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to + point to the location of the exuberant ctags utility (not to the directory) + in the .vimrc file. +4. If you are running a terminal/console version of Vim and the terminal + doesn't support changing the window width then set the + 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. +5. Restart Vim. +6. You can now use the ":TlistToggle" command to open/close the taglist + window. You can use the ":help taglist" command to get more information + about using the taglist plugin. + +To uninstall the taglist plugin, remove the plugin/taglist.vim and +doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory. + +============================================================================== + *taglist-using* +5. Usage~ + +The taglist plugin can be used in several different ways. + +1. You can keep the taglist window open during the entire editing session. On + opening the taglist window, the tags defined in all the files in the Vim + buffer list will be displayed in the taglist window. As you edit files, the + tags defined in them will be added to the taglist window. You can select a + tag from the taglist window and jump to it. The current tag will be + highlighted in the taglist window. You can close the taglist window when + you no longer need the window. +2. You can configure the taglist plugin to process the tags defined in all the + edited files always. In this configuration, even if the taglist window is + closed and the taglist menu is not displayed, the taglist plugin will + processes the tags defined in newly edited files. You can then open the + taglist window only when you need to select a tag and then automatically + close the taglist window after selecting the tag. +3. You can configure the taglist plugin to display only the tags defined in + the current file in the taglist window. By default, the taglist plugin + displays the tags defined in all the files in the Vim buffer list. As you + switch between files, the taglist window will be refreshed to display only + the tags defined in the current file. +4. In GUI Vim, you can use the Tags pull-down and popup menu created by the + taglist plugin to display the tags defined in the current file and select a + tag to jump to it. You can use the menu without opening the taglist window. + By default, the Tags menu is disabled. +5. You can configure the taglist plugin to display the name of the current tag + in the Vim window status line or in the Vim window title bar. For this to + work without the taglist window or menu, you need to configure the taglist + plugin to process the tags defined in a file always. +6. You can save the tags defined in multiple files to a taglist session file + and load it when needed. You can also configure the taglist plugin to not + update the taglist window when editing new files. You can then manually add + files to the taglist window. + +Opening the taglist window~ +You can open the taglist window using the ":TlistOpen" or the ":TlistToggle" +commands. The ":TlistOpen" command opens the taglist window and jumps to it. +The ":TlistToggle" command opens or closes (toggle) the taglist window and the +cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen' +variable is set to 1, then the ":TlistToggle" command opens the taglist window +and moves the cursor to the taglist window. + +You can map a key to invoke these commands. For example, the following command +creates a normal mode mapping for the key to toggle the taglist window. +> + nnoremap :TlistToggle +< +Add the above mapping to your ~/.vimrc or $HOME/_vimrc file. + +To automatically open the taglist window on Vim startup, set the +'Tlist_Auto_Open' variable to 1. + +You can also open the taglist window on startup using the following command +line: +> + $ vim +TlistOpen +< +Closing the taglist window~ +You can close the taglist window from the taglist window by pressing 'q' or +using the Vim ":q" command. You can also use any of the Vim window commands to +close the taglist window. Invoking the ":TlistToggle" command when the taglist +window is opened, closes the taglist window. You can also use the +":TlistClose" command to close the taglist window. + +To automatically close the taglist window when a tag or file is selected, you +can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the +taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1. + +Jumping to a tag or a file~ +You can select a tag in the taglist window either by pressing the key +or by double clicking the tag name using the mouse. To jump to a tag on a +single mouse click set the 'Tlist_Use_SingleClick' variable to 1. + +If the selected file is already opened in a window, then the cursor is moved +to that window. If the file is not currently opened in a window then the file +is opened in the window used by the taglist plugin to show the previously +selected file. If there are no usable windows, then the file is opened in a +new window. The file is not opened in special windows like the quickfix +window, preview window and windows containing buffer with the 'buftype' option +set. + +To jump to the tag in a new window, press the 'o' key. To open the file in the +previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump +to the tag but still keep the cursor in the taglist window (preview). + +To open the selected file in a tab, use the 't' key. If the file is already +present in a tab then the cursor is moved to that tab otherwise the file is +opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist +window is automatically opened in the newly created tab. + +Instead of jumping to a tag, you can open a file by pressing the key +or by double clicking the file name using the mouse. + +In the taglist window, you can use the [[ or key to jump to the +beginning of the previous file. You can use the ]] or key to jump to the +beginning of the next file. When you reach the first or last file, the search +wraps around and the jumps to the next/previous file. + +Highlighting the current tag~ +The taglist plugin automatically highlights the name of the current tag in the +taglist window. The Vim |CursorHold| autocmd event is used for this. If the +current tag name is not visible in the taglist window, then the taglist window +contents are scrolled to make that tag name visible. You can also use the +":TlistHighlightTag" command to force the highlighting of the current tag. + +The tag name is highlighted if no activity is performed for |'updatetime'| +milliseconds. The default value for this Vim option is 4 seconds. To avoid +unexpected problems, you should not set the |'updatetime'| option to a very +low value. + +To disable the automatic highlighting of the current tag name in the taglist +window, set the 'Tlist_Auto_Highlight_Tag' variable to zero. + +When entering a Vim buffer/window, the taglist plugin automatically highlights +the current tag in that buffer/window. If you like to disable the automatic +highlighting of the current tag when entering a buffer, set the +'Tlist_Highlight_Tag_On_BufEnter' variable to zero. + +Adding files to the taglist~ +When the taglist window is opened, all the files in the Vim buffer list are +processed and the supported files are added to the taglist. When you edit a +file in Vim, the taglist plugin automatically processes this file and adds it +to the taglist. If you close the taglist window, the tag information in the +taglist is retained. + +To process files even when the taglist window is not open, set the +'Tlist_Process_File_Always' variable to 1. + +You can manually add multiple files to the taglist without opening them using +the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands. + +For example, to add all the C files in the /my/project/dir directory to the +taglist, you can use the following command: +> + :TlistAddFiles /my/project/dir/*.c +< +Note that when adding several files with a large number of tags or a large +number of files, it will take several seconds to several minutes for the +taglist plugin to process all the files. You should not interrupt the taglist +plugin by pressing . + +You can recursively add multiple files from a directory tree using the +":TlistAddFilesRecursive" command: +> + :TlistAddFilesRecursive /my/project/dir *.c +< +This command takes two arguments. The first argument specifies the directory +from which to recursively add the files. The second optional argument +specifies the wildcard matching pattern for selecting the files to add. The +default pattern is * and all the files are added. + +Displaying tags for only one file~ +The taglist window displays the tags for all the files in the Vim buffer list +and all the manually added files. To display the tags for only the current +active buffer, set the 'Tlist_Show_One_File' variable to 1. + +Removing files from the taglist~ +You can remove a file from the taglist window, by pressing the 'd' key when the +cursor is on one of the tags listed for the file in the taglist window. The +removed file will no longer be displayed in the taglist window in the current +Vim session. To again display the tags for the file, open the file in a Vim +window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command +to add the file to the taglist. + +When a buffer is removed from the Vim buffer list using the ":bdelete" or the +":bwipeout" command, the taglist is updated to remove the stored information +for this buffer. + +Updating the tags displayed for a file~ +The taglist plugin keeps track of the modification time of a file. When the +modification time changes (the file is modified), the taglist plugin +automatically updates the tags listed for that file. The modification time of +a file is checked when you enter a window containing that file or when you +load that file. + +You can also update or refresh the tags displayed for a file by pressing the +"u" key in the taglist window. If an existing file is modified, after the file +is saved, the taglist plugin automatically updates the tags displayed for the +file. + +You can also use the ":TlistUpdate" command to update the tags for the current +buffer after you made some changes to it. You should save the modified buffer +before you update the taglist window. Otherwise the listed tags will not +include the new tags created in the buffer. + +If you have deleted the tags displayed for a file in the taglist window using +the 'd' key, you can again display the tags for that file using the +":TlistUpdate" command. + +Controlling the taglist updates~ +To disable the automatic processing of new files or modified files, you can +set the 'Tlist_Auto_Update' variable to zero. When this variable is set to +zero, the taglist is updated only when you use the ":TlistUpdate" command or +the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use +this option to control which files are added to the taglist. + +You can use the ":TlistLock" command to lock the taglist contents. After this +command is executed, new files are not automatically added to the taglist. +When the taglist is locked, you can use the ":TlistUpdate" command to add the +current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to +add new files to the taglist. To unlock the taglist, use the ":TlistUnlock" +command. + +Displaying the tag prototype~ +To display the prototype of the tag under the cursor in the taglist window, +press the space bar. If you place the cursor on a tag name in the taglist +window, then the tag prototype is displayed at the Vim status line after +|'updatetime'| milliseconds. The default value for the |'updatetime'| Vim +option is 4 seconds. + +You can get the name and prototype of a tag without opening the taglist window +and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype" +commands. These commands will work only if the current file is already present +in the taglist. To use these commands without opening the taglist window, set +the 'Tlist_Process_File_Always' variable to 1. + +You can use the ":TlistShowTag" command to display the name of the tag at or +before the specified line number in the specified file. If the file name and +line number are not supplied, then this command will display the name of the +current tag. For example, +> + :TlistShowTag + :TlistShowTag myfile.java 100 +< +You can use the ":TlistShowPrototype" command to display the prototype of the +tag at or before the specified line number in the specified file. If the file +name and the line number are not supplied, then this command will display the +prototype of the current tag. For example, +> + :TlistShowPrototype + :TlistShowPrototype myfile.c 50 +< +In the taglist window, when the mouse is moved over a tag name, the tag +prototype is displayed in a balloon. This works only in GUI versions where +balloon evaluation is supported. + +Taglist window contents~ +The taglist window contains the tags defined in various files in the taglist +grouped by the filename and by the tag type (variable, function, class, etc.). +For tags with scope information (like class members, structures inside +structures, etc.), the scope information is displayed in square brackets "[]" +after the tag name. + +The contents of the taglist buffer/window are managed by the taglist plugin. +The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim +|'modifiable'| option is turned off for the taglist buffer. You should not +manually edit the taglist buffer, by setting the |'modifiable'| flag. If you +manually edit the taglist buffer contents, then the taglist plugin will be out +of sync with the taglist buffer contents and the plugin will no longer work +correctly. To redisplay the taglist buffer contents again, close the taglist +window and reopen it. + +Opening and closing the tag and file tree~ +In the taglist window, the tag names are displayed as a foldable tree using +the Vim folding support. You can collapse the tree using the '-' key or using +the Vim |zc| fold command. You can open the tree using the '+' key or using +the Vim |zo| fold command. You can open all the folds using the '*' key or +using the Vim |zR| fold command. You can also use the mouse to open/close the +folds. You can close all the folds using the '=' key. You should not manually +create or delete the folds in the taglist window. + +To automatically close the fold for the inactive files/buffers and open only +the fold for the current buffer in the taglist window, set the +'Tlist_File_Fold_Auto_Close' variable to 1. + +Sorting the tags for a file~ +The tags displayed in the taglist window can be sorted either by their name or +by their chronological order. The default sorting method is by the order in +which the tags appear in a file. You can change the default sort method by +setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can +sort the tags by their name by pressing the "s" key in the taglist window. You +can again sort the tags by their chronological order using the "s" key. Each +file in the taglist window can be sorted using different order. + +Zooming in and out of the taglist window~ +You can press the 'x' key in the taglist window to maximize the taglist +window width/height. The window will be maximized to the maximum possible +width/height without closing the other existing windows. You can again press +'x' to restore the taglist window to the default width/height. + + *taglist-session* +Taglist Session~ +A taglist session refers to the group of files and their tags stored in the +taglist in a Vim session. + +You can save and restore a taglist session (and all the displayed tags) using +the ":TlistSessionSave" and ":TlistSessionLoad" commands. + +To save the information about the tags and files in the taglist to a file, use +the ":TlistSessionSave" command and specify the filename: +> + :TlistSessionSave +< +To load a saved taglist session, use the ":TlistSessionLoad" command: > + + :TlistSessionLoad +< +When you load a taglist session file, the tags stored in the file will be +added to the tags already stored in the taglist. + +The taglist session feature can be used to save the tags for large files or a +group of frequently used files (like a project). By using the taglist session +file, you can minimize the amount to time it takes to load/refresh the taglist +for multiple files. + +You can create more than one taglist session file for multiple groups of +files. + +Displaying the tag name in the Vim status line or the window title bar~ +You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist +plugin to display the current tag name in the Vim status line or the window +title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line() +function to display the current tag prototype in the Vim status line or the +window title bar. + +For example, the following command can be used to display the current tag name +in the status line: +> + :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%) +< +The following command can be used to display the current tag name in the +window title bar: +> + :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%) +< +Note that the current tag name can be displayed only after the file is +processed by the taglist plugin. For this, you have to either set the +'Tlist_Process_File_Always' variable to 1 or open the taglist window or use +the taglist menu. For more information about configuring the Vim status line, +refer to the documentation for the Vim |'statusline'| option. + +Changing the taglist window highlighting~ +The following Vim highlight groups are defined and used to highlight the +various entities in the taglist window: + + TagListTagName - Used for tag names + TagListTagScope - Used for tag scope + TagListTitle - Used for tag titles + TagListComment - Used for comments + TagListFileName - Used for filenames + +By default, these highlight groups are linked to the standard Vim highlight +groups. If you want to change the colors used for these highlight groups, +prefix the highlight group name with 'My' and define it in your .vimrc or +.gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle, +MyTagListComment and MyTagListFileName. For example, to change the colors +used for tag names, you can use the following command: +> + :highlight MyTagListTagName guifg=blue ctermfg=blue +< +Controlling the taglist window~ +To use a horizontally split taglist window, instead of a vertically split +window, set the 'Tlist_Use_Horiz_Window' variable to 1. + +To use a vertically split taglist window on the rightmost side of the Vim +window, set the 'Tlist_Use_Right_Window' variable to 1. + +You can specify the width of the vertically split taglist window, by setting +the 'Tlist_WinWidth' variable. You can specify the height of the horizontally +split taglist window, by setting the 'Tlist_WinHeight' variable. + +When opening a vertically split taglist window, the Vim window width is +increased to accommodate the new taglist window. When the taglist window is +closed, the Vim window is reduced. To disable this, set the +'Tlist_Inc_Winwidth' variable to zero. + +To reduce the number of empty lines in the taglist window, set the +'Tlist_Compact_Format' variable to 1. + +To not display the Vim fold column in the taglist window, set the +'Tlist_Enable_Fold_Column' variable to zero. + +To display the tag prototypes instead of the tag names in the taglist window, +set the 'Tlist_Display_Prototype' variable to 1. + +To not display the scope of the tags next to the tag names, set the +'Tlist_Display_Tag_Scope' variable to zero. + + *taglist-keys* +Taglist window key list~ +The following table lists the description of the keys that can be used +in the taglist window. + + Key Description~ + + Jump to the location where the tag under cursor is + defined. + o Jump to the location where the tag under cursor is + defined in a new window. + P Jump to the tag in the previous (Ctrl-W_p) window. + p Display the tag definition in the file window and + keep the cursor in the taglist window itself. + t Jump to the tag in a new tab. If the file is already + opened in a tab, move to that tab. + Ctrl-t Jump to the tag in a new tab. + Display the prototype of the tag under the cursor. + For file names, display the full path to the file, + file type and the number of tags. For tag types, display the + tag type and the number of tags. + u Update the tags listed in the taglist window + s Change the sort order of the tags (by name or by order) + d Remove the tags for the file under the cursor + x Zoom-in or Zoom-out the taglist window + + Open a fold + - Close a fold + * Open all folds + = Close all folds + [[ Jump to the beginning of the previous file + Jump to the beginning of the previous file + ]] Jump to the beginning of the next file + Jump to the beginning of the next file + q Close the taglist window + Display help + +The above keys will work in both the normal mode and the insert mode. + + *taglist-menu* +Taglist menu~ +When using GUI Vim, the taglist plugin can display the tags defined in the +current file in the drop-down menu and the popup menu. By default, this +feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu' +variable to 1. + +You can jump to a tag by selecting the tag name from the menu. You can use the +taglist menu independent of the taglist window i.e. you don't need to open the +taglist window to get the taglist menu. + +When you switch between files/buffers, the taglist menu is automatically +updated to display the tags defined in the current file/buffer. + +The tags are grouped by their type (variables, functions, classes, methods, +etc.) and displayed as a separate sub-menu for each type. If all the tags +defined in a file are of the same type (e.g. functions), then the sub-menu is +not used. + +If the number of items in a tag type submenu exceeds the value specified by +the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into +multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25. +The first and last tag names in the submenu are used to form the submenu name. +The menu items are prefixed by alpha-numeric characters for easy selection by +keyboard. + +If the popup menu support is enabled (the |'mousemodel'| option contains +"popup"), then the tags menu is added to the popup menu. You can access +the popup menu by right clicking on the GUI window. + +You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry. +You can sort the tags listed in the menu either by name or by order by +selecting the 'Tags->Sort menu by->Name/Order' menu entry. + +You can tear-off the Tags menu and keep it on the side of the Vim window +for quickly locating the tags. + +Using the taglist plugin with the winmanager plugin~ +You can use the taglist plugin with the winmanager plugin. This will allow you +to use the file explorer, buffer explorer and the taglist plugin at the same +time in different windows. To use the taglist plugin with the winmanager +plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example, +to use the file explorer plugin and the taglist plugin at the same time, use +the following setting: > + + let winManagerWindowLayout = 'FileExplorer|TagList' +< +Getting help~ +If you have installed the taglist help file (this file), then you can use the +Vim ":help taglist-" command to get help on the various taglist +topics. + +You can press the key in the taglist window to display the help +information about using the taglist window. If you again press the key, +the help information is removed from the taglist window. + + *taglist-debug* +Debugging the taglist plugin~ +You can use the ":TlistDebug" command to enable logging of the debug messages +from the taglist plugin. To display the logged debug messages, you can use the +":TlistMessages" command. To disable the logging of the debug messages, use +the ":TlistUndebug" command. + +You can specify a file name to the ":TlistDebug" command to log the debug +messages to a file. Otherwise, the debug messages are stored in a script-local +variable. In the later case, to minimize memory usage, only the last 3000 +characters from the debug messages are stored. + +============================================================================== + *taglist-options* +6. Options~ + +A number of Vim variables control the behavior of the taglist plugin. These +variables are initialized to a default value. By changing these variables you +can change the behavior of the taglist plugin. You need to change these +settings only if you want to change the behavior of the taglist plugin. You +should use the |:let| command in your .vimrc file to change the setting of any +of these variables. + +The configurable taglist variables are listed below. For a detailed +description of these variables refer to the text below this table. + +|'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the + taglist. +|'Tlist_Auto_Open'| Open the taglist window when Vim starts. +|'Tlist_Auto_Update'| Automatically update the taglist to include + newly edited files. +|'Tlist_Close_On_Select'| Close the taglist window when a file or tag is + selected. +|'Tlist_Compact_Format'| Remove extra information and blank lines from + the taglist window. +|'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility. +|'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist + window. +|'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name. +|'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist + window. +|'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window. +|'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers. +|'Tlist_GainFocus_On_ToggleOpen'| + Jump to taglist window on open. +|'Tlist_Highlight_Tag_On_BufEnter'| + On entering a buffer, automatically highlight + the current tag. +|'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate + the taglist window. +|'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu. +|'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry. +|'Tlist_Process_File_Always'| Process files even when the taglist window is + closed. +|'Tlist_Show_Menu'| Display the tags menu. +|'Tlist_Show_One_File'| Show tags for the current buffer only. +|'Tlist_Sort_Type'| Sort method used for arranging the tags. +|'Tlist_Use_Horiz_Window'| Use a horizontally split window for the + taglist window. +|'Tlist_Use_Right_Window'| Place the taglist window on the right side. +|'Tlist_Use_SingleClick'| Single click on a tag jumps to it. +|'Tlist_WinHeight'| Horizontally split taglist window height. +|'Tlist_WinWidth'| Vertically split taglist window width. + + *'Tlist_Auto_Highlight_Tag'* +Tlist_Auto_Highlight_Tag~ +The taglist plugin will automatically highlight the current tag in the taglist +window. If you want to disable this, then you can set the +'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current +tag highlighting is disabled, the tags for a new file will still be added to +the taglist window. +> + let Tlist_Auto_Highlight_Tag = 0 +< +With the above variable set to 1, you can use the ":TlistHighlightTag" command +to highlight the current tag. + + *'Tlist_Auto_Open'* +Tlist_Auto_Open~ +To automatically open the taglist window, when you start Vim, you can set the +'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and +the taglist window will not be opened automatically on Vim startup. +> + let Tlist_Auto_Open = 1 +< +The taglist window is opened only when a supported type of file is opened on +Vim startup. For example, if you open text files, then the taglist window will +not be opened. + + *'Tlist_Auto_Update'* +Tlist_Auto_Update~ +When a new file is edited, the tags defined in the file are automatically +processed and added to the taglist. To stop adding new files to the taglist, +set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set +to 1. +> + let Tlist_Auto_Update = 0 +< +With the above variable set to 1, you can use the ":TlistUpdate" command to +add the tags defined in the current file to the taglist. + + *'Tlist_Close_On_Select'* +Tlist_Close_On_Select~ +If you want to close the taglist window when a file or tag is selected, then +set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is +set zero and when you select a tag or file from the taglist window, the window +is not closed. +> + let Tlist_Close_On_Select = 1 +< + *'Tlist_Compact_Format'* +Tlist_Compact_Format~ +By default, empty lines are used to separate different tag types displayed for +a file and the tags displayed for different files in the taglist window. If +you want to display as many tags as possible in the taglist window, you can +set the 'Tlist_Compact_Format' variable to 1 to get a compact display. +> + let Tlist_Compact_Format = 1 +< + *'Tlist_Ctags_Cmd'* +Tlist_Ctags_Cmd~ +The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant +ctags utility. If exuberant ctags is present in any one of the directories in +the PATH environment variable, then there is no need to set this variable. + +The exuberant ctags tool can be installed under different names. When the +taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it +checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in +the PATH environment variable. If any one of the named executable is found, +then the Tlist_Ctags_Cmd variable is set to that name. + +If exuberant ctags is not present in one of the directories specified in the +PATH environment variable, then set this variable to point to the location of +the ctags utility in your system. Note that this variable should point to the +fully qualified exuberant ctags location and NOT to the directory in which +exuberant ctags is installed. If the exuberant ctags tool is not found in +either PATH or in the specified location, then the taglist plugin will not be +loaded. Examples: +> + let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe' + let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' +< + *'Tlist_Display_Prototype'* +Tlist_Display_Prototype~ +By default, only the tag name will be displayed in the taglist window. If you +like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype' +variable to 1. By default, this variable is set to zero and only tag names +will be displayed. +> + let Tlist_Display_Prototype = 1 +< + *'Tlist_Display_Tag_Scope'* +Tlist_Display_Tag_Scope~ +By default, the scope of a tag (like a C++ class) will be displayed in +square brackets next to the tag name. If you don't want the tag scopes +to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default, +this variable is set to 1 and the tag scopes will be displayed. +> + let Tlist_Display_Tag_Scope = 0 +< + *'Tlist_Enable_Fold_Column'* +Tlist_Enable_Fold_Column~ +By default, the Vim fold column is enabled and displayed in the taglist +window. If you wish to disable this (for example, when you are working with a +narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column' +variable to zero. +> + let Tlist_Enable_Fold_Column = 1 +< + *'Tlist_Exit_OnlyWindow'* +Tlist_Exit_OnlyWindow~ +If you want to exit Vim if only the taglist window is currently opened, then +set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is +set to zero and the Vim instance will not be closed if only the taglist window +is present. +> + let Tlist_Exit_OnlyWindow = 1 +< + *'Tlist_File_Fold_Auto_Close'* +Tlist_File_Fold_Auto_Close~ +By default, the tags tree displayed in the taglist window for all the files is +opened. You can close/fold the tags tree for the files manually. To +automatically close the tags tree for inactive files, you can set the +'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1, +the tags tree for the current buffer is automatically opened and for all the +other buffers is closed. +> + let Tlist_File_Fold_Auto_Close = 1 +< + *'Tlist_GainFocus_On_ToggleOpen'* +Tlist_GainFocus_On_ToggleOpen~ +When the taglist window is opened using the ':TlistToggle' command, this +option controls whether the cursor is moved to the taglist window or remains +in the current window. By default, this option is set to 0 and the cursor +remains in the current window. When this variable is set to 1, the cursor +moves to the taglist window after opening the taglist window. +> + let Tlist_GainFocus_On_ToggleOpen = 1 +< + *'Tlist_Highlight_Tag_On_BufEnter'* +Tlist_Highlight_Tag_On_BufEnter~ +When you enter a Vim buffer/window, the current tag in that buffer/window is +automatically highlighted in the taglist window. If the current tag name is +not visible in the taglist window, then the taglist window contents are +scrolled to make that tag name visible. If you like to disable the automatic +highlighting of the current tag when entering a buffer, you can set the +'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for +this variable is 1. +> + let Tlist_Highlight_Tag_On_BufEnter = 0 +< + *'Tlist_Inc_Winwidth'* +Tlist_Inc_Winwidth~ +By default, when the width of the window is less than 100 and a new taglist +window is opened vertically, then the window width is increased by the value +set in the 'Tlist_WinWidth' variable to accommodate the new window. The value +of this variable is used only if you are using a vertically split taglist +window. + +If your terminal doesn't support changing the window width from Vim (older +version of xterm running in a Unix system) or if you see any weird problems in +the screen due to the change in the window width or if you prefer not to +adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero. +CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command +window then you must set this variable to zero, otherwise the system may hang +due to a Vim limitation (explained in :help win32-problems) +> + let Tlist_Inc_Winwidth = 0 +< + *'Tlist_Max_Submenu_Items'* +Tlist_Max_Submenu_Items~ +If a file contains too many tags of a particular type (function, variable, +class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items' +variable, then the menu for that tag type will be split into multiple +sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is +25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable: +> + let Tlist_Max_Submenu_Items = 20 +< +The name of the submenu is formed using the names of the first and the last +tag entries in that submenu. + + *'Tlist_Max_Tag_Length'* +Tlist_Max_Tag_Length~ +Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be +used to form the tag type submenu name. The default value for this variable is +10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or +less characters: +> + let Tlist_Max_Tag_Length = 10 +< + *'Tlist_Process_File_Always'* +Tlist_Process_File_Always~ +By default, the taglist plugin will generate and process the tags defined in +the newly opened files only when the taglist window is opened or when the +taglist menu is enabled. When the taglist window is closed, the taglist plugin +will stop processing the tags for newly opened files. + +You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list +of tags for new files even when the taglist window is closed and the taglist +menu is disabled. +> + let Tlist_Process_File_Always = 1 +< +To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the +taglist window and the taglist menu, you should set this variable to 1. + + *'Tlist_Show_Menu'* +Tlist_Show_Menu~ +When using GUI Vim, you can display the tags defined in the current file in a +menu named "Tags". By default, this feature is turned off. To turn on this +feature, set the 'Tlist_Show_Menu' variable to 1: +> + let Tlist_Show_Menu = 1 +< + *'Tlist_Show_One_File'* +Tlist_Show_One_File~ +By default, the taglist plugin will display the tags defined in all the loaded +buffers in the taglist window. If you prefer to display the tags defined only +in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When +this variable is set to 1, as you switch between buffers, the taglist window +will be refreshed to display the tags for the current buffer and the tags for +the previous buffer will be removed. +> + let Tlist_Show_One_File = 1 +< + *'Tlist_Sort_Type'* +Tlist_Sort_Type~ +The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the +taglist window. The tags can be sorted either alphabetically by their name or +by the order of their appearance in the file (chronological order). By +default, the tag names will be listed by the order in which they are defined +in the file. You can change the sort type (from name to order or from order to +name) by pressing the "s" key in the taglist window. You can also change the +default sort order by setting 'Tlist_Sort_Type' to "name" or "order": +> + let Tlist_Sort_Type = "name" +< + *'Tlist_Use_Horiz_Window'* +Tlist_Use_Horiz_Window~ +Be default, the tag names are displayed in a vertically split window. If you +prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window' +variable to 1. If you are running MS-Windows version of Vim in a MS-DOS +command window, then you should use a horizontally split window instead of a +vertically split window. Also, if you are using an older version of xterm in a +Unix system that doesn't support changing the xterm window width, you should +use a horizontally split window. +> + let Tlist_Use_Horiz_Window = 1 +< + *'Tlist_Use_Right_Window'* +Tlist_Use_Right_Window~ +By default, the vertically split taglist window will appear on the left hand +side. If you prefer to open the window on the right hand side, you can set the +'Tlist_Use_Right_Window' variable to 1: +> + let Tlist_Use_Right_Window = 1 +< + *'Tlist_Use_SingleClick'* +Tlist_Use_SingleClick~ +By default, when you double click on the tag name using the left mouse +button, the cursor will be positioned at the definition of the tag. You +can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when +you single click on the tag name using the mouse. By default this variable +is set to zero. +> + let Tlist_Use_SingleClick = 1 +< +Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize +the taglist window using the mouse, then Vim will crash. This problem is fixed +in Vim 6.3 and above. In the meantime, instead of resizing the taglist window +using the mouse, you can use normal Vim window resizing commands to resize the +taglist window. + + *'Tlist_WinHeight'* +Tlist_WinHeight~ +The default height of the horizontally split taglist window is 10. This can be +changed by modifying the 'Tlist_WinHeight' variable: +> + let Tlist_WinHeight = 20 +< +The |'winfixheight'| option is set for the taglist window, to maintain the +height of the taglist window, when new Vim windows are opened and existing +windows are closed. + + *'Tlist_WinWidth'* +Tlist_WinWidth~ +The default width of the vertically split taglist window is 30. This can be +changed by modifying the 'Tlist_WinWidth' variable: +> + let Tlist_WinWidth = 20 +< +Note that the value of the |'winwidth'| option setting determines the minimum +width of the current window. If you set the 'Tlist_WinWidth' variable to a +value less than that of the |'winwidth'| option setting, then Vim will use the +value of the |'winwidth'| option. + +When new Vim windows are opened and existing windows are closed, the taglist +plugin will try to maintain the width of the taglist window to the size +specified by the 'Tlist_WinWidth' variable. + +============================================================================== + *taglist-commands* +7. Commands~ + +The taglist plugin provides the following ex-mode commands: + +|:TlistAddFiles| Add multiple files to the taglist. +|:TlistAddFilesRecursive| + Add files recursively to the taglist. +|:TlistClose| Close the taglist window. +|:TlistDebug| Start logging of taglist debug messages. +|:TlistLock| Stop adding new files to the taglist. +|:TlistMessages| Display the logged taglist plugin debug messages. +|:TlistOpen| Open and jump to the taglist window. +|:TlistSessionSave| Save the information about files and tags in the + taglist to a session file. +|:TlistSessionLoad| Load the information about files and tags stored + in a session file to taglist. +|:TlistShowPrototype| Display the prototype of the tag at or before the + specified line number. +|:TlistShowTag| Display the name of the tag defined at or before the + specified line number. +|:TlistHighlightTag| Highlight the current tag in the taglist window. +|:TlistToggle| Open or close (toggle) the taglist window. +|:TlistUndebug| Stop logging of taglist debug messages. +|:TlistUnlock| Start adding new files to the taglist. +|:TlistUpdate| Update the tags for the current buffer. + + *:TlistAddFiles* +:TlistAddFiles {file(s)} [file(s) ...] + Add one or more specified files to the taglist. You can + specify multiple filenames using wildcards. To specify a + file name with space character, you should escape the space + character with a backslash. + Examples: +> + :TlistAddFiles *.c *.cpp + :TlistAddFiles file1.html file2.html +< + If you specify a large number of files, then it will take some + time for the taglist plugin to process all of them. The + specified files will not be edited in a Vim window and will + not be added to the Vim buffer list. + + *:TlistAddFilesRecursive* +:TlistAddFilesRecursive {directory} [ {pattern} ] + Add files matching {pattern} recursively from the specified + {directory} to the taglist. If {pattern} is not specified, + then '*' is assumed. To specify the current directory, use "." + for {directory}. To specify a directory name with space + character, you should escape the space character with a + backslash. + Examples: +> + :TlistAddFilesRecursive myproject *.java + :TlistAddFilesRecursive smallproject +< + If large number of files are present in the specified + directory tree, then it will take some time for the taglist + plugin to process all of them. + + *:TlistClose* +:TlistClose Close the taglist window. This command can be used from any + one of the Vim windows. + + *:TlistDebug* +:TlistDebug [filename] + Start logging of debug messages from the taglist plugin. + If {filename} is specified, then the debug messages are stored + in the specified file. Otherwise, the debug messages are + stored in a script local variable. If the file {filename} is + already present, then it is overwritten. + + *:TlistLock* +:TlistLock + Lock the taglist and don't process new files. After this + command is executed, newly edited files will not be added to + the taglist. + + *:TlistMessages* +:TlistMessages + Display the logged debug messages from the taglist plugin + in a window. This command works only when logging to a + script-local variable. + + *:TlistOpen* +:TlistOpen Open and jump to the taglist window. Creates the taglist + window, if the window is not opened currently. After executing + this command, the cursor is moved to the taglist window. When + the taglist window is opened for the first time, all the files + in the buffer list are processed and the tags defined in them + are displayed in the taglist window. + + *:TlistSessionSave* +:TlistSessionSave {filename} + Saves the information about files and tags in the taglist to + the specified file. This command can be used to save and + restore the taglist contents across Vim sessions. + + *:TlistSessionLoad* +:TlistSessionLoad {filename} + Load the information about files and tags stored in the + specified session file to the taglist. + + *:TlistShowPrototype* +:TlistShowPrototype [filename] [linenumber] + Display the prototype of the tag at or before the specified + line number. If the file name and the line number are not + specified, then the current file name and line number are + used. A tag spans multiple lines starting from the line where + it is defined to the line before the next tag. This command + displays the prototype for the tag for any line number in this + range. + + *:TlistShowTag* +:TlistShowTag [filename] [linenumber] + Display the name of the tag defined at or before the specified + line number. If the file name and the line number are not + specified, then the current file name and line number are + used. A tag spans multiple lines starting from the line where + it is defined to the line before the next tag. This command + displays the tag name for any line number in this range. + + *:TlistHighlightTag* +:TlistHighlightTag + Highlight the current tag in the taglist window. By default, + the taglist plugin periodically updates the taglist window to + highlight the current tag. This command can be used to force + the taglist plugin to highlight the current tag. + + *:TlistToggle* +:TlistToggle Open or close (toggle) the taglist window. Opens the taglist + window, if the window is not opened currently. Closes the + taglist window, if the taglist window is already opened. When + the taglist window is opened for the first time, all the files + in the buffer list are processed and the tags are displayed in + the taglist window. After executing this command, the cursor + is not moved from the current window to the taglist window. + + *:TlistUndebug* +:TlistUndebug + Stop logging of debug messages from the taglist plugin. + + *:TlistUnlock* +:TlistUnlock + Unlock the taglist and start processing newly edited files. + + *:TlistUpdate* +:TlistUpdate Update the tags information for the current buffer. This + command can be used to re-process the current file/buffer and + get the tags information. As the taglist plugin uses the file + saved in the disk (instead of the file displayed in a Vim + buffer), you should save a modified buffer before you update + the taglist. Otherwise the listed tags will not include the + new tags created in the buffer. You can use this command even + when the taglist window is not opened. + +============================================================================== + *taglist-functions* +8. Global functions~ + +The taglist plugin provides several global functions that can be used from +other Vim plugins to interact with the taglist plugin. These functions are +described below. + +|Tlist_Update_File_Tags()| Update the tags for the specified file +|Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or + before the specified line number in the + specified file. +|Tlist_Get_Tagname_By_Line()| Return the name of the tag at or + before the specified line number in + the specified file. +|Tlist_Set_App()| Set the name of the application + controlling the taglist window. + + *Tlist_Update_File_Tags()* +Tlist_Update_File_Tags({filename}, {filetype}) + Update the tags for the file {filename}. The second argument + specifies the Vim filetype for the file. If the taglist plugin + has not processed the file previously, then the exuberant + ctags tool is invoked to generate the tags for the file. + + *Tlist_Get_Tag_Prototype_By_Line()* +Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}]) + Return the prototype of the tag at or before the specified + line number in the specified file. If the filename and line + number are not specified, then the current buffer name and the + current line number are used. + + *Tlist_Get_Tagname_By_Line()* +Tlist_Get_Tagname_By_Line([{filename}, {linenumber}]) + Return the name of the tag at or before the specified line + number in the specified file. If the filename and line number + are not specified, then the current buffer name and the + current line number are used. + + *Tlist_Set_App()* +Tlist_Set_App({appname}) + Set the name of the plugin that controls the taglist plugin + window and buffer. This can be used to integrate the taglist + plugin with other Vim plugins. + + For example, the winmanager plugin and the Cream package use + this function and specify the appname as "winmanager" and + "cream" respectively. + + By default, the taglist plugin is a stand-alone plugin and + controls the taglist window and buffer. If the taglist window + is controlled by an external plugin, then the appname should + be set appropriately. + +============================================================================== + *taglist-extend* +9. Extending~ + +The taglist plugin supports all the languages supported by the exuberant ctags +tool, which includes the following languages: Assembly, ASP, Awk, Beta, C, +C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua, +Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql, +TCL, Verilog, Vim and Yacc. + +You can extend the taglist plugin to add support for new languages and also +modify the support for the above listed languages. + +You should NOT make modifications to the taglist plugin script file to add +support for new languages. You will lose these changes when you upgrade to the +next version of the taglist plugin. Instead you should follow the below +described instructions to extend the taglist plugin. + +You can extend the taglist plugin by setting variables in the .vimrc or _vimrc +file. The name of these variables depends on the language name and is +described below. + +Modifying support for an existing language~ +To modify the support for an already supported language, you have to set the +tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx +with the Vim filetype name for the language file. For example, to modify the +support for the perl language files, you have to set the tlist_perl_settings +variable. To modify the support for java files, you have to set the +tlist_java_settings variable. + +To determine the filetype name used by Vim for a file, use the following +command in the buffer containing the file: + + :set filetype + +The above command will display the Vim filetype for the current buffer. + +The format of the value set in the tlist_xxx_settings variable is + + ;flag1:name1;flag2:name2;flag3:name3 + +The different fields in the value are separated by the ';' character. + +The first field 'language_name' is the name used by exuberant ctags to refer +to this language file. This name can be different from the file type name used +by Vim. For example, for C++, the language name used by ctags is 'c++' but the +filetype name used by Vim is 'cpp'. To get the list of language names +supported by exuberant ctags, use the following command: + + $ ctags --list-maps=all + +The remaining fields follow the format "flag:name". The sub-field 'flag' is +the language specific flag used by exuberant ctags to generate the +corresponding tags. For example, for the C language, to list only the +functions, the 'f' flag is used. To get the list of flags supported by +exuberant ctags for the various languages use the following command: + + $ ctags --list-kinds=all + +The sub-field 'name' specifies the title text to use for displaying the tags +of a particular type. For example, 'name' can be set to 'functions'. This +field can be set to any text string name. + +For example, to list only the classes and functions defined in a C++ language +file, add the following line to your .vimrc file: + + let tlist_cpp_settings = 'c++;c:class;f:function' + +In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name +used by the exuberant ctags tool. 'c' and 'f' are the flags passed to +exuberant ctags to list C++ classes and functions and 'class' is the title +used for the class tags and 'function' is the title used for the function tags +in the taglist window. + +For example, to display only functions defined in a C file and to use "My +Functions" as the title for the function tags, use + + let tlist_c_settings = 'c;f:My Functions' + +When you set the tlist_xxx_settings variable, you will override the default +setting used by the taglist plugin for the 'xxx' language. You cannot add to +the default options used by the taglist plugin for a particular file type. To +add to the options used by the taglist plugin for a language, copy the option +values from the taglist plugin file to your .vimrc file and modify it. + +Adding support for a new language~ +If you want to add support for a new language to the taglist plugin, you need +to first extend the exuberant ctags tool. For more information about extending +exuberant ctags, visit the following page: + + http://ctags.sourceforge.net/EXTENDING.html + +To add support for a new language, set the tlist_xxx_settings variable in the +~/.vimrc file appropriately as described above. Replace 'xxx' in the variable +name with the Vim filetype name for the new language. + +For example, to extend the taglist plugin to support the latex language, you +can use the following line (assuming, you have already extended exuberant +ctags to support the latex language): + + let tlist_tex_settings='latex;b:bibitem;c:command;l:label' + +With the above line, when you edit files of filetype "tex" in Vim, the taglist +plugin will invoke the exuberant ctags tool passing the "latex" filetype and +the flags b, c and l to generate the tags. The text heading 'bibitem', +'command' and 'label' will be used in the taglist window for the tags which +are generated for the flags b, c and l respectively. + +============================================================================== + *taglist-faq* +10. Frequently Asked Questions~ + +Q. The taglist plugin doesn't work. The taglist window is empty and the tags + defined in a file are not displayed. +A. Are you using Vim version 6.0 and above? The taglist plugin relies on the + features supported by Vim version 6.0 and above. You can use the following + command to get the Vim version: +> + $ vim --version +< + Are you using exuberant ctags version 5.0 and above? The taglist plugin + relies on the features supported by exuberant ctags and will not work with + GNU ctags or the Unix ctags utility. You can use the following command to + determine whether the ctags installed in your system is exuberant ctags: +> + $ ctags --version +< + Is exuberant ctags present in one of the directories in your PATH? If not, + you need to set the Tlist_Ctags_Cmd variable to point to the location of + exuberant ctags. Use the following Vim command to verify that this is setup + correctly: +> + :echo system(Tlist_Ctags_Cmd . ' --version') +< + The above command should display the version information for exuberant + ctags. + + Did you turn on the Vim filetype detection? The taglist plugin relies on + the filetype detected by Vim and passes the filetype to the exuberant ctags + utility to parse the tags. Check the output of the following Vim command: +> + :filetype +< + The output of the above command should contain "filetype detection:ON". + To turn on the filetype detection, add the following line to the .vimrc or + _vimrc file: +> + filetype on +< + Is your version of Vim compiled with the support for the system() function? + The following Vim command should display 1: +> + :echo exists('*system') +< + In some Linux distributions (particularly Suse Linux), the default Vim + installation is built without the support for the system() function. The + taglist plugin uses the system() function to invoke the exuberant ctags + utility. You need to rebuild Vim after enabling the support for the + system() function. If you use the default build options, the system() + function will be supported. + + Do you have the |'shellslash'| option set? You can try disabling the + |'shellslash'| option. When the taglist plugin invokes the exuberant ctags + utility with the path to the file, if the incorrect slashes are used, then + you will see errors. + + Check the shell related Vim options values using the following command: +> + :set shell? shellcmdflag? shellpipe? + :set shellquote? shellredir? shellxquote? +< + If these options are set in your .vimrc or _vimrc file, try removing those + lines. + + Are you using a Unix shell in a MS-Windows environment? For example, + the Unix shell from the MKS-toolkit. Do you have the SHELL environment + set to point to this shell? You can try resetting the SHELL environment + variable. + + If you are using a Unix shell on MS-Windows, you should try to use + exuberant ctags that is compiled for Unix-like environments so that + exuberant ctags will understand path names with forward slash characters. + + Is your filetype supported by the exuberant ctags utility? The file types + supported by the exuberant ctags utility are listed in the ctags help. If a + file type is not supported, you have to extend exuberant ctags. You can use + the following command to list the filetypes supported by exuberant ctags: +> + ctags --list-languages +< + Run the following command from the shell prompt and check whether the tags + defined in your file are listed in the output from exuberant ctags: +> + ctags -f - --format=2 --excmd=pattern --fields=nks +< + If you see your tags in the output from the above command, then the + exuberant ctags utility is properly parsing your file. + + Do you have the .ctags or _ctags or the ctags.cnf file in your home + directory for specifying default options or for extending exuberant ctags? + If you do have this file, check the options in this file and make sure + these options are not interfering with the operation of the taglist plugin. + + If you are using MS-Windows, check the value of the TEMP and TMP + environment variables. If these environment variables are set to a path + with space characters in the name, then try using the DOS 8.3 short name + for the path or set them to a path without the space characters in the + name. For example, if the temporary directory name is "C:\Documents and + Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to + the following: +> + set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp +< + If exuberant ctags is installed in a directory with space characters in the + name, then try adding the directory to the PATH environment variable or try + setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags + or try copying the exuberant ctags to a path without space characters in + the name. For example, if exuberant ctags is installed in the directory + "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable + as below: +> + let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe' +< + If you are using a cygwin compiled version of exuberant ctags on MS-Windows, + make sure that either you have the cygwin compiled sort utility installed + and available in your PATH or compile exuberant ctags with internal sort + support. Otherwise, when exuberant ctags sorts the tags output by invoking + the sort utility, it may end up invoking the MS-Windows version of + sort.exe, thereby resulting in failure. + +Q. When I try to open the taglist window, I am seeing the following error + message. How do I fix this problem? + + Taglist: Failed to generate tags for /my/path/to/file + ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ... + +A. The taglist plugin will work only with the exuberant ctags tool. You + cannot use the GNU ctags or the Unix ctags program with the taglist plugin. + You will see an error message similar to the one shown above, if you try + use a non-exuberant ctags program with Vim. To fix this problem, either add + the exuberant ctags tool location to the PATH environment variable or set + the 'Tlist_Ctags_Cmd' variable. + +Q. A file has more than one tag with the same name. When I select a tag name + from the taglist window, the cursor is positioned at the incorrect tag + location. +A. The taglist plugin uses the search pattern generated by the exuberant ctags + utility to position the cursor at the location of a tag definition. If a + file has more than one tag with the same name and same prototype, then the + search pattern will be the same. In this case, when searching for the tag + pattern, the cursor may be positioned at the incorrect location. + +Q. I have made some modifications to my file and introduced new + functions/classes/variables. I have not yet saved my file. The taglist + plugin is not displaying the new tags when I update the taglist window. +A. The exuberant ctags utility will process only files that are present in the + disk. To list the tags defined in a file, you have to save the file and + then update the taglist window. + +Q. I have created a ctags file using the exuberant ctags utility for my source + tree. How do I configure the taglist plugin to use this tags file? +A. The taglist plugin doesn't use a tags file stored in disk. For every opened + file, the taglist plugin invokes the exuberant ctags utility to get the + list of tags dynamically. The Vim system() function is used to invoke + exuberant ctags and get the ctags output. This function internally uses a + temporary file to store the output. This file is deleted after the output + from the command is read. So you will never see the file that contains the + output of exuberant ctags. + +Q. When I set the |'updatetime'| option to a low value (less than 1000) and if + I keep pressing a key with the taglist window open, the current buffer + contents are changed. Why is this? +A. The taglist plugin uses the |CursorHold| autocmd to highlight the current + tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds. + If the |'updatetime'| option is set to a low value, then the CursorHold + autocmd will be triggered frequently. As the taglist plugin changes + the focus to the taglist window to highlight the current tag, this could + interfere with the key movement resulting in changing the contents of + the current buffer. The workaround for this problem is to not set the + |'updatetime'| option to a low value. + +============================================================================== + *taglist-license* +11. License~ +Permission is hereby granted to use and distribute the taglist plugin, with or +without modifications, provided that this copyright notice is copied with it. +Like anything else that's free, taglist.vim is provided *as is* and comes with +no warranty of any kind, either expressed or implied. In no event will the +copyright holder be liable for any damamges resulting from the use of this +software. + +============================================================================== + *taglist-todo* +12. Todo~ + +1. Group tags according to the scope and display them. For example, + group all the tags belonging to a C++/Java class +2. Support for displaying tags in a modified (not-yet-saved) file. +3. Automatically open the taglist window only for selected filetypes. + For other filetypes, close the taglist window. +4. When using the shell from the MKS toolkit, the taglist plugin + doesn't work. +5. The taglist plugin doesn't work with files edited remotely using the + netrw plugin. The exuberant ctags utility cannot process files over + scp/rcp/ftp, etc. + +============================================================================== + +vim:tw=78:ts=8:noet:ft=help: diff --git a/sources_non_forked/taglist/doc/tags b/sources_non_forked/taglist/doc/tags new file mode 100644 index 00000000..83e80ba1 --- /dev/null +++ b/sources_non_forked/taglist/doc/tags @@ -0,0 +1,62 @@ +'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'* +'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'* +'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'* +'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'* +'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'* +'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'* +'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'* +'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'* +'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'* +'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'* +'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'* +'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'* +'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'* +'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'* +'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'* +'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'* +'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'* +'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'* +'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'* +'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'* +'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'* +'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'* +'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'* +'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'* +'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'* +:TlistAddFiles taglist.txt /*:TlistAddFiles* +:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive* +:TlistClose taglist.txt /*:TlistClose* +:TlistDebug taglist.txt /*:TlistDebug* +:TlistHighlightTag taglist.txt /*:TlistHighlightTag* +:TlistLock taglist.txt /*:TlistLock* +:TlistMessages taglist.txt /*:TlistMessages* +:TlistOpen taglist.txt /*:TlistOpen* +:TlistSessionLoad taglist.txt /*:TlistSessionLoad* +:TlistSessionSave taglist.txt /*:TlistSessionSave* +:TlistShowPrototype taglist.txt /*:TlistShowPrototype* +:TlistShowTag taglist.txt /*:TlistShowTag* +:TlistToggle taglist.txt /*:TlistToggle* +:TlistUndebug taglist.txt /*:TlistUndebug* +:TlistUnlock taglist.txt /*:TlistUnlock* +:TlistUpdate taglist.txt /*:TlistUpdate* +Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()* +Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()* +Tlist_Set_App() taglist.txt /*Tlist_Set_App()* +Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()* +taglist-commands taglist.txt /*taglist-commands* +taglist-debug taglist.txt /*taglist-debug* +taglist-extend taglist.txt /*taglist-extend* +taglist-faq taglist.txt /*taglist-faq* +taglist-functions taglist.txt /*taglist-functions* +taglist-install taglist.txt /*taglist-install* +taglist-internet taglist.txt /*taglist-internet* +taglist-intro taglist.txt /*taglist-intro* +taglist-keys taglist.txt /*taglist-keys* +taglist-license taglist.txt /*taglist-license* +taglist-menu taglist.txt /*taglist-menu* +taglist-options taglist.txt /*taglist-options* +taglist-requirements taglist.txt /*taglist-requirements* +taglist-session taglist.txt /*taglist-session* +taglist-todo taglist.txt /*taglist-todo* +taglist-using taglist.txt /*taglist-using* +taglist.txt taglist.txt /*taglist.txt* diff --git a/sources_non_forked/taglist/plugin/taglist.vim b/sources_non_forked/taglist/plugin/taglist.vim new file mode 100644 index 00000000..59901f64 --- /dev/null +++ b/sources_non_forked/taglist/plugin/taglist.vim @@ -0,0 +1,4546 @@ +" File: taglist.vim +" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Version: 4.5 +" Last Modified: September 21, 2007 +" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" taglist.vim is provided *as is* and comes with no warranty of any +" kind, either expressed or implied. In no event will the copyright +" holder be liable for any damamges resulting from the use of this +" software. +" +" The "Tag List" plugin is a source code browser plugin for Vim and provides +" an overview of the structure of the programming language files and allows +" you to efficiently browse through source code files for different +" programming languages. You can visit the taglist plugin home page for more +" information: +" +" http://vim-taglist.sourceforge.net +" +" You can subscribe to the taglist mailing list to post your questions +" or suggestions for improvement or to report bugs. Visit the following +" page for subscribing to the mailing list: +" +" http://groups.yahoo.com/group/taglist/ +" +" For more information about using this plugin, after installing the +" taglist plugin, use the ":help taglist" command. +" +" Installation +" ------------ +" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim +" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should +" unzip the following two files (the directory structure should be +" preserved): +" +" plugin/taglist.vim - main taglist plugin file +" doc/taglist.txt - documentation (help) file +" +" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath' +" Vim help pages for more details about installing Vim plugins. +" 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or +" $VIM/vimfiles/doc directory, start Vim and run the ":helptags ." +" command to process the taglist help file. +" 3. If the exuberant ctags utility is not present in your PATH, then set the +" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags +" utility (not to the directory) in the .vimrc file. +" 4. If you are running a terminal/console version of Vim and the +" terminal doesn't support changing the window width then set the +" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. +" 5. Restart Vim. +" 6. You can now use the ":TlistToggle" command to open/close the taglist +" window. You can use the ":help taglist" command to get more +" information about using the taglist plugin. +" +" ****************** Do not modify after this line ************************ + +" Line continuation used here +let s:cpo_save = &cpo +set cpo&vim + +if !exists('loaded_taglist') + " First time loading the taglist plugin + " + " To speed up the loading of Vim, the taglist plugin uses autoload + " mechanism to load the taglist functions. + " Only define the configuration variables, user commands and some + " auto-commands and finish sourcing the file + + " The taglist plugin requires the built-in Vim system() function. If this + " function is not available, then don't load the plugin. + if !exists('*system') + echomsg 'Taglist: Vim system() built-in function is not available. ' . + \ 'Plugin is not loaded.' + let loaded_taglist = 'no' + let &cpo = s:cpo_save + finish + endif + + " Location of the exuberant ctags tool + if !exists('Tlist_Ctags_Cmd') + if executable('exuberant-ctags') + " On Debian Linux, exuberant ctags is installed + " as exuberant-ctags + let Tlist_Ctags_Cmd = 'exuberant-ctags' + elseif executable('exctags') + " On Free-BSD, exuberant ctags is installed as exctags + let Tlist_Ctags_Cmd = 'exctags' + elseif executable('ctags') + let Tlist_Ctags_Cmd = 'ctags' + elseif executable('ctags.exe') + let Tlist_Ctags_Cmd = 'ctags.exe' + elseif executable('tags') + let Tlist_Ctags_Cmd = 'tags' + else + echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . + \ 'not found in PATH. Plugin is not loaded.' + " Skip loading the plugin + let loaded_taglist = 'no' + let &cpo = s:cpo_save + finish + endif + endif + + + " Automatically open the taglist window on Vim startup + if !exists('Tlist_Auto_Open') + let Tlist_Auto_Open = 0 + endif + + " When the taglist window is toggle opened, move the cursor to the + " taglist window + if !exists('Tlist_GainFocus_On_ToggleOpen') + let Tlist_GainFocus_On_ToggleOpen = 0 + endif + + " Process files even when the taglist window is not open + if !exists('Tlist_Process_File_Always') + let Tlist_Process_File_Always = 0 + endif + + if !exists('Tlist_Show_Menu') + let Tlist_Show_Menu = 0 + endif + + " Tag listing sort type - 'name' or 'order' + if !exists('Tlist_Sort_Type') + let Tlist_Sort_Type = 'order' + endif + + " Tag listing window split (horizontal/vertical) control + if !exists('Tlist_Use_Horiz_Window') + let Tlist_Use_Horiz_Window = 0 + endif + + " Open the vertically split taglist window on the left or on the right + " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to + " zero (i.e. only for vertically split windows) + if !exists('Tlist_Use_Right_Window') + let Tlist_Use_Right_Window = 0 + endif + + " Increase Vim window width to display vertically split taglist window. + " For MS-Windows version of Vim running in a MS-DOS window, this must be + " set to 0 otherwise the system may hang due to a Vim limitation. + if !exists('Tlist_Inc_Winwidth') + if (has('win16') || has('win95')) && !has('gui_running') + let Tlist_Inc_Winwidth = 0 + else + let Tlist_Inc_Winwidth = 1 + endif + endif + + " Vertically split taglist window width setting + if !exists('Tlist_WinWidth') + let Tlist_WinWidth = 30 + endif + + " Horizontally split taglist window height setting + if !exists('Tlist_WinHeight') + let Tlist_WinHeight = 10 + endif + + " Display tag prototypes or tag names in the taglist window + if !exists('Tlist_Display_Prototype') + let Tlist_Display_Prototype = 0 + endif + + " Display tag scopes in the taglist window + if !exists('Tlist_Display_Tag_Scope') + let Tlist_Display_Tag_Scope = 1 + endif + + " Use single left mouse click to jump to a tag. By default this is disabled. + " Only double click using the mouse will be processed. + if !exists('Tlist_Use_SingleClick') + let Tlist_Use_SingleClick = 0 + endif + + " Control whether additional help is displayed as part of the taglist or + " not. Also, controls whether empty lines are used to separate the tag + " tree. + if !exists('Tlist_Compact_Format') + let Tlist_Compact_Format = 0 + endif + + " Exit Vim if only the taglist window is currently open. By default, this is + " set to zero. + if !exists('Tlist_Exit_OnlyWindow') + let Tlist_Exit_OnlyWindow = 0 + endif + + " Automatically close the folds for the non-active files in the taglist + " window + if !exists('Tlist_File_Fold_Auto_Close') + let Tlist_File_Fold_Auto_Close = 0 + endif + + " Close the taglist window when a tag is selected + if !exists('Tlist_Close_On_Select') + let Tlist_Close_On_Select = 0 + endif + + " Automatically update the taglist window to display tags for newly + " edited files + if !exists('Tlist_Auto_Update') + let Tlist_Auto_Update = 1 + endif + + " Automatically highlight the current tag + if !exists('Tlist_Auto_Highlight_Tag') + let Tlist_Auto_Highlight_Tag = 1 + endif + + " Automatically highlight the current tag on entering a buffer + if !exists('Tlist_Highlight_Tag_On_BufEnter') + let Tlist_Highlight_Tag_On_BufEnter = 1 + endif + + " Enable fold column to display the folding for the tag tree + if !exists('Tlist_Enable_Fold_Column') + let Tlist_Enable_Fold_Column = 1 + endif + + " Display the tags for only one file in the taglist window + if !exists('Tlist_Show_One_File') + let Tlist_Show_One_File = 0 + endif + + if !exists('Tlist_Max_Submenu_Items') + let Tlist_Max_Submenu_Items = 20 + endif + + if !exists('Tlist_Max_Tag_Length') + let Tlist_Max_Tag_Length = 10 + endif + + " Do not change the name of the taglist title variable. The winmanager + " plugin relies on this name to determine the title for the taglist + " plugin. + let TagList_title = "__Tag_List__" + + " Taglist debug messages + let s:tlist_msg = '' + + " Define the taglist autocommand to automatically open the taglist window + " on Vim startup + if g:Tlist_Auto_Open + autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open() + endif + + " Refresh the taglist + if g:Tlist_Process_File_Always + autocmd BufEnter * call s:Tlist_Refresh() + endif + + if g:Tlist_Show_Menu + autocmd GUIEnter * call s:Tlist_Menu_Init() + endif + + " When the taglist buffer is created when loading a Vim session file, + " the taglist buffer needs to be initialized. The BufFilePost event + " is used to handle this case. + autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load() + + " Define the user commands to manage the taglist window + command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle() + command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open() + " For backwards compatiblity define the Tlist command + command! -nargs=0 -bar Tlist TlistToggle + command! -nargs=+ -complete=file TlistAddFiles + \ call s:Tlist_Add_Files() + command! -nargs=+ -complete=dir TlistAddFilesRecursive + \ call s:Tlist_Add_Files_Recursive() + command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close() + command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File() + command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag( + \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1) + " For backwards compatiblity define the TlistSync command + command! -nargs=0 -bar TlistSync TlistHighlightTag + command! -nargs=* -complete=buffer TlistShowPrototype + \ echo Tlist_Get_Tag_Prototype_By_Line() + command! -nargs=* -complete=buffer TlistShowTag + \ echo Tlist_Get_Tagname_By_Line() + command! -nargs=* -complete=file TlistSessionLoad + \ call s:Tlist_Session_Load() + command! -nargs=* -complete=file TlistSessionSave + \ call s:Tlist_Session_Save() + command! -bar TlistLock let Tlist_Auto_Update=0 + command! -bar TlistUnlock let Tlist_Auto_Update=1 + + " Commands for enabling/disabling debug and to display debug messages + command! -nargs=? -complete=file -bar TlistDebug + \ call s:Tlist_Debug_Enable() + command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable() + command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show() + + " Define autocommands to autoload the taglist plugin when needed. + + " Trick to get the current script ID + map xx xx + let s:tlist_sid = substitute(maparg('xx'), '\(\d\+_\)xx$', + \ '\1', '') + unmap xx + + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined Tlist_* source ' . + \ escape(expand(''), ' ') + exe 'autocmd FuncUndefined TagList_* source ' . + \ escape(expand(''), ' ') + + let loaded_taglist = 'fast_load_done' + + if g:Tlist_Show_Menu && has('gui_running') + call s:Tlist_Menu_Init() + endif + + " restore 'cpo' + let &cpo = s:cpo_save + finish +endif + +if !exists('s:tlist_sid') + " Two or more versions of taglist plugin are installed. Don't + " load this version of the plugin. + finish +endif + +unlet! s:tlist_sid + +if loaded_taglist != 'fast_load_done' + " restore 'cpo' + let &cpo = s:cpo_save + finish +endif + +" Taglist plugin functionality is available +let loaded_taglist = 'available' + +"------------------- end of user configurable options -------------------- + +" Default language specific settings for supported file types and tag types +" +" Variable name format: +" +" s:tlist_def_{vim_ftype}_settings +" +" vim_ftype - Filetype detected by Vim +" +" Value format: +" +" ;:;:;... +" +" ctags_ftype - File type supported by exuberant ctags +" flag - Flag supported by exuberant ctags to generate a tag type +" name - Name of the tag type used in the taglist window to display the +" tags of this type +" + +" assembly language +let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type' + +" aspperl language +let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable' + +" aspvbs language +let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable' + +" awk language +let s:tlist_def_awk_settings = 'awk;f:function' + +" beta language +let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern' + +" c language +let s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' . + \ 'v:variable;f:function' + +" c++ language +let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' . + \ 'c:class;g:enum;s:struct;u:union;f:function' + +" c# language +let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' . + \ 'E:event;g:enum;s:struct;i:interface;' . + \ 'p:properties;m:method' + +" cobol language +let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . + \ 'P:program;s:section' + +" eiffel language +let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature' + +" erlang language +let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function' + +" expect (same as tcl) language +let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure' + +" fortran language +let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . + \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . + \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine' + +" HTML language +let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function' + +" java language +let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . + \ 'f:field;m:method' + +" javascript language +let s:tlist_def_javascript_settings = 'javascript;f:function' + +" lisp language +let s:tlist_def_lisp_settings = 'lisp;f:function' + +" lua language +let s:tlist_def_lua_settings = 'lua;f:function' + +" makefiles +let s:tlist_def_make_settings = 'make;m:macro' + +" pascal language +let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure' + +" perl language +let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine' + +" php language +let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function' + +" python language +let s:tlist_def_python_settings = 'python;c:class;m:member;f:function' + +" rexx language +let s:tlist_def_rexx_settings = 'rexx;s:subroutine' + +" ruby language +let s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' . + \ 'm:singleton method' + +" scheme language +let s:tlist_def_scheme_settings = 'scheme;s:set;f:function' + +" shell language +let s:tlist_def_sh_settings = 'sh;f:function' + +" C shell language +let s:tlist_def_csh_settings = 'sh;f:function' + +" Z shell language +let s:tlist_def_zsh_settings = 'sh;f:function' + +" slang language +let s:tlist_def_slang_settings = 'slang;n:namespace;f:function' + +" sml language +let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . + \ 'r:structure;t:type;v:value;f:function' + +" sql language +let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . + \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure' + +" tcl language +let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure' + +" vera language +let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . + \ 'f:function;g:enum;m:member;p:program;' . + \ 'P:prototype;t:task;T:typedef;v:variable;' . + \ 'x:externvar' + +"verilog language +let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . + \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function' + +" vim language +let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function' + +" yacc language +let s:tlist_def_yacc_settings = 'yacc;l:label' + +"------------------- end of language specific options -------------------- + +" Vim window size is changed by the taglist plugin or not +let s:tlist_winsize_chgd = -1 +" Taglist window is maximized or not +let s:tlist_win_maximized = 0 +" Name of files in the taglist +let s:tlist_file_names='' +" Number of files in the taglist +let s:tlist_file_count = 0 +" Number of filetypes supported by taglist +let s:tlist_ftype_count = 0 +" Is taglist part of other plugins like winmanager or cream? +let s:tlist_app_name = "none" +" Are we displaying brief help text +let s:tlist_brief_help = 1 +" List of files removed on user request +let s:tlist_removed_flist = "" +" Index of current file displayed in the taglist window +let s:tlist_cur_file_idx = -1 +" Taglist menu is empty or not +let s:tlist_menu_empty = 1 + +" An autocommand is used to refresh the taglist window when entering any +" buffer. We don't want to refresh the taglist window if we are entering the +" file window from one of the taglist functions. The 'Tlist_Skip_Refresh' +" variable is used to skip the refresh of the taglist window and is set +" and cleared appropriately. +let s:Tlist_Skip_Refresh = 0 + +" Tlist_Window_Display_Help() +function! s:Tlist_Window_Display_Help() + if s:tlist_app_name == "winmanager" + " To handle a bug in the winmanager plugin, add a space at the + " last line + call setline('$', ' ') + endif + + if s:tlist_brief_help + " Add the brief help + call append(0, '" Press to display help text') + else + " Add the extensive help + call append(0, '" : Jump to tag definition') + call append(1, '" o : Jump to tag definition in new window') + call append(2, '" p : Preview the tag definition') + call append(3, '" : Display tag prototype') + call append(4, '" u : Update tag list') + call append(5, '" s : Select sort field') + call append(6, '" d : Remove file from taglist') + call append(7, '" x : Zoom-out/Zoom-in taglist window') + call append(8, '" + : Open a fold') + call append(9, '" - : Close a fold') + call append(10, '" * : Open all folds') + call append(11, '" = : Close all folds') + call append(12, '" [[ : Move to the start of previous file') + call append(13, '" ]] : Move to the start of next file') + call append(14, '" q : Close the taglist window') + call append(15, '" : Remove help text') + endif +endfunction + +" Tlist_Window_Toggle_Help_Text() +" Toggle taglist plugin help text between the full version and the brief +" version +function! s:Tlist_Window_Toggle_Help_Text() + if g:Tlist_Compact_Format + " In compact display mode, do not display help + return + endif + + " Include the empty line displayed after the help text + let brief_help_size = 1 + let full_help_size = 16 + + setlocal modifiable + + " Set report option to a huge value to prevent informational messages + " while deleting the lines + let old_report = &report + set report=99999 + + " Remove the currently highlighted tag. Otherwise, the help text + " might be highlighted by mistake + match none + + " Toggle between brief and full help text + if s:tlist_brief_help + let s:tlist_brief_help = 0 + + " Remove the previous help + exe '1,' . brief_help_size . ' delete _' + + " Adjust the start/end line numbers for the files + call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size) + else + let s:tlist_brief_help = 1 + + " Remove the previous help + exe '1,' . full_help_size . ' delete _' + + " Adjust the start/end line numbers for the files + call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size) + endif + + call s:Tlist_Window_Display_Help() + + " Restore the report option + let &report = old_report + + setlocal nomodifiable +endfunction + +" Taglist debug support +let s:tlist_debug = 0 + +" File for storing the debug messages +let s:tlist_debug_file = '' + +" Tlist_Debug_Enable +" Enable logging of taglist debug messages. +function! s:Tlist_Debug_Enable(...) + let s:tlist_debug = 1 + + " Check whether a valid file name is supplied. + if a:1 != '' + let s:tlist_debug_file = fnamemodify(a:1, ':p') + + " Empty the log file + exe 'redir! > ' . s:tlist_debug_file + redir END + + " Check whether the log file is present/created + if !filewritable(s:tlist_debug_file) + call s:Tlist_Warning_Msg('Taglist: Unable to create log file ' + \ . s:tlist_debug_file) + let s:tlist_debug_file = '' + endif + endif +endfunction + +" Tlist_Debug_Disable +" Disable logging of taglist debug messages. +function! s:Tlist_Debug_Disable(...) + let s:tlist_debug = 0 + let s:tlist_debug_file = '' +endfunction + +" Tlist_Debug_Show +" Display the taglist debug messages in a new window +function! s:Tlist_Debug_Show() + if s:tlist_msg == '' + call s:Tlist_Warning_Msg('Taglist: No debug messages') + return + endif + + " Open a new window to display the taglist debug messages + new taglist_debug.txt + " Delete all the lines (if the buffer already exists) + silent! %delete _ + " Add the messages + silent! put =s:tlist_msg + " Move the cursor to the first line + normal! gg +endfunction + +" Tlist_Log_Msg +" Log the supplied debug message along with the time +function! s:Tlist_Log_Msg(msg) + if s:tlist_debug + if s:tlist_debug_file != '' + exe 'redir >> ' . s:tlist_debug_file + silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n" + redir END + else + " Log the message into a variable + " Retain only the last 3000 characters + let len = strlen(s:tlist_msg) + if len > 3000 + let s:tlist_msg = strpart(s:tlist_msg, len - 3000) + endif + let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' . + \ a:msg . "\n" + endif + endif +endfunction + +" Tlist_Warning_Msg() +" Display a message using WarningMsg highlight group +function! s:Tlist_Warning_Msg(msg) + echohl WarningMsg + echomsg a:msg + echohl None +endfunction + +" Last returned file index for file name lookup. +" Used to speed up file lookup +let s:tlist_file_name_idx_cache = -1 + +" Tlist_Get_File_Index() +" Return the index of the specified filename +function! s:Tlist_Get_File_Index(fname) + if s:tlist_file_count == 0 || a:fname == '' + return -1 + endif + + " If the new filename is same as the last accessed filename, then + " return that index + if s:tlist_file_name_idx_cache != -1 && + \ s:tlist_file_name_idx_cache < s:tlist_file_count + if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname + " Same as the last accessed file + return s:tlist_file_name_idx_cache + endif + endif + + " First, check whether the filename is present + let s_fname = a:fname . "\n" + let i = stridx(s:tlist_file_names, s_fname) + if i == -1 + let s:tlist_file_name_idx_cache = -1 + return -1 + endif + + " Second, compute the file name index + let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g') + let s:tlist_file_name_idx_cache = strlen(nl_txt) + return s:tlist_file_name_idx_cache +endfunction + +" Last returned file index for line number lookup. +" Used to speed up file lookup +let s:tlist_file_lnum_idx_cache = -1 + +" Tlist_Window_Get_File_Index_By_Linenum() +" Return the index of the filename present in the specified line number +" Line number refers to the line number in the taglist window +function! s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')') + + " First try to see whether the new line number is within the range + " of the last returned file + if s:tlist_file_lnum_idx_cache != -1 && + \ s:tlist_file_lnum_idx_cache < s:tlist_file_count + if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start && + \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end + return s:tlist_file_lnum_idx_cache + endif + endif + + let fidx = -1 + + if g:Tlist_Show_One_File + " Displaying only one file in the taglist window. Check whether + " the line is within the tags displayed for that file + if s:tlist_cur_file_idx != -1 + if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start + \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end + let fidx = s:tlist_cur_file_idx + endif + + endif + else + " Do a binary search in the taglist + let left = 0 + let right = s:tlist_file_count - 1 + + while left < right + let mid = (left + right) / 2 + + if a:lnum >= s:tlist_{mid}_start && a:lnum <= s:tlist_{mid}_end + let s:tlist_file_lnum_idx_cache = mid + return mid + endif + + if a:lnum < s:tlist_{mid}_start + let right = mid - 1 + else + let left = mid + 1 + endif + endwhile + + if left >= 0 && left < s:tlist_file_count + \ && a:lnum >= s:tlist_{left}_start + \ && a:lnum <= s:tlist_{left}_end + let fidx = left + endif + endif + + let s:tlist_file_lnum_idx_cache = fidx + + return fidx +endfunction + +" Tlist_Exe_Cmd_No_Acmds +" Execute the specified Ex command after disabling autocommands +function! s:Tlist_Exe_Cmd_No_Acmds(cmd) + let old_eventignore = &eventignore + set eventignore=all + exe a:cmd + let &eventignore = old_eventignore +endfunction + +" Tlist_Skip_File() +" Check whether tag listing is supported for the specified file +function! s:Tlist_Skip_File(filename, ftype) + " Skip buffers with no names and buffers with filetype not set + if a:filename == '' || a:ftype == '' + return 1 + endif + + " Skip files which are not supported by exuberant ctags + " First check whether default settings for this filetype are available. + " If it is not available, then check whether user specified settings are + " available. If both are not available, then don't list the tags for this + " filetype + let var = 's:tlist_def_' . a:ftype . '_settings' + if !exists(var) + let var = 'g:tlist_' . a:ftype . '_settings' + if !exists(var) + return 1 + endif + endif + + " Skip files which are not readable or files which are not yet stored + " to the disk + if !filereadable(a:filename) + return 1 + endif + + return 0 +endfunction + +" Tlist_User_Removed_File +" Returns 1 if a file is removed by a user from the taglist +function! s:Tlist_User_Removed_File(filename) + return stridx(s:tlist_removed_flist, a:filename . "\n") != -1 +endfunction + +" Tlist_Update_Remove_List +" Update the list of user removed files from the taglist +" add == 1, add the file to the removed list +" add == 0, delete the file from the removed list +function! s:Tlist_Update_Remove_List(filename, add) + if a:add + let s:tlist_removed_flist = s:tlist_removed_flist . a:filename . "\n" + else + let idx = stridx(s:tlist_removed_flist, a:filename . "\n") + let text_before = strpart(s:tlist_removed_flist, 0, idx) + let rem_text = strpart(s:tlist_removed_flist, idx) + let next_idx = stridx(rem_text, "\n") + let text_after = strpart(rem_text, next_idx + 1) + + let s:tlist_removed_flist = text_before . text_after + endif +endfunction + +" Tlist_FileType_Init +" Initialize the ctags arguments and tag variable for the specified +" file type +function! s:Tlist_FileType_Init(ftype) + call s:Tlist_Log_Msg('Tlist_FileType_Init (' . a:ftype . ')') + " If the user didn't specify any settings, then use the default + " ctags args. Otherwise, use the settings specified by the user + let var = 'g:tlist_' . a:ftype . '_settings' + if exists(var) + " User specified ctags arguments + let settings = {var} . ';' + else + " Default ctags arguments + let var = 's:tlist_def_' . a:ftype . '_settings' + if !exists(var) + " No default settings for this file type. This filetype is + " not supported + return 0 + endif + let settings = s:tlist_def_{a:ftype}_settings . ';' + endif + + let msg = 'Taglist: Invalid ctags option setting - ' . settings + + " Format of the option that specifies the filetype and ctags arugments: + " + " ;flag1:name1;flag2:name2;flag3:name3 + " + + " Extract the file type to pass to ctags. This may be different from the + " file type detected by Vim + let pos = stridx(settings, ';') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let ctags_ftype = strpart(settings, 0, pos) + if ctags_ftype == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + " Make sure a valid filetype is supplied. If the user didn't specify a + " valid filetype, then the ctags option settings may be treated as the + " filetype + if ctags_ftype =~ ':' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + + " Remove the file type from settings + let settings = strpart(settings, pos + 1) + if settings == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + + " Process all the specified ctags flags. The format is + " flag1:name1;flag2:name2;flag3:name3 + let ctags_flags = '' + let cnt = 0 + while settings != '' + " Extract the flag + let pos = stridx(settings, ':') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let flag = strpart(settings, 0, pos) + if flag == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + " Remove the flag from settings + let settings = strpart(settings, pos + 1) + + " Extract the tag type name + let pos = stridx(settings, ';') + if pos == -1 + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let name = strpart(settings, 0, pos) + if name == '' + call s:Tlist_Warning_Msg(msg) + return 0 + endif + let settings = strpart(settings, pos + 1) + + let cnt = cnt + 1 + + let s:tlist_{a:ftype}_{cnt}_name = flag + let s:tlist_{a:ftype}_{cnt}_fullname = name + let ctags_flags = ctags_flags . flag + endwhile + + let s:tlist_{a:ftype}_ctags_args = '--language-force=' . ctags_ftype . + \ ' --' . ctags_ftype . '-types=' . ctags_flags + let s:tlist_{a:ftype}_count = cnt + let s:tlist_{a:ftype}_ctags_flags = ctags_flags + + " Save the filetype name + let s:tlist_ftype_{s:tlist_ftype_count}_name = a:ftype + let s:tlist_ftype_count = s:tlist_ftype_count + 1 + + return 1 +endfunction + +" Tlist_Detect_Filetype +" Determine the filetype for the specified file using the filetypedetect +" autocmd. +function! s:Tlist_Detect_Filetype(fname) + " Ignore the filetype autocommands + let old_eventignore = &eventignore + set eventignore=FileType + + " Save the 'filetype', as this will be changed temporarily + let old_filetype = &filetype + + " Run the filetypedetect group of autocommands to determine + " the filetype + exe 'doautocmd filetypedetect BufRead ' . a:fname + + " Save the detected filetype + let ftype = &filetype + + " Restore the previous state + let &filetype = old_filetype + let &eventignore = old_eventignore + + return ftype +endfunction + +" Tlist_Get_Buffer_Filetype +" Get the filetype for the specified buffer +function! s:Tlist_Get_Buffer_Filetype(bnum) + let buf_ft = getbufvar(a:bnum, '&filetype') + + if bufloaded(a:bnum) + " For loaded buffers, the 'filetype' is already determined + return buf_ft + endif + + " For unloaded buffers, if the 'filetype' option is set, return it + if buf_ft != '' + return buf_ft + endif + + " Skip non-existent buffers + if !bufexists(a:bnum) + return '' + endif + + " For buffers whose filetype is not yet determined, try to determine + " the filetype + let bname = bufname(a:bnum) + + return s:Tlist_Detect_Filetype(bname) +endfunction + +" Tlist_Discard_TagInfo +" Discard the stored tag information for a file +function! s:Tlist_Discard_TagInfo(fidx) + call s:Tlist_Log_Msg('Tlist_Discard_TagInfo (' . + \ s:tlist_{a:fidx}_filename . ')') + let ftype = s:tlist_{a:fidx}_filetype + + " Discard information about the tags defined in the file + let i = 1 + while i <= s:tlist_{a:fidx}_tag_count + let fidx_i = 's:tlist_' . a:fidx . '_' . i + unlet! {fidx_i}_tag + unlet! {fidx_i}_tag_name + unlet! {fidx_i}_tag_type + unlet! {fidx_i}_ttype_idx + unlet! {fidx_i}_tag_proto + unlet! {fidx_i}_tag_searchpat + unlet! {fidx_i}_tag_linenum + let i = i + 1 + endwhile + + let s:tlist_{a:fidx}_tag_count = 0 + + " Discard information about tag type groups + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + if s:tlist_{a:fidx}_{ttype} != '' + let fidx_ttype = 's:tlist_' . a:fidx . '_' . ttype + let {fidx_ttype} = '' + let {fidx_ttype}_offset = 0 + let cnt = {fidx_ttype}_count + let {fidx_ttype}_count = 0 + let j = 1 + while j <= cnt + unlet! {fidx_ttype}_{j} + let j = j + 1 + endwhile + endif + let i = i + 1 + endwhile + + " Discard the stored menu command also + let s:tlist_{a:fidx}_menu_cmd = '' +endfunction + +" Tlist_Window_Update_Line_Offsets +" Update the line offsets for tags for files starting from start_idx +" and displayed in the taglist window by the specified offset +function! s:Tlist_Window_Update_Line_Offsets(start_idx, increment, offset) + let i = a:start_idx + + while i < s:tlist_file_count + if s:tlist_{i}_visible + " Update the start/end line number only if the file is visible + if a:increment + let s:tlist_{i}_start = s:tlist_{i}_start + a:offset + let s:tlist_{i}_end = s:tlist_{i}_end + a:offset + else + let s:tlist_{i}_start = s:tlist_{i}_start - a:offset + let s:tlist_{i}_end = s:tlist_{i}_end - a:offset + endif + endif + let i = i + 1 + endwhile +endfunction + +" Tlist_Discard_FileInfo +" Discard the stored information for a file +function! s:Tlist_Discard_FileInfo(fidx) + call s:Tlist_Log_Msg('Tlist_Discard_FileInfo (' . + \ s:tlist_{a:fidx}_filename . ')') + call s:Tlist_Discard_TagInfo(a:fidx) + + let ftype = s:tlist_{a:fidx}_filetype + + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + unlet! s:tlist_{a:fidx}_{ttype} + unlet! s:tlist_{a:fidx}_{ttype}_offset + unlet! s:tlist_{a:fidx}_{ttype}_count + let i = i + 1 + endwhile + + unlet! s:tlist_{a:fidx}_filename + unlet! s:tlist_{a:fidx}_sort_type + unlet! s:tlist_{a:fidx}_filetype + unlet! s:tlist_{a:fidx}_mtime + unlet! s:tlist_{a:fidx}_start + unlet! s:tlist_{a:fidx}_end + unlet! s:tlist_{a:fidx}_valid + unlet! s:tlist_{a:fidx}_visible + unlet! s:tlist_{a:fidx}_tag_count + unlet! s:tlist_{a:fidx}_menu_cmd +endfunction + +" Tlist_Window_Remove_File_From_Display +" Remove the specified file from display +function! s:Tlist_Window_Remove_File_From_Display(fidx) + call s:Tlist_Log_Msg('Tlist_Window_Remove_File_From_Display (' . + \ s:tlist_{a:fidx}_filename . ')') + " If the file is not visible then no need to remove it + if !s:tlist_{a:fidx}_visible + return + endif + + " Remove the tags displayed for the specified file from the window + let start = s:tlist_{a:fidx}_start + " Include the empty line after the last line also + if g:Tlist_Compact_Format + let end = s:tlist_{a:fidx}_end + else + let end = s:tlist_{a:fidx}_end + 1 + endif + + setlocal modifiable + exe 'silent! ' . start . ',' . end . 'delete _' + setlocal nomodifiable + + " Correct the start and end line offsets for all the files following + " this file, as the tags for this file are removed + call s:Tlist_Window_Update_Line_Offsets(a:fidx + 1, 0, end - start + 1) +endfunction + +" Tlist_Remove_File +" Remove the file under the cursor or the specified file index +" user_request - User requested to remove the file from taglist +function! s:Tlist_Remove_File(file_idx, user_request) + let fidx = a:file_idx + + if fidx == -1 + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + endif + call s:Tlist_Log_Msg('Tlist_Remove_File (' . + \ s:tlist_{fidx}_filename . ', ' . a:user_request . ')') + + let save_winnr = winnr() + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Taglist window is open, remove the file from display + + if save_winnr != winnum + let old_eventignore = &eventignore + set eventignore=all + exe winnum . 'wincmd w' + endif + + call s:Tlist_Window_Remove_File_From_Display(fidx) + + if save_winnr != winnum + exe save_winnr . 'wincmd w' + let &eventignore = old_eventignore + endif + endif + + let fname = s:tlist_{fidx}_filename + + if a:user_request + " As the user requested to remove the file from taglist, + " add it to the removed list + call s:Tlist_Update_Remove_List(fname, 1) + endif + + " Remove the file name from the taglist list of filenames + let idx = stridx(s:tlist_file_names, fname . "\n") + let text_before = strpart(s:tlist_file_names, 0, idx) + let rem_text = strpart(s:tlist_file_names, idx) + let next_idx = stridx(rem_text, "\n") + let text_after = strpart(rem_text, next_idx + 1) + let s:tlist_file_names = text_before . text_after + + call s:Tlist_Discard_FileInfo(fidx) + + " Shift all the file variables by one index + let i = fidx + 1 + + while i < s:tlist_file_count + let j = i - 1 + + let s:tlist_{j}_filename = s:tlist_{i}_filename + let s:tlist_{j}_sort_type = s:tlist_{i}_sort_type + let s:tlist_{j}_filetype = s:tlist_{i}_filetype + let s:tlist_{j}_mtime = s:tlist_{i}_mtime + let s:tlist_{j}_start = s:tlist_{i}_start + let s:tlist_{j}_end = s:tlist_{i}_end + let s:tlist_{j}_valid = s:tlist_{i}_valid + let s:tlist_{j}_visible = s:tlist_{i}_visible + let s:tlist_{j}_tag_count = s:tlist_{i}_tag_count + let s:tlist_{j}_menu_cmd = s:tlist_{i}_menu_cmd + + let k = 1 + while k <= s:tlist_{j}_tag_count + let s:tlist_{j}_{k}_tag = s:tlist_{i}_{k}_tag + let s:tlist_{j}_{k}_tag_name = s:tlist_{i}_{k}_tag_name + let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k) + let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx + let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k) + let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k) + let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k) + let k = k + 1 + endwhile + + let ftype = s:tlist_{i}_filetype + + let k = 1 + while k <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{k}_name + let s:tlist_{j}_{ttype} = s:tlist_{i}_{ttype} + let s:tlist_{j}_{ttype}_offset = s:tlist_{i}_{ttype}_offset + let s:tlist_{j}_{ttype}_count = s:tlist_{i}_{ttype}_count + if s:tlist_{j}_{ttype} != '' + let l = 1 + while l <= s:tlist_{j}_{ttype}_count + let s:tlist_{j}_{ttype}_{l} = s:tlist_{i}_{ttype}_{l} + let l = l + 1 + endwhile + endif + let k = k + 1 + endwhile + + " As the file and tag information is copied to the new index, + " discard the previous information + call s:Tlist_Discard_FileInfo(i) + + let i = i + 1 + endwhile + + " Reduce the number of files displayed + let s:tlist_file_count = s:tlist_file_count - 1 + + if g:Tlist_Show_One_File + " If the tags for only one file is displayed and if we just + " now removed that file, then invalidate the current file idx + if s:tlist_cur_file_idx == fidx + let s:tlist_cur_file_idx = -1 + endif + endif +endfunction + +" Tlist_Window_Goto_Window +" Goto the taglist window +function! s:Tlist_Window_Goto_Window() + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + if winnr() != winnum + call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') + endif + endif +endfunction + +" Tlist_Window_Create +" Create a new taglist window. If it is already open, jump to it +function! s:Tlist_Window_Create() + call s:Tlist_Log_Msg('Tlist_Window_Create()') + " If the window is open, jump to it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Jump to the existing window + if winnr() != winnum + exe winnum . 'wincmd w' + endif + return + endif + + " If used with winmanager don't open windows. Winmanager will handle + " the window/buffer management + if s:tlist_app_name == "winmanager" + return + endif + + " Create a new window. If user prefers a horizontal window, then open + " a horizontally split window. Otherwise open a vertically split + " window + if g:Tlist_Use_Horiz_Window + " Open a horizontally split window + let win_dir = 'botright' + " Horizontal window height + let win_size = g:Tlist_WinHeight + else + if s:tlist_winsize_chgd == -1 + " Open a vertically split window. Increase the window size, if + " needed, to accomodate the new window + if g:Tlist_Inc_Winwidth && + \ &columns < (80 + g:Tlist_WinWidth) + " Save the original window position + let s:tlist_pre_winx = getwinposx() + let s:tlist_pre_winy = getwinposy() + + " one extra column is needed to include the vertical split + let &columns= &columns + g:Tlist_WinWidth + 1 + + let s:tlist_winsize_chgd = 1 + else + let s:tlist_winsize_chgd = 0 + endif + endif + + if g:Tlist_Use_Right_Window + " Open the window at the rightmost place + let win_dir = 'botright vertical' + else + " Open the window at the leftmost place + let win_dir = 'topleft vertical' + endif + let win_size = g:Tlist_WinWidth + endif + + " If the tag listing temporary buffer already exists, then reuse it. + " Otherwise create a new buffer + let bufnum = bufnr(g:TagList_title) + if bufnum == -1 + " Create a new buffer + let wcmd = g:TagList_title + else + " Edit the existing buffer + let wcmd = '+buffer' . bufnum + endif + + " Create the taglist window + exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd + + " Save the new window position + let s:tlist_winx = getwinposx() + let s:tlist_winy = getwinposy() + + " Initialize the taglist window + call s:Tlist_Window_Init() +endfunction + +" Tlist_Window_Zoom +" Zoom (maximize/minimize) the taglist window +function! s:Tlist_Window_Zoom() + if s:tlist_win_maximized + " Restore the window back to the previous size + if g:Tlist_Use_Horiz_Window + exe 'resize ' . g:Tlist_WinHeight + else + exe 'vert resize ' . g:Tlist_WinWidth + endif + let s:tlist_win_maximized = 0 + else + " Set the window size to the maximum possible without closing other + " windows + if g:Tlist_Use_Horiz_Window + resize + else + vert resize + endif + let s:tlist_win_maximized = 1 + endif +endfunction + +" Tlist_Ballon_Expr +" When the mouse cursor is over a tag in the taglist window, display the +" tag prototype (balloon) +function! Tlist_Ballon_Expr() + " Get the file index + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(v:beval_lnum) + if fidx == -1 + return '' + endif + + " Get the tag output line for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, v:beval_lnum) + if tidx == 0 + return '' + endif + + " Get the tag search pattern and display it + return s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Window_Check_Width +" Check the width of the taglist window. For horizontally split windows, the +" 'winfixheight' option is used to fix the height of the window. For +" vertically split windows, Vim doesn't support the 'winfixwidth' option. So +" need to handle window width changes from this function. +function! s:Tlist_Window_Check_Width() + let tlist_winnr = bufwinnr(g:TagList_title) + if tlist_winnr == -1 + return + endif + + let width = winwidth(tlist_winnr) + if width != g:Tlist_WinWidth + call s:Tlist_Log_Msg("Tlist_Window_Check_Width: Changing window " . + \ "width from " . width . " to " . g:Tlist_WinWidth) + let save_winnr = winnr() + if save_winnr != tlist_winnr + call s:Tlist_Exe_Cmd_No_Acmds(tlist_winnr . 'wincmd w') + endif + exe 'vert resize ' . g:Tlist_WinWidth + if save_winnr != tlist_winnr + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + endif +endfunction + +" Tlist_Window_Exit_Only_Window +" If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the +" taglist window is present. +function! s:Tlist_Window_Exit_Only_Window() + " Before quitting Vim, delete the taglist buffer so that + " the '0 mark is correctly set to the previous buffer. + if v:version < 700 + if winbufnr(2) == -1 + bdelete + quit + endif + else + if winbufnr(2) == -1 + if tabpagenr('$') == 1 + " Only one tag page is present + bdelete + quit + else + " More than one tab page is present. Close only the current + " tab page + close + endif + endif + endif +endfunction + +" Tlist_Window_Init +" Set the default options for the taglist window +function! s:Tlist_Window_Init() + call s:Tlist_Log_Msg('Tlist_Window_Init()') + + " The 'readonly' option should not be set for the taglist buffer. + " If Vim is started as "view/gview" or if the ":view" command is + " used, then the 'readonly' option is set for all the buffers. + " Unset it for the taglist buffer + setlocal noreadonly + + " Set the taglist buffer filetype to taglist + setlocal filetype=taglist + + " Define taglist window element highlighting + syntax match TagListComment '^" .*' + syntax match TagListFileName '^[^" ].*$' + syntax match TagListTitle '^ \S.*$' + syntax match TagListTagScope '\s\[.\{-\}\]$' + + " Define the highlighting only if colors are supported + if has('gui_running') || &t_Co > 2 + " Colors to highlight various taglist window elements + " If user defined highlighting group exists, then use them. + " Otherwise, use default highlight groups. + if hlexists('MyTagListTagName') + highlight link TagListTagName MyTagListTagName + else + highlight default link TagListTagName Search + endif + " Colors to highlight comments and titles + if hlexists('MyTagListComment') + highlight link TagListComment MyTagListComment + else + highlight clear TagListComment + highlight default link TagListComment Comment + endif + if hlexists('MyTagListTitle') + highlight link TagListTitle MyTagListTitle + else + highlight clear TagListTitle + highlight default link TagListTitle Title + endif + if hlexists('MyTagListFileName') + highlight link TagListFileName MyTagListFileName + else + highlight clear TagListFileName + highlight default TagListFileName guibg=Grey ctermbg=darkgray + \ guifg=white ctermfg=white + endif + if hlexists('MyTagListTagScope') + highlight link TagListTagScope MyTagListTagScope + else + highlight clear TagListTagScope + highlight default link TagListTagScope Identifier + endif + else + highlight default TagListTagName term=reverse cterm=reverse + endif + + " Folding related settings + setlocal foldenable + setlocal foldminlines=0 + setlocal foldmethod=manual + setlocal foldlevel=9999 + if g:Tlist_Enable_Fold_Column + setlocal foldcolumn=3 + else + setlocal foldcolumn=0 + endif + setlocal foldtext=v:folddashes.getline(v:foldstart) + + if s:tlist_app_name != "winmanager" + " Mark buffer as scratch + silent! setlocal buftype=nofile + if s:tlist_app_name == "none" + silent! setlocal bufhidden=delete + endif + silent! setlocal noswapfile + " Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted + " buffers. So if the taglist buffer is unlisted, multiple taglist + " windows will be opened. This bug is fixed in Vim 6.1 and above + if v:version >= 601 + silent! setlocal nobuflisted + endif + endif + + silent! setlocal nowrap + + " If the 'number' option is set in the source window, it will affect the + " taglist window. So forcefully disable 'number' option for the taglist + " window + silent! setlocal nonumber + + " Use fixed height when horizontally split window is used + if g:Tlist_Use_Horiz_Window + if v:version >= 602 + set winfixheight + endif + endif + if !g:Tlist_Use_Horiz_Window && v:version >= 700 + set winfixwidth + endif + + " Setup balloon evaluation to display tag prototype + if v:version >= 700 && has('balloon_eval') + setlocal balloonexpr=Tlist_Ballon_Expr() + set ballooneval + endif + + " Setup the cpoptions properly for the maps to work + let old_cpoptions = &cpoptions + set cpoptions&vim + + " Create buffer local mappings for jumping to the tags and sorting the list + nnoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + nnoremap o + \ :call Tlist_Window_Jump_To_Tag('newwin') + nnoremap p + \ :call Tlist_Window_Jump_To_Tag('preview') + nnoremap P + \ :call Tlist_Window_Jump_To_Tag('prevwin') + if v:version >= 700 + nnoremap t + \ :call Tlist_Window_Jump_To_Tag('checktab') + nnoremap + \ :call Tlist_Window_Jump_To_Tag('newtab') + endif + nnoremap <2-LeftMouse> + \ :call Tlist_Window_Jump_To_Tag('useopen') + nnoremap s + \ :call Tlist_Change_Sort('cmd', 'toggle', '') + nnoremap + :silent! foldopen + nnoremap - :silent! foldclose + nnoremap * :silent! %foldopen! + nnoremap = :silent! %foldclose + nnoremap :silent! foldopen + nnoremap :silent! foldclose + nnoremap :silent! %foldopen! + nnoremap :call Tlist_Window_Show_Info() + nnoremap u :call Tlist_Window_Update_File() + nnoremap d :call Tlist_Remove_File(-1, 1) + nnoremap x :call Tlist_Window_Zoom() + nnoremap [[ :call Tlist_Window_Move_To_File(-1) + nnoremap :call Tlist_Window_Move_To_File(-1) + nnoremap ]] :call Tlist_Window_Move_To_File(1) + nnoremap :call Tlist_Window_Move_To_File(1) + nnoremap :call Tlist_Window_Toggle_Help_Text() + nnoremap q :close + + " Insert mode mappings + inoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + " Windows needs return + inoremap + \ :call Tlist_Window_Jump_To_Tag('useopen') + inoremap o + \ :call Tlist_Window_Jump_To_Tag('newwin') + inoremap p + \ :call Tlist_Window_Jump_To_Tag('preview') + inoremap P + \ :call Tlist_Window_Jump_To_Tag('prevwin') + if v:version >= 700 + inoremap t + \ :call Tlist_Window_Jump_To_Tag('checktab') + inoremap + \ :call Tlist_Window_Jump_To_Tag('newtab') + endif + inoremap <2-LeftMouse> + \ :call Tlist_Window_Jump_To_Tag('useopen') + inoremap s + \ :call Tlist_Change_Sort('cmd', 'toggle', '') + inoremap + :silent! foldopen + inoremap - :silent! foldclose + inoremap * :silent! %foldopen! + inoremap = :silent! %foldclose + inoremap :silent! foldopen + inoremap :silent! foldclose + inoremap :silent! %foldopen! + inoremap :call + \ Tlist_Window_Show_Info() + inoremap u + \ :call Tlist_Window_Update_File() + inoremap d :call Tlist_Remove_File(-1, 1) + inoremap x :call Tlist_Window_Zoom() + inoremap [[ :call Tlist_Window_Move_To_File(-1) + inoremap :call Tlist_Window_Move_To_File(-1) + inoremap ]] :call Tlist_Window_Move_To_File(1) + inoremap :call Tlist_Window_Move_To_File(1) + inoremap :call Tlist_Window_Toggle_Help_Text() + inoremap q :close + + " Map single left mouse click if the user wants this functionality + if g:Tlist_Use_SingleClick == 1 + " Contributed by Bindu Wavell + " attempt to perform single click mapping, it would be much + " nicer if we could nnoremap ... however vim does + " not fire the when you use the mouse + " to enter a buffer. + let clickmap = ':if bufname("%") =~ "__Tag_List__" ' . + \ 'call Tlist_Window_Jump_To_Tag("useopen") ' . + \ ' endif ' + if maparg('', 'n') == '' + " no mapping for leftmouse + exe ':nnoremap ' . clickmap + else + " we have a mapping + let mapcmd = ':nnoremap ' + let mapcmd = mapcmd . substitute(substitute( + \ maparg('', 'n'), '|', '', 'g'), + \ '\c^', '', '') + let mapcmd = mapcmd . clickmap + exe mapcmd + endif + endif + + " Define the taglist autocommands + augroup TagListAutoCmds + autocmd! + " Display the tag prototype for the tag under the cursor. + autocmd CursorHold __Tag_List__ call s:Tlist_Window_Show_Info() + " Highlight the current tag periodically + autocmd CursorHold * silent call s:Tlist_Window_Highlight_Tag( + \ fnamemodify(bufname('%'), ':p'), line('.'), 1, 0) + + " Adjust the Vim window width when taglist window is closed + autocmd BufUnload __Tag_List__ call s:Tlist_Post_Close_Cleanup() + " Close the fold for this buffer when leaving the buffer + if g:Tlist_File_Fold_Auto_Close + autocmd BufEnter * silent + \ call s:Tlist_Window_Open_File_Fold(expand('')) + endif + " Exit Vim itself if only the taglist window is present (optional) + if g:Tlist_Exit_OnlyWindow + autocmd BufEnter __Tag_List__ nested + \ call s:Tlist_Window_Exit_Only_Window() + endif + if s:tlist_app_name != "winmanager" && + \ !g:Tlist_Process_File_Always && + \ (!has('gui_running') || !g:Tlist_Show_Menu) + " Auto refresh the taglist window + autocmd BufEnter * call s:Tlist_Refresh() + endif + + if !g:Tlist_Use_Horiz_Window + if v:version < 700 + autocmd WinEnter * call s:Tlist_Window_Check_Width() + endif + endif + if v:version >= 700 + autocmd TabEnter * silent call s:Tlist_Refresh_Folds() + endif + augroup end + + " Restore the previous cpoptions settings + let &cpoptions = old_cpoptions +endfunction + +" Tlist_Window_Refresh +" Display the tags for all the files in the taglist window +function! s:Tlist_Window_Refresh() + call s:Tlist_Log_Msg('Tlist_Window_Refresh()') + " Set report option to a huge value to prevent informational messages + " while deleting the lines + let old_report = &report + set report=99999 + + " Mark the buffer as modifiable + setlocal modifiable + + " Delete the contents of the buffer to the black-hole register + silent! %delete _ + + " As we have cleared the taglist window, mark all the files + " as not visible + let i = 0 + while i < s:tlist_file_count + let s:tlist_{i}_visible = 0 + let i = i + 1 + endwhile + + if g:Tlist_Compact_Format == 0 + " Display help in non-compact mode + call s:Tlist_Window_Display_Help() + endif + + " Mark the buffer as not modifiable + setlocal nomodifiable + + " Restore the report option + let &report = old_report + + " If the tags for only one file should be displayed in the taglist + " window, then no need to add the tags here. The bufenter autocommand + " will add the tags for that file. + if g:Tlist_Show_One_File + return + endif + + " List all the tags for the previously processed files + " Do this only if taglist is configured to display tags for more than + " one file. Otherwise, when Tlist_Show_One_File is configured, + " tags for the wrong file will be displayed. + let i = 0 + while i < s:tlist_file_count + call s:Tlist_Window_Refresh_File(s:tlist_{i}_filename, + \ s:tlist_{i}_filetype) + let i = i + 1 + endwhile + + if g:Tlist_Auto_Update + " Add and list the tags for all buffers in the Vim buffer list + let i = 1 + let last_bufnum = bufnr('$') + while i <= last_bufnum + if buflisted(i) + let fname = fnamemodify(bufname(i), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype(i) + " If the file doesn't support tag listing, skip it + if !s:Tlist_Skip_File(fname, ftype) + call s:Tlist_Window_Refresh_File(fname, ftype) + endif + endif + let i = i + 1 + endwhile + endif + + " If Tlist_File_Fold_Auto_Close option is set, then close all the folds + if g:Tlist_File_Fold_Auto_Close + " Close all the folds + silent! %foldclose + endif + + " Move the cursor to the top of the taglist window + normal! gg +endfunction + +" Tlist_Post_Close_Cleanup() +" Close the taglist window and adjust the Vim window width +function! s:Tlist_Post_Close_Cleanup() + call s:Tlist_Log_Msg('Tlist_Post_Close_Cleanup()') + " Mark all the files as not visible + let i = 0 + while i < s:tlist_file_count + let s:tlist_{i}_visible = 0 + let i = i + 1 + endwhile + + " Remove the taglist autocommands + silent! autocmd! TagListAutoCmds + + " Clear all the highlights + match none + + silent! syntax clear TagListTitle + silent! syntax clear TagListComment + silent! syntax clear TagListTagScope + + " Remove the left mouse click mapping if it was setup initially + if g:Tlist_Use_SingleClick + if hasmapto('') + nunmap + endif + endif + + if s:tlist_app_name != "winmanager" + if g:Tlist_Use_Horiz_Window || g:Tlist_Inc_Winwidth == 0 || + \ s:tlist_winsize_chgd != 1 || + \ &columns < (80 + g:Tlist_WinWidth) + " No need to adjust window width if using horizontally split taglist + " window or if columns is less than 101 or if the user chose not to + " adjust the window width + else + " If the user didn't manually move the window, then restore the window + " position to the pre-taglist position + if s:tlist_pre_winx != -1 && s:tlist_pre_winy != -1 && + \ getwinposx() == s:tlist_winx && + \ getwinposy() == s:tlist_winy + exe 'winpos ' . s:tlist_pre_winx . ' ' . s:tlist_pre_winy + endif + + " Adjust the Vim window width + let &columns= &columns - (g:Tlist_WinWidth + 1) + endif + endif + + let s:tlist_winsize_chgd = -1 + + " Reset taglist state variables + if s:tlist_app_name == "winmanager" + let s:tlist_app_name = "none" + endif + let s:tlist_window_initialized = 0 +endfunction + +" Tlist_Window_Refresh_File() +" List the tags defined in the specified file in a Vim window +function! s:Tlist_Window_Refresh_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Window_Refresh_File (' . a:filename . ')') + " First check whether the file already exists + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx != -1 + let file_listed = 1 + else + let file_listed = 0 + endif + + if !file_listed + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(a:filename) + return + endif + endif + + if file_listed && s:tlist_{fidx}_visible + " Check whether the file tags are currently valid + if s:tlist_{fidx}_valid + " Goto the first line in the file + exe s:tlist_{fidx}_start + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + endif + return + endif + + " Discard and remove the tags for this file from display + call s:Tlist_Discard_TagInfo(fidx) + call s:Tlist_Window_Remove_File_From_Display(fidx) + endif + + " Process and generate a list of tags defined in the file + if !file_listed || !s:tlist_{fidx}_valid + let ret_fidx = s:Tlist_Process_File(a:filename, a:ftype) + if ret_fidx == -1 + return + endif + let fidx = ret_fidx + endif + + " Set report option to a huge value to prevent informational messages + " while adding lines to the taglist window + let old_report = &report + set report=99999 + + if g:Tlist_Show_One_File + " Remove the previous file + if s:tlist_cur_file_idx != -1 + call s:Tlist_Window_Remove_File_From_Display(s:tlist_cur_file_idx) + let s:tlist_{s:tlist_cur_file_idx}_visible = 0 + let s:tlist_{s:tlist_cur_file_idx}_start = 0 + let s:tlist_{s:tlist_cur_file_idx}_end = 0 + endif + let s:tlist_cur_file_idx = fidx + endif + + " Mark the buffer as modifiable + setlocal modifiable + + " Add new files to the end of the window. For existing files, add them at + " the same line where they were previously present. If the file is not + " visible, then add it at the end + if s:tlist_{fidx}_start == 0 || !s:tlist_{fidx}_visible + if g:Tlist_Compact_Format + let s:tlist_{fidx}_start = line('$') + else + let s:tlist_{fidx}_start = line('$') + 1 + endif + endif + + let s:tlist_{fidx}_visible = 1 + + " Goto the line where this file should be placed + if g:Tlist_Compact_Format + exe s:tlist_{fidx}_start + else + exe s:tlist_{fidx}_start - 1 + endif + + let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' . + \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')' + if g:Tlist_Compact_Format == 0 + silent! put =txt + else + silent! put! =txt + " Move to the next line + exe line('.') + 1 + endif + let file_start = s:tlist_{fidx}_start + + " Add the tag names grouped by tag type to the buffer with a title + let i = 1 + let ttype_cnt = s:tlist_{a:ftype}_count + while i <= ttype_cnt + let ttype = s:tlist_{a:ftype}_{i}_name + " Add the tag type only if there are tags for that type + let fidx_ttype = 's:tlist_' . fidx . '_' . ttype + let ttype_txt = {fidx_ttype} + if ttype_txt != '' + let txt = ' ' . s:tlist_{a:ftype}_{i}_fullname + if g:Tlist_Compact_Format == 0 + let ttype_start_lnum = line('.') + 1 + silent! put =txt + else + let ttype_start_lnum = line('.') + silent! put! =txt + endif + silent! put =ttype_txt + + let {fidx_ttype}_offset = ttype_start_lnum - file_start + + " create a fold for this tag type + let fold_start = ttype_start_lnum + let fold_end = fold_start + {fidx_ttype}_count + exe fold_start . ',' . fold_end . 'fold' + + " Adjust the cursor position + if g:Tlist_Compact_Format == 0 + exe ttype_start_lnum + {fidx_ttype}_count + else + exe ttype_start_lnum + {fidx_ttype}_count + 1 + endif + + if g:Tlist_Compact_Format == 0 + " Separate the tag types by a empty line + silent! put ='' + endif + endif + let i = i + 1 + endwhile + + if s:tlist_{fidx}_tag_count == 0 + if g:Tlist_Compact_Format == 0 + silent! put ='' + endif + endif + + let s:tlist_{fidx}_end = line('.') - 1 + + " Create a fold for the entire file + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' + exe 'silent! ' . s:tlist_{fidx}_start . ',' . + \ s:tlist_{fidx}_end . 'foldopen!' + + " Goto the starting line for this file, + exe s:tlist_{fidx}_start + + if s:tlist_app_name == "winmanager" + " To handle a bug in the winmanager plugin, add a space at the + " last line + call setline('$', ' ') + endif + + " Mark the buffer as not modifiable + setlocal nomodifiable + + " Restore the report option + let &report = old_report + + " Update the start and end line numbers for all the files following this + " file + let start = s:tlist_{fidx}_start + " include the empty line after the last line + if g:Tlist_Compact_Format + let end = s:tlist_{fidx}_end + else + let end = s:tlist_{fidx}_end + 1 + endif + call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1) + + " Now that we have updated the taglist window, update the tags + " menu (if present) + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(1) + endif +endfunction + +" Tlist_Init_File +" Initialize the variables for a new file +function! s:Tlist_Init_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')') + " Add new files at the end of the list + let fidx = s:tlist_file_count + let s:tlist_file_count = s:tlist_file_count + 1 + " Add the new file name to the taglist list of file names + let s:tlist_file_names = s:tlist_file_names . a:filename . "\n" + + " Initialize the file variables + let s:tlist_{fidx}_filename = a:filename + let s:tlist_{fidx}_sort_type = g:Tlist_Sort_Type + let s:tlist_{fidx}_filetype = a:ftype + let s:tlist_{fidx}_mtime = -1 + let s:tlist_{fidx}_start = 0 + let s:tlist_{fidx}_end = 0 + let s:tlist_{fidx}_valid = 0 + let s:tlist_{fidx}_visible = 0 + let s:tlist_{fidx}_tag_count = 0 + let s:tlist_{fidx}_menu_cmd = '' + + " Initialize the tag type variables + let i = 1 + while i <= s:tlist_{a:ftype}_count + let ttype = s:tlist_{a:ftype}_{i}_name + let s:tlist_{fidx}_{ttype} = '' + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = 0 + let i = i + 1 + endwhile + + return fidx +endfunction + +" Tlist_Get_Tag_Type_By_Tag +" Return the tag type for the specified tag index +function! s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) + let ttype_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_type' + + " Already parsed and have the tag name + if exists(ttype_var) + return {ttype_var} + endif + + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let {ttype_var} = s:Tlist_Extract_Tagtype(tag_line) + + return {ttype_var} +endfunction + +" Tlist_Get_Tag_Prototype +function! s:Tlist_Get_Tag_Prototype(fidx, tidx) + let tproto_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_proto' + + " Already parsed and have the tag prototype + if exists(tproto_var) + return {tproto_var} + endif + + " Parse and extract the tag prototype + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = stridx(tag_line, '/^') + 2 + let end = stridx(tag_line, '/;"' . "\t") + if tag_line[end - 1] == '$' + let end = end -1 + endif + let tag_proto = strpart(tag_line, start, end - start) + let {tproto_var} = substitute(tag_proto, '\s*', '', '') + + return {tproto_var} +endfunction + +" Tlist_Get_Tag_SearchPat +function! s:Tlist_Get_Tag_SearchPat(fidx, tidx) + let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat' + + " Already parsed and have the tag search pattern + if exists(tpat_var) + return {tpat_var} + endif + + " Parse and extract the tag search pattern + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = stridx(tag_line, '/^') + 2 + let end = stridx(tag_line, '/;"' . "\t") + if tag_line[end - 1] == '$' + let end = end -1 + endif + let {tpat_var} = '\V\^' . strpart(tag_line, start, end - start) . + \ (tag_line[end] == '$' ? '\$' : '') + + return {tpat_var} +endfunction + +" Tlist_Get_Tag_Linenum +" Return the tag line number, given the tag index +function! s:Tlist_Get_Tag_Linenum(fidx, tidx) + let tline_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_linenum' + + " Already parsed and have the tag line number + if exists(tline_var) + return {tline_var} + endif + + " Parse and extract the tag line number + let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag + let start = strridx(tag_line, 'line:') + 5 + let end = strridx(tag_line, "\t") + if end < start + let {tline_var} = strpart(tag_line, start) + 0 + else + let {tline_var} = strpart(tag_line, start, end - start) + 0 + endif + + return {tline_var} +endfunction + +" Tlist_Parse_Tagline +" Parse a tag line from the ctags output. Separate the tag output based on the +" tag type and store it in the tag type variable. +" The format of each line in the ctags output is: +" +" tag_namefile_nameex_cmd;"extension_fields +" +function! s:Tlist_Parse_Tagline(tag_line) + if a:tag_line == '' + " Skip empty lines + return + endif + + " Extract the tag type + let ttype = s:Tlist_Extract_Tagtype(a:tag_line) + + " Make sure the tag type is a valid and supported one + if ttype == '' || stridx(s:ctags_flags, ttype) == -1 + " Line is not in proper tags format or Tag type is not supported + return + endif + + " Update the total tag count + let s:tidx = s:tidx + 1 + + " The following variables are used to optimize this code. Vim is slow in + " using curly brace names. To reduce the amount of processing needed, the + " curly brace variables are pre-processed here + let fidx_tidx = 's:tlist_' . s:fidx . '_' . s:tidx + let fidx_ttype = 's:tlist_' . s:fidx . '_' . ttype + + " Update the count of this tag type + let ttype_idx = {fidx_ttype}_count + 1 + let {fidx_ttype}_count = ttype_idx + + " Store the ctags output for this tag + let {fidx_tidx}_tag = a:tag_line + + " Store the tag index and the tag type index (back pointers) + let {fidx_ttype}_{ttype_idx} = s:tidx + let {fidx_tidx}_ttype_idx = ttype_idx + + " Extract the tag name + let tag_name = strpart(a:tag_line, 0, stridx(a:tag_line, "\t")) + + " Extract the tag scope/prototype + if g:Tlist_Display_Prototype + let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(s:fidx, s:tidx) + else + let ttxt = ' ' . tag_name + + " Add the tag scope, if it is available and is configured. Tag + " scope is the last field after the 'line:\t' field + if g:Tlist_Display_Tag_Scope + let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line) + if tag_scope != '' + let ttxt = ttxt . ' [' . tag_scope . ']' + endif + endif + endif + + " Add this tag to the tag type variable + let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" + + " Save the tag name + let {fidx_tidx}_tag_name = tag_name +endfunction + +" Tlist_Process_File +" Get the list of tags defined in the specified file and store them +" in Vim variables. Returns the file index where the tags are stored. +function! s:Tlist_Process_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Process_File (' . a:filename . ', ' . + \ a:ftype . ')') + " Check whether this file is supported + if s:Tlist_Skip_File(a:filename, a:ftype) + return -1 + endif + + " If the tag types for this filetype are not yet created, then create + " them now + let var = 's:tlist_' . a:ftype . '_count' + if !exists(var) + if s:Tlist_FileType_Init(a:ftype) == 0 + return -1 + endif + endif + + " If this file is already processed, then use the cached values + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + " First time, this file is loaded + let fidx = s:Tlist_Init_File(a:filename, a:ftype) + else + " File was previously processed. Discard the tag information + call s:Tlist_Discard_TagInfo(fidx) + endif + + let s:tlist_{fidx}_valid = 1 + + " Exuberant ctags arguments to generate a tag list + let ctags_args = ' -f - --format=2 --excmd=pattern --fields=nks ' + + " Form the ctags argument depending on the sort type + if s:tlist_{fidx}_sort_type == 'name' + let ctags_args = ctags_args . '--sort=yes' + else + let ctags_args = ctags_args . '--sort=no' + endif + + " Add the filetype specific arguments + let ctags_args = ctags_args . ' ' . s:tlist_{a:ftype}_ctags_args + + " Ctags command to produce output with regexp for locating the tags + let ctags_cmd = g:Tlist_Ctags_Cmd . ctags_args + let ctags_cmd = ctags_cmd . ' "' . a:filename . '"' + + if &shellxquote == '"' + " Double-quotes within double-quotes will not work in the + " command-line.If the 'shellxquote' option is set to double-quotes, + " then escape the double-quotes in the ctags command-line. + let ctags_cmd = escape(ctags_cmd, '"') + endif + + " In Windows 95, if not using cygwin, disable the 'shellslash' + " option. Otherwise, this will cause problems when running the + " ctags command. + if has('win95') && !has('win32unix') + let old_shellslash = &shellslash + set noshellslash + endif + + if has('win32') && !has('win32unix') && !has('win95') + \ && (&shell =~ 'cmd.exe') + " Windows does not correctly deal with commands that have more than 1 + " set of double quotes. It will strip them all resulting in: + " 'C:\Program' is not recognized as an internal or external command + " operable program or batch file. To work around this, place the + " command inside a batch file and call the batch file. + " Do this only on Win2K, WinXP and above. + " Contributed by: David Fishburn. + let s:taglist_tempfile = fnamemodify(tempname(), ':h') . + \ '\taglist.cmd' + exe 'redir! > ' . s:taglist_tempfile + silent echo ctags_cmd + redir END + + call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd) + let ctags_cmd = '"' . s:taglist_tempfile . '"' + endif + + call s:Tlist_Log_Msg('Cmd: ' . ctags_cmd) + + " Run ctags and get the tag list + let cmd_output = system(ctags_cmd) + + " Restore the value of the 'shellslash' option. + if has('win95') && !has('win32unix') + let &shellslash = old_shellslash + endif + + if exists('s:taglist_tempfile') + " Delete the temporary cmd file created on MS-Windows + call delete(s:taglist_tempfile) + endif + + " Handle errors + if v:shell_error + let msg = "Taglist: Failed to generate tags for " . a:filename + call s:Tlist_Warning_Msg(msg) + if cmd_output != '' + call s:Tlist_Warning_Msg(cmd_output) + endif + return fidx + endif + + " Store the modification time for the file + let s:tlist_{fidx}_mtime = getftime(a:filename) + + " No tags for current file + if cmd_output == '' + call s:Tlist_Log_Msg('No tags defined in ' . a:filename) + return fidx + endif + + call s:Tlist_Log_Msg('Generated tags information for ' . a:filename) + + if v:version > 601 + " The following script local variables are used by the + " Tlist_Parse_Tagline() function. + let s:ctags_flags = s:tlist_{a:ftype}_ctags_flags + let s:fidx = fidx + let s:tidx = 0 + + " Process the ctags output one line at a time. The substitute() + " command is used to parse the tag lines instead of using the + " matchstr()/stridx()/strpart() functions for performance reason + call substitute(cmd_output, "\\([^\n]\\+\\)\n", + \ '\=s:Tlist_Parse_Tagline(submatch(1))', 'g') + + " Save the number of tags for this file + let s:tlist_{fidx}_tag_count = s:tidx + + " The following script local variables are no longer needed + unlet! s:ctags_flags + unlet! s:tidx + unlet! s:fidx + else + " Due to a bug in Vim earlier than version 6.1, + " we cannot use substitute() to parse the ctags output. + " Instead the slow str*() functions are used + let ctags_flags = s:tlist_{a:ftype}_ctags_flags + let tidx = 0 + + while cmd_output != '' + " Extract one line at a time + let idx = stridx(cmd_output, "\n") + let one_line = strpart(cmd_output, 0, idx) + " Remove the line from the tags output + let cmd_output = strpart(cmd_output, idx + 1) + + if one_line == '' + " Line is not in proper tags format + continue + endif + + " Extract the tag type + let ttype = s:Tlist_Extract_Tagtype(one_line) + + " Make sure the tag type is a valid and supported one + if ttype == '' || stridx(ctags_flags, ttype) == -1 + " Line is not in proper tags format or Tag type is not + " supported + continue + endif + + " Update the total tag count + let tidx = tidx + 1 + + " The following variables are used to optimize this code. Vim is + " slow in using curly brace names. To reduce the amount of + " processing needed, the curly brace variables are pre-processed + " here + let fidx_tidx = 's:tlist_' . fidx . '_' . tidx + let fidx_ttype = 's:tlist_' . fidx . '_' . ttype + + " Update the count of this tag type + let ttype_idx = {fidx_ttype}_count + 1 + let {fidx_ttype}_count = ttype_idx + + " Store the ctags output for this tag + let {fidx_tidx}_tag = one_line + + " Store the tag index and the tag type index (back pointers) + let {fidx_ttype}_{ttype_idx} = tidx + let {fidx_tidx}_ttype_idx = ttype_idx + + " Extract the tag name + let tag_name = strpart(one_line, 0, stridx(one_line, "\t")) + + " Extract the tag scope/prototype + if g:Tlist_Display_Prototype + let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(fidx, tidx) + else + let ttxt = ' ' . tag_name + + " Add the tag scope, if it is available and is configured. Tag + " scope is the last field after the 'line:\t' field + if g:Tlist_Display_Tag_Scope + let tag_scope = s:Tlist_Extract_Tag_Scope(one_line) + if tag_scope != '' + let ttxt = ttxt . ' [' . tag_scope . ']' + endif + endif + endif + + " Add this tag to the tag type variable + let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" + + " Save the tag name + let {fidx_tidx}_tag_name = tag_name + endwhile + + " Save the number of tags for this file + let s:tlist_{fidx}_tag_count = tidx + endif + + call s:Tlist_Log_Msg('Processed ' . s:tlist_{fidx}_tag_count . + \ ' tags in ' . a:filename) + + return fidx +endfunction + +" Tlist_Update_File +" Update the tags for a file (if needed) +function! Tlist_Update_File(filename, ftype) + call s:Tlist_Log_Msg('Tlist_Update_File (' . a:filename . ')') + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(a:filename, a:ftype) + return + endif + + " Convert the file name to a full path + let fname = fnamemodify(a:filename, ':p') + + " First check whether the file already exists + let fidx = s:Tlist_Get_File_Index(fname) + + if fidx != -1 && s:tlist_{fidx}_valid + " File exists and the tags are valid + " Check whether the file was modified after the last tags update + " If it is modified, then update the tags + if s:tlist_{fidx}_mtime == getftime(fname) + return + endif + else + " If the tags were removed previously based on a user request, + " as we are going to update the tags (based on the user request), + " remove the filename from the deleted list + call s:Tlist_Update_Remove_List(fname, 0) + endif + + " If the taglist window is opened, update it + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + " Taglist window is not present. Just update the taglist + " and return + call s:Tlist_Process_File(fname, a:ftype) + else + if g:Tlist_Show_One_File && s:tlist_cur_file_idx != -1 + " If tags for only one file are displayed and we are not + " updating the tags for that file, then no need to + " refresh the taglist window. Otherwise, the taglist + " window should be updated. + if s:tlist_{s:tlist_cur_file_idx}_filename != fname + call s:Tlist_Process_File(fname, a:ftype) + return + endif + endif + + " Save the current window number + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + " Save the cursor position + let save_line = line('.') + let save_col = col('.') + + " Update the taglist window + call s:Tlist_Window_Refresh_File(fname, a:ftype) + + " Restore the cursor position + if v:version >= 601 + call cursor(save_line, save_col) + else + exe save_line + exe 'normal! ' . save_col . '|' + endif + + if winnr() != save_winnr + " Go back to the original window + call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') + endif + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(1) + endif +endfunction + +" Tlist_Window_Close +" Close the taglist window +function! s:Tlist_Window_Close() + call s:Tlist_Log_Msg('Tlist_Window_Close()') + " Make sure the taglist window exists + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Error: Taglist window is not open') + return + endif + + if winnr() == winnum + " Already in the taglist window. Close it and return + if winbufnr(2) != -1 + " If a window other than the taglist window is open, + " then only close the taglist window. + close + endif + else + " Goto the taglist window, close it and then come back to the + " original window + let curbufnr = bufnr('%') + exe winnum . 'wincmd w' + close + " Need to jump back to the original window only if we are not + " already in that window + let winnum = bufwinnr(curbufnr) + if winnr() != winnum + exe winnum . 'wincmd w' + endif + endif +endfunction + +" Tlist_Window_Mark_File_Window +" Mark the current window as the file window to use when jumping to a tag. +" Only if the current window is a non-plugin, non-preview and non-taglist +" window +function! s:Tlist_Window_Mark_File_Window() + if getbufvar('%', '&buftype') == '' && !&previewwindow + let w:tlist_file_window = "yes" + endif +endfunction + +" Tlist_Window_Open +" Open and refresh the taglist window +function! s:Tlist_Window_Open() + call s:Tlist_Log_Msg('Tlist_Window_Open()') + " If the window is open, jump to it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + " Jump to the existing window + if winnr() != winnum + exe winnum . 'wincmd w' + endif + return + endif + + if s:tlist_app_name == "winmanager" + " Taglist plugin is no longer part of the winmanager app + let s:tlist_app_name = "none" + endif + + " Get the filename and filetype for the specified buffer + let curbuf_name = fnamemodify(bufname('%'), ':p') + let curbuf_ftype = s:Tlist_Get_Buffer_Filetype('%') + let cur_lnum = line('.') + + " Mark the current window as the desired window to open a file when a tag + " is selected. + call s:Tlist_Window_Mark_File_Window() + + " Open the taglist window + call s:Tlist_Window_Create() + + call s:Tlist_Window_Refresh() + + if g:Tlist_Show_One_File + " Add only the current buffer and file + " + " If the file doesn't support tag listing, skip it + if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype) + call s:Tlist_Window_Refresh_File(curbuf_name, curbuf_ftype) + endif + endif + + if g:Tlist_File_Fold_Auto_Close + " Open the fold for the current file, as all the folds in + " the taglist window are closed + let fidx = s:Tlist_Get_File_Index(curbuf_name) + if fidx != -1 + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + endif + endif + + " Highlight the current tag + call s:Tlist_Window_Highlight_Tag(curbuf_name, cur_lnum, 1, 1) +endfunction + +" Tlist_Window_Toggle() +" Open or close a taglist window +function! s:Tlist_Window_Toggle() + call s:Tlist_Log_Msg('Tlist_Window_Toggle()') + " If taglist window is open then close it. + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + call s:Tlist_Window_Close() + return + endif + + call s:Tlist_Window_Open() + + " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not + " set + if !g:Tlist_GainFocus_On_ToggleOpen + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif +endfunction + +" Tlist_Process_Filelist +" Process multiple files. Each filename is separated by "\n" +" Returns the number of processed files +function! s:Tlist_Process_Filelist(file_names) + let flist = a:file_names + + " Enable lazy screen updates + let old_lazyredraw = &lazyredraw + set lazyredraw + + " Keep track of the number of processed files + let fcnt = 0 + + " Process one file at a time + while flist != '' + let nl_idx = stridx(flist, "\n") + let one_file = strpart(flist, 0, nl_idx) + + " Remove the filename from the list + let flist = strpart(flist, nl_idx + 1) + + if one_file == '' + continue + endif + + " Skip directories + if isdirectory(one_file) + continue + endif + + let ftype = s:Tlist_Detect_Filetype(one_file) + + echon "\r " + echon "\rProcessing tags for " . fnamemodify(one_file, ':p:t') + + let fcnt = fcnt + 1 + + call Tlist_Update_File(one_file, ftype) + endwhile + + " Clear the displayed informational messages + echon "\r " + + " Restore the previous state + let &lazyredraw = old_lazyredraw + + return fcnt +endfunction + +" Tlist_Process_Dir +" Process the files in a directory matching the specified pattern +function! s:Tlist_Process_Dir(dir_name, pat) + let flist = glob(a:dir_name . '/' . a:pat) . "\n" + + let fcnt = s:Tlist_Process_Filelist(flist) + + let len = strlen(a:dir_name) + if a:dir_name[len - 1] == '\' || a:dir_name[len - 1] == '/' + let glob_expr = a:dir_name . '*' + else + let glob_expr = a:dir_name . '/*' + endif + let all_files = glob(glob_expr) . "\n" + + while all_files != '' + let nl_idx = stridx(all_files, "\n") + let one_file = strpart(all_files, 0, nl_idx) + + let all_files = strpart(all_files, nl_idx + 1) + if one_file == '' + continue + endif + + " Skip non-directory names + if !isdirectory(one_file) + continue + endif + + echon "\r " + echon "\rProcessing files in directory " . fnamemodify(one_file, ':t') + let fcnt = fcnt + s:Tlist_Process_Dir(one_file, a:pat) + endwhile + + return fcnt +endfunction + +" Tlist_Add_Files_Recursive +" Add files recursively from a directory +function! s:Tlist_Add_Files_Recursive(dir, ...) + let dir_name = fnamemodify(a:dir, ':p') + if !isdirectory(dir_name) + call s:Tlist_Warning_Msg('Error: ' . dir_name . ' is not a directory') + return + endif + + if a:0 == 1 + " User specified file pattern + let pat = a:1 + else + " Default file pattern + let pat = '*' + endif + + echon "\r " + echon "\rProcessing files in directory " . fnamemodify(dir_name, ':t') + let fcnt = s:Tlist_Process_Dir(dir_name, pat) + + echon "\rAdded " . fcnt . " files to the taglist" +endfunction + +" Tlist_Add_Files +" Add the specified list of files to the taglist +function! s:Tlist_Add_Files(...) + let flist = '' + let i = 1 + + " Get all the files matching the file patterns supplied as argument + while i <= a:0 + let flist = flist . glob(a:{i}) . "\n" + let i = i + 1 + endwhile + + if flist == '' + call s:Tlist_Warning_Msg('Error: No matching files are found') + return + endif + + let fcnt = s:Tlist_Process_Filelist(flist) + echon "\rAdded " . fcnt . " files to the taglist" +endfunction + +" Tlist_Extract_Tagtype +" Extract the tag type from the tag text +function! s:Tlist_Extract_Tagtype(tag_line) + " The tag type is after the tag prototype field. The prototype field + " ends with the /;"\t string. We add 4 at the end to skip the characters + " in this special string.. + let start = strridx(a:tag_line, '/;"' . "\t") + 4 + let end = strridx(a:tag_line, 'line:') - 1 + let ttype = strpart(a:tag_line, start, end - start) + + return ttype +endfunction + +" Tlist_Extract_Tag_Scope +" Extract the tag scope from the tag text +function! s:Tlist_Extract_Tag_Scope(tag_line) + let start = strridx(a:tag_line, 'line:') + let end = strridx(a:tag_line, "\t") + if end <= start + return '' + endif + + let tag_scope = strpart(a:tag_line, end + 1) + let tag_scope = strpart(tag_scope, stridx(tag_scope, ':') + 1) + + return tag_scope +endfunction + +" Tlist_Refresh() +" Refresh the taglist +function! s:Tlist_Refresh() + call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' . + \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')') + " If we are entering the buffer from one of the taglist functions, then + " no need to refresh the taglist window again. + if s:Tlist_Skip_Refresh + " We still need to update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif + return + endif + + " If part of the winmanager plugin and not configured to process + " tags always and not configured to display the tags menu, then return + if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always + \ && !g:Tlist_Show_Menu + return + endif + + " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help + if &buftype != '' + return + endif + + let filename = fnamemodify(bufname('%'), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype('%') + + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(filename, ftype) + return + endif + + let tlist_win = bufwinnr(g:TagList_title) + + " If the taglist window is not opened and not configured to process + " tags always and not displaying the tags menu, then return + if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu + return + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(filename) + return + endif + + " If the taglist should not be auto updated, then return + if !g:Tlist_Auto_Update + return + endif + endif + + let cur_lnum = line('.') + + if fidx == -1 + " Update the tags for the file + let fidx = s:Tlist_Process_File(filename, ftype) + else + let mtime = getftime(filename) + if s:tlist_{fidx}_mtime != mtime + " Invalidate the tags listed for this file + let s:tlist_{fidx}_valid = 0 + + " Update the taglist and the window + call Tlist_Update_File(filename, ftype) + + " Store the new file modification time + let s:tlist_{fidx}_mtime = mtime + endif + endif + + " Update the taglist window + if tlist_win != -1 + " Disable screen updates + let old_lazyredraw = &lazyredraw + set nolazyredraw + + " Save the current window number + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + if !g:Tlist_Auto_Highlight_Tag || !g:Tlist_Highlight_Tag_On_BufEnter + " Save the cursor position + let save_line = line('.') + let save_col = col('.') + endif + + " Update the taglist window + call s:Tlist_Window_Refresh_File(filename, ftype) + + " Open the fold for the file + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen!" + + if g:Tlist_Highlight_Tag_On_BufEnter && g:Tlist_Auto_Highlight_Tag + if g:Tlist_Show_One_File && s:tlist_cur_file_idx != fidx + " If displaying tags for only one file in the taglist + " window and about to display the tags for a new file, + " then center the current tag line for the new file + let center_tag_line = 1 + else + let center_tag_line = 0 + endif + + " Highlight the current tag + call s:Tlist_Window_Highlight_Tag(filename, cur_lnum, 1, center_tag_line) + else + " Restore the cursor position + if v:version >= 601 + call cursor(save_line, save_col) + else + exe save_line + exe 'normal! ' . save_col . '|' + endif + endif + + " Jump back to the original window + if save_winnr != winnr() + call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') + endif + + " Restore screen updates + let &lazyredraw = old_lazyredraw + endif + + " Update the taglist menu + if g:Tlist_Show_Menu + call s:Tlist_Menu_Update_File(0) + endif +endfunction + +" Tlist_Change_Sort() +" Change the sort order of the tag listing +" caller == 'cmd', command used in the taglist window +" caller == 'menu', taglist menu +" action == 'toggle', toggle sort from name to order and vice versa +" action == 'set', set the sort order to sort_type +function! s:Tlist_Change_Sort(caller, action, sort_type) + call s:Tlist_Log_Msg('Tlist_Change_Sort (caller = ' . a:caller . + \ ', action = ' . a:action . ', sort_type = ' . a:sort_type . ')') + if a:caller == 'cmd' + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + " Remove the previous highlighting + match none + elseif a:caller == 'menu' + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx == -1 + return + endif + endif + + if a:action == 'toggle' + let sort_type = s:tlist_{fidx}_sort_type + + " Toggle the sort order from 'name' to 'order' and vice versa + if sort_type == 'name' + let s:tlist_{fidx}_sort_type = 'order' + else + let s:tlist_{fidx}_sort_type = 'name' + endif + else + let s:tlist_{fidx}_sort_type = a:sort_type + endif + + " Invalidate the tags listed for this file + let s:tlist_{fidx}_valid = 0 + + if a:caller == 'cmd' + " Save the current line for later restoration + let curline = '\V\^' . getline('.') . '\$' + + call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, + \ s:tlist_{fidx}_filetype) + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' + + " Go back to the cursor line before the tag list is sorted + call search(curline, 'w') + + call s:Tlist_Menu_Update_File(1) + else + call s:Tlist_Menu_Remove_File() + + call s:Tlist_Refresh() + endif +endfunction + +" Tlist_Update_Current_File() +" Update taglist for the current buffer by regenerating the tag list +" Contributed by WEN Guopeng. +function! s:Tlist_Update_Current_File() + call s:Tlist_Log_Msg('Tlist_Update_Current_File()') + if winnr() == bufwinnr(g:TagList_title) + " In the taglist window. Update the current file + call s:Tlist_Window_Update_File() + else + " Not in the taglist window. Update the current buffer + let filename = fnamemodify(bufname('%'), ':p') + let fidx = s:Tlist_Get_File_Index(filename) + if fidx != -1 + let s:tlist_{fidx}_valid = 0 + endif + let ft = s:Tlist_Get_Buffer_Filetype('%') + call Tlist_Update_File(filename, ft) + endif +endfunction + +" Tlist_Window_Update_File() +" Update the tags displayed in the taglist window +function! s:Tlist_Window_Update_File() + call s:Tlist_Log_Msg('Tlist_Window_Update_File()') + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + " Remove the previous highlighting + match none + + " Save the current line for later restoration + let curline = '\V\^' . getline('.') . '\$' + + let s:tlist_{fidx}_valid = 0 + + " Update the taglist window + call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, + \ s:tlist_{fidx}_filetype) + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' + + " Go back to the tag line before the list is updated + call search(curline, 'w') +endfunction + +" Tlist_Window_Get_Tag_Type_By_Linenum() +" Return the tag type index for the specified line in the taglist window +function! s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) + let ftype = s:tlist_{a:fidx}_filetype + + " Determine to which tag type the current line number belongs to using the + " tag type start line number and the number of tags in a tag type + let i = 1 + while i <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{i}_name + let start_lnum = + \ s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset + let end = start_lnum + s:tlist_{a:fidx}_{ttype}_count + if a:lnum >= start_lnum && a:lnum <= end + break + endif + let i = i + 1 + endwhile + + " Current line doesn't belong to any of the displayed tag types + if i > s:tlist_{ftype}_count + return '' + endif + + return ttype +endfunction + +" Tlist_Window_Get_Tag_Index() +" Return the tag index for the specified line in the taglist window +function! s:Tlist_Window_Get_Tag_Index(fidx, lnum) + let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(a:fidx, a:lnum) + + " Current line doesn't belong to any of the displayed tag types + if ttype == '' + return 0 + endif + + " Compute the index into the displayed tags for the tag type + let ttype_lnum = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset + let tidx = a:lnum - ttype_lnum + if tidx == 0 + return 0 + endif + + " Get the corresponding tag line and return it + return s:tlist_{a:fidx}_{ttype}_{tidx} +endfunction + +" Tlist_Window_Highlight_Line +" Highlight the current line +function! s:Tlist_Window_Highlight_Line() + " Clear previously selected name + match none + + " Highlight the current line + if g:Tlist_Display_Prototype == 0 + let pat = '/\%' . line('.') . 'l\s\+\zs.*/' + else + let pat = '/\%' . line('.') . 'l.*/' + endif + + exe 'match TagListTagName ' . pat +endfunction + +" Tlist_Window_Open_File +" Open the specified file in either a new window or an existing window +" and place the cursor at the specified tag pattern +function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat) + call s:Tlist_Log_Msg('Tlist_Window_Open_File (' . a:filename . ',' . + \ a:win_ctrl . ')') + let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh + let s:Tlist_Skip_Refresh = 1 + + if s:tlist_app_name == "winmanager" + " Let the winmanager edit the file + call WinManagerFileEdit(a:filename, a:win_ctrl == 'newwin') + else + + if a:win_ctrl == 'newtab' + " Create a new tab + exe 'tabnew ' . escape(a:filename, ' ') + " Open the taglist window in the new tab + call s:Tlist_Window_Open() + endif + + if a:win_ctrl == 'checktab' + " Check whether the file is present in any of the tabs. + " If the file is present in the current tab, then use the + " current tab. + if bufwinnr(a:filename) != -1 + let file_present_in_tab = 1 + let i = tabpagenr() + else + let i = 1 + let bnum = bufnr(a:filename) + let file_present_in_tab = 0 + while i <= tabpagenr('$') + if index(tabpagebuflist(i), bnum) != -1 + let file_present_in_tab = 1 + break + endif + let i += 1 + endwhile + endif + + if file_present_in_tab + " Goto the tab containing the file + exe 'tabnext ' . i + else + " Open a new tab + exe 'tabnew ' . escape(a:filename, ' ') + + " Open the taglist window + call s:Tlist_Window_Open() + endif + endif + + let winnum = -1 + if a:win_ctrl == 'prevwin' + " Open the file in the previous window, if it is usable + let cur_win = winnr() + wincmd p + if &buftype == '' && !&previewwindow + exe "edit " . escape(a:filename, ' ') + let winnum = winnr() + else + " Previous window is not usable + exe cur_win . 'wincmd w' + endif + endif + + " Goto the window containing the file. If the window is not there, open a + " new window + if winnum == -1 + let winnum = bufwinnr(a:filename) + endif + + if winnum == -1 + " Locate the previously used window for opening a file + let fwin_num = 0 + let first_usable_win = 0 + + let i = 1 + let bnum = winbufnr(i) + while bnum != -1 + if getwinvar(i, 'tlist_file_window') == 'yes' + let fwin_num = i + break + endif + if first_usable_win == 0 && + \ getbufvar(bnum, '&buftype') == '' && + \ !getwinvar(i, '&previewwindow') + " First non-taglist, non-plugin and non-preview window + let first_usable_win = i + endif + let i = i + 1 + let bnum = winbufnr(i) + endwhile + + " If a previously used window is not found, then use the first + " non-taglist window + if fwin_num == 0 + let fwin_num = first_usable_win + endif + + if fwin_num != 0 + " Jump to the file window + exe fwin_num . "wincmd w" + + " If the user asked to jump to the tag in a new window, then split + " the existing window into two. + if a:win_ctrl == 'newwin' + split + endif + exe "edit " . escape(a:filename, ' ') + else + " Open a new window + if g:Tlist_Use_Horiz_Window + exe 'leftabove split ' . escape(a:filename, ' ') + else + if winbufnr(2) == -1 + " Only the taglist window is present + if g:Tlist_Use_Right_Window + exe 'leftabove vertical split ' . + \ escape(a:filename, ' ') + else + exe 'rightbelow vertical split ' . + \ escape(a:filename, ' ') + endif + + " Go to the taglist window to change the window size to + " the user configured value + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + if g:Tlist_Use_Horiz_Window + exe 'resize ' . g:Tlist_WinHeight + else + exe 'vertical resize ' . g:Tlist_WinWidth + endif + " Go back to the file window + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + else + " A plugin or help window is also present + wincmd w + exe 'leftabove split ' . escape(a:filename, ' ') + endif + endif + endif + " Mark the window, so that it can be reused. + call s:Tlist_Window_Mark_File_Window() + else + if v:version >= 700 + " If the file is opened in more than one window, then check + " whether the last accessed window has the selected file. + " If it does, then use that window. + let lastwin_bufnum = winbufnr(winnr('#')) + if bufnr(a:filename) == lastwin_bufnum + let winnum = winnr('#') + endif + endif + exe winnum . 'wincmd w' + + " If the user asked to jump to the tag in a new window, then split the + " existing window into two. + if a:win_ctrl == 'newwin' + split + endif + endif + endif + + " Jump to the tag + if a:tagpat != '' + " Add the current cursor position to the jump list, so that user can + " jump back using the ' and ` marks. + mark ' + silent call search(a:tagpat, 'w') + + " Bring the line to the middle of the window + normal! z. + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + .foldopen + endif + endif + + " If the user selects to preview the tag then jump back to the + " taglist window + if a:win_ctrl == 'preview' + " Go back to the taglist window + let winnum = bufwinnr(g:TagList_title) + exe winnum . 'wincmd w' + else + " If the user has selected to close the taglist window, when a + " tag is selected, close the taglist window + if g:Tlist_Close_On_Select + call s:Tlist_Window_Goto_Window() + close + + " Go back to the window displaying the selected file + let wnum = bufwinnr(a:filename) + if wnum != -1 && wnum != winnr() + call s:Tlist_Exe_Cmd_No_Acmds(wnum . 'wincmd w') + endif + endif + endif + + let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh +endfunction + +" Tlist_Window_Jump_To_Tag() +" Jump to the location of the current tag +" win_ctrl == useopen - Reuse the existing file window +" win_ctrl == newwin - Open a new window +" win_ctrl == preview - Preview the tag +" win_ctrl == prevwin - Open in previous window +" win_ctrl == newtab - Open in new tab +function! s:Tlist_Window_Jump_To_Tag(win_ctrl) + call s:Tlist_Log_Msg('Tlist_Window_Jump_To_Tag(' . a:win_ctrl . ')') + " Do not process comment lines and empty lines + let curline = getline('.') + if curline =~ '^\s*$' || curline[0] == '"' + return + endif + + " If inside a closed fold, then use the first line of the fold + " and jump to the file. + let lnum = foldclosed('.') + if lnum == -1 + " Jump to the selected tag or file + let lnum = line('.') + else + " Open the closed fold + .foldopen! + endif + + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + if fidx == -1 + return + endif + + " Get the tag output for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) + if tidx != 0 + let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, tidx) + + " Highlight the tagline + call s:Tlist_Window_Highlight_Line() + else + " Selected a line which is not a tag name. Just edit the file + let tagpat = '' + endif + + call s:Tlist_Window_Open_File(a:win_ctrl, s:tlist_{fidx}_filename, tagpat) +endfunction + +" Tlist_Window_Show_Info() +" Display information about the entry under the cursor +function! s:Tlist_Window_Show_Info() + call s:Tlist_Log_Msg('Tlist_Window_Show_Info()') + + " Clear the previously displayed line + echo + + " Do not process comment lines and empty lines + let curline = getline('.') + if curline =~ '^\s*$' || curline[0] == '"' + return + endif + + " If inside a fold, then don't display the prototype + if foldclosed('.') != -1 + return + endif + + let lnum = line('.') + + " Get the file index + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) + if fidx == -1 + return + endif + + if lnum == s:tlist_{fidx}_start + " Cursor is on a file name + let fname = s:tlist_{fidx}_filename + if strlen(fname) > 50 + let fname = fnamemodify(fname, ':t') + endif + echo fname . ', Filetype=' . s:tlist_{fidx}_filetype . + \ ', Tag count=' . s:tlist_{fidx}_tag_count + return + endif + + " Get the tag output line for the current tag + let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) + if tidx == 0 + " Cursor is on a tag type + let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) + if ttype == '' + return + endif + + let ttype_name = '' + + let ftype = s:tlist_{fidx}_filetype + let i = 1 + while i <= s:tlist_{ftype}_count + if ttype == s:tlist_{ftype}_{i}_name + let ttype_name = s:tlist_{ftype}_{i}_fullname + break + endif + let i = i + 1 + endwhile + + echo 'Tag type=' . ttype_name . + \ ', Tag count=' . s:tlist_{fidx}_{ttype}_count + return + endif + + " Get the tag search pattern and display it + echo s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Find_Nearest_Tag_Idx +" Find the tag idx nearest to the supplied line number +" Returns -1, if a tag couldn't be found for the specified line number +function! s:Tlist_Find_Nearest_Tag_Idx(fidx, linenum) + let sort_type = s:tlist_{a:fidx}_sort_type + + let left = 1 + let right = s:tlist_{a:fidx}_tag_count + + if sort_type == 'order' + " Tags sorted by order, use a binary search. + " The idea behind this function is taken from the ctags.vim script (by + " Alexey Marinichev) available at the Vim online website. + + " If the current line is the less than the first tag, then no need to + " search + let first_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, 1) + + if a:linenum < first_lnum + return -1 + endif + + while left < right + let middle = (right + left + 1) / 2 + let middle_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, middle) + + if middle_lnum == a:linenum + let left = middle + break + endif + + if middle_lnum > a:linenum + let right = middle - 1 + else + let left = middle + endif + endwhile + else + " Tags sorted by name, use a linear search. (contributed by Dave + " Eggum). + " Look for a tag with a line number less than or equal to the supplied + " line number. If multiple tags are found, then use the tag with the + " line number closest to the supplied line number. IOW, use the tag + " with the highest line number. + let closest_lnum = 0 + let final_left = 0 + while left <= right + let lnum = s:Tlist_Get_Tag_Linenum(a:fidx, left) + + if lnum < a:linenum && lnum > closest_lnum + let closest_lnum = lnum + let final_left = left + elseif lnum == a:linenum + let closest_lnum = lnum + let final_left = left + break + else + let left = left + 1 + endif + endwhile + if closest_lnum == 0 + return -1 + endif + if left >= right + let left = final_left + endif + endif + + return left +endfunction + +" Tlist_Window_Highlight_Tag() +" Highlight the current tag +" cntx == 1, Called by the taglist plugin itself +" cntx == 2, Forced by the user through the TlistHighlightTag command +" center = 1, move the tag line to the center of the taglist window +function! s:Tlist_Window_Highlight_Tag(filename, cur_lnum, cntx, center) + " Highlight the current tag only if the user configured the + " taglist plugin to do so or if the user explictly invoked the + " command to highlight the current tag. + if !g:Tlist_Auto_Highlight_Tag && a:cntx == 1 + return + endif + + if a:filename == '' + return + endif + + " Make sure the taglist window is present + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Error: Taglist window is not open') + return + endif + + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + return + endif + + " If the file is currently not displayed in the taglist window, then retrn + if !s:tlist_{fidx}_visible + return + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return + endif + + " Ignore all autocommands + let old_ei = &eventignore + set eventignore=all + + " Save the original window number + let org_winnr = winnr() + + if org_winnr == winnum + let in_taglist_window = 1 + else + let in_taglist_window = 0 + endif + + " Go to the taglist window + if !in_taglist_window + exe winnum . 'wincmd w' + endif + + " Clear previously selected name + match none + + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, a:cur_lnum) + if tidx == -1 + " Make sure the current tag line is visible in the taglist window. + " Calling the winline() function makes the line visible. Don't know + " of a better way to achieve this. + let lnum = line('.') + + if lnum < s:tlist_{fidx}_start || lnum > s:tlist_{fidx}_end + " Move the cursor to the beginning of the file + exe s:tlist_{fidx}_start + endif + + if foldclosed('.') != -1 + .foldopen + endif + + call winline() + + if !in_taglist_window + exe org_winnr . 'wincmd w' + endif + + " Restore the autocommands + let &eventignore = old_ei + return + endif + + " Extract the tag type + let ttype = s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) + + " Compute the line number + " Start of file + Start of tag type + offset + let lnum = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + + \ s:tlist_{fidx}_{tidx}_ttype_idx + + " Goto the line containing the tag + exe lnum + + " Open the fold + if foldclosed('.') != -1 + .foldopen + endif + + if a:center + " Move the tag line to the center of the taglist window + normal! z. + else + " Make sure the current tag line is visible in the taglist window. + " Calling the winline() function makes the line visible. Don't know + " of a better way to achieve this. + call winline() + endif + + " Highlight the tag name + call s:Tlist_Window_Highlight_Line() + + " Go back to the original window + if !in_taglist_window + exe org_winnr . 'wincmd w' + endif + + " Restore the autocommands + let &eventignore = old_ei + return +endfunction + +" Tlist_Get_Tag_Prototype_By_Line +" Get the prototype for the tag on or before the specified line number in the +" current buffer +function! Tlist_Get_Tag_Prototype_By_Line(...) + if a:0 == 0 + " Arguments are not supplied. Use the current buffer name + " and line number + let filename = bufname('%') + let linenr = line('.') + elseif a:0 == 2 + " Filename and line number are specified + let filename = a:1 + let linenr = a:2 + if linenr !~ '\d\+' + " Invalid line number + return "" + endif + else + " Sufficient arguments are not supplied + let msg = 'Usage: Tlist_Get_Tag_Prototype_By_Line ' . + \ '' + call s:Tlist_Warning_Msg(msg) + return "" + endif + + " Expand the file to a fully qualified name + let filename = fnamemodify(filename, ':p') + if filename == '' + return "" + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + return "" + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return "" + endif + + " Get the tag text using the line number + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) + if tidx == -1 + return "" + endif + + return s:Tlist_Get_Tag_Prototype(fidx, tidx) +endfunction + +" Tlist_Get_Tagname_By_Line +" Get the tag name on or before the specified line number in the +" current buffer +function! Tlist_Get_Tagname_By_Line(...) + if a:0 == 0 + " Arguments are not supplied. Use the current buffer name + " and line number + let filename = bufname('%') + let linenr = line('.') + elseif a:0 == 2 + " Filename and line number are specified + let filename = a:1 + let linenr = a:2 + if linenr !~ '\d\+' + " Invalid line number + return "" + endif + else + " Sufficient arguments are not supplied + let msg = 'Usage: Tlist_Get_Tagname_By_Line ' + call s:Tlist_Warning_Msg(msg) + return "" + endif + + " Make sure the current file has a name + let filename = fnamemodify(filename, ':p') + if filename == '' + return "" + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 + return "" + endif + + " If there are no tags for this file, then no need to proceed further + if s:tlist_{fidx}_tag_count == 0 + return "" + endif + + " Get the tag name using the line number + let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) + if tidx == -1 + return "" + endif + + return s:tlist_{fidx}_{tidx}_tag_name +endfunction + +" Tlist_Window_Move_To_File +" Move the cursor to the beginning of the current file or the next file +" or the previous file in the taglist window +" dir == -1, move to start of current or previous function +" dir == 1, move to start of next function +function! s:Tlist_Window_Move_To_File(dir) + if foldlevel('.') == 0 + " Cursor is on a non-folded line (it is not in any of the files) + " Move it to a folded line + if a:dir == -1 + normal! zk + else + " While moving down to the start of the next fold, + " no need to do go to the start of the next file. + normal! zj + return + endif + endif + + let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) + if fidx == -1 + return + endif + + let cur_lnum = line('.') + + if a:dir == -1 + if cur_lnum > s:tlist_{fidx}_start + " Move to the beginning of the current file + exe s:tlist_{fidx}_start + return + endif + + if fidx != 0 + " Move to the beginning of the previous file + let fidx = fidx - 1 + else + " Cursor is at the first file, wrap around to the last file + let fidx = s:tlist_file_count - 1 + endif + + exe s:tlist_{fidx}_start + return + else + " Move to the beginning of the next file + let fidx = fidx + 1 + + if fidx >= s:tlist_file_count + " Cursor is at the last file, wrap around to the first file + let fidx = 0 + endif + + if s:tlist_{fidx}_start != 0 + exe s:tlist_{fidx}_start + endif + return + endif +endfunction + +" Tlist_Session_Load +" Load a taglist session (information about all the displayed files +" and the tags) from the specified file +function! s:Tlist_Session_Load(...) + if a:0 == 0 || a:1 == '' + call s:Tlist_Warning_Msg('Usage: TlistSessionLoad ') + return + endif + + let sessionfile = a:1 + + if !filereadable(sessionfile) + let msg = 'Taglist: Error - Unable to open file ' . sessionfile + call s:Tlist_Warning_Msg(msg) + return + endif + + " Mark the current window as the file window + call s:Tlist_Window_Mark_File_Window() + + " Source the session file + exe 'source ' . sessionfile + + let new_file_count = g:tlist_file_count + unlet! g:tlist_file_count + + let i = 0 + while i < new_file_count + let ftype = g:tlist_{i}_filetype + unlet! g:tlist_{i}_filetype + + if !exists('s:tlist_' . ftype . '_count') + if s:Tlist_FileType_Init(ftype) == 0 + let i = i + 1 + continue + endif + endif + + let fname = g:tlist_{i}_filename + unlet! g:tlist_{i}_filename + + let fidx = s:Tlist_Get_File_Index(fname) + if fidx != -1 + let s:tlist_{fidx}_visible = 0 + let i = i + 1 + continue + else + " As we are loading the tags from the session file, if this + " file was previously deleted by the user, now we need to + " add it back. So remove the file from the deleted list. + call s:Tlist_Update_Remove_List(fname, 0) + endif + + let fidx = s:Tlist_Init_File(fname, ftype) + + let s:tlist_{fidx}_filename = fname + + let s:tlist_{fidx}_sort_type = g:tlist_{i}_sort_type + unlet! g:tlist_{i}_sort_type + + let s:tlist_{fidx}_filetype = ftype + let s:tlist_{fidx}_mtime = getftime(fname) + + let s:tlist_{fidx}_start = 0 + let s:tlist_{fidx}_end = 0 + + let s:tlist_{fidx}_valid = 1 + + let s:tlist_{fidx}_tag_count = g:tlist_{i}_tag_count + unlet! g:tlist_{i}_tag_count + + let j = 1 + while j <= s:tlist_{fidx}_tag_count + let s:tlist_{fidx}_{j}_tag = g:tlist_{i}_{j}_tag + let s:tlist_{fidx}_{j}_tag_name = g:tlist_{i}_{j}_tag_name + let s:tlist_{fidx}_{j}_ttype_idx = g:tlist_{i}_{j}_ttype_idx + unlet! g:tlist_{i}_{j}_tag + unlet! g:tlist_{i}_{j}_tag_name + unlet! g:tlist_{i}_{j}_ttype_idx + let j = j + 1 + endwhile + + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + + if exists('g:tlist_' . i . '_' . ttype) + let s:tlist_{fidx}_{ttype} = g:tlist_{i}_{ttype} + unlet! g:tlist_{i}_{ttype} + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = g:tlist_{i}_{ttype}_count + unlet! g:tlist_{i}_{ttype}_count + + let k = 1 + while k <= s:tlist_{fidx}_{ttype}_count + let s:tlist_{fidx}_{ttype}_{k} = g:tlist_{i}_{ttype}_{k} + unlet! g:tlist_{i}_{ttype}_{k} + let k = k + 1 + endwhile + else + let s:tlist_{fidx}_{ttype} = '' + let s:tlist_{fidx}_{ttype}_offset = 0 + let s:tlist_{fidx}_{ttype}_count = 0 + endif + + let j = j + 1 + endwhile + + let i = i + 1 + endwhile + + " If the taglist window is open, then update it + let winnum = bufwinnr(g:TagList_title) + if winnum != -1 + let save_winnr = winnr() + + " Goto the taglist window + call s:Tlist_Window_Goto_Window() + + " Refresh the taglist window + call s:Tlist_Window_Refresh() + + " Go back to the original window + if save_winnr != winnr() + call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') + endif + endif +endfunction + +" Tlist_Session_Save +" Save a taglist session (information about all the displayed files +" and the tags) into the specified file +function! s:Tlist_Session_Save(...) + if a:0 == 0 || a:1 == '' + call s:Tlist_Warning_Msg('Usage: TlistSessionSave ') + return + endif + + let sessionfile = a:1 + + if s:tlist_file_count == 0 + " There is nothing to save + call s:Tlist_Warning_Msg('Warning: Taglist is empty. Nothing to save.') + return + endif + + if filereadable(sessionfile) + let ans = input('Do you want to overwrite ' . sessionfile . ' (Y/N)?') + if ans !=? 'y' + return + endif + + echo "\n" + endif + + let old_verbose = &verbose + set verbose&vim + + exe 'redir! > ' . sessionfile + + silent! echo '" Taglist session file. This file is auto-generated.' + silent! echo '" File information' + silent! echo 'let tlist_file_count = ' . s:tlist_file_count + + let i = 0 + + while i < s:tlist_file_count + " Store information about the file + silent! echo 'let tlist_' . i . "_filename = '" . + \ s:tlist_{i}_filename . "'" + silent! echo 'let tlist_' . i . '_sort_type = "' . + \ s:tlist_{i}_sort_type . '"' + silent! echo 'let tlist_' . i . '_filetype = "' . + \ s:tlist_{i}_filetype . '"' + silent! echo 'let tlist_' . i . '_tag_count = ' . + \ s:tlist_{i}_tag_count + " Store information about all the tags + let j = 1 + while j <= s:tlist_{i}_tag_count + let txt = escape(s:tlist_{i}_{j}_tag, '"\\') + silent! echo 'let tlist_' . i . '_' . j . '_tag = "' . txt . '"' + silent! echo 'let tlist_' . i . '_' . j . '_tag_name = "' . + \ s:tlist_{i}_{j}_tag_name . '"' + silent! echo 'let tlist_' . i . '_' . j . '_ttype_idx' . ' = ' . + \ s:tlist_{i}_{j}_ttype_idx + let j = j + 1 + endwhile + + " Store information about all the tags grouped by their type + let ftype = s:tlist_{i}_filetype + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + if s:tlist_{i}_{ttype}_count != 0 + let txt = escape(s:tlist_{i}_{ttype}, '"\') + let txt = substitute(txt, "\n", "\\\\n", 'g') + silent! echo 'let tlist_' . i . '_' . ttype . ' = "' . + \ txt . '"' + silent! echo 'let tlist_' . i . '_' . ttype . '_count = ' . + \ s:tlist_{i}_{ttype}_count + let k = 1 + while k <= s:tlist_{i}_{ttype}_count + silent! echo 'let tlist_' . i . '_' . ttype . '_' . k . + \ ' = ' . s:tlist_{i}_{ttype}_{k} + let k = k + 1 + endwhile + endif + let j = j + 1 + endwhile + + silent! echo + + let i = i + 1 + endwhile + + redir END + + let &verbose = old_verbose +endfunction + +" Tlist_Buffer_Removed +" A buffer is removed from the Vim buffer list. Remove the tags defined +" for that file +function! s:Tlist_Buffer_Removed(filename) + call s:Tlist_Log_Msg('Tlist_Buffer_Removed (' . a:filename . ')') + + " Make sure a valid filename is supplied + if a:filename == '' + return + endif + + " Get tag list index of the specified file + let fidx = s:Tlist_Get_File_Index(a:filename) + if fidx == -1 + " File not present in the taglist + return + endif + + " Remove the file from the list + call s:Tlist_Remove_File(fidx, 0) +endfunction + +" When a buffer is deleted, remove the file from the taglist +autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand(':p')) + +" Tlist_Window_Open_File_Fold +" Open the fold for the specified file and close the fold for all the +" other files +function! s:Tlist_Window_Open_File_Fold(acmd_bufnr) + call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')') + + " Make sure the taglist window is present + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + call s:Tlist_Warning_Msg('Taglist: Error - Taglist window is not open') + return + endif + + " Save the original window number + let org_winnr = winnr() + if org_winnr == winnum + let in_taglist_window = 1 + else + let in_taglist_window = 0 + endif + + if in_taglist_window + " When entering the taglist window, no need to update the folds + return + endif + + " Go to the taglist window + if !in_taglist_window + call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') + endif + + " Close all the folds + silent! %foldclose + + " Get tag list index of the specified file + let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') + if filereadable(fname) + let fidx = s:Tlist_Get_File_Index(fname) + if fidx != -1 + " Open the fold for the file + exe "silent! " . s:tlist_{fidx}_start . "," . + \ s:tlist_{fidx}_end . "foldopen" + endif + endif + + " Go back to the original window + if !in_taglist_window + call s:Tlist_Exe_Cmd_No_Acmds(org_winnr . 'wincmd w') + endif +endfunction + +" Tlist_Window_Check_Auto_Open +" Open the taglist window automatically on Vim startup. +" Open the window only when files present in any of the Vim windows support +" tags. +function! s:Tlist_Window_Check_Auto_Open() + let open_window = 0 + + let i = 1 + let buf_num = winbufnr(i) + while buf_num != -1 + let filename = fnamemodify(bufname(buf_num), ':p') + let ft = s:Tlist_Get_Buffer_Filetype(buf_num) + if !s:Tlist_Skip_File(filename, ft) + let open_window = 1 + break + endif + let i = i + 1 + let buf_num = winbufnr(i) + endwhile + + if open_window + call s:Tlist_Window_Toggle() + endif +endfunction + +" Tlist_Refresh_Folds +" Remove and create the folds for all the files displayed in the taglist +" window. Used after entering a tab. If this is not done, then the folds +" are not properly created for taglist windows displayed in multiple tabs. +function! s:Tlist_Refresh_Folds() + let winnum = bufwinnr(g:TagList_title) + if winnum == -1 + return + endif + + let save_wnum = winnr() + exe winnum . 'wincmd w' + + " First remove all the existing folds + normal! zE + + " Create the folds for each in the tag list + let fidx = 0 + while fidx < s:tlist_file_count + let ftype = s:tlist_{fidx}_filetype + + " Create the folds for each tag type in a file + let j = 1 + while j <= s:tlist_{ftype}_count + let ttype = s:tlist_{ftype}_{j}_name + if s:tlist_{fidx}_{ttype}_count + let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + let e = s + s:tlist_{fidx}_{ttype}_count + exe s . ',' . e . 'fold' + endif + let j = j + 1 + endwhile + + exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' + exe 'silent! ' . s:tlist_{fidx}_start . ',' . + \ s:tlist_{fidx}_end . 'foldopen!' + let fidx = fidx + 1 + endwhile + + exe save_wnum . 'wincmd w' +endfunction + +function! s:Tlist_Menu_Add_Base_Menu() + call s:Tlist_Log_Msg('Adding the base menu') + + " Add the menu + anoremenu T&ags.Refresh\ menu :call Tlist_Menu_Refresh() + anoremenu T&ags.Sort\ menu\ by.Name + \ :call Tlist_Change_Sort('menu', 'set', 'name') + anoremenu T&ags.Sort\ menu\ by.Order + \ :call Tlist_Change_Sort('menu', 'set', 'order') + anoremenu T&ags.-SEP1- : + + if &mousemodel =~ 'popup' + anoremenu PopUp.T&ags.Refresh\ menu + \ :call Tlist_Menu_Refresh() + anoremenu PopUp.T&ags.Sort\ menu\ by.Name + \ :call Tlist_Change_Sort('menu', 'set', 'name') + anoremenu PopUp.T&ags.Sort\ menu\ by.Order + \ :call Tlist_Change_Sort('menu', 'set', 'order') + anoremenu PopUp.T&ags.-SEP1- : + endif +endfunction + +let s:menu_char_prefix = + \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + +" Tlist_Menu_Get_Tag_Type_Cmd +" Get the menu command for the specified tag type +" fidx - File type index +" ftype - File Type +" add_ttype_name - To add or not to add the tag type name to the menu entries +" ttype_idx - Tag type index +function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx) + " Curly brace variable name optimization + let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx + + let ttype = s:tlist_{ftype_ttype_idx}_name + if a:add_ttype_name + " If the tag type name contains space characters, escape it. This + " will be used to create the menu entries. + let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ') + endif + + " Curly brace variable name optimization + let fidx_ttype = a:fidx . '_' . ttype + + " Number of tag entries for this tag type + let tcnt = s:tlist_{fidx_ttype}_count + if tcnt == 0 " No entries for this tag type + return '' + endif + + let mcmd = '' + + " Create the menu items for the tags. + " Depending on the number of tags of this type, split the menu into + " multiple sub-menus, if needed. + if tcnt > g:Tlist_Max_Submenu_Items + let j = 1 + while j <= tcnt + let final_index = j + g:Tlist_Max_Submenu_Items - 1 + if final_index > tcnt + let final_index = tcnt + endif + + " Extract the first and last tag name and form the + " sub-menu name + let tidx = s:tlist_{fidx_ttype}_{j} + let first_tag = s:tlist_{a:fidx}_{tidx}_tag_name + + let tidx = s:tlist_{fidx_ttype}_{final_index} + let last_tag = s:tlist_{a:fidx}_{tidx}_tag_name + + " Truncate the names, if they are greater than the + " max length + let first_tag = strpart(first_tag, 0, g:Tlist_Max_Tag_Length) + let last_tag = strpart(last_tag, 0, g:Tlist_Max_Tag_Length) + + " Form the menu command prefix + let m_prefix = 'anoremenu T\&ags.' + if a:add_ttype_name + let m_prefix = m_prefix . ttype_fullname . '.' + endif + let m_prefix = m_prefix . first_tag . '\.\.\.' . last_tag . '.' + + " Character prefix used to number the menu items (hotkey) + let m_prefix_idx = 0 + + while j <= final_index + let tidx = s:tlist_{fidx_ttype}_{j} + + let tname = s:tlist_{a:fidx}_{tidx}_tag_name + + let mcmd = mcmd . m_prefix . '\&' . + \ s:menu_char_prefix[m_prefix_idx] . '\.' . + \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . + \ tidx . ')|' + + let m_prefix_idx = m_prefix_idx + 1 + let j = j + 1 + endwhile + endwhile + else + " Character prefix used to number the menu items (hotkey) + let m_prefix_idx = 0 + + let m_prefix = 'anoremenu T\&ags.' + if a:add_ttype_name + let m_prefix = m_prefix . ttype_fullname . '.' + endif + let j = 1 + while j <= tcnt + let tidx = s:tlist_{fidx_ttype}_{j} + + let tname = s:tlist_{a:fidx}_{tidx}_tag_name + + let mcmd = mcmd . m_prefix . '\&' . + \ s:menu_char_prefix[m_prefix_idx] . '\.' . + \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . tidx + \ . ')|' + + let m_prefix_idx = m_prefix_idx + 1 + let j = j + 1 + endwhile + endif + + return mcmd +endfunction + +" Update the taglist menu with the tags for the specified file +function! s:Tlist_Menu_File_Refresh(fidx) + call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename) + " The 'B' flag is needed in the 'cpoptions' option + let old_cpoptions = &cpoptions + set cpoptions&vim + + exe s:tlist_{a:fidx}_menu_cmd + + " Update the popup menu (if enabled) + if &mousemodel =~ 'popup' + let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.', + \ ' PopUp.T\\\&ags.', "g") + exe cmd + endif + + " The taglist menu is not empty now + let s:tlist_menu_empty = 0 + + " Restore the 'cpoptions' settings + let &cpoptions = old_cpoptions +endfunction + +" Tlist_Menu_Update_File +" Add the taglist menu +function! s:Tlist_Menu_Update_File(clear_menu) + if !has('gui_running') + " Not running in GUI mode + return + endif + + call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu) + + " Remove the tags menu + if a:clear_menu + call s:Tlist_Menu_Remove_File() + + endif + + " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help + if &buftype != '' + return + endif + + let filename = fnamemodify(bufname('%'), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype('%') + + " If the file doesn't support tag listing, skip it + if s:Tlist_Skip_File(filename, ftype) + return + endif + + let fidx = s:Tlist_Get_File_Index(filename) + if fidx == -1 || !s:tlist_{fidx}_valid + " Check whether this file is removed based on user request + " If it is, then don't display the tags for this file + if s:Tlist_User_Removed_File(filename) + return + endif + + " Process the tags for the file + let fidx = s:Tlist_Process_File(filename, ftype) + if fidx == -1 + return + endif + endif + + let fname = escape(fnamemodify(bufname('%'), ':t'), '.') + if fname != '' + exe 'anoremenu T&ags.' . fname . ' ' + anoremenu T&ags.-SEP2- : + endif + + if !s:tlist_{fidx}_tag_count + return + endif + + if s:tlist_{fidx}_menu_cmd != '' + " Update the menu with the cached command + call s:Tlist_Menu_File_Refresh(fidx) + + return + endif + + " We are going to add entries to the tags menu, so the menu won't be + " empty + let s:tlist_menu_empty = 0 + + let cmd = '' + + " Determine whether the tag type name needs to be added to the menu + " If more than one tag type is present in the taglisting for a file, + " then the tag type name needs to be present + let add_ttype_name = -1 + let i = 1 + while i <= s:tlist_{ftype}_count && add_ttype_name < 1 + let ttype = s:tlist_{ftype}_{i}_name + if s:tlist_{fidx}_{ttype}_count + let add_ttype_name = add_ttype_name + 1 + endif + let i = i + 1 + endwhile + + " Process the tags by the tag type and get the menu command + let i = 1 + while i <= s:tlist_{ftype}_count + let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i) + if mcmd != '' + let cmd = cmd . mcmd + endif + + let i = i + 1 + endwhile + + " Cache the menu command for reuse + let s:tlist_{fidx}_menu_cmd = cmd + + " Update the menu + call s:Tlist_Menu_File_Refresh(fidx) +endfunction + +" Tlist_Menu_Remove_File +" Remove the tags displayed in the tags menu +function! s:Tlist_Menu_Remove_File() + if !has('gui_running') || s:tlist_menu_empty + return + endif + + call s:Tlist_Log_Msg('Removing the tags menu for a file') + + " Cleanup the Tags menu + silent! unmenu T&ags + if &mousemodel =~ 'popup' + silent! unmenu PopUp.T&ags + endif + + " Add a dummy menu item to retain teared off menu + noremenu T&ags.Dummy l + + silent! unmenu! T&ags + if &mousemodel =~ 'popup' + silent! unmenu! PopUp.T&ags + endif + + call s:Tlist_Menu_Add_Base_Menu() + + " Remove the dummy menu item + unmenu T&ags.Dummy + + let s:tlist_menu_empty = 1 +endfunction + +" Tlist_Menu_Refresh +" Refresh the taglist menu +function! s:Tlist_Menu_Refresh() + call s:Tlist_Log_Msg('Refreshing the tags menu') + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx != -1 + " Invalidate the cached menu command + let s:tlist_{fidx}_menu_cmd = '' + endif + + " Update the taglist, menu and window + call s:Tlist_Update_Current_File() +endfunction + +" Tlist_Menu_Jump_To_Tag +" Jump to the selected tag +function! s:Tlist_Menu_Jump_To_Tag(tidx) + let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) + if fidx == -1 + return + endif + + let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx) + if tagpat == '' + return + endif + + " Add the current cursor position to the jump list, so that user can + " jump back using the ' and ` marks. + mark ' + + silent call search(tagpat, 'w') + + " Bring the line to the middle of the window + normal! z. + + " If the line is inside a fold, open the fold + if foldclosed('.') != -1 + .foldopen + endif +endfunction + +" Tlist_Menu_Init +" Initialize the taglist menu +function! s:Tlist_Menu_Init() + call s:Tlist_Menu_Add_Base_Menu() + + " Automatically add the tags defined in the current file to the menu + augroup TagListMenuCmds + autocmd! + + if !g:Tlist_Process_File_Always + autocmd BufEnter * call s:Tlist_Refresh() + endif + autocmd BufLeave * call s:Tlist_Menu_Remove_File() + augroup end + + call s:Tlist_Menu_Update_File(0) +endfunction + +" Tlist_Vim_Session_Load +" Initialize the taglist window/buffer, which is created when loading +" a Vim session file. +function! s:Tlist_Vim_Session_Load() + call s:Tlist_Log_Msg('Tlist_Vim_Session_Load') + + " Initialize the taglist window + call s:Tlist_Window_Init() + + " Refresh the taglist window + call s:Tlist_Window_Refresh() +endfunction + +" Tlist_Set_App +" Set the name of the external plugin/application to which taglist +" belongs. +" Taglist plugin is part of another plugin like cream or winmanager. +function! Tlist_Set_App(name) + if a:name == "" + return + endif + + let s:tlist_app_name = a:name +endfunction + +" Winmanager integration + +" Initialization required for integration with winmanager +function! TagList_Start() + " If current buffer is not taglist buffer, then don't proceed + if bufname('%') != '__Tag_List__' + return + endif + + call Tlist_Set_App('winmanager') + + " Get the current filename from the winmanager plugin + let bufnum = WinManagerGetLastEditedFile() + if bufnum != -1 + let filename = fnamemodify(bufname(bufnum), ':p') + let ftype = s:Tlist_Get_Buffer_Filetype(bufnum) + endif + + " Initialize the taglist window, if it is not already initialized + if !exists('s:tlist_window_initialized') || !s:tlist_window_initialized + call s:Tlist_Window_Init() + call s:Tlist_Window_Refresh() + let s:tlist_window_initialized = 1 + endif + + " Update the taglist window + if bufnum != -1 + if !s:Tlist_Skip_File(filename, ftype) && g:Tlist_Auto_Update + call s:Tlist_Window_Refresh_File(filename, ftype) + endif + endif +endfunction + +function! TagList_IsValid() + return 0 +endfunction + +function! TagList_WrapUp() + return 0 +endfunction + +" restore 'cpo' +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim index 72a93f94..0abc7067 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2010-11-20. -" @Revision: 0.0.79 +" @Last Change: 2012-09-26. +" @Revision: 0.0.90 let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 let s:prototype.highlight = g:tlib_inputlist_higroup @@ -30,6 +30,14 @@ function! s:prototype.Init(world) dict "{{{3 endf +" :nodoc: +function! s:prototype.Help(world) dict "{{{3 + call a:world.PushHelp( + \ printf('"%s", "%s", "%sWORD"', g:tlib_inputlist_and, g:tlib_inputlist_or, g:tlib_inputlist_not), + \ 'AND, OR, NOT') +endf + + " :nodoc: function! s:prototype.AssessName(world, name) dict "{{{3 let xa = 0 @@ -86,18 +94,22 @@ function! s:prototype.Match(world, text) dict "{{{3 " set smartcase " endif " try + if !empty(a:world.filter_neg) for rx in a:world.filter_neg " TLogVAR rx if a:text =~ rx return 0 endif endfor + endif + if !empty(a:world.filter_pos) for rx in a:world.filter_pos " TLogVAR rx if a:text !~ rx return 0 endif endfor + endif " finally " let &smartcase = sc " let &ignorecase = ic @@ -109,13 +121,14 @@ endf " :nodoc: function! s:prototype.DisplayFilter(filter) dict "{{{3 let filter1 = deepcopy(a:filter) - call map(filter1, '"(". join(reverse(s:Pretty(v:val)), " OR ") .")"') + call map(filter1, '"(". join(reverse(self.Pretty(v:val)), " OR ") .")"') return join(reverse(filter1), ' AND ') endf -function! s:Pretty(filter) "{{{3 - call map(a:filter, 'substitute(v:val, ''\\\.\\{-}'', ''__'', ''g'')') +function! s:prototype.Pretty(filter) dict "{{{3 + " call map(a:filter, 'substitute(v:val, ''\\\.\\{-}'', ''=>'', ''g'')') + call map(a:filter, 'self.CleanFilter(v:val)') return a:filter endf diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim index 61e3b9c6..b141b733 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim @@ -3,14 +3,14 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2010-09-15. -" @Revision: 0.0.35 +" @Last Change: 2012-09-20. +" @Revision: 0.0.50 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2 let s:prototype.highlight = g:tlib_inputlist_higroup -" The same as |tlib#FilterCNF#New()| but a dot is expanded to '\.\{-}'. +" The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'. " As a consequence, patterns cannot match dots. " The pattern is a '/\V' very no-'/magic' regexp pattern. function! tlib#Filter_cnfd#New(...) "{{{3 @@ -24,6 +24,19 @@ function! s:prototype.Init(world) dict "{{{3 endf +let s:Help = s:prototype.Help + +" :nodoc: +function! s:prototype.Help(world) dict "{{{3 + call call(s:Help, [a:world], self) + if self.name == 'cnfx' + call a:world.PushHelp(g:tlib#Filter_cnfx#expander, 'Any characters') + else + call a:world.PushHelp('.', 'Any characters') + endif +endf + + " :nodoc: function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 let pattern = substitute(a:pattern, '\.', '\\.\\{-}', 'g') diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim new file mode 100644 index 00000000..95abdae7 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim @@ -0,0 +1,42 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2008-11-25. +" @Last Change: 2012-09-20. +" @Revision: 0.0.61 + +let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2 +let s:prototype.highlight = g:tlib_inputlist_higroup + + +" A character that should be expanded to '\.\{-}'. +TLet g:tlib#Filter_cnfx#expander = '+' + + +" The same as |tlib#Filter_cnfd#New()| but a a customizable character +" |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'. +" The pattern is a '/\V' very no-'/magic' regexp pattern. +function! tlib#Filter_cnfx#New(...) "{{{3 + let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) + return object +endf + + +" :nodoc: +function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 + let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_cnfx#expander, 'V'), '\\.\\{-}', 'g') + let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1] +endf + + +" :nodoc: +function! s:prototype.PushFrontFilter(world, char) dict "{{{3 + let a:world.filter[0][0] .= a:char == char2nr(g:tlib#Filter_cnfx#expander) ? '\.\{-}' : nr2char(a:char) +endf + + +" :nodoc: +function! s:prototype.CleanFilter(filter) dict "{{{3 + return substitute(a:filter, '\\.\\{-}', g:tlib#Filter_cnfx#expander, 'g') +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim b/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim index 2d39b725..39e09844 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_fuzzy.vim @@ -3,15 +3,15 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2010-09-15. -" @Revision: 0.0.38 +" @Last Change: 2012-09-20. +" @Revision: 0.0.46 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_fuzzy'], 'name': 'fuzzy'}) "{{{2 -let s:prototype.highlight = '' +let s:prototype.highlight = g:tlib_inputlist_higroup " Support for "fuzzy" pattern matching in |tlib#input#List()|. -" Characters are interpreted as if connected with '.\{-}'. +" Patterns are interpreted as if characters were connected with '.\{-}'. " " In "fuzzy" mode, the pretty printing of filenames is disabled. function! tlib#Filter_fuzzy#New(...) "{{{3 @@ -23,7 +23,8 @@ endf " :nodoc: function! s:prototype.Init(world) dict "{{{3 " TLogVAR a:world.display_format - function! a:world.Set_display_format(value) dict "{{{3 + " :nodoc: + function! a:world.Set_display_format(value) dict if a:value == 'filename' let self.display_format = '' else @@ -33,6 +34,15 @@ function! s:prototype.Init(world) dict "{{{3 endf +let s:Help = s:prototype.Help + +" :nodoc: +function! s:prototype.Help(world) dict "{{{3 + call call(s:Help, [a:world], self) + call a:world.PushHelp('Patterns are interpreted as if characters were connected with .\{-}') +endf + + " :nodoc: function! s:prototype.DisplayFilter(filter) dict "{{{3 " TLogVAR a:filter diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_seq.vim b/sources_non_forked/tlib/autoload/tlib/Filter_seq.vim deleted file mode 100644 index f5957af0..00000000 --- a/sources_non_forked/tlib/autoload/tlib/Filter_seq.vim +++ /dev/null @@ -1,98 +0,0 @@ -" Filter_seq.vim -" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) -" @Website: http://www.vim.org/account/profile.php?user_id=4037 -" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Created: 2008-11-25. -" @Last Change: 2010-11-20. -" @Revision: 0.0.30 - -let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_seq'], 'name': 'seq'}) "{{{2 -let s:prototype.highlight = g:tlib_inputlist_higroup - -" The search pattern for |tlib#input#List()| is interpreted as a -" disjunction of 'magic' regular expressions with the exception of a dot -" ".", which is interpreted as ".\{-}". -" The pattern is a '/magic' regexp pattern. -function! tlib#Filter_seq#New(...) "{{{3 - let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) - return object -endf - - -" :nodoc: -function! s:prototype.Init(world) dict "{{{3 -endf - - -" :nodoc: -function! s:prototype.Match(world, text) dict "{{{3 - " TLogVAR a:text - for rx in a:world.filter_neg - if a:text !~ rx - " TLogDBG "filter_neg ". rx - return 1 - endif - endfor - for rx in a:world.filter_pos - if a:text =~ rx - " TLogDBG "filter_pos ". rx - return 1 - endif - endfor - return 0 -endf - - -" :nodoc: -function! s:prototype.DisplayFilter(filter) dict "{{{3 - let filter1 = deepcopy(a:filter) - call map(filter1, '"(". join(reverse(s:Pretty(v:val)), "_") .")"') - return join(reverse(filter1), ' OR ') -endf - - -function! s:Pretty(filter) "{{{3 - call map(a:filter, 's:prototype.CleanFilter(v:val)') - return a:filter -endf - - -" :nodoc: -function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 - let a:world.filter[0] = map(reverse(split(a:pattern, '\s*|\s*')), 'join(split(v:val, ''\.''), ''.\{-}'')') + a:world.filter[0][1 : -1] -endf - - -" :nodoc: -function! s:prototype.PushFrontFilter(world, char) dict "{{{3 - let cc = nr2char(a:char) - if cc == '.' - let a:world.filter[0][0] .= '.\{-}' - else - let a:world.filter[0][0] .= nr2char(a:char) - endif -endf - - -" :nodoc: -function! s:prototype.ReduceFrontFilter(world) dict "{{{3 - let flt = a:world.filter[0][0] - if flt =~ '\.\\{-}$' - let a:world.filter[0][0] = flt[0:-6] - else - let a:world.filter[0][0] = flt[0:-2] - endif -endf - - -" :nodoc: -function! s:prototype.FilterRxPrefix() dict "{{{3 - return '' -endf - - -" :nodoc: -function! s:prototype.CleanFilter(filter) dict "{{{3 - return substitute(a:filter, '.\\{-}', '.', 'g') -endf - diff --git a/sources_non_forked/tlib/autoload/tlib/World.vim b/sources_non_forked/tlib/autoload/tlib/World.vim index c38e48b4..296f2d41 100644 --- a/sources_non_forked/tlib/autoload/tlib/World.vim +++ b/sources_non_forked/tlib/autoload/tlib/World.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-05-01. -" @Last Change: 2011-04-01. -" @Revision: 0.1.915 +" @Last Change: 2012-10-03. +" @Revision: 0.1.1203 " :filedoc: " A prototype used by |tlib#input#List|. @@ -24,6 +24,7 @@ let s:prototype = tlib#Object#New({ \ 'fileencoding': &fileencoding, \ 'fmt_display': {}, \ 'fmt_filter': {}, + \ 'fmt_options': {}, \ 'filetype': '', \ 'filter': [['']], \ 'filter_format': '', @@ -62,6 +63,7 @@ let s:prototype = tlib#Object#New({ \ 'state': 'display', \ 'state_handlers': [], \ 'sticky': 0, + \ 'temp_prompt': [], \ 'timeout': 0, \ 'timeout_resolution': 2, \ 'type': '', @@ -94,71 +96,115 @@ endf " :nodoc: function! s:prototype.Set_highlight_filename() dict "{{{3 let self.tlib_UseInputListScratch = 'call world.Highlight_filename()' - " \ 'syntax match TLibMarker /\%>'. (1 + eval(g:tlib_inputlist_width_filename)) .'c |.\{-}| / | hi def link TLibMarker Special' - " let self.tlib_UseInputListScratch .= '| syntax match TLibDir /\%>'. (4 + eval(g:tlib_inputlist_width_filename)) .'c\S\{-}[\/].*$/ | hi def link TLibDir Directory' endf -" :nodoc: -function! s:prototype.Highlight_filename() dict "{{{3 - " exec 'syntax match TLibDir /\%>'. (3 + eval(g:tlib_inputlist_width_filename)) .'c \(\S:\)\?[\/].*$/ contained containedin=TLibMarker' - exec 'syntax match TLibDir /\(\a:\|\.\.\..\{-}\)\?[\/][^&<>*|]*$/ contained containedin=TLibMarker' - exec 'syntax match TLibMarker /\%>'. (1 + eval(g:tlib_inputlist_width_filename)) .'c |\( \|[[:alnum:]%*+-]*\)| \S.*$/ contains=TLibDir' - hi def link TLibMarker Special - hi def link TLibDir Directory -endf +if g:tlib#input#format_filename == 'r' + + " :nodoc: + function! s:prototype.Highlight_filename() dict "{{{3 + syntax match TLibDir /\s\+\zs.\{-}[\/]\ze[^\/]\+$/ + hi def link TLibDir Directory + syntax match TLibFilename /[^\/]\+$/ + hi def link TLibFilename Normal + endf + + " :nodoc: + function! s:prototype.FormatFilename(file) dict "{{{3 + if !has_key(self.fmt_options, 'maxlen') + let maxco = &co - len(len(self.base)) - eval(g:tlib#input#filename_padding_r) + let maxfi = max(map(copy(self.base), 'len(v:val)')) + let self.fmt_options.maxlen = min([maxco, maxfi]) + " TLogVAR maxco, maxfi, self.fmt_options.maxlen + endif + let max = self.fmt_options.maxlen + if len(a:file) > max + let filename = '...' . strpart(a:file, len(a:file) - max + 3) + else + let filename = printf('% '. max .'s', a:file) + endif + return filename + endf + +else + + " :nodoc: + function! s:prototype.Highlight_filename() dict "{{{3 + " let self.width_filename = 1 + eval(g:tlib_inputlist_width_filename) + " TLogVAR self.base + let self.width_filename = min([ + \ get(self, 'width_filename', &co), + \ empty(g:tlib#input#filename_max_width) ? &co : eval(g:tlib#input#filename_max_width), + \ max(map(copy(self.base), 'len(fnamemodify(v:val, ":t"))')) + \ ]) + " TLogVAR self.width_filename + exec 'syntax match TLibFilename /[^\/]\+$/ contained containedin=TLibDir' + exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir' + hi def link TLibMarker Special + hi def link TLibDir Directory + hi def link TLibFilename NonText + " :nodoc: + function! self.Highlighter(rx) dict + let rx = '/\c\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) .\{-}\zs'. escape(a:rx, '/') .'/' + exec 'match' self.matcher.highlight rx + endf + endf -" :nodoc: -function! s:prototype.FormatFilename(file) dict "{{{3 - let width = eval(g:tlib_inputlist_width_filename) - let split = match(a:file, '[/\\]\zs[^/\\]\+$') - if split == -1 - let fname = '' - let dname = a:file - else - let fname = strpart(a:file, split) - let dname = strpart(a:file, 0, split - 1) - endif - " let fname = fnamemodify(a:file, ":p:t") - " " let fname = fnamemodify(a:file, ":t") - " " if isdirectory(a:file) - " " let fname .='/' - " " endif - " let dname = fnamemodify(a:file, ":h") - " let dname = pathshorten(fnamemodify(a:file, ":h")) - let dnmax = &co - max([width, len(fname)]) - 11 - self.index_width - &fdc - if len(dname) > dnmax - let dname = '...'. strpart(dname, len(dname) - dnmax) - endif - let marker = [] - if g:tlib_inputlist_filename_indicators - let bnr = bufnr(a:file) - " TLogVAR a:file, bnr, self.bufnr - if bnr != -1 - if bnr == self.bufnr - call add(marker, '%') + " :nodoc: + function! s:prototype.FormatFilename(file) dict "{{{3 + let width = self.width_filename + let split = match(a:file, '[/\\]\zs[^/\\]\+$') + if split == -1 + let fname = '' + let dname = a:file + else + let fname = strpart(a:file, split) + " let dname = strpart(a:file, 0, split - 1) + let dname = a:file + endif + if strwidth(fname) > width + let fname = strpart(fname, 0, width - 3) .'...' + endif + let dnmax = &co - max([width, len(fname)]) - 10 - self.index_width - &fdc + if g:tlib_inputlist_filename_indicators + let dnmax -= 2 + endif + if len(dname) > dnmax + let dname = '...'. strpart(dname, len(dname) - dnmax) + endif + let marker = [] + if g:tlib_inputlist_filename_indicators + call insert(marker, '[') + let bnr = bufnr(a:file) + " TLogVAR a:file, bnr, self.bufnr + if bnr != -1 + if bnr == self.bufnr + call add(marker, '%') + else + call add(marker, bnr) + endif + if getbufvar(bnr, '&modified') + call add(marker, '+') + endif + if getbufvar(bnr, '&bufhidden') == 'hide' + call add(marker, 'h') + endif + " if !buflisted(bnr) + " call add(marker, 'u') + " endif else call add(marker, ' ') - " elseif buflisted(a:file) - " if getbufvar(a:file, "&mod") - " call add(marker, '+') - " else - " call add(marker, 'B') - " endif - " elseif bufloaded(a:file) - " call add(marker, 'h') - " else - " call add(marker, 'u') endif + call add(marker, ']') else - call add(marker, ' ') + call add(marker, '|') endif - endif - call insert(marker, '|') - call add(marker, '|') - return printf("%-". eval(g:tlib_inputlist_width_filename) ."s %s %s", fname, join(marker, ''), dname) -endf + return printf("%-". self.width_filename ."s %s %s", fname, join(marker, ''), dname) + endf + +endif " :nodoc: @@ -312,7 +358,11 @@ endf " :nodoc: function! s:prototype.GetBaseIdx0(idx) dict "{{{3 - return self.GetBaseIdx(a:idx) - 1 + let idx0 = self.GetBaseIdx(a:idx) - 1 + if idx0 < 0 + call tlib#notify#Echo('TLIB: Internal Error: GetBaseIdx0: idx0 < 0', 'WarningMsg') + endif + return idx0 endf @@ -416,22 +466,25 @@ function! s:prototype.SetFilter() dict "{{{3 let mrx = self.FilterRxPrefix() . self.filter_options let self.filter_pos = [] let self.filter_neg = [] - " TLogVAR self.filter + " TLogVAR mrx, self.filter for filter in self.filter " TLogVAR filter let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|') - if rx =~ '\u' - let mrx1 = mrx .'\C' - else - let mrx1 = mrx - endif " TLogVAR rx - if rx[0] == g:tlib_inputlist_not - if len(rx) > 1 - call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)') + if !empty(rx) + if rx =~ '\u' + let mrx1 = mrx .'\C' + else + let mrx1 = mrx + endif + " TLogVAR rx + if rx[0] == g:tlib_inputlist_not + if len(rx) > 1 + call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)') + endif + else + call add(self.filter_pos, mrx1 .'\('. rx .'\)') endif - else - call add(self.filter_pos, mrx1 .'\('. rx .'\)') endif endfor " TLogVAR self.filter_pos, self.filter_neg @@ -485,14 +538,22 @@ endf " :nodoc: function! s:prototype.BuildTableList() dict "{{{3 + " let time0 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time0 call self.SetFilter() " TLogVAR self.filter_neg, self.filter_pos if empty(self.filter_pos) && empty(self.filter_neg) let self.table = range(1, len(self.base)) let self.list = copy(self.base) else + " let time1 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time1, time1 - time0 let self.table = filter(range(1, len(self.base)), 'self.MatchBaseIdx(v:val)') + " let time2 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time2, time2 - time0 let self.list = map(copy(self.table), 'self.GetBaseItem(v:val)') + " let time3 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time3, time3 - time0 endif endf @@ -623,25 +684,32 @@ endf " :nodoc: function! s:prototype.UseInputListScratch() dict "{{{3 let scratch = self.UseScratch() - " TLogVAR scratch - syntax match InputlListIndex /^\d\+:/ - syntax match InputlListCursor /^\d\+\* .*$/ contains=InputlListIndex - syntax match InputlListSelected /^\d\+# .*$/ contains=InputlListIndex - hi def link InputlListIndex Constant - hi def link InputlListCursor Search - hi def link InputlListSelected IncSearch - " exec "au BufEnter call tlib#input#Resume(". string(self.name) .")" - setlocal nowrap - " hi def link InputlListIndex Special - " let b:tlibDisplayListMarks = {} - let b:tlibDisplayListMarks = [] - let b:tlibDisplayListWorld = self - call tlib#hook#Run('tlib_UseInputListScratch', self) + if !exists('b:tlib_list_init') + call tlib#autocmdgroup#Init() + autocmd TLib VimResized call feedkeys("\", 't') + let b:tlib_list_init = 1 + endif + if !exists('w:tlib_list_init') + " TLogVAR scratch + syntax match InputlListIndex /^\d\+:/ + syntax match InputlListCursor /^\d\+\* .*$/ contains=InputlListIndex + syntax match InputlListSelected /^\d\+# .*$/ contains=InputlListIndex + hi def link InputlListIndex Constant + hi def link InputlListCursor Search + hi def link InputlListSelected IncSearch + setlocal nowrap + " hi def link InputlListIndex Special + " let b:tlibDisplayListMarks = {} + let b:tlibDisplayListMarks = [] + let b:tlibDisplayListWorld = self + call tlib#hook#Run('tlib_UseInputListScratch', self) + let w:tlib_list_init = 1 + endif return scratch endf -" :def: function! s:prototype.Reset(?initial=0) +" s:prototype.Reset(?initial=0) " :nodoc: function! s:prototype.Reset(...) dict "{{{3 TVarArg ['initial', 0] @@ -687,56 +755,158 @@ function! s:prototype.Retrieve(anyway) dict "{{{3 endf +function! s:FormatHelp(help) "{{{3 + " TLogVAR a:help + let max = [0, 0] + for item in a:help + " TLogVAR item + if type(item) == 3 + let itemlen = map(copy(item), 'strwidth(v:val)') + " TLogVAR itemlen + let max = map(range(2), 'max[v:val] >= itemlen[v:val] ? max[v:val] : itemlen[v:val]') + endif + unlet item + endfor + " TLogVAR max + let cols = float2nr((winwidth(0) - &foldcolumn - 1) / (max[0] + max[1] + 2)) + if cols < 1 + let cols = 1 + endif + let fmt = printf('%%%ds: %%-%ds', max[0], max[1]) + " TLogVAR cols, fmt + let help = [] + let idx = -1 + let maxidx = len(a:help) + while idx < maxidx + let push_item = 0 + let accum = [] + for i in range(cols) + let idx += 1 + if idx >= maxidx + break + endif + let item = a:help[idx] + if type(item) == 3 + call add(accum, item) + else + let push_item = 1 + break + endif + unlet item + endfor + if !empty(accum) + call add(help, s:FormatHelpItem(accum, fmt)) + endif + if push_item + call add(help, a:help[idx]) + endif + endwh + " TLogVAR help + return help +endf + + +function! s:FormatHelpItem(item, fmt) "{{{3 + let args = [join(repeat([a:fmt], len(a:item)), ' ')] + for item in a:item + " TLogVAR item + let args += item + endfor + " TLogVAR args + return call('printf', args) +endf + + +" :nodoc: +function! s:prototype.InitHelp() dict "{{{3 + return [] +endf + + +" :nodoc: +function! s:prototype.PushHelp(...) dict "{{{3 + " TLogVAR a:000 + if a:0 == 1 + if type(a:1) == 3 + let self._help += a:1 + else + call add(self._help, a:1) + endif + elseif a:0 == 2 + call add(self._help, a:000) + else + throw "TLIB: PushHelp: Wrong number of arguments: ". string(a:000) + endif + " TLogVAR helpstring +endf + + " :nodoc: function! s:prototype.DisplayHelp() dict "{{{3 - " \ 'Help:', - let help = [ - \ 'Mouse ... Pick an item Letter ... Filter the list', - \ printf(' ... Pick an item "%s", "%s", %sWORD ... AND, OR, NOT', - \ g:tlib_inputlist_and, g:tlib_inputlist_or, g:tlib_inputlist_not), - \ 'Enter ... Pick the current item , ... Reduce filter', - \ ' ... Reset the display Up/Down ... Next/previous item', - \ ' ... Edit top filter string Page Up/Down ... Scroll', - \ ' ... Abort', - \ ] + let self._help = self.InitHelp() + call self.PushHelp('', self.key_mode == 'default' ? 'Abort' : 'Reset keymap') + call self.PushHelp('Enter, ', 'Pick the current item') + call self.PushHelp('', 'Pick an item') + call self.PushHelp('Mouse', 'L: Pick item, R: Show menu') + call self.PushHelp(', ', 'Reduce filter') + call self.PushHelp(', ', 'Enter command') - if self.allow_suspend - call add(help, - \ ' ... Suspend/Resume ... Switch to origin') + if self.key_mode == 'default' + call self.PushHelp('', 'Reset the display') + call self.PushHelp('Up/Down', 'Next/previous item') + call self.PushHelp('', 'Edit top filter string') + call self.PushHelp('Page Up/Down', 'Scroll') + if self.allow_suspend + call self.PushHelp('', 'Suspend/Resume') + call self.PushHelp('', 'Switch to origin') + endif + if stridx(self.type, 'm') != -1 + call self.PushHelp('', '(Un)Select items') + call self.PushHelp('#, ', '(Un)Select the current item') + call self.PushHelp('', '(Un)Select all items') + " \ ' ... Show only selected', + endif endif - if stridx(self.type, 'm') != -1 - let help += [ - \ '#, ... (Un)Select the current item', - \ ' ... (Un)Select all currently visible items', - \ ' ... (Un)Select items', - \ ] - " \ ' ... Show only selected', - endif - for handler in self.key_handlers + " TLogVAR len(self._help) + call self.matcher.Help(self) + + " TLogVAR self.key_mode + for handler in values(self.key_map[self.key_mode]) + " TLogVAR handler let key = get(handler, 'key_name', '') + " TLogVAR key if !empty(key) let desc = get(handler, 'help', '') - call add(help, printf('%-12s ... %s', key, desc)) + if empty(desc) + let desc = get(handler, 'agent', '') + endif + call self.PushHelp(key, desc) endif endfor - if !empty(self.help_extra) - let help += self.help_extra + + if !has_key(self.key_map[self.key_mode], 'unknown_key') + call self.PushHelp('Letter', 'Filter the list') endif - let help += [ + + if self.key_mode == 'default' && !empty(self.help_extra) + call self.PushHelp(self.help_extra) + endif + + " TLogVAR len(self._help) + call self.PushHelp([ \ '', - \ 'Exact matches and matches at word boundaries is given more weight.', - \ 'Warning: Please don''t resize the window with the mouse.', - \ '', - \ 'Press any key to continue.', - \ ] + \ 'Matches at word boundaries are prioritized.', + \ ]) + let self._help = s:FormatHelp(self._help) + let self.temp_prompt = ['Press any key to continue.', 'Question'] " call tlib#normal#WithRegister('gg"tdG', 't') call tlib#buffer#DeleteRange('1', '$') - call append(0, help) + call append(0, self._help) " call tlib#normal#WithRegister('G"tddgg', 't') call tlib#buffer#DeleteRange('$', '$') 1 - call self.Resize(len(help), 0) + call self.Resize(len(self._help), 0) endf @@ -785,12 +955,13 @@ function! s:prototype.GetResize(size) dict "{{{3 endf -" function! s:prototype.DisplayList(query, ?list) +" function! s:prototype.DisplayList(?query=self.Query(), ?list=[]) " :nodoc: -function! s:prototype.DisplayList(query, ...) dict "{{{3 - " TLogVAR a:query +function! s:prototype.DisplayList(...) dict "{{{3 " TLogVAR self.state - let list = a:0 >= 1 ? a:1 : [] + let query = a:0 >= 1 ? a:1 : self.Query() + let list = a:0 >= 2 ? a:2 : [] + " TLogVAR query, len(list) " TLogDBG 'len(list) = '. len(list) call self.UseScratch() " TLogVAR self.scratch @@ -799,6 +970,7 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3 call self.ScrollToOffset() elseif self.state == 'help' call self.DisplayHelp() + call self.SetStatusline(query) else " TLogVAR query " let ll = len(list) @@ -832,7 +1004,7 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3 call add(b:tlibDisplayListMarks, base_pref) call self.DisplayListMark(x, base_pref, '*') call self.SetOffset() - call self.SetStatusline(a:query) + call self.SetStatusline(query) " TLogVAR self.offset call self.ScrollToOffset() let rx0 = self.GetRx0() @@ -841,7 +1013,11 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3 if empty(rx0) match none elseif self.IsValidFilter() - exec 'match '. self.matcher.highlight .' /\c'. escape(rx0, '/') .'/' + if has_key(self, 'Highlighter') + call self.Highlighter(rx0) + else + exec 'match '. self.matcher.highlight .' /\c'. escape(rx0, '/') .'/' + endif endif endif endif @@ -849,22 +1025,51 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3 endf +" :nodoc: function! s:prototype.SetStatusline(query) dict "{{{3 - let query = a:query - let options = [self.matcher.name] - if self.sticky - call add(options, '#') + " TLogVAR a:query + if !empty(self.temp_prompt) + let echo = get(self.temp_prompt, 0, '') + let hl = get(self.temp_prompt, 1, 'Normal') + let self.temp_prompt = [] + else + let hl = 'Normal' + let query = a:query + let options = [self.matcher.name] + if self.sticky + call add(options, '#') + endif + if self.key_mode != 'default' + call add(options, 'map:'. self.key_mode) + endif + if !empty(options) + let sopts = printf('[%s]', join(options, ', ')) + " let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts + let echo = query . ' ' . sopts + " let query .= '%%='. sopts .' ' + endif + " TLogVAR &l:statusline, query + " let &l:statusline = query endif - if !empty(options) - let sopts = printf('[%s]', join(options, ', ')) - " let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts - let echo = query . ' ' . sopts - " let query .= '%%='. sopts .' ' - endif - " TLogVAR &l:statusline, query - " let &l:statusline = query echo - echo echo + if hl != 'Normal' + exec 'echohl' hl + echo echo + echohl None + else + echo echo + endif +endf + + +" :nodoc: +function! s:prototype.Query() dict "{{{3 + if g:tlib_inputlist_shortmessage + let query = 'Filter: '. self.DisplayFilter() + else + let query = self.query .' (filter: '. self.DisplayFilter() .'; press "?" for help)' + endif + return query endf diff --git a/sources_non_forked/tlib/autoload/tlib/agent.vim b/sources_non_forked/tlib/autoload/tlib/agent.vim index c6a02266..56365c11 100644 --- a/sources_non_forked/tlib/autoload/tlib/agent.vim +++ b/sources_non_forked/tlib/autoload/tlib/agent.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-24. -" @Last Change: 2010-11-20. -" @Revision: 0.1.185 +" @Last Change: 2012-10-03. +" @Revision: 0.1.208 " :filedoc: @@ -14,11 +14,16 @@ " General {{{1 function! tlib#agent#Exit(world, selected) "{{{3 - call a:world.CloseScratch() - let a:world.state = 'exit empty escape' - let a:world.list = [] - " let a:world.base = [] - call a:world.ResetSelected() + if a:world.key_mode == 'default' + call a:world.CloseScratch() + let a:world.state = 'exit empty escape' + let a:world.list = [] + " let a:world.base = [] + call a:world.ResetSelected() + else + let a:world.key_mode = 'default' + let a:world.state = 'redisplay' + endif return a:world endf @@ -156,17 +161,14 @@ function! tlib#agent#Suspend(world, selected) "{{{3 " TLogDBG bufnr('%') let br = tlib#buffer#Set(a:world.scratch) " TLogVAR br, a:world.bufnr, a:world.scratch - " TLogDBG bufnr('%') + if bufnr('%') != a:world.scratch + echohl WarningMsg + echom "tlib#agent#Suspend: Internal error: Not a scratch buffer:" bufname('%') + echohl NONE + endif + " TLogVAR bufnr('%'), bufname('%'), a:world.scratch call tlib#autocmdgroup#Init() - autocmd TLib InsertEnter,InsertChange call tlib#input#Resume("world", 0) - let b:tlib_suspend = { - \ '': 0, '': 0, '': 0, - \ '': 1, - \ '': 1, '': 0, '': 0, '': 0, - \ '<': 2} - for [m, pick] in items(b:tlib_suspend) - exec 'noremap '. m .' :call tlib#input#Resume("world", '. pick .')' - endfor + exec 'autocmd TLib BufEnter call tlib#input#Resume("world", 0, '. a:world.scratch .')' let b:tlib_world = a:world exec br let a:world.state = 'exit suspend' @@ -373,6 +375,7 @@ function! tlib#agent#ViewFile(world, selected) "{{{3 let cmd1 = 'buffer' endif call tlib#file#With(cmd0, cmd1, a:selected, a:world) + " TLogVAR &filetype exec back let a:world.state = 'display' endif @@ -512,3 +515,49 @@ function! tlib#agent#Wildcard(world, selected) "{{{3 return a:world endf + +function! tlib#agent#Null(world, selected) "{{{3 + let a:world.state = 'redisplay' + return a:world +endf + + +function! tlib#agent#ExecAgentByName(world, selected) "{{{3 + let s:agent_names_world = a:world + let agent_names = {} + for def in values(a:world.key_map[a:world.key_mode]) + if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent) + let agent_names[def.help] = def.agent + endif + endfor + let s:agent_names = join(sort(keys(agent_names)), "\n") + let command = input('Command: ', '', 'custom,tlib#agent#CompleteAgentNames') + " TLogVAR command + if !has_key(agent_names, command) + " TLogVAR command + silent! let matches = filter(keys(agent_names), 'v:val =~ command') + " TLogVAR matches + if len(matches) == 1 + let command = matches[0] + endif + endif + if has_key(agent_names, command) + let agent = agent_names[command] + return call(agent, [a:world, a:selected]) + else + if !empty(command) + echohl WarningMsg + echom "Unknown command:" command + echohl NONE + sleep 1 + endif + let a:world.state = 'display' + return a:world + endif +endf + + +function! tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) + return s:agent_names +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/buffer.vim b/sources_non_forked/tlib/autoload/tlib/buffer.vim index 3f49fdd6..de151a49 100644 --- a/sources_non_forked/tlib/autoload/tlib/buffer.vim +++ b/sources_non_forked/tlib/autoload/tlib/buffer.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2010-09-23. -" @Revision: 0.0.334 +" @Last Change: 2012-02-09. +" @Revision: 0.0.351 let s:bmru = [] @@ -351,6 +351,7 @@ function! tlib#buffer#InsertText(text, ...) "{{{3 exec 'norm! '. posshift .'h' endif endif + " TLogDBG getline(lineno) " TLogDBG string(getline(1, '$')) return grow endf diff --git a/sources_non_forked/tlib/autoload/tlib/cache.vim b/sources_non_forked/tlib/autoload/tlib/cache.vim index 2913772b..c480495c 100644 --- a/sources_non_forked/tlib/autoload/tlib/cache.vim +++ b/sources_non_forked/tlib/autoload/tlib/cache.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2011-03-10. -" @Revision: 0.1.182 +" @Last Change: 2012-05-11. +" @Revision: 0.1.192 " |tlib#cache#Purge()|: Remove cache files older than N days. @@ -24,6 +24,10 @@ TLet g:tlib#cache#script_encoding = &enc " 2 ... Yes TLet g:tlib#cache#run_script = 1 +" If non-nil, don't display a message that files were deleted from the +" cache. +TLet g:tlib#cache#silent = 0 + " A list of regexps that are matched against partial filenames of the " cached files. If a regexp matches, the file won't be removed by " |tlib#cache#Purge()|. @@ -42,10 +46,10 @@ function! tlib#cache#Dir(...) "{{{3 endf -" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0) +" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') function! tlib#cache#Filename(type, ...) "{{{3 " TLogDBG 'bufname='. bufname('.') - let dir = tlib#cache#Dir() + let dir = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir() if a:0 >= 1 && !empty(a:1) let file = a:1 else @@ -87,70 +91,64 @@ endf function! tlib#cache#Save(cfile, dictionary) "{{{3 - if !empty(a:cfile) - " TLogVAR a:dictionary - call writefile([string(a:dictionary)], a:cfile, 'b') - endif + call tlib#persistent#Save(a:cfile, a:dictionary) endf function! tlib#cache#Get(cfile) "{{{3 call tlib#cache#MaybePurge() - if !empty(a:cfile) && filereadable(a:cfile) - let val = readfile(a:cfile, 'b') - return eval(join(val, "\n")) - else - return {} - endif + return tlib#persistent#Get(a:cfile) endf " Call |tlib#cache#Purge()| if the last purge was done before - " |g:tlib#cache#purge_every_days|. - function! tlib#cache#MaybePurge() "{{{3 - if g:tlib#cache#purge_every_days < 0 - return - endif - let dir = tlib#cache#Dir('g') - let last_purge = tlib#file#Join([dir, '.last_purge']) - let last_purge_exists = filereadable(last_purge) +" |g:tlib#cache#purge_every_days|. +function! tlib#cache#MaybePurge() "{{{3 + if g:tlib#cache#purge_every_days < 0 + return + endif + let dir = tlib#cache#Dir('g') + let last_purge = tlib#file#Join([dir, '.last_purge']) + let last_purge_exists = filereadable(last_purge) + if last_purge_exists + let threshold = localtime() - g:tlib#cache#purge_every_days * g:tlib#date#dayshift + let should_purge = getftime(last_purge) < threshold + else + let should_purge = 0 " should ignore empty dirs, like the tmru one: !empty(glob(tlib#file#Join([dir, '**']))) + endif + if should_purge if last_purge_exists - let threshold = localtime() - g:tlib#cache#purge_every_days * g:tlib#date#dayshift - let should_purge = getftime(last_purge) < threshold + let yn = 'y' else - let should_purge = 0 " should ignore empty dirs, like the tmru one: !empty(glob(tlib#file#Join([dir, '**']))) + let txt = "TLib: The cache directory '". dir ."' should be purged of old files.\nDelete files older than ". g:tlib#cache#purge_days ." days now?" + let yn = tlib#input#Dialog(txt, ['yes', 'no'], 'no') endif - if should_purge - if last_purge_exists - let yn = 'y' - else - let txt = "TLib: The cache directory '". dir ."' should be purged of old files.\nDelete files older than ". g:tlib#cache#purge_days ." days now?" - let yn = tlib#input#Dialog(txt, ['yes', 'no'], 'no') + if yn =~ '^y\%[es]$' + call tlib#cache#Purge() + else + let g:tlib#cache#purge_every_days = -1 + if !last_purge_exists + call s:PurgeTimestamp(dir) endif - if yn =~ '^y\%[es]$' - call tlib#cache#Purge() - else - let g:tlib#cache#purge_every_days = -1 - if !last_purge_exists - call s:PurgeTimestamp(dir) - endif - echohl WarningMsg - echom "TLib: Please run :call tlib#cache#Purge() to clean up ". dir - echohl NONE - endif - elseif !last_purge_exists - call s:PurgeTimestamp(dir) + echohl WarningMsg + echom "TLib: Please run :call tlib#cache#Purge() to clean up ". dir + echohl NONE endif - endf + elseif !last_purge_exists + call s:PurgeTimestamp(dir) + endif +endf " Delete old files. function! tlib#cache#Purge() "{{{3 let threshold = localtime() - g:tlib#cache#purge_days * g:tlib#date#dayshift let dir = tlib#cache#Dir('g') - echohl WarningMsg - echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir - echohl NONE + if !g:tlib#cache#silent + echohl WarningMsg + echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir + echohl NONE + endif let files = tlib#cache#ListFilesInCache() let deldir = [] let newer = [] @@ -169,7 +167,6 @@ function! tlib#cache#Purge() "{{{3 call add(msg, "TLib: Could not delete cache file: ". file) else call add(msg, "TLib: Delete cache file: ". file) - " echo "TLib: Delete cache file: ". file endif else call add(newer, file) @@ -179,7 +176,7 @@ function! tlib#cache#Purge() "{{{3 finally let &more = more endtry - if !empty(msg) + if !empty(msg) && !g:tlib#cache#silent echo join(msg, "\n") endif if !empty(deldir) @@ -206,11 +203,14 @@ function! tlib#cache#Purge() "{{{3 call inputsave() if g:tlib#cache#run_script == 0 echohl WarningMsg - echom "TLib: Please review and execute ". scriptfile + if g:tlib#cache#silent + echom "TLib: Purged cache. Need to run script to delete directories" + endif + echom "TLib: Please review and execute: ". scriptfile echohl NONE else try - let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: Could not delete some directories.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') + let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') if yn =~ '^y\%[es]$' exec 'cd '. fnameescape(dir) exec '! ' &shell shellescape(scriptfile, 1) diff --git a/sources_non_forked/tlib/autoload/tlib/cmd.vim b/sources_non_forked/tlib/autoload/tlib/cmd.vim index ea8cd8e5..478e4bb6 100644 --- a/sources_non_forked/tlib/autoload/tlib/cmd.vim +++ b/sources_non_forked/tlib/autoload/tlib/cmd.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-08-23. -" @Last Change: 2011-04-28. -" @Revision: 0.0.31 +" @Last Change: 2012-02-10. +" @Revision: 0.0.35 if &cp || exists("loaded_tlib_cmd_autoload") finish @@ -12,12 +12,18 @@ endif let loaded_tlib_cmd_autoload = 1 +let g:tlib#cmd#last_output = [] + + function! tlib#cmd#OutputAsList(command) "{{{3 + " TLogVAR a:command " let lines = '' redir => lines silent! exec a:command redir END - return split(lines, '\n') + " TLogVAR lines + let g:tlib#cmd#last_output = split(lines, '\n') + return g:tlib#cmd#last_output endf diff --git a/sources_non_forked/tlib/autoload/tlib/file.vim b/sources_non_forked/tlib/autoload/tlib/file.vim index 66673e48..f768abdd 100644 --- a/sources_non_forked/tlib/autoload/tlib/file.vim +++ b/sources_non_forked/tlib/autoload/tlib/file.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2010-04-03. -" @Revision: 0.0.74 +" @Last Change: 2012-03-23. +" @Revision: 0.0.106 if &cp || exists("loaded_tlib_file_autoload") finish @@ -97,22 +97,34 @@ endf function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3 " TLogVAR a:fcmd, a:bcmd, a:files exec tlib#arg#Let([['world', {}]]) + call tlib#autocmdgroup#Init() + augroup TLibFileRead + autocmd! + augroup END for f in a:files let bn = bufnr('^'.f.'$') " TLogVAR f, bn + let bufloaded = bufloaded(bn) + let ok = 0 + let s:bufread = "" if bn != -1 && buflisted(bn) if !empty(a:bcmd) " TLogDBG a:bcmd .' '. bn exec a:bcmd .' '. bn + let ok = 1 call s:SetScrollBind(world) endif else if filereadable(f) if !empty(a:fcmd) - " TLogDBG a:fcmd .' '. escape(f, '%#\ ') - " exec a:fcmd .' '. escape(f, '%#\ ') - " exec a:fcmd .' '. escape(f, '%# ') - exec a:fcmd .' '. tlib#arg#Ex(f) + " TLogDBG a:fcmd .' '. tlib#arg#Ex(f) + exec 'autocmd TLibFileRead BufRead' escape(f, ' ') 'let s:bufread=expand(":p")' + try + exec a:fcmd .' '. tlib#arg#Ex(f) + finally + exec 'autocmd! TLibFileRead BufRead' + endtry + let ok = 1 call s:SetScrollBind(world) endif else @@ -121,7 +133,14 @@ function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3 echohl NONE endif endif + " TLogVAR ok, bufloaded, &filetype + if empty(s:bufread) && ok && !bufloaded && empty(&filetype) + doautocmd BufRead + endif endfor + augroup! TLibFileRead + unlet! s:bufread + " TLogDBG "done" endf diff --git a/sources_non_forked/tlib/autoload/tlib/input.vim b/sources_non_forked/tlib/autoload/tlib/input.vim index 4b081120..302aca88 100644 --- a/sources_non_forked/tlib/autoload/tlib/input.vim +++ b/sources_non_forked/tlib/autoload/tlib/input.vim @@ -3,14 +3,36 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2011-03-31. -" @Revision: 0.0.840 +" @Last Change: 2012-10-01. +" @Revision: 0.0.966 " :filedoc: " Input-related, select from a list etc. +" If true, define a popup menu for |tlib#input#List()| and related +" functions. +TLet g:tlib#input#use_popup = has('menu') && (has('gui_gtk') || has('gui_gtk2') || has('gui_win32')) + + +" How to format filenames: +" l ... Show basenames on the left side, separated from the +" directory names +" r ... Show basenames on the right side +TLet g:tlib#input#format_filename = 'l' + + +" If g:tlib#input#format_filename == 'r', how much space should be kept +" free on the right side. +TLet g:tlib#input#filename_padding_r = '&co / 10' + + +" If g:tlib#input#format_filename == 'l', an expression that +" |eval()|uates to the maximum display width of filenames. +TLet g:tlib#input#filename_max_width = '&co / 2' + + " Functions related to tlib#input#List(type, ...) "{{{2 " :def: function! tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0) @@ -115,65 +137,39 @@ endf " (an instance of tlib#World as returned by |tlib#World#New|). function! tlib#input#ListW(world, ...) "{{{3 TVarArg 'cmd' - if a:world.pick_last_item >= 1 && stridx(a:world.type, 'e') == -1 && len(a:world.base) <= 1 - return get(a:world.base, 0, a:world.rv) - endif + " let time0 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time0 let world = a:world - let world.filetype = &filetype - let world.fileencoding = &fileencoding - call world.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'wb')) + if world.pick_last_item >= 1 && stridx(world.type, 'e') == -1 && len(world.base) <= 1 + let rv = get(world.base, 0, world.rv) + if stridx(world.type, 'm') != -1 + return [rv] + else + return rv + endif + endif call s:Init(world, cmd) " TLogVAR world.state, world.sticky, world.initial_index - let key_agents = copy(g:tlib_keyagents_InputList_s) - if stridx(world.type, 'm') != -1 - call extend(key_agents, g:tlib_keyagents_InputList_m, 'force') - endif - if has('menu') - amenu ]TLibInputListPopupMenu.Pick\ selected\ item - amenu ]TLibInputListPopupMenu.Select # - amenu ]TLibInputListPopupMenu.Select\ all - amenu ]TLibInputListPopupMenu.Reset\ list - amenu ]TLibInputListPopupMenu.Cancel - amenu ]TLibInputListPopupMenu.-StandardEntries- : - endif - for handler in world.key_handlers - let k = get(handler, 'key', '') - if !empty(k) - let key_agents[k] = handler.agent - if has('menu') && has_key(handler, 'help') && !empty(handler.help) - exec 'amenu ]TLibInputListPopupMenu.'. escape(handler.help, ' .\') - \ .' '. handler.key_name - let world.has_menu = 1 - endif - endif - endfor " let statusline = &l:statusline " let laststatus = &laststatus let lastsearch = @/ + let scrolloff = &l:scrolloff + let &l:scrolloff = 0 let @/ = '' let dlist = [] " let &laststatus = 2 - let world.initial_display = 1 try while !empty(world.state) && world.state !~ '^exit' && (world.show_empty || !empty(world.base)) " TLogDBG 'while' " TLogVAR world.state + " let time01 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time01, time01 - time0 try - for handler in world.state_handlers - let eh = get(handler, 'state', '') - if !empty(eh) && world.state =~ eh - let ea = get(handler, 'exec', '') - if !empty(ea) - exec ea - else - let agent = get(handler, 'agent', '') - let world = call(agent, [world, world.GetSelectedItems(world.CurrentItem())]) - call s:CheckAgentReturnValue(agent, world) - endif - endif - endfor + call s:RunStateHandlers(world) + " let time02 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time02, time02 - time0 if world.state =~ '\' " TLogDBG 'reset' " call world.Reset(world.state =~ '\') @@ -181,23 +177,21 @@ function! tlib#input#ListW(world, ...) "{{{3 continue endif - let llenw = len(world.base) - winheight(0) + 1 - if world.offset > llenw - let world.offset = llenw - endif - if world.offset < 1 - let world.offset = 1 - endif + call s:SetOffset(world) + " let time02 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time02, time02 - time0 " TLogDBG 1 " TLogVAR world.state if world.state == 'scroll' let world.prefidx = world.offset let world.state = 'redisplay' endif + if world.state =~ '\' let world.sticky = 1 endif + " TLogVAR world.filter " TLogVAR world.sticky if world.state =~ '\' @@ -206,9 +200,15 @@ function! tlib#input#ListW(world, ...) "{{{3 throw 'pick' elseif world.state =~ 'display' if world.state =~ '^display' + " let time03 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time03, time03 - time0 if world.IsValidFilter() + " let time1 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time1, time1 - time0 call world.BuildTableList() + " let time2 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time2, time2 - time0 " TLogDBG 2 " TLogDBG len(world.table) " TLogVAR world.table @@ -223,6 +223,8 @@ function! tlib#input#ListW(world, ...) "{{{3 let dindex = world.index_table let world.index_width = len(max(dindex)) endif + " let time3 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time3, time3 - time0 if world.llen == 0 && !world.show_empty call world.ReduceFilter() let world.offset = 1 @@ -241,6 +243,8 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.last_item = '' endif endif + " let time4 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time4, time4 - time0 " TLogDBG 4 " TLogVAR world.idx, world.llen, world.state " TLogDBG world.FilterIsEmpty() @@ -256,6 +260,8 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.prefidx = 1 endif endif + " let time5 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time5, time5 - time0 " TLogVAR world.initial_index, world.prefidx " TLogDBG 5 " TLogDBG len(world.list) @@ -270,19 +276,30 @@ function! tlib#input#ListW(world, ...) "{{{3 endif " TLogVAR world.prefidx " TLogDBG 6 + " let time6 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time6, time6 - time0 if world.offset_horizontal > 0 call map(dlist, 'v:val[world.offset_horizontal:-1]') endif + " let time7 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time7, time7 - time0 " TLogVAR dindex let dlist = map(range(0, world.llen - 1), 'printf("%0'. world.index_width .'d", dindex[v:val]) .": ". dlist[v:val]') " TLogVAR dlist + " let time8 = str2float(reltimestr(reltime())) " DBG + " TLogVAR time8, time8 - time0 else let dlist = ['Malformed filter'] endif + else + if world.prefidx == 0 + let world.prefidx = 1 + endif endif + " TLogVAR world.idx, world.prefidx " TLogDBG 7 " TLogVAR world.prefidx, world.offset @@ -301,12 +318,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogDBG 8 if world.initial_display || !tlib#char#IsAvailable() " TLogDBG len(dlist) - if g:tlib_inputlist_shortmessage - let query = 'Filter: '. world.DisplayFilter() - else - let query = world.query .' (filter: '. world.DisplayFilter() .'; press "?" for help)' - endif - call world.DisplayList(query, dlist) + call world.DisplayList(world.Query(), dlist) call world.FollowCursor() let world.initial_display = 0 " TLogDBG 9 @@ -320,7 +332,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " if world.state == 'scroll' " let world.prefidx = world.offset " endif - call world.DisplayList('') + call world.DisplayList() if world.state == 'help' let world.state = 'display' else @@ -344,21 +356,31 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogVAR world.timeout let c = tlib#char#Get(world.timeout, world.timeout_resolution) + " TLogVAR c, has_key(world.key_map[world.key_mode],c) + " TLogDBG string(sort(keys(world.key_map[world.key_mode]))) if world.state != '' " continue - elseif has_key(key_agents, c) + elseif has_key(world.key_map[world.key_mode], c) let sr = @/ silent! let @/ = lastsearch - " TLogVAR c, key_agents[c] - " TLog "Agent: ". string(key_agents[c]) - let world = call(key_agents[c], [world, world.GetSelectedItems(world.CurrentItem())]) + " TLogVAR c, world.key_map[world.key_mode][c] + " TLog "Agent: ". string(world.key_map[world.key_mode][c]) + let handler = world.key_map[world.key_mode][c] + " TLogVAR handler + let world = call(handler.agent, [world, world.GetSelectedItems(world.CurrentItem())]) call s:CheckAgentReturnValue(c, world) silent! let @/ = sr " continue elseif c == 13 throw 'pick' elseif c == 27 - let world.state = 'exit empty' + " TLogVAR c, world.key_mode + if world.key_mode != 'default' + let world.key_mode = 'default' + let world.state = 'redisplay' + else + let world.state = 'exit empty' + endif elseif c == "\" let world.prefidx = world.GetLineIdx(v:mouse_lnum) " let world.offset = world.prefidx @@ -371,12 +393,12 @@ function! tlib#input#ListW(world, ...) "{{{3 endif throw 'pick' elseif c == "\" - if has('menu') + if g:tlib#input#use_popup && world.has_menu " if v:mouse_lnum != line('.') " endif let world.prefidx = world.GetLineIdx(v:mouse_lnum) let world.state = 'redisplay' - call world.DisplayList('') + call world.DisplayList() if line('w$') - v:mouse_lnum < 6 popup ]TLibInputListPopupMenu else @@ -386,6 +408,9 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.state = 'redisplay' endif " TLogVAR world.prefidx, world.state + elseif has_key(world.key_map[world.key_mode], 'unknown_key') + let agent = world.key_map[world.key_mode].unknown_key.agent + let world = call(agent, [world, c]) elseif c >= 32 let world.state = 'display' let numbase = get(world.numeric_chars, c, -99999) @@ -526,8 +551,10 @@ function! tlib#input#ListW(world, ...) "{{{3 " let &l:statusline = statusline " let &laststatus = laststatus silent! let @/ = lastsearch - if has('menu') && world.has_menu + let &l:scrolloff = scrolloff + if g:tlib#input#use_popup && world.has_menu silent! aunmenu ]TLibInputListPopupMenu + let world.has_menu = 0 endif " TLogDBG 'finally 2' @@ -568,6 +595,7 @@ endf function! s:Init(world, cmd) "{{{3 " TLogVAR a:cmd + let a:world.initial_display = 1 if a:cmd =~ '\' let a:world.sticky = 1 endif @@ -582,15 +610,117 @@ function! s:Init(world, cmd) "{{{3 endif elseif !a:world.initialized " TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr + let a:world.filetype = &filetype + let a:world.fileencoding = &fileencoding + call a:world.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'wb')) call a:world.Initialize() + if !has_key(a:world, 'key_mode') + let a:world.key_mode = 'default' + endif + " TLogVAR has_key(a:world,'key_map') + if has_key(a:world, 'key_map') + " TLogVAR has_key(a:world.key_map,a:world.key_mode) + if has_key(a:world.key_map, a:world.key_mode) + let a:world.key_map[a:world.key_mode] = extend( + \ a:world.key_map[a:world.key_mode], + \ copy(g:tlib_keyagents_InputList_s), + \ 'keep') + else + let a:world.key_map[a:world.key_mode] = copy(g:tlib_keyagents_InputList_s) + endif + else + let a:world.key_map = { + \ a:world.key_mode : copy(g:tlib_keyagents_InputList_s) + \ } + endif + if stridx(a:world.type, 'm') != -1 + call extend(a:world.key_map[a:world.key_mode], g:tlib_keyagents_InputList_m, 'force') + endif + for key_mode in keys(a:world.key_map) + let a:world.key_map[key_mode] = map(a:world.key_map[key_mode], 'type(v:val) == 4 ? v:val : {"agent": v:val}') + endfor + if type(a:world.key_handlers) == 3 + call s:ExtendKeyMap(a:world, a:world.key_mode, a:world.key_handlers) + elseif type(a:world.key_handlers) == 4 + for [world_key_mode, world_key_handlers] in items(a:world.key_handlers) + call s:ExtendKeyMap(a:world, world_key_mode, world_key_handlers) + endfor + else + throw "tlib#input#ListW: key_handlers must be either a list or a dictionary" + endif if !empty(a:cmd) let a:world.state .= ' '. a:cmd endif endif + call s:BuildMenu(a:world) " TLogVAR a:world.state, a:world.sticky endf +function! s:ExtendKeyMap(world, key_mode, key_handlers) "{{{3 + for handler in a:key_handlers + let k = get(handler, 'key', '') + if !empty(k) + let a:world.key_map[a:key_mode][k] = handler + endif + endfor +endf + + +function! s:BuildMenu(world) "{{{3 + if g:tlib#input#use_popup + if a:world.has_menu + silent! aunmenu ]TLibInputListPopupMenu + endif + amenu ]TLibInputListPopupMenu.Pick\ selected\ item + amenu ]TLibInputListPopupMenu.Select # + amenu ]TLibInputListPopupMenu.Select\ all + amenu ]TLibInputListPopupMenu.Reset\ list + amenu ]TLibInputListPopupMenu.Cancel + amenu ]TLibInputListPopupMenu.-StandardEntries- : + let a:world.has_menu = 1 + for [key_mode, key_handlers] in items(a:world.key_map) + let keys = sort(keys(key_handlers)) + for key in keys + let handler = key_handlers[key] + let k = get(handler, 'key', '') + if !empty(k) && has_key(handler, 'help') && !empty(handler.help) + if empty(key_mode) || key_mode == 'default' + exec 'amenu ]TLibInputListPopupMenu.'. escape(handler.help, ' .\') + \ .' '. handler.key_name + else + exec 'amenu ]TLibInputListPopupMenu'. + \ '.'. escape(key_mode, ' .\') + \ '.'. escape(handler.help, ' .\') + \ .' '. handler.key_name + endif + endif + endfor + endfor + endif +endf + + +function! s:RunStateHandlers(world) "{{{3 + " Provide the variable "world" in the environment of an "exec" + " handler (ea). + let world = a:world + for handler in a:world.state_handlers + let eh = get(handler, 'state', '') + if !empty(eh) && a:world.state =~ eh + let ea = get(handler, 'exec', '') + if !empty(ea) + exec ea + else + let agent = get(handler, 'agent', '') + let a:world = call(agent, [a:world, a:world.GetSelectedItems(a:world.CurrentItem())]) + call s:CheckAgentReturnValue(agent, a:world) + endif + endif + endfor +endf + + function! s:CheckAgentReturnValue(name, value) "{{{3 if type(a:value) != 4 && !has_key(a:value, 'state') echoerr 'Malformed agent: '. a:name @@ -599,6 +729,17 @@ function! s:CheckAgentReturnValue(name, value) "{{{3 endf +function! s:SetOffset(world) "{{{3 + let llenw = len(a:world.base) - winheight(0) + 1 + if a:world.offset > llenw + let a:world.offset = llenw + endif + if a:world.offset < 1 + let a:world.offset = 1 + endif +endf + + " Functions related to tlib#input#EditList(type, ...) "{{{2 " :def: function! tlib#input#EditList(query, list, ?timeout=0) @@ -622,26 +763,47 @@ function! tlib#input#EditList(query, list, ...) "{{{3 endf -function! tlib#input#Resume(name, pick) "{{{3 +function! tlib#input#Resume(name, pick, bufnr) "{{{3 + " TLogVAR a:name, a:pick echo - if exists('b:tlib_suspend') - for [m, pick] in items(b:tlib_suspend) - exec 'unmap '. m - endfor - unlet b:tlib_suspend + if bufnr('%') != a:bufnr + if g:tlib_debug + echohl WarningMsg + echom "tlib#input#Resume: Internal error: Not in scratch buffer:" bufname('%') + echohl NONE + endif + let br = tlib#buffer#Set(a:bufnr) endif - call tlib#autocmdgroup#Init() - autocmd! TLib InsertEnter,InsertChange - let b:tlib_{a:name}.state = 'display' - " call tlib#input#List('resume '. a:name) - let cmd = 'resume '. a:name - if a:pick >= 1 - let cmd .= ' pick' - if a:pick >= 2 - let cmd .= ' sticky' - end + if !exists('b:tlib_'. a:name) + if g:tlib_debug + echohl WarningMsg + echom "tlib#input#Resume: Internal error: b:tlib_". a:name ." does not exist:" bufname('%') + echohl NONE + redir => varss + silent let b: + redir END + let vars = split(varss, '\n') + call filter(vars, 'v:val =~ "^b:tlib_"') + echom "DEBUG tlib#input#Resume" string(vars) + endif + else + call tlib#autocmdgroup#Init() + autocmd! TLib BufEnter + if b:tlib_{a:name}.state =~ '\' + let b:tlib_{a:name}.state = 'redisplay' + else + let b:tlib_{a:name}.state .= ' redisplay' + endif + " call tlib#input#List('resume '. a:name) + let cmd = 'resume '. a:name + if a:pick >= 1 + let cmd .= ' pick' + if a:pick >= 2 + let cmd .= ' sticky' + end + endif + call tlib#input#ListW(b:tlib_{a:name}, cmd) endif - call tlib#input#ListW(b:tlib_{a:name}, cmd) endf diff --git a/sources_non_forked/tlib/autoload/tlib/notify.vim b/sources_non_forked/tlib/autoload/tlib/notify.vim index c6a19367..cf6a0473 100644 --- a/sources_non_forked/tlib/autoload/tlib/notify.vim +++ b/sources_non_forked/tlib/autoload/tlib/notify.vim @@ -3,16 +3,17 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-09-19. -" @Last Change: 2011-03-10. -" @Revision: 0.0.15 +" @Last Change: 2012-01-02. +" @Revision: 0.0.19 let s:save_cpo = &cpo set cpo&vim +" :display: tlib#notify#Echo(text, ?style='') " Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' " in order to prevent |press-enter| messages. -function! tlib#notify#Echo(text, ...) "{{{3 +function! tlib#notify#Echo(text, ...) TVarArg 'style' let ruler = &ruler let showcmd = &showcmd diff --git a/sources_non_forked/tlib/autoload/tlib/persistent.vim b/sources_non_forked/tlib/autoload/tlib/persistent.vim new file mode 100644 index 00000000..a4611a69 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/persistent.vim @@ -0,0 +1,47 @@ +" persistent.vim -- Persistent data +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2012-05-11. +" @Last Change: 2012-05-11. +" @Revision: 6 + +" The directory for persistent data files. If empty, use +" |tlib#dir#MyRuntime|.'/share'. +TLet g:tlib_persistent = '' + + +" :display: tlib#persistent#Dir(?mode = 'bg') +" Return the full directory name for persistent data files. +function! tlib#persistent#Dir() "{{{3 + TVarArg ['mode', 'bg'] + let dir = tlib#var#Get('tlib_persistent', mode) + if empty(dir) + let dir = tlib#file#Join([tlib#dir#MyRuntime(), 'share']) + endif + return dir +endf + +" :def: function! tlib#persistent#Filename(type, ?file=%, ?mkdir=0) +function! tlib#persistent#Filename(type, ...) "{{{3 + " TLogDBG 'bufname='. bufname('.') + let file = a:0 >= 1 ? a:1 : '' + let mkdir = a:0 >= 2 ? a:2 : 0 + return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir()) +endf + +function! tlib#persistent#Get(cfile) "{{{3 + if !empty(a:cfile) && filereadable(a:cfile) + let val = readfile(a:cfile, 'b') + return eval(join(val, "\n")) + else + return {} + endif +endf + +function! tlib#persistent#Save(cfile, dictionary) "{{{3 + if !empty(a:cfile) + " TLogVAR a:dictionary + call writefile([string(a:dictionary)], a:cfile, 'b') + endif +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/scratch.vim b/sources_non_forked/tlib/autoload/tlib/scratch.vim index 533bf421..41f935d9 100644 --- a/sources_non_forked/tlib/autoload/tlib/scratch.vim +++ b/sources_non_forked/tlib/autoload/tlib/scratch.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-07-18. -" @Last Change: 2011-03-10. -" @Revision: 0.0.166 +" @Last Change: 2012-02-08. +" @Revision: 0.0.167 if &cp || exists("loaded_tlib_scratch_autoload") finish @@ -29,7 +29,7 @@ function! tlib#scratch#UseScratch(...) "{{{3 " TLogDBG bufnr('%') if id =~ '^\d\+$' && bufwinnr(id) != -1 if bufnr('%') != id - exec 'buffer! '. id + exec 'noautocmd buffer! '. id endif " let ft = &ft let ft = '*' @@ -47,29 +47,29 @@ function! tlib#scratch#UseScratch(...) "{{{3 let wn = bufwinnr(bn) if wn != -1 " TLogVAR wn - exec wn .'wincmd w' + exec 'noautocmd' (wn .'wincmd w') else if scratch_split == 1 - let cmd = wpos.' sbuffer! ' + let cmd = wpos.' sbuffer!' elseif scratch_split == -1 - let cmd = wpos.' tab sbuffer! ' + let cmd = wpos.' tab sbuffer!' else - let cmd = 'buffer! ' + let cmd = 'buffer!' endif " TLogVAR cmd - silent exec cmd . bn + silent exec 'noautocmd' cmd bn endif else " TLogVAR id if scratch_split == 1 - let cmd = wpos.' split ' + let cmd = wpos.' split' elseif scratch_split == -1 - let cmd = wpos.' tab split ' + let cmd = wpos.' tab split' else - let cmd = 'edit ' + let cmd = 'edit' endif " TLogVAR cmd - silent exec cmd . escape(id, '%#\ ') + silent exec 'noautocmd' cmd escape(id, '%#\ ') " silent exec 'split '. id endif let ft = get(keyargs, 'scratch_filetype', '') diff --git a/sources_non_forked/tlib/autoload/tlib/tag.vim b/sources_non_forked/tlib/autoload/tlib/tag.vim index 97f4d1ba..64a1715c 100644 --- a/sources_non_forked/tlib/autoload/tlib/tag.vim +++ b/sources_non_forked/tlib/autoload/tlib/tag.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-11-01. -" @Last Change: 2011-03-10. -" @Revision: 0.0.53 +" @Last Change: 2011-08-11. +" @Revision: 0.0.56 if &cp || exists("loaded_tlib_tag_autoload") finish @@ -38,6 +38,7 @@ let loaded_tlib_tag_autoload = 1 " < tags from the JDK will be included. function! tlib#tag#Retrieve(rx, ...) "{{{3 TVarArg ['extra_tags', 0] + " TLogVAR a:rx, extra_tags if extra_tags let tags_orig = &l:tags if empty(tags_orig) diff --git a/sources_non_forked/tlib/autoload/tlib/vcs.vim b/sources_non_forked/tlib/autoload/tlib/vcs.vim new file mode 100644 index 00000000..42bb0c25 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/vcs.vim @@ -0,0 +1,155 @@ +" vcs.vim +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2012-03-08. +" @Last Change: 2012-09-10. +" @Revision: 122 + + +" A dictionarie of supported VCS (currently: git, hg, svn, bzr). +" :display: g:tlib#vcs#def {...} +TLet g:tlib#vcs#def = { + \ 'git': { + \ 'dir': '.git', + \ 'ls': 'git ls-files --full-name %s', + \ 'diff': 'git diff --no-ext-diff -U0 %s' + \ }, + \ 'hg': { + \ 'dir': '.hg', + \ 'diff': 'hg diff -U0 %s', + \ 'ls': 'hg manifest' + \ }, + \ 'svn': { + \ 'dir': '.svn', + \ 'diff': 'svn diff --diff-cmd diff --extensions -U0 %s', + \ }, + \ 'bzr': { + \ 'dir': '.bzr', + \ 'diff': 'bzr diff --diff-options=-U0 %s', + \ } + \ } + + +" A dictionary of custom executables for VCS commands. If the value is +" empty, support for that VCS will be removed. If no key is present, it +" is assumed that the VCS "type" is the name of the executable. +" :display: g:tlib#vcs#executables {...} +TLet g:tlib#vcs#executables = {} + + +" If non-empty, use it as a format string to check whether a VCS is +" installed on your computer. +TLet g:tlib#vcs#check = has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s' + + +if !empty(g:tlib#vcs#check) + for [s:cmd, s:def] in items(g:tlib#vcs#def) + if !has_key(g:tlib#vcs#executables, s:cmd) + let s:cmd1 = printf(g:tlib#vcs#check, s:cmd) + let g:tlib#vcs#executables[s:cmd] = executable(s:cmd1) ? s:cmd1 : '' + endif + endfor +endif + + +function! tlib#vcs#FindVCS(filename) "{{{3 + let type = '' + let dir = '' + " let path = escape(fnamemodify(a:filename, ':p'), ',:') .';' + let filename = fnamemodify(a:filename, isdirectory(a:filename) ? ':p:h' : ':p') + let path = escape(filename, ';') .';' + " TLogVAR a:filename, path + let depth = -1 + for vcs in keys(g:tlib#vcs#def) + let subdir = g:tlib#vcs#def[vcs].dir + let vcsdir = finddir(subdir, path) + " TLogVAR vcs, subdir, vcsdir + if !empty(vcsdir) + let vcsdir_depth = len(split(fnamemodify(vcsdir, ':p'), '\/')) + if vcsdir_depth > depth + let depth = vcsdir_depth + let type = vcs + let dir = vcsdir + " TLogVAR type, depth + endif + endif + endfor + " TLogVAR type, dir + if empty(type) + return ['', ''] + else + return [type, dir] + endif +endf + + +function! s:GetCmd(vcstype, cmd) + let vcsdef = get(g:tlib#vcs#def, a:vcstype, {}) + if has_key(vcsdef, a:cmd) + let cmd = vcsdef[a:cmd] + let bin = get(g:tlib#vcs#executables, a:vcstype, '') + if empty(bin) + let cmd = '' + elseif bin != a:vcstype + " let bin = escape(shellescape(bin), '\') + let bin = escape(bin, '\') + let cmd = substitute(cmd, '^.\{-}\zs'. escape(a:vcstype, '\'), bin, '') + endif + return cmd + else + return '' + endif +endf + + +" :display: tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir]) +" Return the files under VCS. +function! tlib#vcs#Ls(...) "{{{3 + if a:0 >= 2 + let vcs = a:2 + else + let vcs = tlib#vcs#FindVCS(a:0 >= 1 ? a:1 : bufname('%')) + endif + " TLogVAR vcs + if !empty(vcs) + let [vcstype, vcsdir] = vcs + if has_key(g:tlib#vcs#def, vcstype) + let ls = s:GetCmd(vcstype, 'ls') + " TLogVAR ls + if !empty(ls) + let rootdir = fnamemodify(vcsdir, ':p:h:h') + " TLogVAR vcsdir, rootdir + if ls =~ '%s' + let cmd = printf(ls, shellescape(rootdir)) + else + let cmd = ls + endif + " TLogVAR cmd + let filess = system(cmd) + " TLogVAR filess + let files = split(filess, '\n') + call map(files, 'join([rootdir, v:val], "/")') + return files + endif + endif + endif + return [] +endf + + +" :display: tlib#vcs#Diff(filename, ?vcs=[type, dir]) +" Return the diff for "filename" +function! tlib#vcs#Diff(filename, ...) "{{{3 + let vcs = a:0 >= 1 ? a:1 : tlib#vcs#FindVCS(a:filename) + if !empty(vcs) + let [vcstype, vcsdir] = vcs + let diff = s:GetCmd(vcstype, 'diff') + if !empty(diff) + let cmd = printf(diff, shellescape(fnamemodify(a:filename, ':p'))) + let patch = system(cmd) + return patch + endif + endif + return [] +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/vim.vim b/sources_non_forked/tlib/autoload/tlib/vim.vim index 2ebfd12f..150c4161 100644 --- a/sources_non_forked/tlib/autoload/tlib/vim.vim +++ b/sources_non_forked/tlib/autoload/tlib/vim.vim @@ -3,8 +3,8 @@ " @GIT: http://github.com/tomtom/tlib_vim/ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-07-19. -" @Last Change: 2010-10-24. -" @Revision: 24 +" @Last Change: 2012-06-08. +" @Revision: 35 let s:restoreframecmd = '' @@ -13,14 +13,22 @@ let s:fullscreen = 0 if has('win16') || has('win32') || has('win64') if !exists('g:tlib#vim#simalt_maximize') + " The alt-key for maximizing the window. + " CAUTION: The value of this paramter depends on your locale and + " maybe the windows version you are running. let g:tlib#vim#simalt_maximize = 'x' "{{{2 endif if !exists('g:tlib#vim#simalt_restore') + " The alt-key for restoring the window. + " CAUTION: The value of this paramter depends on your locale and + " maybe the windows version you are running. let g:tlib#vim#simalt_restore = 'r' "{{{2 endif if !exists('g:tlib#vim#use_vimtweak') + " If true, use the vimtweak.dll for windows. This will enable + " tlib to remove the caption for fullscreen windows. let g:tlib#vim#use_vimtweak = 0 "{{{2 endif @@ -54,6 +62,13 @@ if has('win16') || has('win32') || has('win64') else if !exists('g:tlib#vim#use_wmctrl') + " If true, use wmctrl for X windows to make a window + " maximized/fullscreen. + " + " This is the preferred method for maximizing windows under X + " windows. Some window managers have problem coping with the + " default method of setting 'lines' and 'columns' to a large + " value. let g:tlib#vim#use_wmctrl = executable('wmctrl') "{{{2 endif diff --git a/sources_non_forked/tlib/doc/tags b/sources_non_forked/tlib/doc/tags new file mode 100644 index 00000000..8ca42840 --- /dev/null +++ b/sources_non_forked/tlib/doc/tags @@ -0,0 +1,252 @@ +:TBrowseOutput tlib.txt /*:TBrowseOutput* +:TBrowseScriptnames tlib.txt /*:TBrowseScriptnames* +:TKeyArg tlib.txt /*:TKeyArg* +:TLet tlib.txt /*:TLet* +:TRequire tlib.txt /*:TRequire* +:TScratch tlib.txt /*:TScratch* +:TTimeCommand tlib.txt /*:TTimeCommand* +:TVarArg tlib.txt /*:TVarArg* +g:tlib#Filter_cnfx#expander tlib.txt /*g:tlib#Filter_cnfx#expander* +g:tlib#cache#dont_purge tlib.txt /*g:tlib#cache#dont_purge* +g:tlib#cache#purge_days tlib.txt /*g:tlib#cache#purge_days* +g:tlib#cache#purge_every_days tlib.txt /*g:tlib#cache#purge_every_days* +g:tlib#cache#run_script tlib.txt /*g:tlib#cache#run_script* +g:tlib#cache#script_encoding tlib.txt /*g:tlib#cache#script_encoding* +g:tlib#cache#silent tlib.txt /*g:tlib#cache#silent* +g:tlib#input#filename_max_width tlib.txt /*g:tlib#input#filename_max_width* +g:tlib#input#filename_padding_r tlib.txt /*g:tlib#input#filename_padding_r* +g:tlib#input#format_filename tlib.txt /*g:tlib#input#format_filename* +g:tlib#input#use_popup tlib.txt /*g:tlib#input#use_popup* +g:tlib#vcs#check tlib.txt /*g:tlib#vcs#check* +g:tlib#vcs#def tlib.txt /*g:tlib#vcs#def* +g:tlib#vcs#executables tlib.txt /*g:tlib#vcs#executables* +g:tlib#vim#simalt_maximize tlib.txt /*g:tlib#vim#simalt_maximize* +g:tlib#vim#simalt_restore tlib.txt /*g:tlib#vim#simalt_restore* +g:tlib#vim#use_vimtweak tlib.txt /*g:tlib#vim#use_vimtweak* +g:tlib#vim#use_wmctrl tlib.txt /*g:tlib#vim#use_wmctrl* +g:tlib_cache tlib.txt /*g:tlib_cache* +g:tlib_debug tlib.txt /*g:tlib_debug* +g:tlib_filename_sep tlib.txt /*g:tlib_filename_sep* +g:tlib_handlers_EditList tlib.txt /*g:tlib_handlers_EditList* +g:tlib_inputlist_and tlib.txt /*g:tlib_inputlist_and* +g:tlib_inputlist_filename_indicators tlib.txt /*g:tlib_inputlist_filename_indicators* +g:tlib_inputlist_higroup tlib.txt /*g:tlib_inputlist_higroup* +g:tlib_inputlist_livesearch_threshold tlib.txt /*g:tlib_inputlist_livesearch_threshold* +g:tlib_inputlist_match tlib.txt /*g:tlib_inputlist_match* +g:tlib_inputlist_not tlib.txt /*g:tlib_inputlist_not* +g:tlib_inputlist_or tlib.txt /*g:tlib_inputlist_or* +g:tlib_inputlist_pct tlib.txt /*g:tlib_inputlist_pct* +g:tlib_inputlist_shortmessage tlib.txt /*g:tlib_inputlist_shortmessage* +g:tlib_inputlist_width_filename tlib.txt /*g:tlib_inputlist_width_filename* +g:tlib_keyagents_InputList_m tlib.txt /*g:tlib_keyagents_InputList_m* +g:tlib_keyagents_InputList_s tlib.txt /*g:tlib_keyagents_InputList_s* +g:tlib_numeric_chars tlib.txt /*g:tlib_numeric_chars* +g:tlib_persistent tlib.txt /*g:tlib_persistent* +g:tlib_pick_last_item tlib.txt /*g:tlib_pick_last_item* +g:tlib_scratch_pos tlib.txt /*g:tlib_scratch_pos* +g:tlib_scroll_lines tlib.txt /*g:tlib_scroll_lines* +g:tlib_sortprefs_threshold tlib.txt /*g:tlib_sortprefs_threshold* +g:tlib_tag_substitute tlib.txt /*g:tlib_tag_substitute* +g:tlib_tags_extra tlib.txt /*g:tlib_tags_extra* +g:tlib_viewline_position tlib.txt /*g:tlib_viewline_position* +o_sp tlib.txt /*o_sp* +standard-paragraph tlib.txt /*standard-paragraph* +tlib#Filter_cnf#New() tlib.txt /*tlib#Filter_cnf#New()* +tlib#Filter_cnfd#New() tlib.txt /*tlib#Filter_cnfd#New()* +tlib#Filter_cnfx#New() tlib.txt /*tlib#Filter_cnfx#New()* +tlib#Filter_fuzzy#New() tlib.txt /*tlib#Filter_fuzzy#New()* +tlib#Object#Methods() tlib.txt /*tlib#Object#Methods()* +tlib#Object#New() tlib.txt /*tlib#Object#New()* +tlib#World#New() tlib.txt /*tlib#World#New()* +tlib#agent#AND() tlib.txt /*tlib#agent#AND()* +tlib#agent#CompleteAgentNames() tlib.txt /*tlib#agent#CompleteAgentNames()* +tlib#agent#Copy() tlib.txt /*tlib#agent#Copy()* +tlib#agent#CopyItems() tlib.txt /*tlib#agent#CopyItems()* +tlib#agent#Cut() tlib.txt /*tlib#agent#Cut()* +tlib#agent#Debug() tlib.txt /*tlib#agent#Debug()* +tlib#agent#DeleteItems() tlib.txt /*tlib#agent#DeleteItems()* +tlib#agent#DoAtLine() tlib.txt /*tlib#agent#DoAtLine()* +tlib#agent#Down() tlib.txt /*tlib#agent#Down()* +tlib#agent#DownN() tlib.txt /*tlib#agent#DownN()* +tlib#agent#EditFile() tlib.txt /*tlib#agent#EditFile()* +tlib#agent#EditFileInSplit() tlib.txt /*tlib#agent#EditFileInSplit()* +tlib#agent#EditFileInTab() tlib.txt /*tlib#agent#EditFileInTab()* +tlib#agent#EditFileInVSplit() tlib.txt /*tlib#agent#EditFileInVSplit()* +tlib#agent#EditItem() tlib.txt /*tlib#agent#EditItem()* +tlib#agent#EditReturnValue() tlib.txt /*tlib#agent#EditReturnValue()* +tlib#agent#ExecAgentByName() tlib.txt /*tlib#agent#ExecAgentByName()* +tlib#agent#Exit() tlib.txt /*tlib#agent#Exit()* +tlib#agent#GotoLine() tlib.txt /*tlib#agent#GotoLine()* +tlib#agent#Help() tlib.txt /*tlib#agent#Help()* +tlib#agent#Input() tlib.txt /*tlib#agent#Input()* +tlib#agent#NewItem() tlib.txt /*tlib#agent#NewItem()* +tlib#agent#Null() tlib.txt /*tlib#agent#Null()* +tlib#agent#OR() tlib.txt /*tlib#agent#OR()* +tlib#agent#PageDown() tlib.txt /*tlib#agent#PageDown()* +tlib#agent#PageUp() tlib.txt /*tlib#agent#PageUp()* +tlib#agent#Paste() tlib.txt /*tlib#agent#Paste()* +tlib#agent#PopFilter() tlib.txt /*tlib#agent#PopFilter()* +tlib#agent#PreviewLine() tlib.txt /*tlib#agent#PreviewLine()* +tlib#agent#ReduceFilter() tlib.txt /*tlib#agent#ReduceFilter()* +tlib#agent#Reset() tlib.txt /*tlib#agent#Reset()* +tlib#agent#Select() tlib.txt /*tlib#agent#Select()* +tlib#agent#SelectAll() tlib.txt /*tlib#agent#SelectAll()* +tlib#agent#SelectDown() tlib.txt /*tlib#agent#SelectDown()* +tlib#agent#SelectUp() tlib.txt /*tlib#agent#SelectUp()* +tlib#agent#ShiftLeft() tlib.txt /*tlib#agent#ShiftLeft()* +tlib#agent#ShiftRight() tlib.txt /*tlib#agent#ShiftRight()* +tlib#agent#ShowInfo() tlib.txt /*tlib#agent#ShowInfo()* +tlib#agent#Suspend() tlib.txt /*tlib#agent#Suspend()* +tlib#agent#SuspendToParentWindow() tlib.txt /*tlib#agent#SuspendToParentWindow()* +tlib#agent#ToggleScrollbind() tlib.txt /*tlib#agent#ToggleScrollbind()* +tlib#agent#ToggleStickyList() tlib.txt /*tlib#agent#ToggleStickyList()* +tlib#agent#Up() tlib.txt /*tlib#agent#Up()* +tlib#agent#UpN() tlib.txt /*tlib#agent#UpN()* +tlib#agent#ViewFile() tlib.txt /*tlib#agent#ViewFile()* +tlib#agent#Wildcard() tlib.txt /*tlib#agent#Wildcard()* +tlib#arg#Ex() tlib.txt /*tlib#arg#Ex()* +tlib#arg#Get() tlib.txt /*tlib#arg#Get()* +tlib#arg#Key() tlib.txt /*tlib#arg#Key()* +tlib#arg#Let() tlib.txt /*tlib#arg#Let()* +tlib#arg#StringAsKeyArgs() tlib.txt /*tlib#arg#StringAsKeyArgs()* +tlib#autocmdgroup#Init() tlib.txt /*tlib#autocmdgroup#Init()* +tlib#balloon#Expr() tlib.txt /*tlib#balloon#Expr()* +tlib#balloon#Register() tlib.txt /*tlib#balloon#Register()* +tlib#balloon#Remove() tlib.txt /*tlib#balloon#Remove()* +tlib#buffer#BufDo() tlib.txt /*tlib#buffer#BufDo()* +tlib#buffer#CurrentByte() tlib.txt /*tlib#buffer#CurrentByte()* +tlib#buffer#DeleteRange() tlib.txt /*tlib#buffer#DeleteRange()* +tlib#buffer#DisableMRU() tlib.txt /*tlib#buffer#DisableMRU()* +tlib#buffer#EnableMRU() tlib.txt /*tlib#buffer#EnableMRU()* +tlib#buffer#Eval() tlib.txt /*tlib#buffer#Eval()* +tlib#buffer#GetList() tlib.txt /*tlib#buffer#GetList()* +tlib#buffer#HighlightLine() tlib.txt /*tlib#buffer#HighlightLine()* +tlib#buffer#InsertText() tlib.txt /*tlib#buffer#InsertText()* +tlib#buffer#InsertText0() tlib.txt /*tlib#buffer#InsertText0()* +tlib#buffer#KeepCursorPosition() tlib.txt /*tlib#buffer#KeepCursorPosition()* +tlib#buffer#ReplaceRange() tlib.txt /*tlib#buffer#ReplaceRange()* +tlib#buffer#ScratchEnd() tlib.txt /*tlib#buffer#ScratchEnd()* +tlib#buffer#ScratchStart() tlib.txt /*tlib#buffer#ScratchStart()* +tlib#buffer#Set() tlib.txt /*tlib#buffer#Set()* +tlib#buffer#ViewLine() tlib.txt /*tlib#buffer#ViewLine()* +tlib#cache#Dir() tlib.txt /*tlib#cache#Dir()* +tlib#cache#Filename() tlib.txt /*tlib#cache#Filename()* +tlib#cache#Get() tlib.txt /*tlib#cache#Get()* +tlib#cache#ListFilesInCache() tlib.txt /*tlib#cache#ListFilesInCache()* +tlib#cache#MaybePurge() tlib.txt /*tlib#cache#MaybePurge()* +tlib#cache#Purge() tlib.txt /*tlib#cache#Purge()* +tlib#cache#Save() tlib.txt /*tlib#cache#Save()* +tlib#char#Get() tlib.txt /*tlib#char#Get()* +tlib#char#GetWithTimeout() tlib.txt /*tlib#char#GetWithTimeout()* +tlib#char#IsAvailable() tlib.txt /*tlib#char#IsAvailable()* +tlib#cmd#BrowseOutput() tlib.txt /*tlib#cmd#BrowseOutput()* +tlib#cmd#BrowseOutputWithCallback() tlib.txt /*tlib#cmd#BrowseOutputWithCallback()* +tlib#cmd#DefaultBrowseOutput() tlib.txt /*tlib#cmd#DefaultBrowseOutput()* +tlib#cmd#OutputAsList() tlib.txt /*tlib#cmd#OutputAsList()* +tlib#cmd#ParseScriptname() tlib.txt /*tlib#cmd#ParseScriptname()* +tlib#cmd#Time() tlib.txt /*tlib#cmd#Time()* +tlib#cmd#UseVertical() tlib.txt /*tlib#cmd#UseVertical()* +tlib#comments#Comments() tlib.txt /*tlib#comments#Comments()* +tlib#date#DiffInDays() tlib.txt /*tlib#date#DiffInDays()* +tlib#date#Parse() tlib.txt /*tlib#date#Parse()* +tlib#date#SecondsSince1970() tlib.txt /*tlib#date#SecondsSince1970()* +tlib#dir#CD() tlib.txt /*tlib#dir#CD()* +tlib#dir#CanonicName() tlib.txt /*tlib#dir#CanonicName()* +tlib#dir#Ensure() tlib.txt /*tlib#dir#Ensure()* +tlib#dir#MyRuntime() tlib.txt /*tlib#dir#MyRuntime()* +tlib#dir#PlainName() tlib.txt /*tlib#dir#PlainName()* +tlib#dir#Pop() tlib.txt /*tlib#dir#Pop()* +tlib#dir#Push() tlib.txt /*tlib#dir#Push()* +tlib#eval#FormatValue() tlib.txt /*tlib#eval#FormatValue()* +tlib#file#Join() tlib.txt /*tlib#file#Join()* +tlib#file#Relative() tlib.txt /*tlib#file#Relative()* +tlib#file#Split() tlib.txt /*tlib#file#Split()* +tlib#file#With() tlib.txt /*tlib#file#With()* +tlib#hook#Run() tlib.txt /*tlib#hook#Run()* +tlib#input#CommandSelect() tlib.txt /*tlib#input#CommandSelect()* +tlib#input#Dialog() tlib.txt /*tlib#input#Dialog()* +tlib#input#Edit() tlib.txt /*tlib#input#Edit()* +tlib#input#EditList() tlib.txt /*tlib#input#EditList()* +tlib#input#List() tlib.txt /*tlib#input#List()* +tlib#input#ListD() tlib.txt /*tlib#input#ListD()* +tlib#input#ListW() tlib.txt /*tlib#input#ListW()* +tlib#input#Resume() tlib.txt /*tlib#input#Resume()* +tlib#list#All() tlib.txt /*tlib#list#All()* +tlib#list#Any() tlib.txt /*tlib#list#Any()* +tlib#list#Compact() tlib.txt /*tlib#list#Compact()* +tlib#list#Find() tlib.txt /*tlib#list#Find()* +tlib#list#FindAll() tlib.txt /*tlib#list#FindAll()* +tlib#list#Flatten() tlib.txt /*tlib#list#Flatten()* +tlib#list#Inject() tlib.txt /*tlib#list#Inject()* +tlib#list#Remove() tlib.txt /*tlib#list#Remove()* +tlib#list#RemoveAll() tlib.txt /*tlib#list#RemoveAll()* +tlib#list#Uniq() tlib.txt /*tlib#list#Uniq()* +tlib#list#Zip() tlib.txt /*tlib#list#Zip()* +tlib#map#PumAccept() tlib.txt /*tlib#map#PumAccept()* +tlib#normal#WithRegister() tlib.txt /*tlib#normal#WithRegister()* +tlib#notify#Echo() tlib.txt /*tlib#notify#Echo()* +tlib#notify#TrimMessage() tlib.txt /*tlib#notify#TrimMessage()* +tlib#paragraph#GetMetric() tlib.txt /*tlib#paragraph#GetMetric()* +tlib#paragraph#Move() tlib.txt /*tlib#paragraph#Move()* +tlib#persistent#Dir() tlib.txt /*tlib#persistent#Dir()* +tlib#persistent#Filename() tlib.txt /*tlib#persistent#Filename()* +tlib#persistent#Get() tlib.txt /*tlib#persistent#Get()* +tlib#persistent#Save() tlib.txt /*tlib#persistent#Save()* +tlib#progressbar#Display() tlib.txt /*tlib#progressbar#Display()* +tlib#progressbar#Init() tlib.txt /*tlib#progressbar#Init()* +tlib#progressbar#Restore() tlib.txt /*tlib#progressbar#Restore()* +tlib#rx#Escape() tlib.txt /*tlib#rx#Escape()* +tlib#rx#EscapeReplace() tlib.txt /*tlib#rx#EscapeReplace()* +tlib#rx#Suffixes() tlib.txt /*tlib#rx#Suffixes()* +tlib#scratch#CloseScratch() tlib.txt /*tlib#scratch#CloseScratch()* +tlib#scratch#UseScratch() tlib.txt /*tlib#scratch#UseScratch()* +tlib#signs#ClearAll() tlib.txt /*tlib#signs#ClearAll()* +tlib#signs#ClearBuffer() tlib.txt /*tlib#signs#ClearBuffer()* +tlib#signs#Mark() tlib.txt /*tlib#signs#Mark()* +tlib#string#Chomp() tlib.txt /*tlib#string#Chomp()* +tlib#string#Count() tlib.txt /*tlib#string#Count()* +tlib#string#Format() tlib.txt /*tlib#string#Format()* +tlib#string#Printf1() tlib.txt /*tlib#string#Printf1()* +tlib#string#RemoveBackslashes() tlib.txt /*tlib#string#RemoveBackslashes()* +tlib#string#Strip() tlib.txt /*tlib#string#Strip()* +tlib#string#TrimLeft() tlib.txt /*tlib#string#TrimLeft()* +tlib#string#TrimRight() tlib.txt /*tlib#string#TrimRight()* +tlib#syntax#Collect() tlib.txt /*tlib#syntax#Collect()* +tlib#syntax#Names() tlib.txt /*tlib#syntax#Names()* +tlib#tab#BufMap() tlib.txt /*tlib#tab#BufMap()* +tlib#tab#Set() tlib.txt /*tlib#tab#Set()* +tlib#tab#TabWinNr() tlib.txt /*tlib#tab#TabWinNr()* +tlib#tag#Collect() tlib.txt /*tlib#tag#Collect()* +tlib#tag#Format() tlib.txt /*tlib#tag#Format()* +tlib#tag#Retrieve() tlib.txt /*tlib#tag#Retrieve()* +tlib#textobjects#Init() tlib.txt /*tlib#textobjects#Init()* +tlib#time#Diff() tlib.txt /*tlib#time#Diff()* +tlib#time#DiffMSecs() tlib.txt /*tlib#time#DiffMSecs()* +tlib#time#MSecs() tlib.txt /*tlib#time#MSecs()* +tlib#time#Now() tlib.txt /*tlib#time#Now()* +tlib#type#IsDictionary() tlib.txt /*tlib#type#IsDictionary()* +tlib#type#IsFuncref() tlib.txt /*tlib#type#IsFuncref()* +tlib#type#IsList() tlib.txt /*tlib#type#IsList()* +tlib#type#IsNumber() tlib.txt /*tlib#type#IsNumber()* +tlib#type#IsString() tlib.txt /*tlib#type#IsString()* +tlib#url#Decode() tlib.txt /*tlib#url#Decode()* +tlib#url#DecodeChar() tlib.txt /*tlib#url#DecodeChar()* +tlib#url#Encode() tlib.txt /*tlib#url#Encode()* +tlib#url#EncodeChar() tlib.txt /*tlib#url#EncodeChar()* +tlib#var#EGet() tlib.txt /*tlib#var#EGet()* +tlib#var#Get() tlib.txt /*tlib#var#Get()* +tlib#var#Let() tlib.txt /*tlib#var#Let()* +tlib#var#List() tlib.txt /*tlib#var#List()* +tlib#vcs#Diff() tlib.txt /*tlib#vcs#Diff()* +tlib#vcs#FindVCS() tlib.txt /*tlib#vcs#FindVCS()* +tlib#vcs#Ls() tlib.txt /*tlib#vcs#Ls()* +tlib#vim#Maximize() tlib.txt /*tlib#vim#Maximize()* +tlib#vim#RestoreWindow() tlib.txt /*tlib#vim#RestoreWindow()* +tlib#win#GetLayout() tlib.txt /*tlib#win#GetLayout()* +tlib#win#List() tlib.txt /*tlib#win#List()* +tlib#win#Set() tlib.txt /*tlib#win#Set()* +tlib#win#SetLayout() tlib.txt /*tlib#win#SetLayout()* +tlib#win#Width() tlib.txt /*tlib#win#Width()* +tlib#win#WinDo() tlib.txt /*tlib#win#WinDo()* +tlib.txt tlib.txt /*tlib.txt* +v_sp tlib.txt /*v_sp* diff --git a/sources_non_forked/tlib/doc/tlib.txt b/sources_non_forked/tlib/doc/tlib.txt index def5ed5c..6caa99f5 100644 --- a/sources_non_forked/tlib/doc/tlib.txt +++ b/sources_non_forked/tlib/doc/tlib.txt @@ -61,32 +61,35 @@ Contents~ g:tlib_scroll_lines ..................... |g:tlib_scroll_lines| g:tlib_keyagents_InputList_m ............ |g:tlib_keyagents_InputList_m| g:tlib_handlers_EditList ................ |g:tlib_handlers_EditList| - tlib#autocmdgroup#Init .................. |tlib#autocmdgroup#Init()| - tlib#tab#BufMap ......................... |tlib#tab#BufMap()| - tlib#tab#TabWinNr ....................... |tlib#tab#TabWinNr()| - tlib#tab#Set ............................ |tlib#tab#Set()| - tlib#paragraph#GetMetric ................ |tlib#paragraph#GetMetric()| - tlib#paragraph#Move ..................... |tlib#paragraph#Move()| - tlib#scratch#UseScratch ................. |tlib#scratch#UseScratch()| - tlib#scratch#CloseScratch ............... |tlib#scratch#CloseScratch()| + g:tlib_debug ............................ |g:tlib_debug| + tlib#notify#Echo ........................ |tlib#notify#Echo()| + tlib#notify#TrimMessage ................. |tlib#notify#TrimMessage()| + g:tlib_persistent ....................... |g:tlib_persistent| + tlib#persistent#Dir ..................... |tlib#persistent#Dir()| + tlib#persistent#Filename ................ |tlib#persistent#Filename()| + tlib#persistent#Get ..................... |tlib#persistent#Get()| + tlib#persistent#Save .................... |tlib#persistent#Save()| + g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize| + g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore| + g:tlib#vim#use_vimtweak ................. |g:tlib#vim#use_vimtweak| + tlib#vim#Maximize ....................... |tlib#vim#Maximize()| + tlib#vim#RestoreWindow .................. |tlib#vim#RestoreWindow()| + g:tlib#vim#use_wmctrl ................... |g:tlib#vim#use_wmctrl| tlib#progressbar#Init ................... |tlib#progressbar#Init()| tlib#progressbar#Display ................ |tlib#progressbar#Display()| tlib#progressbar#Restore ................ |tlib#progressbar#Restore()| - tlib#Object#New ......................... |tlib#Object#New()| - prototype.New - prototype.Inherit - prototype.Extend - prototype.IsA - prototype.IsRelated - prototype.RespondTo - prototype.Super - tlib#Object#Methods ..................... |tlib#Object#Methods()| - tlib#win#Set ............................ |tlib#win#Set()| - tlib#win#GetLayout ...................... |tlib#win#GetLayout()| - tlib#win#SetLayout ...................... |tlib#win#SetLayout()| - tlib#win#List ........................... |tlib#win#List()| - tlib#win#Width .......................... |tlib#win#Width()| - tlib#win#WinDo .......................... |tlib#win#WinDo()| + tlib#eval#FormatValue ................... |tlib#eval#FormatValue()| + tlib#list#Inject ........................ |tlib#list#Inject()| + tlib#list#Compact ....................... |tlib#list#Compact()| + tlib#list#Flatten ....................... |tlib#list#Flatten()| + tlib#list#FindAll ....................... |tlib#list#FindAll()| + tlib#list#Find .......................... |tlib#list#Find()| + tlib#list#Any ........................... |tlib#list#Any()| + tlib#list#All ........................... |tlib#list#All()| + tlib#list#Remove ........................ |tlib#list#Remove()| + tlib#list#RemoveAll ..................... |tlib#list#RemoveAll()| + tlib#list#Zip ........................... |tlib#list#Zip()| + tlib#list#Uniq .......................... |tlib#list#Uniq()| tlib#cmd#OutputAsList ................... |tlib#cmd#OutputAsList()| tlib#cmd#BrowseOutput ................... |tlib#cmd#BrowseOutput()| tlib#cmd#BrowseOutputWithCallback ....... |tlib#cmd#BrowseOutputWithCallback()| @@ -94,89 +97,45 @@ Contents~ tlib#cmd#ParseScriptname ................ |tlib#cmd#ParseScriptname()| tlib#cmd#UseVertical .................... |tlib#cmd#UseVertical()| tlib#cmd#Time ........................... |tlib#cmd#Time()| - tlib#comments#Comments .................. |tlib#comments#Comments()| + tlib#syntax#Collect ..................... |tlib#syntax#Collect()| + tlib#syntax#Names ....................... |tlib#syntax#Names()| + tlib#balloon#Register ................... |tlib#balloon#Register()| + tlib#balloon#Remove ..................... |tlib#balloon#Remove()| + tlib#balloon#Expr ....................... |tlib#balloon#Expr()| + g:tlib#vcs#def .......................... |g:tlib#vcs#def| + g:tlib#vcs#executables .................. |g:tlib#vcs#executables| + g:tlib#vcs#check ........................ |g:tlib#vcs#check| + tlib#vcs#FindVCS ........................ |tlib#vcs#FindVCS()| + tlib#vcs#Ls ............................. |tlib#vcs#Ls()| + tlib#vcs#Diff ........................... |tlib#vcs#Diff()| tlib#char#Get ........................... |tlib#char#Get()| tlib#char#IsAvailable ................... |tlib#char#IsAvailable()| tlib#char#GetWithTimeout ................ |tlib#char#GetWithTimeout()| - tlib#World#New .......................... |tlib#World#New()| - prototype.Reset + tlib#scratch#UseScratch ................. |tlib#scratch#UseScratch()| + tlib#scratch#CloseScratch ............... |tlib#scratch#CloseScratch()| + tlib#autocmdgroup#Init .................. |tlib#autocmdgroup#Init()| + g:tlib#cache#purge_days ................. |g:tlib#cache#purge_days| + g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days| + g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding| + g:tlib#cache#run_script ................. |g:tlib#cache#run_script| + g:tlib#cache#silent ..................... |g:tlib#cache#silent| + g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge| + tlib#cache#Dir .......................... |tlib#cache#Dir()| + tlib#cache#Filename ..................... |tlib#cache#Filename()| + tlib#cache#Save ......................... |tlib#cache#Save()| + tlib#cache#Get .......................... |tlib#cache#Get()| + tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()| + tlib#cache#Purge ........................ |tlib#cache#Purge()| + tlib#cache#ListFilesInCache ............. |tlib#cache#ListFilesInCache()| + tlib#normal#WithRegister ................ |tlib#normal#WithRegister()| tlib#time#MSecs ......................... |tlib#time#MSecs()| tlib#time#Now ........................... |tlib#time#Now()| tlib#time#Diff .......................... |tlib#time#Diff()| tlib#time#DiffMSecs ..................... |tlib#time#DiffMSecs()| - tlib#textobjects#StandardParagraph ...... |standard-paragraph| - tlib#textobjects#Init ................... |tlib#textobjects#Init()| - v_sp .................................... |v_sp| - o_sp .................................... |o_sp| - tlib#Filter_fuzzy#New ................... |tlib#Filter_fuzzy#New()| - tlib#file#Split ......................... |tlib#file#Split()| - tlib#file#Join .......................... |tlib#file#Join()| - tlib#file#Relative ...................... |tlib#file#Relative()| - tlib#file#With .......................... |tlib#file#With()| - tlib#Filter_seq#New ..................... |tlib#Filter_seq#New()| - tlib#date#DiffInDays .................... |tlib#date#DiffInDays()| - tlib#date#Parse ......................... |tlib#date#Parse()| - tlib#date#SecondsSince1970 .............. |tlib#date#SecondsSince1970()| - tlib#balloon#Register ................... |tlib#balloon#Register()| - tlib#balloon#Remove ..................... |tlib#balloon#Remove()| - tlib#balloon#Expr ....................... |tlib#balloon#Expr()| - tlib#buffer#EnableMRU ................... |tlib#buffer#EnableMRU()| - tlib#buffer#DisableMRU .................. |tlib#buffer#DisableMRU()| - tlib#buffer#Set ......................... |tlib#buffer#Set()| - tlib#buffer#Eval ........................ |tlib#buffer#Eval()| - tlib#buffer#GetList ..................... |tlib#buffer#GetList()| - tlib#buffer#ViewLine .................... |tlib#buffer#ViewLine()| - tlib#buffer#HighlightLine ............... |tlib#buffer#HighlightLine()| - tlib#buffer#DeleteRange ................. |tlib#buffer#DeleteRange()| - tlib#buffer#ReplaceRange ................ |tlib#buffer#ReplaceRange()| - tlib#buffer#ScratchStart ................ |tlib#buffer#ScratchStart()| - tlib#buffer#ScratchEnd .................. |tlib#buffer#ScratchEnd()| - tlib#buffer#BufDo ....................... |tlib#buffer#BufDo()| - tlib#buffer#InsertText .................. |tlib#buffer#InsertText()| - tlib#buffer#InsertText0 ................. |tlib#buffer#InsertText0()| - tlib#buffer#CurrentByte ................. |tlib#buffer#CurrentByte()| - tlib#buffer#KeepCursorPosition .......... |tlib#buffer#KeepCursorPosition()| - tlib#Filter_cnfd#New .................... |tlib#Filter_cnfd#New()| - tlib#type#IsNumber ...................... |tlib#type#IsNumber()| - tlib#type#IsString ...................... |tlib#type#IsString()| - tlib#type#IsFuncref ..................... |tlib#type#IsFuncref()| - tlib#type#IsList ........................ |tlib#type#IsList()| - tlib#type#IsDictionary .................. |tlib#type#IsDictionary()| - tlib#syntax#Collect ..................... |tlib#syntax#Collect()| - tlib#syntax#Names ....................... |tlib#syntax#Names()| - g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize| - g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore| - g:tlib#vim#use_vimtweak ................. |g:tlib#vim#use_vimtweak| - tlib#vim#Maximize ....................... |tlib#vim#Maximize()| - tlib#vim#RestoreWindow .................. |tlib#vim#RestoreWindow()| - g:tlib#vim#use_wmctrl ................... |g:tlib#vim#use_wmctrl| - tlib#hook#Run ........................... |tlib#hook#Run()| - tlib#eval#FormatValue ................... |tlib#eval#FormatValue()| - tlib#arg#Get ............................ |tlib#arg#Get()| - tlib#arg#Let ............................ |tlib#arg#Let()| - tlib#arg#Key ............................ |tlib#arg#Key()| - tlib#arg#StringAsKeyArgs ................ |tlib#arg#StringAsKeyArgs()| - tlib#arg#Ex ............................. |tlib#arg#Ex()| tlib#var#Let ............................ |tlib#var#Let()| tlib#var#EGet ........................... |tlib#var#EGet()| tlib#var#Get ............................ |tlib#var#Get()| tlib#var#List ........................... |tlib#var#List()| - tlib#Filter_cnf#New ..................... |tlib#Filter_cnf#New()| - tlib#rx#Escape .......................... |tlib#rx#Escape()| - tlib#rx#EscapeReplace ................... |tlib#rx#EscapeReplace()| - tlib#rx#Suffixes ........................ |tlib#rx#Suffixes()| - tlib#url#Decode ......................... |tlib#url#Decode()| - tlib#url#DecodeChar ..................... |tlib#url#DecodeChar()| - tlib#url#EncodeChar ..................... |tlib#url#EncodeChar()| - tlib#url#Encode ......................... |tlib#url#Encode()| - tlib#input#List ......................... |tlib#input#List()| - tlib#input#ListD ........................ |tlib#input#ListD()| - tlib#input#ListW ........................ |tlib#input#ListW()| - tlib#input#EditList ..................... |tlib#input#EditList()| - tlib#input#Resume ....................... |tlib#input#Resume()| - tlib#input#CommandSelect ................ |tlib#input#CommandSelect()| - tlib#input#Edit ......................... |tlib#input#Edit()| - tlib#input#Dialog ....................... |tlib#input#Dialog()| tlib#agent#Exit ......................... |tlib#agent#Exit()| tlib#agent#CopyItems .................... |tlib#agent#CopyItems()| tlib#agent#PageUp ....................... |tlib#agent#PageUp()| @@ -220,26 +179,66 @@ Contents~ tlib#agent#GotoLine ..................... |tlib#agent#GotoLine()| tlib#agent#DoAtLine ..................... |tlib#agent#DoAtLine()| tlib#agent#Wildcard ..................... |tlib#agent#Wildcard()| - tlib#tag#Retrieve ....................... |tlib#tag#Retrieve()| - tlib#tag#Collect ........................ |tlib#tag#Collect()| - tlib#tag#Format ......................... |tlib#tag#Format()| + tlib#agent#Null ......................... |tlib#agent#Null()| + tlib#agent#ExecAgentByName .............. |tlib#agent#ExecAgentByName()| + tlib#agent#CompleteAgentNames ........... |tlib#agent#CompleteAgentNames()| + g:tlib#Filter_cnfx#expander ............. |g:tlib#Filter_cnfx#expander| + tlib#Filter_cnfx#New .................... |tlib#Filter_cnfx#New()| + tlib#url#Decode ......................... |tlib#url#Decode()| + tlib#url#DecodeChar ..................... |tlib#url#DecodeChar()| + tlib#url#EncodeChar ..................... |tlib#url#EncodeChar()| + tlib#url#Encode ......................... |tlib#url#Encode()| tlib#signs#ClearAll ..................... |tlib#signs#ClearAll()| tlib#signs#ClearBuffer .................. |tlib#signs#ClearBuffer()| tlib#signs#Mark ......................... |tlib#signs#Mark()| - g:tlib#cache#purge_days ................. |g:tlib#cache#purge_days| - g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days| - g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding| - g:tlib#cache#run_script ................. |g:tlib#cache#run_script| - g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge| - tlib#cache#Dir .......................... |tlib#cache#Dir()| - tlib#cache#Filename ..................... |tlib#cache#Filename()| - tlib#cache#Save ......................... |tlib#cache#Save()| - tlib#cache#Get .......................... |tlib#cache#Get()| - tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()| - tlib#cache#Purge ........................ |tlib#cache#Purge()| - tlib#cache#ListFilesInCache ............. |tlib#cache#ListFilesInCache()| + tlib#rx#Escape .......................... |tlib#rx#Escape()| + tlib#rx#EscapeReplace ................... |tlib#rx#EscapeReplace()| + tlib#rx#Suffixes ........................ |tlib#rx#Suffixes()| + tlib#tag#Retrieve ....................... |tlib#tag#Retrieve()| + tlib#tag#Collect ........................ |tlib#tag#Collect()| + tlib#tag#Format ......................... |tlib#tag#Format()| tlib#map#PumAccept ...................... |tlib#map#PumAccept()| - tlib#normal#WithRegister ................ |tlib#normal#WithRegister()| + tlib#Filter_cnfd#New .................... |tlib#Filter_cnfd#New()| + g:tlib#input#use_popup .................. |g:tlib#input#use_popup| + g:tlib#input#format_filename ............ |g:tlib#input#format_filename| + g:tlib#input#filename_padding_r ......... |g:tlib#input#filename_padding_r| + g:tlib#input#filename_max_width ......... |g:tlib#input#filename_max_width| + tlib#input#List ......................... |tlib#input#List()| + tlib#input#ListD ........................ |tlib#input#ListD()| + tlib#input#ListW ........................ |tlib#input#ListW()| + tlib#input#EditList ..................... |tlib#input#EditList()| + tlib#input#Resume ....................... |tlib#input#Resume()| + tlib#input#CommandSelect ................ |tlib#input#CommandSelect()| + tlib#input#Edit ......................... |tlib#input#Edit()| + tlib#input#Dialog ....................... |tlib#input#Dialog()| + tlib#file#Split ......................... |tlib#file#Split()| + tlib#file#Join .......................... |tlib#file#Join()| + tlib#file#Relative ...................... |tlib#file#Relative()| + tlib#file#With .......................... |tlib#file#With()| + tlib#paragraph#GetMetric ................ |tlib#paragraph#GetMetric()| + tlib#paragraph#Move ..................... |tlib#paragraph#Move()| + tlib#World#New .......................... |tlib#World#New()| + tlib#tab#BufMap ......................... |tlib#tab#BufMap()| + tlib#tab#TabWinNr ....................... |tlib#tab#TabWinNr()| + tlib#tab#Set ............................ |tlib#tab#Set()| + tlib#date#DiffInDays .................... |tlib#date#DiffInDays()| + tlib#date#Parse ......................... |tlib#date#Parse()| + tlib#date#SecondsSince1970 .............. |tlib#date#SecondsSince1970()| + tlib#type#IsNumber ...................... |tlib#type#IsNumber()| + tlib#type#IsString ...................... |tlib#type#IsString()| + tlib#type#IsFuncref ..................... |tlib#type#IsFuncref()| + tlib#type#IsList ........................ |tlib#type#IsList()| + tlib#type#IsDictionary .................. |tlib#type#IsDictionary()| + tlib#Filter_fuzzy#New ................... |tlib#Filter_fuzzy#New()| + tlib#textobjects#StandardParagraph ...... |standard-paragraph| + tlib#textobjects#Init ................... |tlib#textobjects#Init()| + v_sp .................................... |v_sp| + o_sp .................................... |o_sp| + tlib#arg#Get ............................ |tlib#arg#Get()| + tlib#arg#Let ............................ |tlib#arg#Let()| + tlib#arg#Key ............................ |tlib#arg#Key()| + tlib#arg#StringAsKeyArgs ................ |tlib#arg#StringAsKeyArgs()| + tlib#arg#Ex ............................. |tlib#arg#Ex()| tlib#dir#CanonicName .................... |tlib#dir#CanonicName()| tlib#dir#PlainName ...................... |tlib#dir#PlainName()| tlib#dir#Ensure ......................... |tlib#dir#Ensure()| @@ -247,19 +246,41 @@ Contents~ tlib#dir#CD ............................. |tlib#dir#CD()| tlib#dir#Push ........................... |tlib#dir#Push()| tlib#dir#Pop ............................ |tlib#dir#Pop()| - tlib#notify#Echo ........................ |tlib#notify#Echo()| - tlib#notify#TrimMessage ................. |tlib#notify#TrimMessage()| - tlib#list#Inject ........................ |tlib#list#Inject()| - tlib#list#Compact ....................... |tlib#list#Compact()| - tlib#list#Flatten ....................... |tlib#list#Flatten()| - tlib#list#FindAll ....................... |tlib#list#FindAll()| - tlib#list#Find .......................... |tlib#list#Find()| - tlib#list#Any ........................... |tlib#list#Any()| - tlib#list#All ........................... |tlib#list#All()| - tlib#list#Remove ........................ |tlib#list#Remove()| - tlib#list#RemoveAll ..................... |tlib#list#RemoveAll()| - tlib#list#Zip ........................... |tlib#list#Zip()| - tlib#list#Uniq .......................... |tlib#list#Uniq()| + tlib#win#Set ............................ |tlib#win#Set()| + tlib#win#GetLayout ...................... |tlib#win#GetLayout()| + tlib#win#SetLayout ...................... |tlib#win#SetLayout()| + tlib#win#List ........................... |tlib#win#List()| + tlib#win#Width .......................... |tlib#win#Width()| + tlib#win#WinDo .......................... |tlib#win#WinDo()| + tlib#comments#Comments .................. |tlib#comments#Comments()| + tlib#Filter_cnf#New ..................... |tlib#Filter_cnf#New()| + prototype.Pretty + tlib#Object#New ......................... |tlib#Object#New()| + prototype.New + prototype.Inherit + prototype.Extend + prototype.IsA + prototype.IsRelated + prototype.RespondTo + prototype.Super + tlib#Object#Methods ..................... |tlib#Object#Methods()| + tlib#buffer#EnableMRU ................... |tlib#buffer#EnableMRU()| + tlib#buffer#DisableMRU .................. |tlib#buffer#DisableMRU()| + tlib#buffer#Set ......................... |tlib#buffer#Set()| + tlib#buffer#Eval ........................ |tlib#buffer#Eval()| + tlib#buffer#GetList ..................... |tlib#buffer#GetList()| + tlib#buffer#ViewLine .................... |tlib#buffer#ViewLine()| + tlib#buffer#HighlightLine ............... |tlib#buffer#HighlightLine()| + tlib#buffer#DeleteRange ................. |tlib#buffer#DeleteRange()| + tlib#buffer#ReplaceRange ................ |tlib#buffer#ReplaceRange()| + tlib#buffer#ScratchStart ................ |tlib#buffer#ScratchStart()| + tlib#buffer#ScratchEnd .................. |tlib#buffer#ScratchEnd()| + tlib#buffer#BufDo ....................... |tlib#buffer#BufDo()| + tlib#buffer#InsertText .................. |tlib#buffer#InsertText()| + tlib#buffer#InsertText0 ................. |tlib#buffer#InsertText0()| + tlib#buffer#CurrentByte ................. |tlib#buffer#CurrentByte()| + tlib#buffer#KeepCursorPosition .......... |tlib#buffer#KeepCursorPosition()| + tlib#hook#Run ........................... |tlib#hook#Run()| tlib#string#RemoveBackslashes ........... |tlib#string#RemoveBackslashes()| tlib#string#Chomp ....................... |tlib#string#Chomp()| tlib#string#Format ...................... |tlib#string#Format()| @@ -274,9 +295,9 @@ Contents~ plugin/02tlib.vim~ *:TRequire* -TRequire NAME [VERSION [FILE]] +:TRequire NAME [VERSION [FILE]] Make a certain vim file is loaded. - + Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The file must provide a variable loaded_{NAME} that represents the version number. @@ -325,86 +346,126 @@ TRequire NAME [VERSION [FILE]] < *:TBrowseOutput* -TBrowseOutput COMMAND +:TBrowseOutput COMMAND Ever wondered how to efficiently browse the output of a command without redirecting it to a file? This command takes a command as argument and presents the output via |tlib#input#List()| so that you can easily search for a keyword (e.g. the name of a variable or function) and the like. - + If you press enter, the selected line will be copied to the command line. Press ESC to cancel browsing. - + EXAMPLES: > TBrowseOutput 20verb TeaseTheCulprit < *:TBrowseScriptnames* -TBrowseScriptnames +:TBrowseScriptnames List all sourced script names (the output of ':scriptnames'). - + When you press enter, the selected script will be opened in the current window. Press ESC to cancel. - + EXAMPLES: > TBrowseScriptnames < *:TTimeCommand* -TTimeCommand CMD +:TTimeCommand CMD Time the execution time of CMD. + +Variables~ + *g:tlib_pick_last_item* g:tlib_pick_last_item (default: 1) When 1, automatically select the last remaining item only if the list had only one item to begin with. When 2, automatically select a last remaining item after applying any filters. + See |tlib#input#List()|. *g:tlib_sortprefs_threshold* g:tlib_sortprefs_threshold (default: 200) If a list is bigger than this value, don't try to be smart when selecting an item. Be slightly faster instead. + See |tlib#input#List()|. *g:tlib_scratch_pos* g:tlib_scratch_pos (default: 'botright') Scratch window position. By default the list window is opened on the bottom. Set this variable to 'topleft' or '' to change this behaviour. + See |tlib#input#List()|. *g:tlib_inputlist_pct* g:tlib_inputlist_pct (default: 50) Size of the input list window (in percent) from the main size (of &lines). + See |tlib#input#List()|. *g:tlib_inputlist_width_filename* g:tlib_inputlist_width_filename (default: '&co / 3') Size of filename columns when listing filenames. + See |tlib#input#List()|. *g:tlib_inputlist_higroup* g:tlib_inputlist_higroup (default: 'IncSearch') - The highlight group to use for showing matches in the input list window. + The highlight group to use for showing matches in the input list + window. + See |tlib#input#List()|. *g:tlib_inputlist_livesearch_threshold* g:tlib_inputlist_livesearch_threshold (default: 1000) - If a list contains more items, don't do an incremental "live search", - but use |input()| to query the user for a filter. This is useful on - slower machines or with very long lists. + If a list contains more items, |tlib#input#List()| does not perform an + incremental "live search" but uses |input()| to query the user for a + filter. This is useful on slower machines or with very long lists. *g:tlib_inputlist_filename_indicators* g:tlib_inputlist_filename_indicators (default: 0) - If true, show some indicators about the status of a filename (e.g. - buflisted(), bufloaded() etc.). + If true, |tlib#input#List()| will show some indicators about the + status of a filename (e.g. buflisted(), bufloaded() etc.). This is disabled by default because vim checks also for the file on disk when doing this. *g:tlib_inputlist_match* -g:tlib_inputlist_match (default: 'cnf') - Can be "cnf", "cnfd", "seq", or "fuzzy". See: - cnf :: Match substrings - - |tlib#Filter_cnf#New()| (this is the default method) - - |tlib#Filter_cnfd#New()| - seq :: Match sequences of characters +g:tlib_inputlist_match (default: 'cnfx') + Determine how |tlib#input#List()| and related functions work. + Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: + cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted + as a wildcard (this is the default method) + - A plus character ("+") acts as a wildcard as if ".\{-}" (see + |/\{-|) were entered. + - Examples: + - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match + "far". + - Otherwise it is a derivate of the cnf method (see below). + - See also |tlib#Filter_cnfx#New()|. + cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is + expanded to "\.\{-}" + - A period character (".") acts as a wildcard as if ".\{-}" (see + |/\{-|) were entered. + - Examples: + - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match + "far". + - Otherwise it is a derivate of the cnf method (see below). + - See also |tlib#Filter_cnfd#New()|. + cnf .... Match substrings + - A blank creates an AND conjunction, i.e. the next pattern has to + match too. + - A pipe character ("|") creates an OR conjunction, either this or + the next next pattern has to match. + - Patterns are very 'nomagic' |regexp| with a |\V| prefix. + - A pattern starting with "-" makes the filter exclude items + matching that pattern. + - Examples: + - "foo bar" matches items that contain the strings "foo" AND + "bar". + - "foo|bar boo|far" matches items that contain either ("foo" OR + "bar") AND ("boo" OR "far"). + - See also |tlib#Filter_cnf#New()|. + seq .... Match sequences of characters - |tlib#Filter_seq#New()| - fuzzy :: Match fuzzy character sequences + fuzzy .. Match fuzzy character sequences - |tlib#Filter_fuzzy#New()| *g:tlib_inputlist_shortmessage* @@ -464,7 +525,7 @@ g:tlib_keyagents_InputList_s The default key bindings for single-item-select list views. If you want to use , to move the cursor up and down, add these two lines to after/plugin/02tlib.vim: > - + let g:tlib_keyagents_InputList_s[10] = 'tlib#agent#Down' " let g:tlib_keyagents_InputList_s[11] = 'tlib#agent#Up' " < @@ -479,67 +540,90 @@ g:tlib_keyagents_InputList_m *g:tlib_handlers_EditList* g:tlib_handlers_EditList - -======================================================================== -autoload/tlib/autocmdgroup.vim~ - - *tlib#autocmdgroup#Init()* -tlib#autocmdgroup#Init() + *g:tlib_debug* +g:tlib_debug ======================================================================== -autoload/tlib/tab.vim~ +autoload/tlib/notify.vim~ - *tlib#tab#BufMap()* -tlib#tab#BufMap() - Return a dictionary of bufnumbers => [[tabpage, winnr] ...] + *tlib#notify#Echo()* +tlib#notify#Echo(text, ?style='') + Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' + in order to prevent |press-enter| messages. - *tlib#tab#TabWinNr()* -tlib#tab#TabWinNr(buffer) - Find a buffer's window at some tab page. - - *tlib#tab#Set()* -tlib#tab#Set(tabnr) + *tlib#notify#TrimMessage()* +tlib#notify#TrimMessage(message) + Contributed by Erik Falor: + If the line containing the message is too long, echoing it will cause + a 'Hit ENTER' prompt to appear. This function cleans up the line so + that does not happen. + The echoed line is too long if it is wider than the width of the + window, minus cmdline space taken up by the ruler and showcmd + features. ======================================================================== -autoload/tlib/paragraph.vim~ +autoload/tlib/persistent.vim~ - *tlib#paragraph#GetMetric()* -tlib#paragraph#GetMetric() - Return an object describing a |paragraph|. + *g:tlib_persistent* +g:tlib_persistent (default: '') + The directory for persistent data files. If empty, use + |tlib#dir#MyRuntime|.'/share'. - *tlib#paragraph#Move()* -tlib#paragraph#Move(direction, count) - This function can be used with the tinymode plugin to move around - paragraphs. - - Example configuration: > - - call tinymode#EnterMap("para_move", "gp") - call tinymode#ModeMsg("para_move", "Move paragraph: j/k") - call tinymode#Map("para_move", "j", "silent call tlib#paragraph#Move('Down', '[N]')") - call tinymode#Map("para_move", "k", "silent call tlib#paragraph#Move('Up', '[N]')") - call tinymode#ModeArg("para_move", "owncount", 1) -< + *tlib#persistent#Dir()* +tlib#persistent#Dir(?mode = 'bg') + Return the full directory name for persistent data files. + + *tlib#persistent#Filename()* +tlib#persistent#Filename(type, ?file=%, ?mkdir=0) + + *tlib#persistent#Get()* +tlib#persistent#Get(cfile) + + *tlib#persistent#Save()* +tlib#persistent#Save(cfile, dictionary) ======================================================================== -autoload/tlib/scratch.vim~ +autoload/tlib/vim.vim~ - *tlib#scratch#UseScratch()* -tlib#scratch#UseScratch(?keyargs={}) - Display a scratch buffer (a buffer with no file). See :TScratch for an - example. - Return the scratch buffer's number. - Values for keyargs: - scratch_split ... 1: split, 0: window, -1: tab + *g:tlib#vim#simalt_maximize* +g:tlib#vim#simalt_maximize (default: 'x') + The alt-key for maximizing the window. + CAUTION: The value of this paramter depends on your locale and + maybe the windows version you are running. - *tlib#scratch#CloseScratch()* -tlib#scratch#CloseScratch(keyargs, ...) - Close a scratch buffer as defined in keyargs (usually a World). - Return 1 if the scratch buffer is closed (or if it already was - closed). + *g:tlib#vim#simalt_restore* +g:tlib#vim#simalt_restore (default: 'r') + The alt-key for restoring the window. + CAUTION: The value of this paramter depends on your locale and + maybe the windows version you are running. + + *g:tlib#vim#use_vimtweak* +g:tlib#vim#use_vimtweak (default: 0) + If true, use the vimtweak.dll for windows. This will enable + tlib to remove the caption for fullscreen windows. + + *tlib#vim#Maximize()* +tlib#vim#Maximize(fullscreen) + Maximize the window. + You might need to redefine |g:tlib#vim#simalt_maximize| if it doesn't + work for you. + + *tlib#vim#RestoreWindow()* +tlib#vim#RestoreWindow() + Restore the original vimsize after having called |tlib#vim#Maximize()|. + + *g:tlib#vim#use_wmctrl* +g:tlib#vim#use_wmctrl (default: executable('wmctrl')) + If true, use wmctrl for X windows to make a window + maximized/fullscreen. + + This is the preferred method for maximizing windows under X + windows. Some window managers have problem coping with the + default method of setting 'lines' and 'columns' to a large + value. ======================================================================== @@ -567,91 +651,90 @@ tlib#progressbar#Restore() ======================================================================== -autoload/tlib/Object.vim~ -Provides a prototype plus some OO-like methods. +autoload/tlib/eval.vim~ - *tlib#Object#New()* -tlib#Object#New(?fields={}) - This function creates a prototype that provides some kind of - inheritance mechanism and a way to call parent/super methods. - - The usage demonstrated in the following example works best when every - class/prototype is defined in a file of its own. - - The reason for why there is a dedicated constructor function is that - this layout facilitates the use of templates and that methods are - hidden from the user. Other solutions are possible. - - EXAMPLES: > - let s:prototype = tlib#Object#New({ - \ '_class': ['FooBar'], - \ 'foo': 1, - \ 'bar': 2, - \ }) - " Constructor - function! FooBar(...) - let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) - return object - endf - function! s:prototype.babble() { - echo "I think, therefore I am ". (self.foo * self.bar) ." months old." - } - -< This could now be used like this: > - let myfoo = FooBar({'foo': 3}) - call myfoo.babble() - => I think, therefore I am 6 months old. - echo myfoo.IsA('FooBar') - => 1 - echo myfoo.IsA('object') - => 1 - echo myfoo.IsA('Foo') - => 0 - echo myfoo.RespondTo('babble') - => 1 - echo myfoo.RespondTo('speak') - => 0 -< - -prototype.New - -prototype.Inherit - -prototype.Extend - -prototype.IsA - -prototype.IsRelated - -prototype.RespondTo - -prototype.Super - - *tlib#Object#Methods()* -tlib#Object#Methods(object, ...) + *tlib#eval#FormatValue()* +tlib#eval#FormatValue(value, ...) ======================================================================== -autoload/tlib/win.vim~ +autoload/tlib/list.vim~ - *tlib#win#Set()* -tlib#win#Set(winnr) - Return vim code to jump back to the original window. + *tlib#list#Inject()* +tlib#list#Inject(list, initial_value, funcref) + EXAMPLES: > + echo tlib#list#Inject([1,2,3], 0, function('Add') + => 6 +< - *tlib#win#GetLayout()* -tlib#win#GetLayout(?save_view=0) + *tlib#list#Compact()* +tlib#list#Compact(list) + EXAMPLES: > + tlib#list#Compact([0,1,2,3,[], {}, ""]) + => [1,2,3] +< - *tlib#win#SetLayout()* -tlib#win#SetLayout(layout) + *tlib#list#Flatten()* +tlib#list#Flatten(list) + EXAMPLES: > + tlib#list#Flatten([0,[1,2,[3,""]]]) + => [0,1,2,3,""] +< - *tlib#win#List()* -tlib#win#List() + *tlib#list#FindAll()* +tlib#list#FindAll(list, filter, ?process_expr="") + Basically the same as filter() - *tlib#win#Width()* -tlib#win#Width(wnr) + EXAMPLES: > + tlib#list#FindAll([1,2,3], 'v:val >= 2') + => [2, 3] +< - *tlib#win#WinDo()* -tlib#win#WinDo(ex) + *tlib#list#Find()* +tlib#list#Find(list, filter, ?default="", ?process_expr="") + + EXAMPLES: > + tlib#list#Find([1,2,3], 'v:val >= 2') + => 2 +< + + *tlib#list#Any()* +tlib#list#Any(list, expr) + EXAMPLES: > + tlib#list#Any([1,2,3], 'v:val >= 2') + => 1 +< + + *tlib#list#All()* +tlib#list#All(list, expr) + EXAMPLES: > + tlib#list#All([1,2,3], 'v:val >= 2') + => 0 +< + + *tlib#list#Remove()* +tlib#list#Remove(list, element) + EXAMPLES: > + tlib#list#Remove([1,2,1,2], 2) + => [1,1,2] +< + + *tlib#list#RemoveAll()* +tlib#list#RemoveAll(list, element) + EXAMPLES: > + tlib#list#RemoveAll([1,2,1,2], 2) + => [1,1] +< + + *tlib#list#Zip()* +tlib#list#Zip(lists, ?default='') + EXAMPLES: > + tlib#list#Zip([[1,2,3], [4,5,6]]) + => [[1,4], [2,5], [3,6]] +< + + *tlib#list#Uniq()* +tlib#list#Uniq(list, ...) ======================================================================== @@ -669,16 +752,16 @@ tlib#cmd#BrowseOutputWithCallback(callback, command) Execute COMMAND and present its output in a |tlib#input#List()|; when a line is selected, execute the function named as the CALLBACK and pass in that line as an argument. - + The CALLBACK function gives you an opportunity to massage the COMMAND output and possibly act on it in a meaningful way. For example, if COMMAND listed all URIs found in the current buffer, CALLBACK could validate and then open the selected URI in the system's default browser. - + This function is meant to be a tool to help compose the implementations of powerful commands that use |tlib#input#List()| as a common interface. See |TBrowseScriptnames| as an example. - + EXAMPLES: > call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames') < @@ -702,11 +785,56 @@ tlib#cmd#Time(cmd) ======================================================================== -autoload/tlib/comments.vim~ +autoload/tlib/syntax.vim~ - *tlib#comments#Comments()* -tlib#comments#Comments(...) - function! tlib#comments#Comments(?rx='') + *tlib#syntax#Collect()* +tlib#syntax#Collect() + + *tlib#syntax#Names()* +tlib#syntax#Names(?rx='') + + +======================================================================== +autoload/tlib/balloon.vim~ + + *tlib#balloon#Register()* +tlib#balloon#Register(expr) + + *tlib#balloon#Remove()* +tlib#balloon#Remove(expr) + + *tlib#balloon#Expr()* +tlib#balloon#Expr() + + +======================================================================== +autoload/tlib/vcs.vim~ + + *g:tlib#vcs#def* +g:tlib#vcs#def {...} + A dictionarie of supported VCS (currently: git, hg, svn, bzr). + + *g:tlib#vcs#executables* +g:tlib#vcs#executables {...} + A dictionary of custom executables for VCS commands. If the value is + empty, support for that VCS will be removed. If no key is present, it + is assumed that the VCS "type" is the name of the executable. + + *g:tlib#vcs#check* +g:tlib#vcs#check (default: has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s') + If non-empty, use it as a format string to check whether a VCS is + installed on your computer. + + *tlib#vcs#FindVCS()* +tlib#vcs#FindVCS(filename) + + *tlib#vcs#Ls()* +tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir]) + Return the files under VCS. + + *tlib#vcs#Diff()* +tlib#vcs#Diff(filename, ?vcs=[type, dir]) + Return the diff for "filename" ======================================================================== @@ -715,7 +843,7 @@ autoload/tlib/char.vim~ *tlib#char#Get()* tlib#char#Get(?timeout=0) Get a character. - + EXAMPLES: > echo tlib#char#Get() echo tlib#char#Get(5) @@ -729,14 +857,97 @@ tlib#char#GetWithTimeout(timeout, ...) ======================================================================== -autoload/tlib/World.vim~ -A prototype used by |tlib#input#List|. -Inherits from |tlib#Object#New|. +autoload/tlib/scratch.vim~ - *tlib#World#New()* -tlib#World#New(...) + *tlib#scratch#UseScratch()* +tlib#scratch#UseScratch(?keyargs={}) + Display a scratch buffer (a buffer with no file). See :TScratch for an + example. + Return the scratch buffer's number. + Values for keyargs: + scratch_split ... 1: split, 0: window, -1: tab -prototype.Reset + *tlib#scratch#CloseScratch()* +tlib#scratch#CloseScratch(keyargs, ...) + Close a scratch buffer as defined in keyargs (usually a World). + Return 1 if the scratch buffer is closed (or if it already was + closed). + + +======================================================================== +autoload/tlib/autocmdgroup.vim~ + + *tlib#autocmdgroup#Init()* +tlib#autocmdgroup#Init() + + +======================================================================== +autoload/tlib/cache.vim~ + + *g:tlib#cache#purge_days* +g:tlib#cache#purge_days (default: 31) + |tlib#cache#Purge()|: Remove cache files older than N days. + + *g:tlib#cache#purge_every_days* +g:tlib#cache#purge_every_days (default: 31) + Purge the cache every N days. Disable automatic purging by setting + this value to a negative value. + + *g:tlib#cache#script_encoding* +g:tlib#cache#script_encoding (default: &enc) + The encoding used for the purge-cache script. + Default: 'enc' + + *g:tlib#cache#run_script* +g:tlib#cache#run_script (default: 1) + Whether to run the directory removal script: + 0 ... No + 1 ... Query user + 2 ... Yes + + *g:tlib#cache#silent* +g:tlib#cache#silent (default: 0) + If non-nil, don't display a message that files were deleted from the + cache. + + *g:tlib#cache#dont_purge* +g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$']) + A list of regexps that are matched against partial filenames of the + cached files. If a regexp matches, the file won't be removed by + |tlib#cache#Purge()|. + + *tlib#cache#Dir()* +tlib#cache#Dir(?mode = 'bg') + The default cache directory. + + *tlib#cache#Filename()* +tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') + + *tlib#cache#Save()* +tlib#cache#Save(cfile, dictionary) + + *tlib#cache#Get()* +tlib#cache#Get(cfile) + + *tlib#cache#MaybePurge()* +tlib#cache#MaybePurge() + Call |tlib#cache#Purge()| if the last purge was done before + |g:tlib#cache#purge_every_days|. + + *tlib#cache#Purge()* +tlib#cache#Purge() + Delete old files. + + *tlib#cache#ListFilesInCache()* +tlib#cache#ListFilesInCache(...) + + +======================================================================== +autoload/tlib/normal.vim~ + + *tlib#normal#WithRegister()* +tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!') + Execute a normal command while maintaining all registers. ======================================================================== @@ -755,305 +966,6 @@ tlib#time#Diff(a, b, ...) tlib#time#DiffMSecs(a, b, ...) -======================================================================== -autoload/tlib/textobjects.vim~ - - *standard-paragraph* -tlib#textobjects#StandardParagraph() - Select a "Standard Paragraph", i.e. a text block followed by blank - lines. Other than |ap|, the last paragraph in a document is handled - just the same. - - The |text-object| can be accessed as "sp". Example: > - - vsp ... select the current standard paragraph - -< Return 1, if the paragraph is the last one in the document. - - *tlib#textobjects#Init()* -tlib#textobjects#Init() - - *v_sp* -v_sp ... :call tlib#textobjects#StandardParagraph() - sp ... Standard paragraph (for use as |text-objects|). - - *o_sp* -o_sp ... :normal Vsp - - -======================================================================== -autoload/tlib/Filter_fuzzy.vim~ - - *tlib#Filter_fuzzy#New()* -tlib#Filter_fuzzy#New(...) - Support for "fuzzy" pattern matching in |tlib#input#List()|. - Characters are interpreted as if connected with '.\{-}'. - - In "fuzzy" mode, the pretty printing of filenames is disabled. - - - TLogVAR a:world.display_format - - -======================================================================== -autoload/tlib/file.vim~ - - *tlib#file#Split()* -tlib#file#Split(filename) - EXAMPLES: > - tlib#file#Split('foo/bar/filename.txt') - => ['foo', 'bar', 'filename.txt'] -< - - *tlib#file#Join()* -tlib#file#Join(filename_parts, ?strip_slashes=0) - EXAMPLES: > - tlib#file#Join(['foo', 'bar', 'filename.txt']) - => 'foo/bar/filename.txt' -< - - *tlib#file#Relative()* -tlib#file#Relative(filename, basedir) - EXAMPLES: > - tlib#file#Relative('foo/bar/filename.txt', 'foo') - => 'bar/filename.txt' -< - - *tlib#file#With()* -tlib#file#With(fcmd, bcmd, files, ?world={}) - - -======================================================================== -autoload/tlib/Filter_seq.vim~ - - *tlib#Filter_seq#New()* -tlib#Filter_seq#New(...) - The search pattern for |tlib#input#List()| is interpreted as a - disjunction of 'magic' regular expressions with the exception of a dot - ".", which is interpreted as ".\{-}". - The pattern is a '/magic' regexp pattern. - - -======================================================================== -autoload/tlib/date.vim~ - - *tlib#date#DiffInDays()* -tlib#date#DiffInDays(date1, ?date2=localtime(), ?allow_zero=0) - - *tlib#date#Parse()* -tlib#date#Parse(date, ?allow_zero=0) "{{{3 - - *tlib#date#SecondsSince1970()* -tlib#date#SecondsSince1970(date, ...) - tlib#date#SecondsSince1970(date, ?daysshift=0, ?allow_zero=0) - - -======================================================================== -autoload/tlib/balloon.vim~ - - *tlib#balloon#Register()* -tlib#balloon#Register(expr) - - *tlib#balloon#Remove()* -tlib#balloon#Remove(expr) - - *tlib#balloon#Expr()* -tlib#balloon#Expr() - - -======================================================================== -autoload/tlib/buffer.vim~ - - *tlib#buffer#EnableMRU()* -tlib#buffer#EnableMRU() - - *tlib#buffer#DisableMRU()* -tlib#buffer#DisableMRU() - - *tlib#buffer#Set()* -tlib#buffer#Set(buffer) - Set the buffer to buffer and return a command as string that can be - evaluated by |:execute| in order to restore the original view. - - *tlib#buffer#Eval()* -tlib#buffer#Eval(buffer, code) - Evaluate CODE in BUFFER. - - EXAMPLES: > - call tlib#buffer#Eval('foo.txt', 'echo b:bar') -< - - *tlib#buffer#GetList()* -tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') - Possible values for the "order" argument: - bufnr :: Default behaviour - mru :: Sort buffers according to most recent use - basename :: Sort by the file's basename (last component) - - NOTE: MRU order works on second invocation only. If you want to always - use MRU order, call tlib#buffer#EnableMRU() in your ~/.vimrc file. - - *tlib#buffer#ViewLine()* -tlib#buffer#ViewLine(line, ?position='z') - line is either a number or a string that begins with a number. - For possible values for position see |scroll-cursor|. - See also |g:tlib_viewline_position|. - - *tlib#buffer#HighlightLine()* -tlib#buffer#HighlightLine(...) - - *tlib#buffer#DeleteRange()* -tlib#buffer#DeleteRange(line1, line2) - Delete the lines in the current buffer. Wrapper for |:delete|. - - *tlib#buffer#ReplaceRange()* -tlib#buffer#ReplaceRange(line1, line2, lines) - Replace a range of lines. - - *tlib#buffer#ScratchStart()* -tlib#buffer#ScratchStart() - Initialize some scratch area at the bottom of the current buffer. - - *tlib#buffer#ScratchEnd()* -tlib#buffer#ScratchEnd() - Remove the in-buffer scratch area. - - *tlib#buffer#BufDo()* -tlib#buffer#BufDo(exec) - Run exec on all buffers via bufdo and return to the original buffer. - - *tlib#buffer#InsertText()* -tlib#buffer#InsertText(text, keyargs) - Keyargs: - 'shift': 0|N - 'col': col('.')|N - 'lineno': line('.')|N - 'indent': 0|1 - 'pos': 'e'|'s' ... Where to locate the cursor (somewhat like s and e in {offset}) - Insert text (a string) in the buffer. - - *tlib#buffer#InsertText0()* -tlib#buffer#InsertText0(text, ...) - - *tlib#buffer#CurrentByte()* -tlib#buffer#CurrentByte() - - *tlib#buffer#KeepCursorPosition()* -tlib#buffer#KeepCursorPosition(cmd) - Evaluate cmd while maintaining the cursor position and jump registers. - - -======================================================================== -autoload/tlib/Filter_cnfd.vim~ - - *tlib#Filter_cnfd#New()* -tlib#Filter_cnfd#New(...) - The same as |tlib#FilterCNF#New()| but a dot is expanded to '\.\{-}'. - As a consequence, patterns cannot match dots. - The pattern is a '/\V' very no-'/magic' regexp pattern. - - -======================================================================== -autoload/tlib/type.vim~ - - *tlib#type#IsNumber()* -tlib#type#IsNumber(expr) - - *tlib#type#IsString()* -tlib#type#IsString(expr) - - *tlib#type#IsFuncref()* -tlib#type#IsFuncref(expr) - - *tlib#type#IsList()* -tlib#type#IsList(expr) - - *tlib#type#IsDictionary()* -tlib#type#IsDictionary(expr) - - -======================================================================== -autoload/tlib/syntax.vim~ - - *tlib#syntax#Collect()* -tlib#syntax#Collect() - - *tlib#syntax#Names()* -tlib#syntax#Names(?rx='') - - -======================================================================== -autoload/tlib/vim.vim~ - - *g:tlib#vim#simalt_maximize* -g:tlib#vim#simalt_maximize (default: 'x') - - *g:tlib#vim#simalt_restore* -g:tlib#vim#simalt_restore (default: 'r') - - *g:tlib#vim#use_vimtweak* -g:tlib#vim#use_vimtweak (default: 0) - - *tlib#vim#Maximize()* -tlib#vim#Maximize(fullscreen) - Maximize the window. - You might need to redefine |g:tlib#vim#simalt_maximize| if it doesn't - work for you. - - *tlib#vim#RestoreWindow()* -tlib#vim#RestoreWindow() - Restore the original vimsize after having called |tlib#vim#Maximize()|. - - *g:tlib#vim#use_wmctrl* -g:tlib#vim#use_wmctrl (default: executable('wmctrl')) - - -======================================================================== -autoload/tlib/hook.vim~ - - *tlib#hook#Run()* -tlib#hook#Run(hook, ?dict={}) - Execute dict[hook], w:{hook}, b:{hook}, or g:{hook} if existent. - - -======================================================================== -autoload/tlib/eval.vim~ - - *tlib#eval#FormatValue()* -tlib#eval#FormatValue(value, ...) - - -======================================================================== -autoload/tlib/arg.vim~ - - *tlib#arg#Get()* -tlib#arg#Get(n, var, ?default="", ?test='') - Set a positional argument from a variable argument list. - See tlib#string#RemoveBackslashes() for an example. - - *tlib#arg#Let()* -tlib#arg#Let(list, ?default='') - Set a positional arguments from a variable argument list. - See tlib#input#List() for an example. - - *tlib#arg#Key()* -tlib#arg#Key(dict, list, ?default='') - See |:TKeyArg|. - - *tlib#arg#StringAsKeyArgs()* -tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0) - - *tlib#arg#Ex()* -tlib#arg#Ex(arg, ?chars='%#! ') - Escape some characters in a string. - - Use |fnamescape()| if available. - - EXAMPLES: > - exec 'edit '. tlib#arg#Ex('foo%#bar.txt') -< - - ======================================================================== autoload/tlib/var.vim~ @@ -1061,7 +973,7 @@ autoload/tlib/var.vim~ tlib#var#Let(name, val) Define a variable called NAME if yet undefined. You can also use the :TLLet command. - + EXAMPLES: > exec tlib#var#Let('g:foo', 1) TLet g:foo = 1 @@ -1070,7 +982,7 @@ tlib#var#Let(name, val) *tlib#var#EGet()* tlib#var#EGet(var, namespace, ?default='') Retrieve a variable by searching several namespaces. - + EXAMPLES: > let g:foo = 1 let b:foo = 2 @@ -1083,7 +995,7 @@ tlib#var#EGet(var, namespace, ?default='') *tlib#var#Get()* tlib#var#Get(var, namespace, ?default='') Retrieve a variable by searching several namespaces. - + EXAMPLES: > let g:foo = 1 let b:foo = 2 @@ -1100,151 +1012,6 @@ tlib#var#List(rx, ?prefix='') echo tlib#var#List('tlib_', 'g:') -======================================================================== -autoload/tlib/Filter_cnf.vim~ - - *tlib#Filter_cnf#New()* -tlib#Filter_cnf#New(...) - The search pattern for |tlib#input#List()| is in conjunctive normal - form: (P1 OR P2 ...) AND (P3 OR P4 ...) ... - The pattern is a '/\V' very no-'/magic' regexp pattern. - - Pressing joins two patterns with AND. - Pressing | joins two patterns with OR. - I.e. In order to get "lala AND (foo OR bar)", you type - "lala foo|bar". - - This is also the base class for other filters. - - -======================================================================== -autoload/tlib/rx.vim~ - - *tlib#rx#Escape()* -tlib#rx#Escape(text, ?magic='m') - magic can be one of: m, M, v, V - See :help 'magic' - - *tlib#rx#EscapeReplace()* -tlib#rx#EscapeReplace(text, ?magic='m') - Escape return |sub-replace-special|. - - *tlib#rx#Suffixes()* -tlib#rx#Suffixes(...) - - -======================================================================== -autoload/tlib/url.vim~ - - *tlib#url#Decode()* -tlib#url#Decode(url) - Decode an encoded URL. - - *tlib#url#DecodeChar()* -tlib#url#DecodeChar(char) - Decode a single character. - - *tlib#url#EncodeChar()* -tlib#url#EncodeChar(char) - Encode a single character. - - *tlib#url#Encode()* -tlib#url#Encode(url, ...) - Encode an URL. - - -======================================================================== -autoload/tlib/input.vim~ -Input-related, select from a list etc. - - *tlib#input#List()* -tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0) - Select a single or multiple items from a list. Return either the list - of selected elements or its indexes. - - By default, typing numbers will select an item by its index. See - |g:tlib_numeric_chars| to find out how to change this. - - The item is automatically selected if the numbers typed equals the - number of digits of the list length. I.e. if a list contains 20 items, - typing 1 will first highlight item 1 but it won't select/use it - because 1 is an ambiguous input in this context. If you press enter, - the first item will be selected. If you press another digit (e.g. 0), - item 10 will be selected. Another way to select item 1 would be to - type 01. If the list contains only 9 items, typing 1 would select the - first item right away. - - type can be: - s ... Return one selected element - si ... Return the index of the selected element - m ... Return a list of selected elements - mi ... Return a list of indexes - - Several pattern matching styles are supported. See - |g:tlib_inputlist_match|. - - EXAMPLES: > - echo tlib#input#List('s', 'Select one item', [100,200,300]) - echo tlib#input#List('si', 'Select one item', [100,200,300]) - echo tlib#input#List('m', 'Select one or more item(s)', [100,200,300]) - echo tlib#input#List('mi', 'Select one or more item(s)', [100,200,300]) - -< See ../samples/tlib/input/tlib_input_list.vim (move the cursor over - the filename and press gf) for a more elaborated example. - - *tlib#input#ListD()* -tlib#input#ListD(dict) - A wrapper for |tlib#input#ListW()| that builds |tlib#World#New| from - dict. - - *tlib#input#ListW()* -tlib#input#ListW(world, ?command='') - The second argument (command) is meant for internal use only. - The same as |tlib#input#List| but the arguments are packed into world - (an instance of tlib#World as returned by |tlib#World#New|). - - *tlib#input#EditList()* -tlib#input#EditList(query, list, ?timeout=0) - Edit a list. - - EXAMPLES: > - echo tlib#input#EditList('Edit:', [100,200,300]) -< - - *tlib#input#Resume()* -tlib#input#Resume(name, pick) - - *tlib#input#CommandSelect()* -tlib#input#CommandSelect(command, ?keyargs={}) - Take a command, view the output, and let the user select an item from - its output. - - EXAMPLE: > - command! TMarks exec 'norm! `'. matchstr(tlib#input#CommandSelect('marks'), '^ \+\zs.') - command! TAbbrevs exec 'norm i'. matchstr(tlib#input#CommandSelect('abbrev'), '^\S\+\s\+\zs\S\+') -< - - *tlib#input#Edit()* -tlib#input#Edit(name, value, callback, ?cb_args=[]) - - Edit a value (asynchronously) in a scratch buffer. Use name for - identification. Call callback when done (or on cancel). - In the scratch buffer: - Press or to enter the new value, c to cancel - editing. - EXAMPLES: > - fun! FooContinue(success, text) - if a:success - let b:var = a:text - endif - endf - call tlib#input#Edit('foo', b:var, 'FooContinue') -< - - *tlib#input#Dialog()* -tlib#input#Dialog(text, options, default) - - ======================================================================== autoload/tlib/agent.vim~ Various agents for use as key handlers in tlib#input#List() @@ -1388,6 +1155,86 @@ tlib#agent#DoAtLine(world, selected) *tlib#agent#Wildcard()* tlib#agent#Wildcard(world, selected) + *tlib#agent#Null()* +tlib#agent#Null(world, selected) + + *tlib#agent#ExecAgentByName()* +tlib#agent#ExecAgentByName(world, selected) + + *tlib#agent#CompleteAgentNames()* +tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) + + +======================================================================== +autoload/tlib/Filter_cnfx.vim~ + + *g:tlib#Filter_cnfx#expander* +g:tlib#Filter_cnfx#expander (default: '+') + A character that should be expanded to '\.\{-}'. + + *tlib#Filter_cnfx#New()* +tlib#Filter_cnfx#New(...) + The same as |tlib#Filter_cnfd#New()| but a a customizable character + |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'. + The pattern is a '/\V' very no-'/magic' regexp pattern. + + +======================================================================== +autoload/tlib/url.vim~ + + *tlib#url#Decode()* +tlib#url#Decode(url) + Decode an encoded URL. + + *tlib#url#DecodeChar()* +tlib#url#DecodeChar(char) + Decode a single character. + + *tlib#url#EncodeChar()* +tlib#url#EncodeChar(char) + Encode a single character. + + *tlib#url#Encode()* +tlib#url#Encode(url, ...) + Encode an URL. + + +======================================================================== +autoload/tlib/signs.vim~ + + *tlib#signs#ClearAll()* +tlib#signs#ClearAll(sign) + Clear all signs with name SIGN. + + *tlib#signs#ClearBuffer()* +tlib#signs#ClearBuffer(sign, bufnr) + Clear all signs with name SIGN in buffer BUFNR. + + *tlib#signs#Mark()* +tlib#signs#Mark(sign, list) + Add signs for all locations in LIST. LIST must adhere with the + quickfix list format (see |getqflist()|; only the fields lnum and + bufnr are required). + + list:: a quickfix or location list + sign:: a sign defined with |:sign-define| + + +======================================================================== +autoload/tlib/rx.vim~ + + *tlib#rx#Escape()* +tlib#rx#Escape(text, ?magic='m') + magic can be one of: m, M, v, V + See :help 'magic' + + *tlib#rx#EscapeReplace()* +tlib#rx#EscapeReplace(text, ?magic='m') + Escape return |sub-replace-special|. + + *tlib#rx#Suffixes()* +tlib#rx#Suffixes(...) + ======================================================================== autoload/tlib/tag.vim~ @@ -1397,7 +1244,7 @@ tlib#tag#Retrieve(rx, ?extra_tags=0) Get all tags matching rx. Basically, this function simply calls |taglist()|, but when extra_tags is true, the list of the tag files (see 'tags') is temporarily expanded with |g:tlib_tags_extra|. - + Example use: If you want to include tags for, eg, JDK, normal tags use can become slow. You could proceed as follows: @@ -1429,83 +1276,6 @@ tlib#tag#Collect(constraints, ?use_extra=1, ?match_front=1) tlib#tag#Format(tag) -======================================================================== -autoload/tlib/signs.vim~ - - *tlib#signs#ClearAll()* -tlib#signs#ClearAll(sign) - Clear all signs with name SIGN. - - *tlib#signs#ClearBuffer()* -tlib#signs#ClearBuffer(sign, bufnr) - Clear all signs with name SIGN in buffer BUFNR. - - *tlib#signs#Mark()* -tlib#signs#Mark(sign, list) - Add signs for all locations in LIST. LIST must adhere with the - quickfix list format (see |getqflist()|; only the fields lnum and - bufnr are required). - - list:: a quickfix or location list - sign:: a sign defined with |:sign-define| - - -======================================================================== -autoload/tlib/cache.vim~ - - *g:tlib#cache#purge_days* -g:tlib#cache#purge_days (default: 31) - |tlib#cache#Purge()|: Remove cache files older than N days. - - *g:tlib#cache#purge_every_days* -g:tlib#cache#purge_every_days (default: 31) - Purge the cache every N days. Disable automatic purging by setting - this value to a negative value. - - *g:tlib#cache#script_encoding* -g:tlib#cache#script_encoding (default: &enc) - The encoding used for the purge-cache script. - Default: 'enc' - - *g:tlib#cache#run_script* -g:tlib#cache#run_script (default: 1) - Whether to run the directory removal script: - 0 ... No - 1 ... Query user - 2 ... Yes - - *g:tlib#cache#dont_purge* -g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$']) - A list of regexps that are matched against partial filenames of the - cached files. If a regexp matches, the file won't be removed by - |tlib#cache#Purge()|. - - *tlib#cache#Dir()* -tlib#cache#Dir(?mode = 'bg') - The default cache directory. - - *tlib#cache#Filename()* -tlib#cache#Filename(type, ?file=%, ?mkdir=0) - - *tlib#cache#Save()* -tlib#cache#Save(cfile, dictionary) - - *tlib#cache#Get()* -tlib#cache#Get(cfile) - - *tlib#cache#MaybePurge()* -tlib#cache#MaybePurge() - Call |tlib#cache#Purge()| if the last purge was done before - |g:tlib#cache#purge_every_days|. - - *tlib#cache#Purge()* -tlib#cache#Purge() - Delete old files. - - *tlib#cache#ListFilesInCache()* -tlib#cache#ListFilesInCache(...) - - ======================================================================== autoload/tlib/map.vim~ @@ -1518,11 +1288,302 @@ tlib#map#PumAccept(key) ======================================================================== -autoload/tlib/normal.vim~ +autoload/tlib/Filter_cnfd.vim~ - *tlib#normal#WithRegister()* -tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!') - Execute a normal command while maintaining all registers. + *tlib#Filter_cnfd#New()* +tlib#Filter_cnfd#New(...) + The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'. + As a consequence, patterns cannot match dots. + The pattern is a '/\V' very no-'/magic' regexp pattern. + + +======================================================================== +autoload/tlib/input.vim~ +Input-related, select from a list etc. + + *g:tlib#input#use_popup* +g:tlib#input#use_popup (default: has('menu') && (has('gui_gtk') || has('gui_gtk2') || has('gui_win32'))) + If true, define a popup menu for |tlib#input#List()| and related + functions. + + *g:tlib#input#format_filename* +g:tlib#input#format_filename (default: 'l') + How to format filenames: + l ... Show basenames on the left side, separated from the + directory names + r ... Show basenames on the right side + + *g:tlib#input#filename_padding_r* +g:tlib#input#filename_padding_r (default: '&co / 10') + If g:tlib#input#format_filename == 'r', how much space should be kept + free on the right side. + + *g:tlib#input#filename_max_width* +g:tlib#input#filename_max_width (default: '&co / 2') + If g:tlib#input#format_filename == 'l', an expression that + |eval()|uates to the maximum display width of filenames. + + *tlib#input#List()* +tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0) + Select a single or multiple items from a list. Return either the list + of selected elements or its indexes. + + By default, typing numbers will select an item by its index. See + |g:tlib_numeric_chars| to find out how to change this. + + The item is automatically selected if the numbers typed equals the + number of digits of the list length. I.e. if a list contains 20 items, + typing 1 will first highlight item 1 but it won't select/use it + because 1 is an ambiguous input in this context. If you press enter, + the first item will be selected. If you press another digit (e.g. 0), + item 10 will be selected. Another way to select item 1 would be to + type 01. If the list contains only 9 items, typing 1 would select the + first item right away. + + type can be: + s ... Return one selected element + si ... Return the index of the selected element + m ... Return a list of selected elements + mi ... Return a list of indexes + + Several pattern matching styles are supported. See + |g:tlib_inputlist_match|. + + EXAMPLES: > + echo tlib#input#List('s', 'Select one item', [100,200,300]) + echo tlib#input#List('si', 'Select one item', [100,200,300]) + echo tlib#input#List('m', 'Select one or more item(s)', [100,200,300]) + echo tlib#input#List('mi', 'Select one or more item(s)', [100,200,300]) + +< See ../samples/tlib/input/tlib_input_list.vim (move the cursor over + the filename and press gf) for a more elaborated example. + + *tlib#input#ListD()* +tlib#input#ListD(dict) + A wrapper for |tlib#input#ListW()| that builds |tlib#World#New| from + dict. + + *tlib#input#ListW()* +tlib#input#ListW(world, ?command='') + The second argument (command) is meant for internal use only. + The same as |tlib#input#List| but the arguments are packed into world + (an instance of tlib#World as returned by |tlib#World#New|). + + *tlib#input#EditList()* +tlib#input#EditList(query, list, ?timeout=0) + Edit a list. + + EXAMPLES: > + echo tlib#input#EditList('Edit:', [100,200,300]) +< + + *tlib#input#Resume()* +tlib#input#Resume(name, pick, bufnr) + + *tlib#input#CommandSelect()* +tlib#input#CommandSelect(command, ?keyargs={}) + Take a command, view the output, and let the user select an item from + its output. + + EXAMPLE: > + command! TMarks exec 'norm! `'. matchstr(tlib#input#CommandSelect('marks'), '^ \+\zs.') + command! TAbbrevs exec 'norm i'. matchstr(tlib#input#CommandSelect('abbrev'), '^\S\+\s\+\zs\S\+') +< + + *tlib#input#Edit()* +tlib#input#Edit(name, value, callback, ?cb_args=[]) + + Edit a value (asynchronously) in a scratch buffer. Use name for + identification. Call callback when done (or on cancel). + In the scratch buffer: + Press or to enter the new value, c to cancel + editing. + EXAMPLES: > + fun! FooContinue(success, text) + if a:success + let b:var = a:text + endif + endf + call tlib#input#Edit('foo', b:var, 'FooContinue') +< + + *tlib#input#Dialog()* +tlib#input#Dialog(text, options, default) + + +======================================================================== +autoload/tlib/file.vim~ + + *tlib#file#Split()* +tlib#file#Split(filename) + EXAMPLES: > + tlib#file#Split('foo/bar/filename.txt') + => ['foo', 'bar', 'filename.txt'] +< + + *tlib#file#Join()* +tlib#file#Join(filename_parts, ?strip_slashes=0) + EXAMPLES: > + tlib#file#Join(['foo', 'bar', 'filename.txt']) + => 'foo/bar/filename.txt' +< + + *tlib#file#Relative()* +tlib#file#Relative(filename, basedir) + EXAMPLES: > + tlib#file#Relative('foo/bar/filename.txt', 'foo') + => 'bar/filename.txt' +< + + *tlib#file#With()* +tlib#file#With(fcmd, bcmd, files, ?world={}) + + +======================================================================== +autoload/tlib/paragraph.vim~ + + *tlib#paragraph#GetMetric()* +tlib#paragraph#GetMetric() + Return an object describing a |paragraph|. + + *tlib#paragraph#Move()* +tlib#paragraph#Move(direction, count) + This function can be used with the tinymode plugin to move around + paragraphs. + + Example configuration: > + + call tinymode#EnterMap("para_move", "gp") + call tinymode#ModeMsg("para_move", "Move paragraph: j/k") + call tinymode#Map("para_move", "j", "silent call tlib#paragraph#Move('Down', '[N]')") + call tinymode#Map("para_move", "k", "silent call tlib#paragraph#Move('Up', '[N]')") + call tinymode#ModeArg("para_move", "owncount", 1) +< + + +======================================================================== +autoload/tlib/World.vim~ +A prototype used by |tlib#input#List|. +Inherits from |tlib#Object#New|. + + *tlib#World#New()* +tlib#World#New(...) + + +======================================================================== +autoload/tlib/tab.vim~ + + *tlib#tab#BufMap()* +tlib#tab#BufMap() + Return a dictionary of bufnumbers => [[tabpage, winnr] ...] + + *tlib#tab#TabWinNr()* +tlib#tab#TabWinNr(buffer) + Find a buffer's window at some tab page. + + *tlib#tab#Set()* +tlib#tab#Set(tabnr) + + +======================================================================== +autoload/tlib/date.vim~ + + *tlib#date#DiffInDays()* +tlib#date#DiffInDays(date1, ?date2=localtime(), ?allow_zero=0) + + *tlib#date#Parse()* +tlib#date#Parse(date, ?allow_zero=0) "{{{3 + + *tlib#date#SecondsSince1970()* +tlib#date#SecondsSince1970(date, ...) + tlib#date#SecondsSince1970(date, ?daysshift=0, ?allow_zero=0) + + +======================================================================== +autoload/tlib/type.vim~ + + *tlib#type#IsNumber()* +tlib#type#IsNumber(expr) + + *tlib#type#IsString()* +tlib#type#IsString(expr) + + *tlib#type#IsFuncref()* +tlib#type#IsFuncref(expr) + + *tlib#type#IsList()* +tlib#type#IsList(expr) + + *tlib#type#IsDictionary()* +tlib#type#IsDictionary(expr) + + +======================================================================== +autoload/tlib/Filter_fuzzy.vim~ + + *tlib#Filter_fuzzy#New()* +tlib#Filter_fuzzy#New(...) + Support for "fuzzy" pattern matching in |tlib#input#List()|. + Patterns are interpreted as if characters were connected with '.\{-}'. + + In "fuzzy" mode, the pretty printing of filenames is disabled. + + +======================================================================== +autoload/tlib/textobjects.vim~ + + *standard-paragraph* +tlib#textobjects#StandardParagraph() + Select a "Standard Paragraph", i.e. a text block followed by blank + lines. Other than |ap|, the last paragraph in a document is handled + just the same. + + The |text-object| can be accessed as "sp". Example: > + + vsp ... select the current standard paragraph + +< Return 1, if the paragraph is the last one in the document. + + *tlib#textobjects#Init()* +tlib#textobjects#Init() + + *v_sp* +v_sp ... :call tlib#textobjects#StandardParagraph() + sp ... Standard paragraph (for use as |text-objects|). + + *o_sp* +o_sp ... :normal Vsp + + +======================================================================== +autoload/tlib/arg.vim~ + + *tlib#arg#Get()* +tlib#arg#Get(n, var, ?default="", ?test='') + Set a positional argument from a variable argument list. + See tlib#string#RemoveBackslashes() for an example. + + *tlib#arg#Let()* +tlib#arg#Let(list, ?default='') + Set a positional arguments from a variable argument list. + See tlib#input#List() for an example. + + *tlib#arg#Key()* +tlib#arg#Key(dict, list, ?default='') + See |:TKeyArg|. + + *tlib#arg#StringAsKeyArgs()* +tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0) + + *tlib#arg#Ex()* +tlib#arg#Ex(arg, ?chars='%#! ') + Escape some characters in a string. + + Use |fnamescape()| if available. + + EXAMPLES: > + exec 'edit '. tlib#arg#Ex('foo%#bar.txt') +< ======================================================================== @@ -1561,102 +1622,208 @@ tlib#dir#Pop() ======================================================================== -autoload/tlib/notify.vim~ +autoload/tlib/win.vim~ - *tlib#notify#Echo()* -tlib#notify#Echo(text, ...) - Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' - in order to prevent |press-enter| messages. + *tlib#win#Set()* +tlib#win#Set(winnr) + Return vim code to jump back to the original window. - *tlib#notify#TrimMessage()* -tlib#notify#TrimMessage(message) - Contributed by Erik Falor: - If the line containing the message is too long, echoing it will cause - a 'Hit ENTER' prompt to appear. This function cleans up the line so - that does not happen. - The echoed line is too long if it is wider than the width of the - window, minus cmdline space taken up by the ruler and showcmd - features. + *tlib#win#GetLayout()* +tlib#win#GetLayout(?save_view=0) + + *tlib#win#SetLayout()* +tlib#win#SetLayout(layout) + + *tlib#win#List()* +tlib#win#List() + + *tlib#win#Width()* +tlib#win#Width(wnr) + + *tlib#win#WinDo()* +tlib#win#WinDo(ex) ======================================================================== -autoload/tlib/list.vim~ +autoload/tlib/comments.vim~ + + *tlib#comments#Comments()* +tlib#comments#Comments(...) + function! tlib#comments#Comments(?rx='') + + +======================================================================== +autoload/tlib/Filter_cnf.vim~ + + *tlib#Filter_cnf#New()* +tlib#Filter_cnf#New(...) + The search pattern for |tlib#input#List()| is in conjunctive normal + form: (P1 OR P2 ...) AND (P3 OR P4 ...) ... + The pattern is a '/\V' very no-'/magic' regexp pattern. + + Pressing joins two patterns with AND. + Pressing | joins two patterns with OR. + I.e. In order to get "lala AND (foo OR bar)", you type + "lala foo|bar". + + This is also the base class for other filters. + +prototype.Pretty + + +======================================================================== +autoload/tlib/Object.vim~ +Provides a prototype plus some OO-like methods. + + *tlib#Object#New()* +tlib#Object#New(?fields={}) + This function creates a prototype that provides some kind of + inheritance mechanism and a way to call parent/super methods. + + The usage demonstrated in the following example works best when every + class/prototype is defined in a file of its own. + + The reason for why there is a dedicated constructor function is that + this layout facilitates the use of templates and that methods are + hidden from the user. Other solutions are possible. - *tlib#list#Inject()* -tlib#list#Inject(list, initial_value, funcref) EXAMPLES: > - echo tlib#list#Inject([1,2,3], 0, function('Add') - => 6 + let s:prototype = tlib#Object#New({ + \ '_class': ['FooBar'], + \ 'foo': 1, + \ 'bar': 2, + \ }) + " Constructor + function! FooBar(...) + let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) + return object + endf + function! s:prototype.babble() { + echo "I think, therefore I am ". (self.foo * self.bar) ." months old." + } + +< This could now be used like this: > + let myfoo = FooBar({'foo': 3}) + call myfoo.babble() + => I think, therefore I am 6 months old. + echo myfoo.IsA('FooBar') + => 1 + echo myfoo.IsA('object') + => 1 + echo myfoo.IsA('Foo') + => 0 + echo myfoo.RespondTo('babble') + => 1 + echo myfoo.RespondTo('speak') + => 0 < - *tlib#list#Compact()* -tlib#list#Compact(list) +prototype.New + +prototype.Inherit + +prototype.Extend + +prototype.IsA + +prototype.IsRelated + +prototype.RespondTo + +prototype.Super + + *tlib#Object#Methods()* +tlib#Object#Methods(object, ...) + + +======================================================================== +autoload/tlib/buffer.vim~ + + *tlib#buffer#EnableMRU()* +tlib#buffer#EnableMRU() + + *tlib#buffer#DisableMRU()* +tlib#buffer#DisableMRU() + + *tlib#buffer#Set()* +tlib#buffer#Set(buffer) + Set the buffer to buffer and return a command as string that can be + evaluated by |:execute| in order to restore the original view. + + *tlib#buffer#Eval()* +tlib#buffer#Eval(buffer, code) + Evaluate CODE in BUFFER. + EXAMPLES: > - tlib#list#Compact([0,1,2,3,[], {}, ""]) - => [1,2,3] + call tlib#buffer#Eval('foo.txt', 'echo b:bar') < - *tlib#list#Flatten()* -tlib#list#Flatten(list) - EXAMPLES: > - tlib#list#Flatten([0,[1,2,[3,""]]]) - => [0,1,2,3,""] -< + *tlib#buffer#GetList()* +tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') + Possible values for the "order" argument: + bufnr :: Default behaviour + mru :: Sort buffers according to most recent use + basename :: Sort by the file's basename (last component) - *tlib#list#FindAll()* -tlib#list#FindAll(list, filter, ?process_expr="") - Basically the same as filter() - - EXAMPLES: > - tlib#list#FindAll([1,2,3], 'v:val >= 2') - => [2, 3] -< + NOTE: MRU order works on second invocation only. If you want to always + use MRU order, call tlib#buffer#EnableMRU() in your ~/.vimrc file. - *tlib#list#Find()* -tlib#list#Find(list, filter, ?default="", ?process_expr="") - - EXAMPLES: > - tlib#list#Find([1,2,3], 'v:val >= 2') - => 2 -< + *tlib#buffer#ViewLine()* +tlib#buffer#ViewLine(line, ?position='z') + line is either a number or a string that begins with a number. + For possible values for position see |scroll-cursor|. + See also |g:tlib_viewline_position|. - *tlib#list#Any()* -tlib#list#Any(list, expr) - EXAMPLES: > - tlib#list#Any([1,2,3], 'v:val >= 2') - => 1 -< + *tlib#buffer#HighlightLine()* +tlib#buffer#HighlightLine(...) - *tlib#list#All()* -tlib#list#All(list, expr) - EXAMPLES: > - tlib#list#All([1,2,3], 'v:val >= 2') - => 0 -< + *tlib#buffer#DeleteRange()* +tlib#buffer#DeleteRange(line1, line2) + Delete the lines in the current buffer. Wrapper for |:delete|. - *tlib#list#Remove()* -tlib#list#Remove(list, element) - EXAMPLES: > - tlib#list#Remove([1,2,1,2], 2) - => [1,1,2] -< + *tlib#buffer#ReplaceRange()* +tlib#buffer#ReplaceRange(line1, line2, lines) + Replace a range of lines. - *tlib#list#RemoveAll()* -tlib#list#RemoveAll(list, element) - EXAMPLES: > - tlib#list#RemoveAll([1,2,1,2], 2) - => [1,1] -< + *tlib#buffer#ScratchStart()* +tlib#buffer#ScratchStart() + Initialize some scratch area at the bottom of the current buffer. - *tlib#list#Zip()* -tlib#list#Zip(lists, ?default='') - EXAMPLES: > - tlib#list#Zip([[1,2,3], [4,5,6]]) - => [[1,4], [2,5], [3,6]] -< + *tlib#buffer#ScratchEnd()* +tlib#buffer#ScratchEnd() + Remove the in-buffer scratch area. - *tlib#list#Uniq()* -tlib#list#Uniq(list, ...) + *tlib#buffer#BufDo()* +tlib#buffer#BufDo(exec) + Run exec on all buffers via bufdo and return to the original buffer. + + *tlib#buffer#InsertText()* +tlib#buffer#InsertText(text, keyargs) + Keyargs: + 'shift': 0|N + 'col': col('.')|N + 'lineno': line('.')|N + 'indent': 0|1 + 'pos': 'e'|'s' ... Where to locate the cursor (somewhat like s and e in {offset}) + Insert text (a string) in the buffer. + + *tlib#buffer#InsertText0()* +tlib#buffer#InsertText0(text, ...) + + *tlib#buffer#CurrentByte()* +tlib#buffer#CurrentByte() + + *tlib#buffer#KeepCursorPosition()* +tlib#buffer#KeepCursorPosition(cmd) + Evaluate cmd while maintaining the cursor position and jump registers. + + +======================================================================== +autoload/tlib/hook.vim~ + + *tlib#hook#Run()* +tlib#hook#Run(hook, ?dict={}) + Execute dict[hook], w:{hook}, b:{hook}, or g:{hook} if existent. ======================================================================== diff --git a/sources_non_forked/tlib/plugin/02tlib.vim b/sources_non_forked/tlib/plugin/02tlib.vim index f9cfe0b1..126db40a 100644 --- a/sources_non_forked/tlib/plugin/02tlib.vim +++ b/sources_non_forked/tlib/plugin/02tlib.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-04-10. -" @Last Change: 2011-04-28. -" @Revision: 672 +" @Last Change: 2012-10-03. +" @Revision: 725 " GetLatestVimScripts: 1863 1 tlib.vim if &cp || exists("loaded_tlib") @@ -14,7 +14,7 @@ if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let loaded_tlib = 41 +let loaded_tlib = 102 let s:save_cpo = &cpo set cpo&vim @@ -26,7 +26,7 @@ set cpo&vim " Commands~ {{{1 -" :display: TRequire NAME [VERSION [FILE]] +" :display: :TRequire NAME [VERSION [FILE]] " Make a certain vim file is loaded. " " Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The @@ -84,7 +84,7 @@ command! -nargs=+ TVarArg exec tlib#arg#Let([]) command! -nargs=+ TKeyArg exec tlib#arg#Key([]) -" :display: TBrowseOutput COMMAND +" :display: :TBrowseOutput COMMAND " Ever wondered how to efficiently browse the output of a command " without redirecting it to a file? This command takes a command as " argument and presents the output via |tlib#input#List()| so that you @@ -98,7 +98,7 @@ command! -nargs=+ TKeyArg exec tlib#arg#Key([]) " TBrowseOutput 20verb TeaseTheCulprit command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput() -" :display: TBrowseScriptnames +" :display: :TBrowseScriptnames " List all sourced script names (the output of ':scriptnames'). " " When you press enter, the selected script will be opened in the current @@ -109,58 +109,96 @@ command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput() +" :doc: " Variables~ {{{1 " When 1, automatically select the last remaining item only if the list " had only one item to begin with. " When 2, automatically select a last remaining item after applying " any filters. +" See |tlib#input#List()|. TLet g:tlib_pick_last_item = 1 " If a list is bigger than this value, don't try to be smart when " selecting an item. Be slightly faster instead. +" See |tlib#input#List()|. TLet g:tlib_sortprefs_threshold = 200 " Scratch window position. By default the list window is opened on the " bottom. Set this variable to 'topleft' or '' to change this behaviour. +" See |tlib#input#List()|. TLet g:tlib_scratch_pos = 'botright' " Size of the input list window (in percent) from the main size (of &lines). +" See |tlib#input#List()|. TLet g:tlib_inputlist_pct = 50 " Size of filename columns when listing filenames. +" See |tlib#input#List()|. TLet g:tlib_inputlist_width_filename = '&co / 3' " TLet g:tlib_inputlist_width_filename = 25 -" The highlight group to use for showing matches in the input list window. +" The highlight group to use for showing matches in the input list +" window. +" See |tlib#input#List()|. TLet g:tlib_inputlist_higroup = 'IncSearch' -" If a list contains more items, don't do an incremental "live search", -" but use |input()| to query the user for a filter. This is useful on -" slower machines or with very long lists. +" If a list contains more items, |tlib#input#List()| does not perform an +" incremental "live search" but uses |input()| to query the user for a +" filter. This is useful on slower machines or with very long lists. TLet g:tlib_inputlist_livesearch_threshold = 1000 -" If true, show some indicators about the status of a filename (e.g. -" buflisted(), bufloaded() etc.). +" If true, |tlib#input#List()| will show some indicators about the +" status of a filename (e.g. buflisted(), bufloaded() etc.). " This is disabled by default because vim checks also for the file on " disk when doing this. TLet g:tlib_inputlist_filename_indicators = 0 -" Can be "cnf", "cnfd", "seq", or "fuzzy". See: -" cnf :: Match substrings -" - |tlib#Filter_cnf#New()| (this is the default method) -" - |tlib#Filter_cnfd#New()| -" seq :: Match sequences of characters +" Determine how |tlib#input#List()| and related functions work. +" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: +" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted +" as a wildcard (this is the default method) +" - A plus character ("+") acts as a wildcard as if ".\{-}" (see +" |/\{-|) were entered. +" - Examples: +" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match +" "far". +" - Otherwise it is a derivate of the cnf method (see below). +" - See also |tlib#Filter_cnfx#New()|. +" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is +" expanded to "\.\{-}" +" - A period character (".") acts as a wildcard as if ".\{-}" (see +" |/\{-|) were entered. +" - Examples: +" - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match +" "far". +" - Otherwise it is a derivate of the cnf method (see below). +" - See also |tlib#Filter_cnfd#New()|. +" cnf .... Match substrings +" - A blank creates an AND conjunction, i.e. the next pattern has to +" match too. +" - A pipe character ("|") creates an OR conjunction, either this or +" the next next pattern has to match. +" - Patterns are very 'nomagic' |regexp| with a |\V| prefix. +" - A pattern starting with "-" makes the filter exclude items +" matching that pattern. +" - Examples: +" - "foo bar" matches items that contain the strings "foo" AND +" "bar". +" - "foo|bar boo|far" matches items that contain either ("foo" OR +" "bar") AND ("boo" OR "far"). +" - See also |tlib#Filter_cnf#New()|. +" seq .... Match sequences of characters " - |tlib#Filter_seq#New()| -" fuzzy :: Match fuzzy character sequences +" fuzzy .. Match fuzzy character sequences " - |tlib#Filter_fuzzy#New()| -TLet g:tlib_inputlist_match = 'cnf' +TLet g:tlib_inputlist_match = 'cnfx' " If not null, display only a short info about the filter. TLet g:tlib_inputlist_shortmessage = 0 @@ -265,6 +303,8 @@ TLet g:tlib_keyagents_InputList_s = { \ 15: 'tlib#agent#SuspendToParentWindow', \ 63: 'tlib#agent#Help', \ "\": 'tlib#agent#Help', + \ "\": 'tlib#agent#ExecAgentByName', + \ "\": 'tlib#agent#ExecAgentByName', \ "\": 'tlib#agent#ReduceFilter', \ "\": 'tlib#agent#ReduceFilter', \ "\": 'tlib#agent#PopFilter', @@ -306,13 +346,8 @@ TLet g:tlib_handlers_EditList = [ \ ]}, \ ] - - -" " TEST: -" TRequire tselectbuffer 6 -" echo loaded_tselectbuffer - - +" :nodefault: +TLet g:tlib_debug = 0 let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/vim-addon-mw-utils/autoload/tovl/scratch_buffer.vim b/sources_non_forked/vim-addon-mw-utils/autoload/tovl/scratch_buffer.vim new file mode 100644 index 00000000..217dca11 --- /dev/null +++ b/sources_non_forked/vim-addon-mw-utils/autoload/tovl/scratch_buffer.vim @@ -0,0 +1,103 @@ +" old code + +augroup TOVLWrite +augroup end + +" =========== scratch buffer ========================================= +" a scratch buffer is a temporary buffer where the user can enter some text +" It can be used to get commit messages, edit configuration options and so on + +function! tovl#scratch_buffer#KeepIntactLineNr() + let i = 0 + while getline(i)!= b:keepIntact && i < line('$') + let i = i+1 + endwhile + if i > line('$') + return -1 + else + return i + endif +endfunction + +" opens a buffer and runs an action when the buffer is written +" keys: +" name : the name of the buffer +" onWrite : will be called on write +" onWrite is responsible for setlocal nomodified to indicate that +" saving has been successful +" help : callback returning additional information lines +" getContent : callback returning lines +" cmds : extra commands to be run (optional) +" (maybe you prefer adding them the default way afer the +" ScratchBuffer call. They'll be rerun on GetContents +" sp_cmd : the command to use to create the new buffer. Defaults to :e +" buftype : ... +" modifiable : 1 / 0 defaults to 1 +function! tovl#scratch_buffer#ScratchBuffer(opts) + let a:opts['name'] = get(a:opts,'name', 'strach_buffer_without_name') + exec get(a:opts, 'sp_cmd', 'e').' '.escape(a:opts['name'],' ') + let b:settings = a:opts + let b:settings['modifiable'] = get(a:opts,'modifiable', 1) + setlocal buftype=acwrite + command! -buffer -nargs=0 Help call tovl#scratch_buffer#Help() + + " setup write notification + au TOVLWrite BufWriteCmd call tovl#scratch_buffer#Write() + + if has_key(a:opts,'getContent') + command! -buffer -nargs=0 GetContents call tovl#scratch_buffer#GetContents() + GetContents + if !b:settings['modifiable'] + setlocal nomodifiable + endif + endif + "let u=&undolevels + "setlocal undolevels=-1 + "exec 'setlocal undolevels='.u + + " mark buffer as not modified + setlocal nomodified + + au BufReadCmd GetContents + + " run addittional commands + for cmd in get(a:opts,'cmds',[]) + exec cmd + endfor + silent echo get(a:opts,'echo_help', "type :Help for help") +endfunction + +" =========== utility functions ====================================== + +function! tovl#scratch_buffer#Write() + if has_key(b:settings, 'onWrite') + call funcref#Call(b:settings['onWrite']) + else + echo "don't know how to write. Option hasn't been passed" + endif +endfunction + +function! tovl#scratch_buffer#GetContents() + setlocal modifiable + " empty buffer + %g!//d + call append(0, funcref#Call(b:settings['getContent'])) + if !b:settings['modifiable'] + setlocal nomodifiable + endif + for cmd in get(b:settings,'cmds',[]) + exec cmd + endfor +endfunction + +function! tovl#scratch_buffer#Help() + let help = ["use :e! to reload contents, ZZ or :w(q) to write and quit" + \ ,"" + \ ,"Help for this scratch buffer:" + \ ,"=======================================================","",""] + \ + funcref#Call(get(b:settings, 'help', [])) + call tovl#scratch_buffer#ScratchBuffer({ + \ 'name' : "return Help of ".b:settings['name'], + \ 'getContent' : help + \ }) +endfunction diff --git a/sources_non_forked/vim-addon-mw-utils/autoload/tovl/ui/filter_list.vim b/sources_non_forked/vim-addon-mw-utils/autoload/tovl/ui/filter_list.vim new file mode 100644 index 00000000..74b2ab49 --- /dev/null +++ b/sources_non_forked/vim-addon-mw-utils/autoload/tovl/ui/filter_list.vim @@ -0,0 +1,473 @@ +" OLD CODE ! +" I should contribute the multiple filter feature to tlib + +" filter list displays a list of items +" you can white / black filter them by regular expressions (similar to the +" tlib TToC command +" However you can edit the filters afterwards and select the cols which should +" be shown + +fun! tovl#ui#filter_list#ListTest() + call tovl#ui#filter_list#ListView({ + \ 'aligned' : 1, + \ 'Continuation' : funcref#Function('echo string(ARGS[0])'), + \ 'items' : [ {"aa" : "a\nAAAAAAAAAAA", 'bb' : "bbbbbbbbbbbbb\nB" }, + \ {"aa" : "2a\n2AAAAAAAAAAAA", "bb" : "2 bbbbbbbbbbbbb\n2B"}, + \ {"aa" : "XXX", "bb" : "YY"} ], + \ }) + +endfun + +fun! s:Intersection(a, b) + return filter(copy(a:a), 'index(a:b, v:val) >= 0') +endf + +fun! tovl#ui#filter_list#ListTestGotoLineCurrentBuf() + let nr=1 + let lines = [] + for l in getline(0,line('$')) + call add(lines, {'nr': nr, 'line' :l}) + let nr = nr +1 + endfor + call tovl#ui#filter_list#ListView({ + \ 'aligned' : 0, + \ 'keys' : ['nr','line'], + \ 'number' : 1, + \ 'selectByIdOrFilter' : 1, + \ 'Continuation' : funcref#Function('exec ARGS[0]["nr"]'), + \ 'items' : lines, + \ }) +endfun + +" opens a new filtered list +" keys of opts parameters: +" Continuation: This function will be called with the selected items +" items: { key : (string or dict) } +" items willl be modified. use copy(youritems) as argument to prevent +" this. An item is either a string or a dict +" (eg {'file' : .., 'line': ... , 'msg' : .. ) +" keys: list of keys to be shown (optional) +" filter: list of inital filters which must be applied +" contains [ { filter: .. , keep : .. }, ] see FilterItems() below +" aligned: default 0 +" sp_cmd: the command to be used to create the new buffer (default ':e') +" init : 0 / 1 (default 1): wether to show the view right now +" number: 0 /1 (default 1): number items ? +" selectByIdOrFilter: 1: start in getchar() loop so that the user can select +" the item even faster +" auto: only do this if all items fit on screen +" (recommend) +" cmds: extra cmds to be run +" cursorAt : at which item to put the cursor? +" +" If you don't like the default view you can override UpdateDisplay +" +" Usage examples of this list control: +" - db results +" - replacement of the quickfix window +" - select a buffer etc +fun! tovl#ui#filter_list#ListView(opts) + " ActivateAddons theonevimlib + let d = {} + let d.items = a:opts.items + let d.cursorAt = get(a:opts, 'cursorAt', 0) + let d.aligned = get(a:opts, 'aligned', 0) + let d.sep = ' ' + let d.filter = get(a:opts, 'filter', []) + " using sp because of bd! (FIXME) + let d.sp_cmd = get(a:opts, 'sp_cmd', 'sp') + let d.allKeys = {} + let d.closeOnContinuation = get(a:opts,'closeOnContinuation',1) + " don't recommend OnSingleMatch, use OnSingleMatchCR instead + let d.continueOnSingleMatch = get(a:opts, 'continueOnSingleMatch',0) + let d.continueOnSingleMatchCR = get(a:opts, 'continueOnSingleMatchCR',1) + let d.selectByIdOrFilter = get(a:opts, 'selectByIdOrFilter', 0) + let d.linesToItems = {} + let d.number = get(a:opts, 'number', 1) + let d.cmds = get(a:opts, 'cmds', []) + let d.syn_cmds = get(a:opts, 'syn_cmds', []) + + if has_key(a:opts,'keys') | let d.keys = a:opts.keys | endif + if has_key(a:opts,'Continuation') | let d.Continuation = a:opts.Continuation | endif + + " cache already filtered items in case we want to view really long results + " contains [ { filter : { regex: .. , keep : .. } , items : .. , cursorAt :}, + " { filter : { ... } , items: .. , cursorAt : } + let d.cached = [] + " id of buffer + let d.buffer = -1 + let d.modeText = '' + + fun d.HelpText() + return [ "you've entered the the help of the powerful filtered view buffer", + \ "", + \ "type f to start filtering items by regex", + \ "type F to start dropping items by regex", + \ "k / K will ask you for the key to apply the filter to first", + \ "apply the filter by and press again to select item", + \ "", + \ "use :ShowAppliedFilters to list active filters", + \ "use :ToggleAlignment to toggle alignment", + \ "", + \ "TODO: Implement sorting, implement interface to change keys (displayed columns)" + \ ] + endfun + + " create new scratch buffer + " preprocess items calculating line count and maxwidth for all items + fun d.NewBufferAndInit() + let self.bufferId = bufnr(bufname('%')) + for idx in range(0,len(self.items)-1) + if type(self.items[idx]) != 4 + " no dict yet, make it one + let self.items[idx] = {'string_line' : self.items[idx]} + endif + let new = {} + for [k,v] in items(self.items[idx]) + let lines = split(v,"\n") + let self.items[idx][k] = { 'text' : v, 'rows' : len(lines), 'cols' : max(map(copy(lines),'len(v:val)')), 'lines' : lines } + let self.allKeys[k] = 1 + unlet k v + endfor + endfor + call tovl#scratch_buffer#ScratchBuffer({ + \ 'help' : funcref#Function(self.HelpText,{ 'self' : self }), + \ 'sp_cmd' : self.sp_cmd, + \ 'cmds' : self.cmds + \ }) + " I assume we have some kind of formatting anyway. Thus breaking lines is bad! + set nowrap + setlocal cursorline + let b:filtered_view = self + command! -buffer -nargs=0 ToggleAlignment call b:filtered_view.ToggleAlignment() + command! -buffer -nargs=0 ShowAppliedFilters call b:filtered_view.ShowAppliedFilters() + command! -buffer -nargs=0 RemoveFilters call b:filtered_view.RemoveFilters() + noremap f :call b:filtered_view.FilterFromKeyboard(1,'') + " noremap f :call b:filtered_view.FilterFromKeyboard(1) + noremap F :call b:filtered_view.FilterFromKeyboard(0,'') + if has_key(self,'Continuation') + nnoremap :call b:filtered_view.Continue() + endif + "noremap k + "noremap K + + let [items, cursorAt] = self.FilteredItems() + " len(items) is an approximation because one item can have multiple + " lines.. However adding the lines first to check takes too much time + if self.selectByIdOrFilter == 1 || (self.selectByIdOrFilter == 'auto' && winheight('%') > len(items) ) + call self.SelectByIdOrFilter() + else + " user should choose how to proceed + call self.UpdateDisplay() + endif + endfun + + " user interface + fun d.ToggleAlignment() + let self.aligned = !self.aligned + call self.UpdateDisplay() + endfun + fun d.ShowAppliedFilters() + for i in self.filter | echo string(i) | endfor + endfun + fun d.RemoveFilters() + let self.filter = [] + call self.UpdateDisplay() + endfun + fun d.Continue() + let item = self.CurrentItem() + call self.DoContinue(item) + endfun + fun d.DoContinue(v) + if self.closeOnContinuation | bw! | endif + call funcref#Call(self.Continuation,[a:v]) + endfun + + fun d.MapToOriginal(v) + if has_key(a:v, 'string_line') + return a:v.string_line.text + else + let d = {} + for [k,v] in items(a:v) + let d[k] = v.text + unlet k v + endfor + return d + endif + endfun + + fun d.CurrentItem() + let idx=line('.')-len(self.headerLines) + while idx >= 0 + if has_key(self.linesToItems, idx) + return self.MapToOriginal(self.FilteredItems()[0][self.linesToItems[idx]]) + else + let idx = idx -1 + endif + endwhile + throw "internal error, couldn't determine selected item!" + endfun + + " updates the filter cache and returns the final filtered items + fun d.FilteredItems() + " update cache + let idx = 0 + let [items, cursorAt] = [self.items, self.cursorAt] + for idx in range(0, len(self.filter)-1) + if idx +1 > len(self.cached) || self.cached[idx]['filter'] != self.filter[idx] + let self.cached = self.cached[:idx-1] + let [items, cursorAt] = self.FilterItem(copy(items), self.filter[idx], cursorAt) + call add(self.cached, { 'cursorAt' : cursorAt, 'items' : items, 'filter' : self.filter[idx]}) + else + let ci = self.cached[idx] + let [items, cursorAt] = [ci['items'], ci['cursorAt']] + endif + endfor + return [items, cursorAt] + endfun + + " calling this will return a set of lines which are expected to be the new + " buffer contents. The self.linesToItems dict is updated + fun d.UpdateDisplay() + + if empty(self.filter) + let self.statusline= 'no filter applied, :Help for help' + else + let self.statusline = len(self.filter).' '.string(self.filter[-1]) + endif + + let self.linesToItems = {} + let [items, cursorAt] = self.FilteredItems() + "let num_width = printf('%.0f', trunc(log10(len(items))+1)) + let num_width = 4 + if self.aligned + " get column width.. (probably will not work with unicde characters.. I + " don't have a better solution) + let maxlens={} + for i in items + for [k,v] in items(i) + if get(maxlens,k,0) < v.cols + let maxlens[k] = v.cols + endif + endfor + endfor + endif + + " format lines + let self.headerLines = [self.modeText] + let lines = copy(self.headerLines) + let lines_count = 0 + if self.number + let fmt_startA = '%'.num_width.'s)' + let fmt_startB = '%'.num_width.'s' + else + let fmt_startA = '' | let fmt_startB = '' + endif + let cursorAtLine = 1 " sane default + for idx in range(0,len(items)-1) + let self.linesToItems[lines_count + 1] = idx + let i = items[idx] + let keys = has_key(self,'keys') + \ ? s:Intersection(self.keys, keys(i)) + \ : keys(i) + let fmt = '' + let args = [i] + let cols = [] + for k in keys + let fmt .= self.sep.'%-'.(self.aligned ? maxlens[k] : i[k]['cols']).'s' + call add(cols, i[k]) + endfor + for row in range(0, max([1] + map(copy(cols),'v:val["rows"]'))-1) + let fmt_args = row == 0 ? [fmt_startA.fmt] : [fmt_startB.fmt] + if self.number + call add(fmt_args, row == 0 ? idx : '') + endif + for c in cols + call add(fmt_args, c.rows <= row ? '' : c.lines[row]) + endfor + call add(lines, call('printf', fmt_args)) + let lines_count += 1 + endfor + if idx == cursorAt + let cursorAtLine = lines_count + endif + endfor + " update stauts line to show last applied filter + " disabled cause it causes trouble on :wincmd w + " setlocal statusline=%!b:filtered_view.statusline + + " syntax + syn clear + for s in self.syn_cmds | exec s | endfor + let id = 0 + " highlight filter regex in buffer as well + let syn_ids = [ 'Underlined', 'Todo', 'Error', 'Type', 'Statement' ] + for f in self.filter + if !f.keep || !has_key(f, 'regex') | continue | endif + if f.regex != '' + try + exec 'syn match '.syn_ids[id % len(syn_ids)].' '.string(f.regex) + catch /.*/ + " ignore errors such as \ without following characters. Thus just + " ignore and wait for the next character + endtry + endif + let id = id +1 + endfor + if len(lines) > winheight('%') + call extend(lines, self.headerLines) + endif + normal ggdG + call append(0, lines) + " place cursor + exec (cursorAtLine+1) + " move cursor into the middle of the window + normal zz + endf + + " filter = keys : + " filter = string to be executed containing Val + " keep = 1 keep on match + " = 0 drop on match + " key (optional) + " cursorAt: at which item to put the cursor + " if that item is deleted it will be placed at the item above + " optional: key of dict if dict + fun d.FilterItem(items, filter, cursorAt) + let filter = 'Val =~ '.string(a:filter.regex) + let keep = a:filter.keep + let cursorAt = a:cursorAt + + for idx in reverse(range(0, len(a:items)-1)) + let i = a:items[idx] + if has_key(a:filter,'key') + let key = a:filter.key + if has_key(i, key) + " key given, only filter by this column + let Val = i[key]['text'] + exec 'let any = '.filter + else + let any = 0 + endif + else + let any = 0 + " no key given, try all + for x in values(i) + let Val = x['text'] + exec 'let any = '.filter + if any | break | endif + endfor + endif + if any != keep + call remove(a:items, idx) + if idx <= cursorAt + let cursorAt = cursorAt -1 + endif + endif + endfor + return [a:items, cursorAt] + endfun + + " if the user enters a number select by index else start filtering.. + fun d.SelectByIdOrFilter() + let idx='' + let items = self.FilteredItems()[0] + try + let self.modeText = '[0-9]* : select by index| : escape getchar() loop, any char: start filtering' + call self.UpdateDisplay() | redraw + while 1 + let c=getchar() + if index([13,10],c) >= 0 + return self.DoContinue(self.MapToOriginal(items[idx])) + elseif index([27], c) >=0 + " esc, abort + return + else + if type(c) == 0 + let c = nr2char(c) + endif + if c == "\" || index(map(range(0,10),'v:val.""'),c) >= 0 + if c == "\" + let idx = idx[:-2] + else + let idx .= c + endif + if idx < len(items) && idx.'0' > len(items) || idx == 0 && len(items) < 10 + " only match + return self.DoContinue(self.MapToOriginal(items[idx])) + endif + else + return self.FilterFromKeyboard(1,c) + endif + endif + endwhile + finally + let self.modeText = '' + endtry + endfun + + " gets a regular expresion filter by keybaord and updates the display while + " you're typing. The regex ist shown in the statusline + fun d.FilterFromKeyboard(keep, start, ...) + let self.modeText = 'press ESC to exit getchar() loop' + call self.UpdateDisplay() | redraw + + try + let key_text = a:0 > 0 ? 'key : '.a:1 : '' + let filter_bak = self.filter + let filter = copy(self.filter) + let start = a:start + let filter_new = '' + while 1 + if start != '' + " use c= last char to force updating display etc + let filter_new = start[:-2] + let c = start[-1:] + let start = '' + else + let c=getchar() + endif + if index([13,10],c) >= 0 + " c-j or return, accept new filter + let items = self.FilteredItems() + if len(items) == 1 && has_key(self, 'Continuation') && self.continueOnSingleMatchCR + call self.DoContinue(self.MapToOriginal(items[0])) + endif + return + elseif index([27], c) >=0 + " esc, abort + let self.filter = filter_bak + call self.UpdateDisplay() + return + else + if type(c) == 0 + let c = nr2char(c) + endif + if c == "\" + let filter_new = filter_new[:-2] + else + let filter_new .= c + endif + let d = {'keep' : a:keep, 'regex' : filter_new } + if a:0 > 0 + let d['key'] = a:1 + endif + let self.filter = copy(filter_bak) + call add(self.filter, d) + let items = self.FilteredItems() + if len(items) == 1 && has_key(self, 'Continuation') && self.continueOnSingleMatch + call self.DoContinue(self.MapToOriginal(items[0])) + return + endif + call self.UpdateDisplay() | redraw + endif + endwhile + finally + let self.modeText = '' + endtry + endfun + + if get(a:opts,'init',1) + call d.NewBufferAndInit() + endif +endfun diff --git a/sources_non_forked/vim-coffee-script/Readme.md b/sources_non_forked/vim-coffee-script/Readme.md index 1f8b75f9..664b9835 100644 --- a/sources_non_forked/vim-coffee-script/Readme.md +++ b/sources_non_forked/vim-coffee-script/Readme.md @@ -1,11 +1,10 @@ This project adds [CoffeeScript] support to the vim editor. It handles syntax, -indenting, compiling, and more. Also included is an [eco] syntax and support for -CoffeeScript in Haml and HTML. +indenting, compiling, and more. Also included is support for CoffeeScript in +Haml and HTML. ![Screenshot](http://i.imgur.com/eUBvm.png) [CoffeeScript]: http://jashkenas.github.com/coffee-script/ -[eco]: https://github.com/sstephenson/eco ### Install from a Zipball diff --git a/sources_non_forked/vim-coffee-script/compiler/coffee.vim b/sources_non_forked/vim-coffee-script/compiler/coffee.vim index 03c69e0c..8def0bfc 100644 --- a/sources_non_forked/vim-coffee-script/compiler/coffee.vim +++ b/sources_non_forked/vim-coffee-script/compiler/coffee.vim @@ -3,11 +3,20 @@ " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL +" All this is needed to support compiling filenames with spaces, quotes, and +" such. The filename is escaped and embedded into the `makeprg` setting. +" +" Because of this, `makeprg` must be updated on every file rename. And because +" of that, `CompilerSet` can't be used because it doesn't exist when the +" rename autocmd is ran. So, we have to do some checks to see whether `compiler` +" was called locally or globally, and respect that in the rest of the script. + if exists('current_compiler') finish +else + let current_compiler = 'coffee' endif -let current_compiler = 'coffee' " Pattern to check if coffee is the compiler let s:pat = '^' . current_compiler @@ -16,21 +25,12 @@ if !exists('coffee_compiler') let coffee_compiler = 'coffee' endif -if exists('coffee_make_compiler') - echohl WarningMsg - echom '`coffee_make_compiler` is deprecated: use `coffee_compiler` instead' - echohl None - - let coffee_compiler = coffee_make_compiler -endif - " Extra options passed to CoffeeMake if !exists('coffee_make_options') let coffee_make_options = '' endif -" Get a `makeprg` for the current filename. This is needed to support filenames -" with spaces and quotes, but also not break generic `make`. +" Get a `makeprg` for the current filename. function! s:GetMakePrg() return g:coffee_compiler . ' -c ' . g:coffee_make_options . ' $* ' \ . fnameescape(expand('%')) diff --git a/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim b/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim index 59e154b1..50569298 100644 --- a/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim +++ b/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim @@ -6,7 +6,7 @@ autocmd BufNewFile,BufRead *.coffee set filetype=coffee autocmd BufNewFile,BufRead *Cakefile set filetype=coffee autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee -autocmd BufNewFile,BufRead *.ck set filetype=coffee +autocmd BufNewFile,BufRead *._coffee set filetype=coffee function! s:DetectCoffee() if getline(1) =~ '^#!.*\' diff --git a/sources_non_forked/vim-coffee-script/syntax/coffee.vim b/sources_non_forked/vim-coffee-script/syntax/coffee.vim old mode 100755 new mode 100644 diff --git a/sources_non_forked/vim-indent-object/.gitignore b/sources_non_forked/vim-indent-object/.gitignore new file mode 100644 index 00000000..1b19a79f --- /dev/null +++ b/sources_non_forked/vim-indent-object/.gitignore @@ -0,0 +1,2 @@ +tags + diff --git a/sources_non_forked/vim-indent-object/doc/indent-object.txt b/sources_non_forked/vim-indent-object/doc/indent-object.txt new file mode 100644 index 00000000..5b581020 --- /dev/null +++ b/sources_non_forked/vim-indent-object/doc/indent-object.txt @@ -0,0 +1,120 @@ +*indent-object.txt* Text objects based on indent levels. + + Copyright (c) 2010 Michael Smith + +Indent Text Objects + +INTRODUCTION |idntobj-introduction| +TEXT OBJECTS |idntobj-objects| +BLANK LINES |idntobj-blanklines| +ABOUT |idntobj-about| + + +============================================================================== +INTRODUCTION *idntobj-introduction* + +Vim text objects provide a convenient way to select and operate on various +types of objects. These objects include regions surrounded by various types of +brackets and various parts of language (ie sentences, paragraphs, etc). + +This plugin defines a new text object, based on indentation levels. This is +very useful in languages such as Python, in which the syntax defines scope in +terms of indentation. Using the objects defined in this plugin, an entire if +structure can be quickly selected, for example. + + +============================================================================== +TEXT OBJECTS *ai* *ii* *aI* *iI* *idntobj-objects* + +This plugin defines two new text objects. These are very similar - they differ +only in whether they include the line below the block or not. + + Key Mapping Description ~ +> + ai (A)n (I)ndentation level and line above. + ii (I)nner (I)ndentation level (no line above). + aI (A)n (I)ndentation level and lines above/below. + iI (I)nner (I)ndentation level (no lines above/below). +< + +Note that the iI mapping is mostly included simply for completeness, it is +effectively a synonym for ii. + +Just like regular text objects, these mappings can be used either with +operators expecting a motion, such as 'd' or 'c', as well as in visual mode. +In visual mode the mapping can be repeated, which has the effect of +iteratively increasing the scope of indentation block selected. Specifying a +count can be used to achieve the same effect. + +The difference between |ai| and |aI| is that |ai| includes the line +immediately above the indentation block, whereas aI includes not only that, +but also the line below. Which of these is most useful largely depends on the +structure of the language being edited. + +For example, when editing the Python code, |ai| is generally more useful, as +the line above the indentation block is usually related to it. For example, in +the following code (* is used to indicate the cursor position): +> + if foo > 3: + log("foo is big") * + foo = 3 + do_something_else() +< +the if clause is logically related to the code block, whereas the function +call below is not. It is unlikely we would want to select the line below when +we are interested in the if block. + +However, in other languages, such as Vim scripts, control structures are +usually terminated with something like 'endif'. Therefore, in this example: +> + if foo > 3 + echo "foo is big" * + let foo = 3 + endif + call do_something_else() +< +we would more likely want to include the endif when we select the if +structure. + + +============================================================================== +BLANK LINES *idntobj-blanklines* + +When scanning code blocks, the plugin usually ignores blank lines. There is an +exception to this, however, when the block being selected is not indented. In +this case if blank lines are ignored, then the entire file would be selected. +Instead when code at the top level is being indented blank lines are +considered to delimit the block. + + +============================================================================== +ABOUT *idntobj-about* + +vim-indent-object was written by Michael Smith . The +project repository is kept at: + +http://github.com/michaeljsmith/vim-indent-object + +Any feedback or criticism is welcome, and can be mailed to the author at the +above email address. Alternatively issues can be raised on the project +website. + +Licence: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/sources_non_forked/vim-indent-object/plugin/indent-object.vim b/sources_non_forked/vim-indent-object/plugin/indent-object.vim new file mode 100644 index 00000000..afb8edd2 --- /dev/null +++ b/sources_non_forked/vim-indent-object/plugin/indent-object.vim @@ -0,0 +1,224 @@ +"-------------------------------------------------------------------------------- +" +" Copyright (c) 2010 Michael Smith +" +" http://github.com/michaeljsmith/vim-indent-object +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +"-------------------------------------------------------------------------------- + +" Mappings excluding line below. +onoremap ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) +onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) +vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv + +" Mappings including line below. +onoremap aI :cal HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")]) +onoremap iI :cal HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")]) +vnoremap aI :cal HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +vnoremap iI :cal HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv + +let s:l0 = -1 +let s:l1 = -1 +let s:c0 = -1 +let s:c1 = -1 + +function! TextObject(inner, incbelow, vis, range, count) + + " Record the current state of the visual region. + let vismode = "V" + + " Detect if this is a completely new visual selction session. + let new_vis = 0 + let new_vis = new_vis || s:l0 != a:range[0] + let new_vis = new_vis || s:l1 != a:range[1] + let new_vis = new_vis || s:c0 != a:range[2] + let new_vis = new_vis || s:c1 != a:range[3] + + let s:l0 = a:range[0] + let s:l1 = a:range[1] + let s:c0 = a:range[2] + let s:c1 = a:range[3] + + " Repeatedly increase the scope of the selection. + let itr_cnt = 0 + let cnt = a:count + while cnt > 0 + + " Look for the minimum indentation in the current visual region. + let l = s:l0 + let idnt_invalid = 1000 + let idnt = idnt_invalid + while l <= s:l1 + if !(getline(l) =~ "^\\s*$") + let idnt = min([idnt, indent(l)]) + endif + let l += 1 + endwhile + + " Keep track of where the range should be expanded to. + let l_1 = s:l0 + let l_1o = l_1 + let l2 = s:l1 + let l2o = l2 + + " If we are highlighting only blank lines, we may not have found a + " valid indent. In this case we need to look for the next and previous + " non blank lines and check which of those has the largest indent. + if idnt == idnt_invalid + let idnt = 0 + let pnb = prevnonblank(s:l0) + if pnb + let idnt = max([idnt, indent(pnb)]) + let l_1 = pnb + endif + let nnb = nextnonblank(s:l0) + if nnb + let idnt = max([idnt, indent(nnb)]) + endif + + " If we are in whitespace at the beginning of a block, skip over + " it when we are selecting the range. Similarly, if we are in + " whitespace at the end, ignore it. + if idnt > indent(pnb) + let l_1 = nnb + endif + if idnt > indent(nnb) + let l2 = pnb + endif + endif + + " Search backward for the first line with less indent than the target + " indent (skipping blank lines). + let blnk = getline(l_1) =~ "^\\s*$" + while l_1 > 0 && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l_1) >= idnt))) + if !blnk || !a:inner + let l_1o = l_1 + endif + let l_1 -= 1 + let blnk = getline(l_1) =~ "^\\s*$" + endwhile + + " Search forward for the first line with more indent than the target + " indent (skipping blank lines). + let line_cnt = line("$") + let blnk = getline(l2) =~ "^\\s*$" + while l2 <= line_cnt && ((idnt == 0 && !blnk) || (idnt != 0 && (blnk || indent(l2) >= idnt))) + if !blnk || !a:inner + let l2o = l2 + endif + let l2 += 1 + let blnk = getline(l2) =~ "^\\s*$" + endwhile + + " Determine which of these extensions to include. Include neither if + " we are selecting an 'inner' object. Exclude the bottom unless are + " told to include it. + let idnt2 = max([indent(l_1), indent(l2)]) + if indent(l_1) < idnt2 || a:inner + let l_1 = l_1o + endif + if indent(l2) < idnt2 || a:inner || !a:incbelow + let l2 = l2o + endif + let l_1 = max([l_1, 1]) + let l2 = min([l2, line("$")]) + + " Extend the columns to the start and end. + " If inner is selected, set the final cursor pos to the start + " of the text in the line. + let c_1 = 1 + if a:inner + let c_1 = match(getline(l_1), "\\c\\S") + 1 + endif + let c2 = len(getline(l2)) + if !a:inner + let c2 += 1 + endif + + " Make sure there's no change if we haven't really made a + " significant change in linewise mode - this makes sure that + " we can iteratively increase selection in linewise mode. + if itr_cnt == 0 && vismode ==# 'V' && s:l0 == l_1 && s:l1 == l2 + let c_1 = s:c0 + let c2 = s:c1 + endif + + " Check whether the visual region has changed. + let chg = 0 + let chg = chg || s:l0 != l_1 + let chg = chg || s:l1 != l2 + let chg = chg || s:c0 != c_1 + let chg = chg || s:c1 != c2 + + if vismode ==# 'V' && new_vis + let chg = 1 + endif + + " Update the vars. + let s:l0 = l_1 + let s:l1 = l2 + let s:c0 = c_1 + let s:c1 = c2 + + " If there was no change, then don't decrement the count (it didn't + " count because it didn't do anything). + if chg + let cnt = cnt - 1 + else + " Since this didn't work, push the selection back one char. This + " will have the effect of getting the enclosing block. Do it at + " the beginning rather than the end - the beginning is very likely + " to be only one indentation level different. + if s:l0 == 0 + return + endif + let s:l0 -= 1 + let s:c0 = len(getline(s:l0)) + endif + + let itr_cnt += 1 + + endwhile + + " Apply the range we have found. Make sure to use the current visual mode. + call cursor(s:l0, s:c0) + exe "normal! " . vismode + call cursor(s:l1, s:c1) + normal! o + + " Update these static variables - we need to keep these up-to-date between + " invocations because it's the only way we can detect whether it's a new + " visual mode. We need to know if it's a new visual mode because otherwise + " if there's a single line block in visual line mode and we select it with + " "V", we can't tell whether it's already been selected using Vii. + exe "normal! \" + let s:l0 = line("'<") + let s:l1 = line("'>") + let s:c0 = col("'<") + let s:c1 = col("'>") + normal gv + +endfunction + +function! HandleTextObjectMapping(inner, incbelow, vis, range) + call TextObject(a:inner, a:incbelow, a:vis, a:range, v:count1) +endfunction diff --git a/sources_non_forked/vim-less/ftplugin/less.vim b/sources_non_forked/vim-less/ftplugin/less.vim index d7d22156..b6eaf6a3 100644 --- a/sources_non_forked/vim-less/ftplugin/less.vim +++ b/sources_non_forked/vim-less/ftplugin/less.vim @@ -12,11 +12,13 @@ let b:did_ftplugin = 1 let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<" +setlocal iskeyword+=- setlocal commentstring=//\ %s setlocal define=^\\s*\\%(@mixin\\\|=\\) setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','') setlocal omnifunc=csscomplete#CompleteCSS setlocal suffixesadd=.less +setlocal comments=s1:/*,mb:*,ex:*/ let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\=' diff --git a/sources_non_forked/vim-less/syntax/less.vim b/sources_non_forked/vim-less/syntax/less.vim index 3c9e9529..fa5a247e 100644 --- a/sources_non_forked/vim-less/syntax/less.vim +++ b/sources_non_forked/vim-less/syntax/less.vim @@ -9,9 +9,9 @@ runtime! after/syntax/css/*.vim syn case ignore -syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,@cssColors fold +syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold -syn match lessVariable "@[[:alnum:]_-]\+" contained +syn match lessVariable "@[[:alnum:]_-]\+" contained syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted @@ -21,13 +21,33 @@ syn match lessOperator "-" contained syn match lessOperator "/" contained syn match lessOperator "*" contained +syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty +syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained + syn match lessDefault "!default" contained syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass syn match lessClass "[[:alnum:]_-]\+" contained -syn keyword lessFunction lighten darken saturate desaturate fadein fadeout spin hue saturation lightness containedin=cssDefinition contained +" functions {{{ + +" string functions +syn keyword lessFunction escape e % containedin=cssDefinition contained +" misc functions +syn keyword lessFunction color unit containedin=cssDefinition contained +" math functions +syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained +" color definition +syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained +" color channel information +syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained +" color operations +syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained +" color blending +syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained + +" }}} syn match lessComment "//.*$" contains=@Spell @@ -38,7 +58,7 @@ hi def link lessComment Comment hi def link lessFunction Function hi def link lessMixinChar Special hi def link lessAmpersandChar Special +hi def link lessNestedProperty Type hi def link lessClass PreProc let b:current_syntax = "less" - diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index bc1563bc..aad30095 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -7,39 +7,55 @@ if exists("b:current_syntax") finish endif +if !exists('main_syntax') + let main_syntax = 'markdown' +endif + runtime! syntax/html.vim unlet! b:current_syntax +if !exists('g:markdown_fenced_languages') + let g:markdown_fenced_languages = [] +endif +for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")') + if s:type =~ '\.' + let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*') + endif + exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim' + unlet! b:current_syntax +endfor +unlet! s:type + syn sync minlines=10 syn case ignore -syn match markdownValid '[<>]\S\@!' +syn match markdownValid '[<>]\c[a-z/$!]\@!' syn match markdownValid '&\%(#\=\w*;\)\@!' -syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock +syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock,htmlSpecialChar syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError -syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule -syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule +syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink +syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink syn match markdownHeadingRule "^[=-]\+$" contained -syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained -syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained -syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained -syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained -syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained -syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained +syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained +syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained +syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained +syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained +syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained -syn match markdownBlockquote ">\s" contained nextgroup=@markdownBlock +syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock syn region markdownCodeBlock start=" \|\t" end="$" contained " TODO: real nesting syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained -syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s*\S\)\@=" contained +syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained syn match markdownRule "\* *\* *\*[ *]*$" contained syn match markdownRule "- *- *-[ -]*$" contained @@ -66,7 +82,14 @@ syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\ syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart -syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*\zs```\s*.*$" end="^```\ze\s*$" keepend +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend + +if main_syntax ==# 'markdown' + for s:type in g:markdown_fenced_languages + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + endfor + unlet! s:type +endif syn match markdownEscape "\\[][\\`*_{}()#+.!-]" syn match markdownError "\w\@<=_\w\@=" diff --git a/sources_non_forked/vim-powerline/.gitignore b/sources_non_forked/vim-powerline/.gitignore deleted file mode 100644 index 4d6ed1d8..00000000 --- a/sources_non_forked/vim-powerline/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -doc/tags -*.cache diff --git a/sources_non_forked/vim-powerline/README.md b/sources_non_forked/vim-powerline/README.md new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-powerline/README.rst b/sources_non_forked/vim-powerline/README.rst deleted file mode 100644 index 72cd84f2..00000000 --- a/sources_non_forked/vim-powerline/README.rst +++ /dev/null @@ -1,107 +0,0 @@ -================= -Powerline for vim -================= - -:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) -:Source: https://github.com/Lokaltog/vim-powerline -:Version: β - -Introduction ------------- - -Powerline is a utility plugin which allows you to create better-looking, -more functional vim statuslines. See the screenshots below for -a demonstration of the plugin's capabilities. - -It's recommended that you install the plugin using Pathogen_ or Vundle_. -After the plugin is installed update your help tags and see ``:help -Powerline`` for instructions on how to enable and configure the plugin. - -See the `Troubleshooting`_ section below if you're having any issues with -the plugin or the font patcher. - -**Note:** You need a patched font to be able to use the symbols in the -statusline. An experimental Python/fontforge-based font patcher is included -in the ``fontpatcher`` directory. See ``fontpatcher/README.rst`` for usage -instructions. - -.. _Pathogen: https://github.com/tpope/vim-pathogen -.. _Vundle: https://github.com/gmarik/vundle - -Screenshots ------------ - -.. image:: http://i.imgur.com/MsuIB.png - -Troubleshooting ---------------- - -I can't see the fancy symbols, what's wrong? - Make sure that you have ``let g:Powerline_symbols = 'fancy'`` in your - ``vimrc`` file. The settings may be loaded too late if you have this in - ``gvimrc``, so always put this in your ``vimrc``. - - Clear the cache using ``:PowerlineClearCache`` and restart vim. - - Make sure that you've configured gvim or your terminal emulator to use - a patched font. - - Make sure that vim is compiled with the ``--with-features=big`` flag. - -The fancy symbols look a bit blurry or "off"! - Make sure that you have patched all variants of your font (i.e. both the - regular and the bold font files). - -I'm unable to patch my font, what should I do? - Font patching is only known to work on most Linux and OS X machines. If - you have followed the instructions in the fontpatcher README and still - have problems, please submit an issue on GitHub. - - You can download some community-contributed patched fonts from the - `Powerline wiki`_ if you don't want to mess around with the font - patcher. - -The Syntastic/Fugitive statusline flags don't work! - These flags should work without any configuration. If you installed - either plugin after Powerline, you'll have to clear the cache using - ``:PowerlineClearCache`` and restart vim. - -The colors are weird in the default OS X Terminal app! - The default OS X Terminal app is known to have some issues with the - Powerline colors. Please use another terminal emulator. iTerm2 should - work fine. - - The arrows may have the wrong colors if you have changed the "minimum - contrast" slider in the color tab of your OS X settings. - -The statusline has strange characters like ``^B`` in it! - Please add ``set encoding=utf-8`` to your ``vimrc``. - - You may also need to set your ``LANG`` and ``LC_*`` environment - variables to a UTF-8 locale (e.g. ``LANG=en_US.utf8``). Consult your - Linux distro's documentation for information about setting these - variables correctly. - -The statusline has a lot of ``^`` or underline characters in it! - You need to configure the ``fillchars`` setting to disable statusline - fillchars (see ``:h fillchars`` for details). Add this to your - ``vimrc`` to solve this issue:: - - set fillchars+=stl:\ ,stlnc:\ - -The statusline is hidden/only appears in split windows! - Make sure that you have ``set laststatus=2`` in your ``vimrc``. - -I'm using tmux and Powerline looks like crap, what's wrong? - You need to tell tmux that it has 256-color capabilities. Add this to - your ``.tmux.conf`` to solve this issue:: - - set -g default-terminal "screen-256color" - - If you use iTerm2, make sure that you have enabled the setting 'Set - locale variables automatically' in Profiles > Terminal > Environment. - -If you have any other issues and you can't find the answer in the docs, -please submit an issue on GitHub. - -.. _`Powerline wiki`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts diff --git a/sources_non_forked/vim-powerline/autoload/Pl.vim b/sources_non_forked/vim-powerline/autoload/Pl.vim deleted file mode 100644 index c933030d..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl.vim +++ /dev/null @@ -1,183 +0,0 @@ -" Powerline - The ultimate statusline utility -" -" Author: Kim Silkebækken -" Source repository: https://github.com/Lokaltog/vim-powerline - -" Script variables {{{ - let g:Pl#OLD_STL = '' - let g:Pl#THEME = [] - let g:Pl#THEME_CALLBACKS = [] - let g:Pl#HL = [] - - " Cache revision, this must be incremented whenever the cache format is changed - let s:CACHE_REVISION = 7 -" }}} -" Script initialization {{{ - function! Pl#LoadCache() " {{{ - if filereadable(g:Powerline_cache_file) && g:Powerline_cache_enabled - exec 'source' escape(g:Powerline_cache_file, ' \') - - if ! exists('g:Powerline_cache_revision') || g:Powerline_cache_revision != s:CACHE_REVISION - " Cache revision differs, cache is invalid - unlet! g:Powerline_cache_revision - - return 0 - endif - - " Create highlighting groups - for hi_cmd in g:Pl#HL - exec hi_cmd - endfor - - " Run theme callbacks - for callback in g:Pl#THEME_CALLBACKS - " Substitute {{NEWLINE}} with newlines (strings must be - " stored without newlines characters to avoid vim errors) - exec substitute(callback[0], "{{NEWLINE}}", "\n", 'g') - exec substitute(callback[1], "{{NEWLINE}}", "\n", 'g') - endfor - - return 1 - endif - - return 0 - endfunction " }}} - function! Pl#ClearCache() " {{{ - if filereadable(g:Powerline_cache_file) - " Delete the cache file - call delete(g:Powerline_cache_file) - endif - - echo 'Powerline cache cleared. Please restart vim for the changes to take effect.' - endfunction " }}} - function! Pl#ReloadColorscheme() " {{{ - call Pl#ClearCache() - - " The colorscheme and theme files must be manually sourced because - " vim won't reload previously autoloaded files - " - " This is a bit hackish, but it works - unlet! g:Powerline#Colorschemes#{g:Powerline_colorscheme}#colorscheme - exec "source" split(globpath(&rtp, 'autoload/Powerline/Colorschemes/'. g:Powerline_colorscheme .'.vim', 1), '\n')[0] - - unlet! g:Powerline#Themes#{g:Powerline_theme}#theme - exec "source" split(globpath(&rtp, 'autoload/Powerline/Themes/'. g:Powerline_theme .'.vim', 1), '\n')[0] - - let g:Pl#THEME = [] - - call Pl#Load() - endfunction " }}} - function! Pl#Load() " {{{ - if empty(g:Pl#OLD_STL) - " Store old statusline - let g:Pl#OLD_STL = &statusline - endif - - if ! Pl#LoadCache() - try - " Autoload the theme dict first - let raw_theme = g:Powerline#Themes#{g:Powerline_theme}#theme - catch - echom 'Invalid Powerline theme! Please check your theme and colorscheme settings.' - - return - endtry - - " Create list with parsed statuslines - for buffer_statusline in raw_theme - unlet! mode_statuslines - let mode_statuslines = Pl#Parser#GetStatusline(buffer_statusline.segments) - - if ! empty(buffer_statusline.callback) - " The callback function passes its arguments on to - " Pl#StatuslineCallback along with the normal/current mode - " statusline. - let s:cb_func = "function! PowerlineStatuslineCallback_". buffer_statusline.callback[1] ."(...)\n" - let s:cb_func .= "return Pl#StatuslineCallback(". string(mode_statuslines['n']) .", a:000)\n" - let s:cb_func .= "endfunction" - - " The callback expression should be used to initialize any - " variables that will use the callback function. The - " expression requires a %s which will be replaced by the - " callback function name. - let s:cb_expr = printf(buffer_statusline.callback[2], 'PowerlineStatuslineCallback_'. buffer_statusline.callback[1]) - - exec s:cb_func - exec s:cb_expr - - " Newlines must be substituted with another character - " because vim doesn't like newlines in strings - call add(g:Pl#THEME_CALLBACKS, [substitute(s:cb_func, "\n", "{{NEWLINE}}", 'g'), substitute(s:cb_expr, "\n", "{{NEWLINE}}", 'g')]) - - unlet! s:cb_func s:cb_expr - - continue - endif - - " Store the statuslines for matching specific buffers - call add(g:Pl#THEME, { - \ 'matches': buffer_statusline.matches, - \ 'mode_statuslines': mode_statuslines - \ }) - endfor - - if ! g:Powerline_cache_enabled - " Don't cache anything if caching is disabled or cache file isn't writeable - return - endif - - " Prepare commands and statuslines for caching - let cache = [ - \ 'let g:Powerline_cache_revision = '. string(s:CACHE_REVISION), - \ 'let g:Pl#HL = '. string(g:Pl#HL), - \ 'let g:Pl#THEME = '. string(g:Pl#THEME), - \ 'let g:Pl#THEME_CALLBACKS = '. string(g:Pl#THEME_CALLBACKS), - \ ] - - call writefile(cache, g:Powerline_cache_file) - endif - endfunction " }}} -" }}} -" Statusline updater {{{ - function! Pl#Statusline(statusline, current) " {{{ - let mode = mode() - - if ! a:current - let mode = 'N' " Normal (non-current) - elseif mode =~# '\v(v|V|)' - let mode = 'v' " Visual mode - elseif mode =~# '\v(s|S|)' - let mode = 's' " Select mode - elseif mode =~# '\vi' - let mode = 'i' " Insert mode - elseif mode =~# '\v(R|Rv)' - let mode = 'r' " Replace mode - else - " Fallback to normal mode - let mode = 'n' " Normal (current) - endif - - return g:Pl#THEME[a:statusline].mode_statuslines[mode] - endfunction " }}} - function! Pl#StatuslineCallback(statusline, args) " {{{ - " Replace %1, %2, etc. in the statusline with the callback args - return substitute( - \ a:statusline, - \ '\v\%(\d+)', - \ '\=a:args[submatch(1)]', - \ 'g') - endfunction " }}} - function! Pl#UpdateStatusline(current) " {{{ - if empty(g:Pl#THEME) - " Load statuslines if they aren't loaded yet - call Pl#Load() - endif - - for i in range(0, len(g:Pl#THEME) - 1) - if Pl#Match#Validate(g:Pl#THEME[i]) - " Update window-local statusline - let &l:statusline = '%!Pl#Statusline('. i .','. a:current .')' - endif - endfor - endfunction " }}} -" }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Colorscheme.vim b/sources_non_forked/vim-powerline/autoload/Pl/Colorscheme.vim deleted file mode 100644 index ec15e461..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Colorscheme.vim +++ /dev/null @@ -1,145 +0,0 @@ -function! Pl#Colorscheme#Init(hi) " {{{ - let colorscheme = {} - - for hi in a:hi - " Ensure that the segments are a list - let segments = type(hi[0]) == type('') ? [ hi[0] ] : hi[0] - let mode_hi_dict = hi[1] - - for segment in segments - let colorscheme[segment] = mode_hi_dict - endfor - endfor - - return colorscheme -endfunction " }}} -function! Pl#Colorscheme#Apply(colorscheme, buffer_segments) " {{{ - " Set color parameters for all segments in a:buffer_segments - - " TODO This function should be recursive and work on both segments and groups - " TODO We could probably handle the NS stuff here... - - try - let colorscheme = g:Powerline#Colorschemes#{a:colorscheme}#colorscheme - catch - echom 'Color scheme "'. a:colorscheme .'" doesn''t exist!' - - return - endtry - - let buffer_segments = a:buffer_segments - - " This is a bit complex, I'll walk you through exactly what happens here... - " - " First of all we loop through the buffer_segments, which are the segments that - " this specific buffer will have. - for buffer_segment in buffer_segments - " The buffer_segment consists of a 'matches' list and a 'segments' list. - " The 'matches' list has conditions to limit this statusline to specific buffers/windows. - " The 'segments' list has each segment and segment group for this buffer - for segment in buffer_segment.segments - let type = get(segment, 'type', '') - - if type == 'segment_group' - " We're going to handle segment groups different from single segments. Segment groups - " have child segments which may have their own highlighting (e.g. fileinfo.flags), - " and these child segments may be grouped (e.g. fileinfo.flags.ro) to provide very - " specific highlighting. So here we'll handle all that: - - " Set the default/fallback colors for this group - for i in range(len(segment.variants), 0, -1) - " Check for available highlighting for the main group segment - " - " This works like the segment highlighting below - " TODO Create a function for this - let seg_variants = join(segment.variants[0:i], '.') - - let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name - let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name - - if has_key(colorscheme, seg_ns_name) - " We have a namespaced highlight group - let segment.colors = colorscheme[seg_ns_name] - break - elseif has_key(colorscheme, seg_name) - " We have a non-namespaced group - let segment.colors = colorscheme[seg_name] - break - endif - endfor - - " The reason why we need to deepcopy the group's segments is that the child segments - " all point to the same base segments and that screws up highlighting if we highlight - " some child segments with different namespaced colors - let segment.segments = deepcopy(segment.segments) - - " Apply colors to each child segment - for child_segment in segment.segments - " Check if this child segment is grouped (e.g. fileinfo.flags.group.subgroup) - " We're going to prioritize the most specific grouping and then work back to the - " most common group (e.g. fileinfo.flags) - - " FIXME We don't have the variants from before because group children aren't run through Pl#Segment#Get - let child_segment.variants = [seg_name] + split(child_segment.name, '\.') - - " Use the parent group's namespace - let child_segment.ns = segment.ns - - for i in range(len(child_segment.variants), 0, -1) - " Check for available highlighting for the main group segment - let child_seg_name = join(child_segment.variants[0:i], '.') - - let child_seg_ns_name = len(child_segment.ns) > 0 ? child_segment.ns .':'. child_seg_name : child_seg_name - - if has_key(colorscheme, child_seg_ns_name) - " We have a namespaced highlight group - let child_segment.colors = colorscheme[child_seg_ns_name] - break - elseif has_key(colorscheme, child_seg_name) - " We have a non-namespaced group - let child_segment.colors = colorscheme[child_seg_name] - break - endif - endfor - endfor - elseif type == 'segment' - for i in range(len(segment.variants), 0, -1) - " Check for available highlighting - " - " This is done in the following manner, using the segment gundo:static_filename.text.buffer as an example: - " - " * Look for the hl group: gundo:static_filename.text.buffer - " * Look for the hl group: static_filename.text.buffer - " * Look for the hl group: gundo:static_filename.text - " * Look for the hl group: static_filename.text - " * Look for the hl group: gundo:static_filename - " * Look for the hl group: static_filename - " * Return the segment without highlighting, causing an error in the parser - let seg_variants = join(segment.variants[0:i], '.') - - let seg_name = i > 0 ? segment.name .'.'. seg_variants : segment.name - let seg_ns_name = len(segment.ns) > 0 ? segment.ns .':'. seg_name : seg_name - - if has_key(colorscheme, seg_ns_name) - " We have a namespaced highlight group - let segment.colors = colorscheme[seg_ns_name] - break - elseif has_key(colorscheme, seg_name) - " We have a non-namespaced group - let segment.colors = colorscheme[seg_name] - break - endif - endfor - endif - - unlet! segment - endfor - endfor - - " Good luck parsing this return value - " - " It's a huge dict with all segments for all buffers with their respective syntax highlighting. - " It will be parsed by the main Powerline code, where all the data will be shortened to a simple - " array consiting of a statusline for each mode, with generated highlighting groups and dividers. - return buffer_segments -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Hi.vim b/sources_non_forked/vim-powerline/autoload/Pl/Hi.vim deleted file mode 100644 index f6b3eea2..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Hi.vim +++ /dev/null @@ -1,140 +0,0 @@ -" cterm -> gui color dict {{{ -let s:cterm2gui_dict = { - \ 16: 0x000000, 17: 0x00005f, 18: 0x000087, 19: 0x0000af, 20: 0x0000d7, 21: 0x0000ff, - \ 22: 0x005f00, 23: 0x005f5f, 24: 0x005f87, 25: 0x005faf, 26: 0x005fd7, 27: 0x005fff, - \ 28: 0x008700, 29: 0x00875f, 30: 0x008787, 31: 0x0087af, 32: 0x0087d7, 33: 0x0087ff, - \ 34: 0x00af00, 35: 0x00af5f, 36: 0x00af87, 37: 0x00afaf, 38: 0x00afd7, 39: 0x00afff, - \ 40: 0x00d700, 41: 0x00d75f, 42: 0x00d787, 43: 0x00d7af, 44: 0x00d7d7, 45: 0x00d7ff, - \ 46: 0x00ff00, 47: 0x00ff5f, 48: 0x00ff87, 49: 0x00ffaf, 50: 0x00ffd7, 51: 0x00ffff, - \ 52: 0x5f0000, 53: 0x5f005f, 54: 0x5f0087, 55: 0x5f00af, 56: 0x5f00d7, 57: 0x5f00ff, - \ 58: 0x5f5f00, 59: 0x5f5f5f, 60: 0x5f5f87, 61: 0x5f5faf, 62: 0x5f5fd7, 63: 0x5f5fff, - \ 64: 0x5f8700, 65: 0x5f875f, 66: 0x5f8787, 67: 0x5f87af, 68: 0x5f87d7, 69: 0x5f87ff, - \ 70: 0x5faf00, 71: 0x5faf5f, 72: 0x5faf87, 73: 0x5fafaf, 74: 0x5fafd7, 75: 0x5fafff, - \ 76: 0x5fd700, 77: 0x5fd75f, 78: 0x5fd787, 79: 0x5fd7af, 80: 0x5fd7d7, 81: 0x5fd7ff, - \ 82: 0x5fff00, 83: 0x5fff5f, 84: 0x5fff87, 85: 0x5fffaf, 86: 0x5fffd7, 87: 0x5fffff, - \ 88: 0x870000, 89: 0x87005f, 90: 0x870087, 91: 0x8700af, 92: 0x8700d7, 93: 0x8700ff, - \ 94: 0x875f00, 95: 0x875f5f, 96: 0x875f87, 97: 0x875faf, 98: 0x875fd7, 99: 0x875fff, - \ 100: 0x878700, 101: 0x87875f, 102: 0x878787, 103: 0x8787af, 104: 0x8787d7, 105: 0x8787ff, - \ 106: 0x87af00, 107: 0x87af5f, 108: 0x87af87, 109: 0x87afaf, 110: 0x87afd7, 111: 0x87afff, - \ 112: 0x87d700, 113: 0x87d75f, 114: 0x87d787, 115: 0x87d7af, 116: 0x87d7d7, 117: 0x87d7ff, - \ 118: 0x87ff00, 119: 0x87ff5f, 120: 0x87ff87, 121: 0x87ffaf, 122: 0x87ffd7, 123: 0x87ffff, - \ 124: 0xaf0000, 125: 0xaf005f, 126: 0xaf0087, 127: 0xaf00af, 128: 0xaf00d7, 129: 0xaf00ff, - \ 130: 0xaf5f00, 131: 0xaf5f5f, 132: 0xaf5f87, 133: 0xaf5faf, 134: 0xaf5fd7, 135: 0xaf5fff, - \ 136: 0xaf8700, 137: 0xaf875f, 138: 0xaf8787, 139: 0xaf87af, 140: 0xaf87d7, 141: 0xaf87ff, - \ 142: 0xafaf00, 143: 0xafaf5f, 144: 0xafaf87, 145: 0xafafaf, 146: 0xafafd7, 147: 0xafafff, - \ 148: 0xafd700, 149: 0xafd75f, 150: 0xafd787, 151: 0xafd7af, 152: 0xafd7d7, 153: 0xafd7ff, - \ 154: 0xafff00, 155: 0xafff5f, 156: 0xafff87, 157: 0xafffaf, 158: 0xafffd7, 159: 0xafffff, - \ 160: 0xd70000, 161: 0xd7005f, 162: 0xd70087, 163: 0xd700af, 164: 0xd700d7, 165: 0xd700ff, - \ 166: 0xd75f00, 167: 0xd75f5f, 168: 0xd75f87, 169: 0xd75faf, 170: 0xd75fd7, 171: 0xd75fff, - \ 172: 0xd78700, 173: 0xd7875f, 174: 0xd78787, 175: 0xd787af, 176: 0xd787d7, 177: 0xd787ff, - \ 178: 0xd7af00, 179: 0xd7af5f, 180: 0xd7af87, 181: 0xd7afaf, 182: 0xd7afd7, 183: 0xd7afff, - \ 184: 0xd7d700, 185: 0xd7d75f, 186: 0xd7d787, 187: 0xd7d7af, 188: 0xd7d7d7, 189: 0xd7d7ff, - \ 190: 0xd7ff00, 191: 0xd7ff5f, 192: 0xd7ff87, 193: 0xd7ffaf, 194: 0xd7ffd7, 195: 0xd7ffff, - \ 196: 0xff0000, 197: 0xff005f, 198: 0xff0087, 199: 0xff00af, 200: 0xff00d7, 201: 0xff00ff, - \ 202: 0xff5f00, 203: 0xff5f5f, 204: 0xff5f87, 205: 0xff5faf, 206: 0xff5fd7, 207: 0xff5fff, - \ 208: 0xff8700, 209: 0xff875f, 210: 0xff8787, 211: 0xff87af, 212: 0xff87d7, 213: 0xff87ff, - \ 214: 0xffaf00, 215: 0xffaf5f, 216: 0xffaf87, 217: 0xffafaf, 218: 0xffafd7, 219: 0xffafff, - \ 220: 0xffd700, 221: 0xffd75f, 222: 0xffd787, 223: 0xffd7af, 224: 0xffd7d7, 225: 0xffd7ff, - \ 226: 0xffff00, 227: 0xffff5f, 228: 0xffff87, 229: 0xffffaf, 230: 0xffffd7, 231: 0xffffff, - \ 232: 0x080808, 233: 0x121212, 234: 0x1c1c1c, 235: 0x262626, 236: 0x303030, 237: 0x3a3a3a, - \ 238: 0x444444, 239: 0x4e4e4e, 240: 0x585858, 241: 0x626262, 242: 0x6c6c6c, 243: 0x767676, - \ 244: 0x808080, 245: 0x8a8a8a, 246: 0x949494, 247: 0x9e9e9e, 248: 0xa8a8a8, 249: 0xb2b2b2, - \ 250: 0xbcbcbc, 251: 0xc6c6c6, 252: 0xd0d0d0, 253: 0xdadada, 254: 0xe4e4e4, 255: 0xeeeeee -\ } -" }}} -" Allocated color dict {{{ -let s:allocated_colors = { - \ 'NONE': 'NONE', - \ } -" }}} -function! s:Cterm2GUI(cterm) " {{{ - if toupper(a:cterm) == 'NONE' - return 'NONE' - endif - - if ! has_key(s:cterm2gui_dict, a:cterm) - return 0xff0000 - endif - - return s:cterm2gui_dict[a:cterm] -endfunction " }}} -function! Pl#Hi#Segments(segments, mode_colors) " {{{ - let mode_translate = { - \ 'normal': 'n', - \ 'noncurrent': 'N', - \ 'insert': 'i', - \ 'visual': 'v', - \ 'replace': 'r', - \ 'select': 's', - \ } - - let attributes = ['bold', 'italic', 'underline'] - - let segments = a:segments - let mode_hi_dict = {} - - " Mode dict - for [mode, colors] in items(a:mode_colors) - if has_key(mode_translate, mode) - let mode = mode_translate[mode] - endif - - unlet! fg - let fg = s:allocated_colors[colors[0]] - - let hi = { - \ 'cterm': [fg['cterm'], ''], - \ 'gui' : [fg['gui'], ''], - \ 'attr' : [] - \ } - - if exists('colors[1]') - if type(colors[1]) == type([]) - " We don't have a BG color, but we have attributes - let hi.attr = colors[1] - else - " The second parameter is the background color - unlet! bg - let bg = s:allocated_colors[colors[1]] - - let hi.cterm[1] = bg['cterm'] - let hi.gui[1] = bg['gui'] - endif - endif - - if exists('colors[2]') && type(colors[2]) == type([]) - " The third parameter is always an attribute list - let hi.attr = colors[2] - endif - - let mode_hi_dict[mode] = { - \ 'ctermfg': (empty(hi['cterm'][0]) ? '' : (string(hi['cterm'][0]) == 'NONE' ? 'NONE' : hi['cterm'][0])), - \ 'ctermbg': (empty(hi['cterm'][1]) ? '' : (string(hi['cterm'][1]) == 'NONE' ? 'NONE' : hi['cterm'][1])), - \ 'guifg' : (empty(hi['gui'][0]) ? '' : (string(hi['gui'][0]) == 'NONE' ? 'NONE' : hi['gui'][0])), - \ 'guibg' : (empty(hi['gui'][1]) ? '' : (string(hi['gui'][1]) == 'NONE' ? 'NONE' : hi['gui'][1])), - \ 'attr' : (! len(hi['attr']) ? 'NONE' : join(hi['attr'], ',')) - \ } - endfor - - return [segments, mode_hi_dict] -endfunction " }}} -function! Pl#Hi#Allocate(colors) " {{{ - for [key, color] in items(a:colors) - if type(color) == type(0) - " Only terminal color - let cterm = color - let gui = s:Cterm2GUI(color) - elseif type(color) == type([]) && len(color) == 2 - " Terminal and GUI colors - let cterm = color[0] - let gui = color[1] - endif - - let s:allocated_colors[key] = { - \ 'cterm': cterm, - \ 'gui': gui, - \ } - - unlet! color - endfor -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Match.vim b/sources_non_forked/vim-powerline/autoload/Pl/Match.vim deleted file mode 100644 index b05f5851..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Match.vim +++ /dev/null @@ -1,43 +0,0 @@ -function! Pl#Match#Add(pat, expr) " {{{ - return [a:pat, a:expr] -endfunction " }}} -function! Pl#Match#Any(...) " {{{ - let matches = [] - - for match_name in a:000 - if empty(match_name) - " Skip empty match parameters - continue - endif - - if has_key(g:Powerline#Matches#matches, match_name) - call add(matches, g:Powerline#Matches#matches[match_name]) - endif - - unlet! match_name - endfor - - return ['match', 'any', matches] -endfunction " }}} -function! Pl#Match#Validate(theme) " {{{ - let match = a:theme.matches[1] - - if match == 'none' - return 0 - elseif match == 'any' - let matches = a:theme.matches[2] - - if ! len(matches) - " Empty match array matches everything - return 1 - endif - - for [eval, re] in matches - if match(eval(eval), '\v'. re) != -1 - return 1 - endif - endfor - - return 0 - endif -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Mod.vim b/sources_non_forked/vim-powerline/autoload/Pl/Mod.vim deleted file mode 100644 index fdfb5718..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Mod.vim +++ /dev/null @@ -1,40 +0,0 @@ -let s:segment_mods = [] - -function! Pl#Mod#AddSegmentMod(action, properties) " {{{ - call add(s:segment_mods, [a:action, a:properties]) -endfunction " }}} -function! Pl#Mod#ApplySegmentMods(theme) " {{{ - let theme = deepcopy(a:theme) - - for mod in s:segment_mods - let [action, properties] = mod - - " We have to loop through the segments instead of using index() because some - " segments are lists! - let target_seg_idx = -1 - - for i in range(0, len(theme) - 1) - unlet! segment - let segment = theme[i] - - if type(segment) == type(properties.target_segment) && segment == properties.target_segment - let target_seg_idx = i - break - endif - endfor - - if action == 'insert_segment' - " Insert segment - if target_seg_idx != -1 - call insert(theme, properties.new_segment, (properties.where == 'before' ? target_seg_idx : target_seg_idx + 1)) - endif - elseif action == 'remove_segment' - " Remove segment - if target_seg_idx != -1 - call remove(theme, target_seg_idx) - endif - endif - endfor - - return theme -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Parser.vim b/sources_non_forked/vim-powerline/autoload/Pl/Parser.vim deleted file mode 100644 index a6f3428a..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Parser.vim +++ /dev/null @@ -1,371 +0,0 @@ -let g:Pl#Parser#Symbols = { - \ 'compatible': { - \ 'dividers': [ '', [0x2502], '', [0x2502] ] - \ , 'symbols' : { - \ 'BRANCH': 'BR:' - \ , 'RO' : 'RO' - \ , 'FT' : 'FT' - \ , 'LINE' : 'LN' - \ } - \ }, - \ 'unicode': { - \ 'dividers': [ [0x25b6], [0x276f], [0x25c0], [0x276e] ] - \ , 'symbols' : { - \ 'BRANCH': [0x26a1] - \ , 'RO' : [0x2613] - \ , 'FT' : [0x2691] - \ , 'LINE' : [0x204b] - \ }, - \ }, - \ 'fancy': { - \ 'dividers': [ [0x2b80], [0x2b81], [0x2b82], [0x2b83] ] - \ , 'symbols' : { - \ 'BRANCH': [0x2b60] - \ , 'RO' : [0x2b64] - \ , 'FT' : [0x2b62, 0x2b63] - \ , 'LINE' : [0x2b61] - \ } - \ } -\ } - -" Handle symbol overrides -for [s:key, s:value] in items(g:Powerline_symbols_override) - let g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[s:key] = s:value - - unlet! s:key s:value -endfor - -" Handle divider overrides -if len(g:Powerline_dividers_override) == 4 - let g:Pl#Parser#Symbols[g:Powerline_symbols].dividers = g:Powerline_dividers_override -endif - -let s:LEFT_SIDE = 0 -let s:RIGHT_SIDE = 2 - -let s:PADDING = 1 - -let s:EMPTY_SEGMENT = { 'type': 'empty' } - -let s:HARD_DIVIDER = 0 -let s:SOFT_DIVIDER = 1 - -function! Pl#Parser#GetStatusline(segments) " {{{ - let statusline = { - \ 'n': '' - \ , 'N': '' - \ , 'v': '' - \ , 'i': '' - \ , 'r': '' - \ , 's': '' - \ } - - " Run through the different modes and create the statuslines - for mode in keys(statusline) - " Create an empty statusline list - let stl = [] - - call extend(stl, s:ParseSegments(mode, s:LEFT_SIDE, a:segments)) - - let statusline[mode] .= join(stl, '') - endfor - - return statusline -endfunction " }}} -function! Pl#Parser#ParseChars(arg) " {{{ - " Handles symbol arrays which can be either an array of hex values, - " or a string. Will convert the hex array to a string, or return the - " string as-is. - let arg = a:arg - - if type(arg) == type([]) - " Hex array - call map(arg, 'nr2char(v:val)') - - return join(arg, '') - endif - - " Anything else, just return it as it is - return arg -endfunction " }}} -function! s:ParseSegments(mode, side, segments, ...) " {{{ - let mode = a:mode - let side = a:side - let segments = a:segments - - let level = exists('a:1') ? a:1 : 0 - let base_color = exists('a:2') ? a:2 : {} - - let ret = [] - - for i in range(0, len(segments) - 1) - unlet! seg_prev seg_curr seg_next - - " Prepare some resources (fetch previous, current and next segment) - let seg_curr = deepcopy(get(segments, i)) - - " Find previous segment - let seg_prev = s:EMPTY_SEGMENT - - " If we're currently at i = 0 we have to start on 0 or else we will start on the last segment (list[-1]) - let range_start = (i == 0 ? i : i - 1) - for j in range(range_start, 0, -1) - let seg = deepcopy(get(segments, j)) - if get(seg, 'name') ==# 'TRUNCATE' - " Skip truncate segments - continue - endif - - " Look ahead for another segment that's visible in this mode - if index(get(seg, 'modes'), mode) != -1 - " Use this segment - let seg_prev = seg - - break - endif - endfor - - "" Find next segment - let seg_next = s:EMPTY_SEGMENT - - " If we're currently at i = len(segments) - 1 we have to start on i or else we will get an error because the index doesn't exist - let range_start = (i == len(segments) - 1 ? i : i + 1) - for j in range(range_start, len(segments) - 1, 1) - let seg = deepcopy(get(segments, j)) - if get(seg, 'name') ==# 'TRUNCATE' - " Skip truncate segments - continue - endif - - " Look ahead for another segment that's visible in this mode - if index(get(seg, 'modes'), mode) != -1 - " Use this segment - let seg_next = seg - - break - endif - endfor - - if index(get(seg_curr, 'modes', []), mode) == -1 - " The segment is invisible in this mode, skip it - " FIXME When two segments after each other are hidden, a gap appears where the segments would be, this is probably due to segment padding - continue - endif - - " Handle the different segment types - if seg_curr.type == 'segment' - if seg_curr.name ==# 'TRUNCATE' - " Truncate statusline - call add(ret, '%<') - elseif seg_curr.name ==# 'SPLIT' - " Split statusline - - " Switch sides - let side = s:RIGHT_SIDE - - " Handle highlighting - let mode_colors = get(seg_curr.colors, mode, seg_curr.colors['n']) - let hl_group = s:HlCreate(mode_colors) - - " Add segment text - call add(ret, '%#'. hl_group .'#%=') - else - " Add segment text - let text = seg_curr.text - - " Decide on whether to use the group's colors or the segment's colors - let colors = get(seg_curr, 'colors', base_color) - - " Fallback to normal (current) highlighting if we don't have mode-specific highlighting - let mode_colors = get(colors, mode, get(colors, 'n', {})) - - if empty(mode_colors) - echom 'Segment doesn''t have any colors! NS: "'. seg_curr.ns .'" SEG: "'. seg_curr.name .'"' - - continue - endif - - " Check if we're in a group (level > 0) - if level > 0 - " If we're in a group we don't have dividers between - " segments, so we should only pad one side, but only pad - " if the segment doesn't have Pl#Segment#NoPadding() set - let padding_right = (seg_curr.padding && side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') - let padding_left = (seg_curr.padding && side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') - - " Check if we lack a bg/fg color for this segment - " If we do, use the bg/fg color from base_color - let base_color_mode = ! has_key(base_color, mode) ? base_color['n'] : base_color[mode] - - for col in ['ctermbg', 'ctermfg', 'guibg', 'guifg'] - if empty(mode_colors[col]) - let mode_colors[col] = base_color_mode[col] - endif - endfor - else - "" If we're outside a group we have dividers and must pad both sides - let padding_left = repeat(' ', s:PADDING) - let padding_right = repeat(' ', s:PADDING) - endif - - " Get main hl group for segment - let hl_group = s:HlCreate(mode_colors) - - " Prepare segment text - let text = '%(%#'. hl_group .'#'. padding_left . text . padding_right . '%)' - - if level == 0 - " Add divider to single segments - let text = s:AddDivider(text, side, mode, colors, seg_prev, seg_curr, seg_next) - endif - - call add(ret, text) - endif - elseif seg_curr.type == 'segment_group' - " Recursively parse segment group - let func_params = [mode, side, seg_curr.segments, level + 1] - - if has_key(seg_curr, 'colors') - " Pass the base colors on to the child segments - call add(func_params, seg_curr.colors) - endif - - " Get segment group string - let text = join(call('s:ParseSegments', func_params), '') - - " Pad on the opposite side of the divider - let padding_right = (side == s:RIGHT_SIDE ? repeat(' ', s:PADDING) : '') - let padding_left = (side == s:LEFT_SIDE ? repeat(' ', s:PADDING) : '') - - let text = s:AddDivider(padding_left . text . padding_right, side, mode, seg_curr.colors, seg_prev, seg_curr, seg_next) - - call add(ret, text) - endif - endfor - - return ret -endfunction " }}} -function! s:HlCreate(hl) " {{{ - " Create a short and unique highlighting group name - " It uses the hex values of all the color properties and an attribute flag at the end - " NONE colors are translated to NN for cterm and NNNNNN for gui colors - let hi_group = printf('Pl%s%s%s%s%s' - \ , (a:hl['ctermfg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermfg'])) - \ , (a:hl['guifg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guifg'] )) - \ , (a:hl['ctermbg'] == 'NONE' ? 'NN' : printf('%02x', a:hl['ctermbg'])) - \ , (a:hl['guibg'] == 'NONE' ? 'NNNNNN' : printf('%06x', a:hl['guibg'] )) - \ , substitute(a:hl['attr'], '\v([a-zA-Z])[a-zA-Z]*,?', '\1', 'g') - \ ) - - if ! s:HlExists(hi_group) - let ctermbg = a:hl['ctermbg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermbg']) - if (has('win32') || has('win64')) && !has('gui_running') && ctermbg != 'NONE' && ctermbg > 128 - let ctermbg -= 128 - endif - let hi_cmd = printf('hi %s ctermfg=%s ctermbg=%s cterm=%s guifg=%s guibg=%s gui=%s' - \ , hi_group - \ , a:hl['ctermfg'] == 'NONE' ? 'NONE' : printf('%d', a:hl['ctermfg']) - \ , ctermbg - \ , a:hl['attr'] - \ , (a:hl['guifg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guifg'])) - \ , (a:hl['guibg'] == 'NONE' ? 'NONE' : printf('#%06x', a:hl['guibg'])) - \ , a:hl['attr'] - \ ) - - exec hi_cmd - - " Add command to Pl#HL list for caching - call add(g:Pl#HL, hi_cmd) - endif - - " Return only the highlighting group name - return hi_group -endfunction " }}} -function! s:HlExists(hl) " {{{ - if ! hlexists(a:hl) - return 0 - endif - - redir => hlstatus - silent exec 'hi' a:hl - redir END - - return (hlstatus !~ 'cleared') -endfunction " }}} -function! s:AddDivider(text, side, mode, colors, prev, curr, next) " {{{ - let seg_prev = a:prev - let seg_curr = a:curr - let seg_next = a:next - - " Set default color/type for the divider - let div_colors = get(a:colors, a:mode, a:colors['n']) - let div_type = s:SOFT_DIVIDER - - " Define segment to compare - let cmp_seg = a:side == s:LEFT_SIDE ? seg_next : seg_prev - - let cmp_all_colors = get(cmp_seg, 'colors', {}) - let cmp_colors = get(cmp_all_colors, a:mode, get(cmp_all_colors, 'n', {})) - - if ! empty(cmp_colors) - " Compare the highlighting groups - " - " If the background color for cterm is equal, use soft divider with the current segment's highlighting - " If not, use hard divider with a new highlighting group - " - " Note that if the previous/next segment is the split, a hard divider is always used - if get(div_colors, 'ctermbg') != get(cmp_colors, 'ctermbg') || get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT' - let div_type = s:HARD_DIVIDER - - " Create new highlighting group - if div_colors['attr'] =~ 'reverse' && cmp_colors['attr'] =~ 'reverse' - " Use FG = CURRENT FG, BG = CMP FG - let div_colors['ctermbg'] = get(cmp_colors, 'ctermfg') - let div_colors['guibg'] = get(cmp_colors, 'guifg') - - let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' - elseif div_colors['attr'] =~ 'reverse' - " Use FG = CURRENT FG, BG = CMP BG - let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') - let div_colors['guibg'] = get(cmp_colors, 'guibg') - - let div_colors['attr'] = div_colors['attr'] =~ 'bold' ? 'bold' : 'NONE' - elseif cmp_colors['attr'] =~ 'reverse' - " Use FG = CMP FG, BG = CURRENT BG : reversed - let div_colors['ctermfg'] = get(cmp_colors, 'ctermfg') - let div_colors['guifg'] = get(cmp_colors, 'guifg') - - let div_colors['attr'] = 'reverse' - - else - " Use FG = CURRENT BG, BG = CMP BG - let div_colors['ctermfg'] = get(div_colors, 'ctermbg') - let div_colors['guifg'] = get(div_colors, 'guibg') - - let div_colors['ctermbg'] = get(cmp_colors, 'ctermbg') - let div_colors['guibg'] = get(cmp_colors, 'guibg') - - let div_colors['attr'] = 'NONE' - endif - endif - endif - - " Prepare divider - let divider_raw = deepcopy(g:Pl#Parser#Symbols[g:Powerline_symbols].dividers[a:side + div_type]) - let divider = Pl#Parser#ParseChars(divider_raw) - - " Don't add dividers for segments adjacent to split (unless it's a hard divider) - if ((get(seg_next, 'name') ==# 'SPLIT' || get(seg_prev, 'name') ==# 'SPLIT') && div_type != s:HARD_DIVIDER) - return '' - endif - - if a:side == s:LEFT_SIDE - " Left side - " Divider to the right - return printf('%%(%s%%#%s#%s%%)', a:text, s:HlCreate(div_colors), divider) - else - " Right side - " Divider to the left - return printf('%%(%%#%s#%s%s%%)', s:HlCreate(div_colors), divider, a:text) - endif -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Segment.vim b/sources_non_forked/vim-powerline/autoload/Pl/Segment.vim deleted file mode 100644 index bb09438c..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Segment.vim +++ /dev/null @@ -1,188 +0,0 @@ -let s:default_modes = ['n', 'N', 'v', 'i', 'r', 's'] - -function! s:CheckConditions(params) " {{{ - " Check conditions for a segment/group - " Integer parameters are always conditions - for param in a:params - if type(param) == type(0) && param == 0 - " Break here if it's an integer parameter and it's false (0) - return 0 - endif - unlet! param - endfor - - return 1 -endfunction " }}} -function! Pl#Segment#Create(name, ...) " {{{ - " Check condition parameters - if ! s:CheckConditions(a:000) - return {} - endif - - let name = a:name - let modes = s:default_modes - let padding = 1 - let segments = [] - - for param in a:000 - " Lookup modes for this segment/group - if type(param) == type([]) && param[0] == 'modes' - let modes = param[1] - elseif type(param) == type([]) && param[0] == 'nopadding' - let padding = 0 - elseif type(a:1) == type([]) && a:1[0] == 'segment' - call add(segments, param[1]) - endif - - unlet! param - endfor - - if type(a:1) == type([]) && a:1[0] == 'segment' - " This is a segment group - return ['segment_group', { - \ 'type': 'segment_group' - \ , 'name': name - \ , 'segments': segments - \ , 'modes': modes - \ , 'padding': padding - \ }] - else - " This is a single segment - let text = a:1 - - " Search/replace symbols - for [key, symbol] in items(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols) - let text = substitute( - \ text, - \ '\v\$('. key .')', - \ '\=Pl#Parser#ParseChars(g:Pl#Parser#Symbols[g:Powerline_symbols].symbols[submatch(1)])', - \ 'g') - - unlet! key symbol - endfor - - return ['segment', { - \ 'type': 'segment' - \ , 'name': name - \ , 'text': text - \ , 'modes': modes - \ , 'padding': padding - \ }] - endif - -endfunction " }}} -function! Pl#Segment#Init(params) " {{{ - " Check condition parameters - if ! s:CheckConditions(a:params) - return {} - endif - - let segments = {} - let ns = '' - - for param in a:params - if type(param) == type('') - " String parameters is the namespace - let ns = param - elseif type(param) == type([]) - " The data dict is in param[1] - " By default we don't have a namespace for the segment - let segment = param[1] - - if ! empty(ns) - " Update segment so that it includes the namespace - " Add the namespace to the segment dict key - let segment.ns = ns - let segment.name = join([segment.ns, segment.name], ':') - endif - - let key = segment.name - - let segments[key] = segment - endif - - unlet! param - endfor - - return segments -endfunction " }}} -function! Pl#Segment#Modes(modes) " {{{ - " Handle modes for both segments and groups - let modes = split(a:modes, '\zs') - - if modes[0] == '!' - " Filter modes (e.g. "!nr" will ignore the segment in normal and replace modes) - let modes = filter(deepcopy(s:default_modes), 'v:val !~# "['. join(modes[1:]) .']"') - endif - - return ['modes', modes] -endfunction " }}} -function! Pl#Segment#NoPadding() " {{{ - return ['nopadding'] -endfunction " }}} -function! Pl#Segment#Split(...) " {{{ - return a:0 ? a:1 .':SPLIT' : 'SPLIT' -endfunction " }}} -function! Pl#Segment#Truncate() " {{{ - return 'TRUNCATE' -endfunction " }}} -function! Pl#Segment#Get(name) " {{{ - " Return a segment data dict - let args = [] - - " Check for printf segments (lists) - if type(a:name) == type([]) - " We're dealing with a segment with printf arguments - let seg_orig_name = a:name[0] - let args = a:name[1:] - else - let seg_orig_name = a:name - endif - - " Fetch namespace and variants for storing in the segment dict - let seg_ns = '' - let seg_variants = [] - - " Retrieve color scheme variants - let seg_name_split = split(seg_orig_name, '\v\.') - if len(seg_name_split) > 1 - let seg_variants = seg_name_split[1:] - endif - - " Retrieve segment name and namespace - " Use the first piece of the split string, we can't have variants in the final segment name - let seg_name_split = split(seg_name_split[0], '\v:') - let seg_name = seg_name_split[0] - - if len(seg_name_split) > 1 - let seg_ns = seg_name_split[0] - let seg_name = seg_name_split[-1] - endif - - try - " If we have a namespace, try to use the namespaced segment first (i.e. search for the segment in the namespaced file first) - let return_segment = deepcopy(g:Powerline#Segments#{seg_ns}#segments[seg_ns .':'. seg_name]) - catch - try - " We didn't find a namespaced segment, fall back to common segments - let return_segment = deepcopy(g:Powerline#Segments#segments[seg_name]) - catch - " Didn't find the segment among the common segments either, just skip it - return {} - endtry - endtry - - if len(args) && has_key(return_segment, 'text') - " Handle segment printf arguments - " printf doesn't accept lists as its second argument, so we have to work around that - let return_segment.text = call('printf', [ return_segment.text ] + args) - endif - - " Assign namespace, name and variants - let return_segment.ns = seg_ns - let return_segment.name = seg_name - let return_segment.orig_name = seg_orig_name - let return_segment.variants = seg_variants - - return return_segment -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Pl/Theme.vim b/sources_non_forked/vim-powerline/autoload/Pl/Theme.vim deleted file mode 100644 index da1581e2..00000000 --- a/sources_non_forked/vim-powerline/autoload/Pl/Theme.vim +++ /dev/null @@ -1,100 +0,0 @@ -function! Pl#Theme#Create(...) " {{{ - let buffer_segments = [] - - for buffer_segment in a:000 - " Remove empty segments (e.g. 'Pl#Theme#Function's) - if empty(buffer_segment) - continue - endif - - call add(buffer_segments, buffer_segment) - endfor - - let buffer_segments = Pl#Colorscheme#Apply(g:Powerline_colorscheme, buffer_segments) - - return buffer_segments -endfunction " }}} -function! Pl#Theme#Callback(name, expr) " {{{ - return ['callback', a:name, a:expr] -endfunction " }}} -function! Pl#Theme#Buffer(ns, ...) " {{{ - let segments = [] - let ns = ! empty(a:ns) ? a:ns .':' : '' - - " Match namespace parameter by default - let matches = Pl#Match#Any(a:ns) - let callback = [] - - let args = a:000 - let args = Pl#Mod#ApplySegmentMods(args) - - " Fetch segment data dicts - for item in args - if type(item) == type([]) - if item[0] == 'match' - " Match item, overrides default namespace match - let matches = item - - unlet! item - continue - elseif item[0] == 'callback' - " Store the item as a callback expression - let matches = ['match', 'none'] - let callback = [a:ns, item[1], item[2]] - - unlet! item - continue - endif - - " printf segment, append ns to first item in list - let item[0] = ns . item[0] - else - let item = ns . item - endif - - let segment = Pl#Segment#Get(item) - - if ! empty(segment) - " Skip empty (possible disabled) segments - call add(segments, segment) - endif - - unlet! item - endfor - - return { - \ 'matches': matches - \ , 'callback': callback - \ , 'segments': segments - \ } -endfunction " }}} -function! Pl#Theme#InsertSegment(new_segment, where, target_segment) " {{{ - " It's very important to NOT refer to the theme dict until everything's loaded! - " - " Because these functions are called from the vimrc, we need to put the - " actions in a list which will be parsed later. - " - " These functions don't accept a name parameter, because they work on the - " currently selected theme (will change any selected theme) - call Pl#Mod#AddSegmentMod('insert_segment', { - \ 'new_segment': a:new_segment, - \ 'where': a:where, - \ 'target_segment': a:target_segment - \ }) -endfunction " }}} -function! Pl#Theme#RemoveSegment(target_segment) " {{{ - " It's very important to NOT refer to the theme dict until everything's loaded! - " - " Because these functions are called from the vimrc, we need to put the - " actions in a list which will be parsed later. - " - " These functions don't accept a name parameter, because they work on the - " currently selected theme (will change any selected theme) - call Pl#Mod#AddSegmentMod('remove_segment', { - \ 'target_segment': a:target_segment - \ }) -endfunction " }}} -function! Pl#Theme#ReplaceSegment(old_segment, new_segment) " {{{ - call Pl#Theme#InsertSegment(a:new_segment, 'after', a:old_segment) - call Pl#Theme#RemoveSegment(a:old_segment) -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim deleted file mode 100644 index 4d4c7fa8..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/default.vim +++ /dev/null @@ -1,166 +0,0 @@ -call Pl#Hi#Allocate({ - \ 'black' : 16, - \ 'white' : 231, - \ - \ 'darkestgreen' : 22, - \ 'darkgreen' : 28, - \ 'mediumgreen' : 70, - \ 'brightgreen' : 148, - \ - \ 'darkestcyan' : 23, - \ 'mediumcyan' : 117, - \ - \ 'darkestblue' : 24, - \ 'darkblue' : 31, - \ - \ 'darkestred' : 52, - \ 'darkred' : 88, - \ 'mediumred' : 124, - \ 'brightred' : 160, - \ 'brightestred' : 196, - \ - \ 'darkestpurple' : 55, - \ 'mediumpurple' : 98, - \ 'brightpurple' : 189, - \ - \ 'brightorange' : 208, - \ 'brightestorange': 214, - \ - \ 'gray0' : 233, - \ 'gray1' : 235, - \ 'gray2' : 236, - \ 'gray3' : 239, - \ 'gray4' : 240, - \ 'gray5' : 241, - \ 'gray6' : 244, - \ 'gray7' : 245, - \ 'gray8' : 247, - \ 'gray9' : 250, - \ 'gray10' : 252, - \ }) - -let g:Powerline#Colorschemes#default#colorscheme = Pl#Colorscheme#Init([ - \ Pl#Hi#Segments(['SPLIT'], { - \ 'n': ['white', 'gray2'], - \ 'N': ['white', 'gray0'], - \ 'i': ['white', 'darkestblue'], - \ }), - \ - \ Pl#Hi#Segments(['mode_indicator'], { - \ 'n': ['darkestgreen', 'brightgreen', ['bold']], - \ 'i': ['darkestcyan', 'white', ['bold']], - \ 'v': ['darkred', 'brightorange', ['bold']], - \ 'r': ['white', 'brightred', ['bold']], - \ 's': ['white', 'gray5', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['branch', 'scrollpercent', 'raw', 'filesize'], { - \ 'n': ['gray9', 'gray4'], - \ 'N': ['gray4', 'gray1'], - \ 'i': ['mediumcyan', 'darkblue'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo', 'filename'], { - \ 'n': ['white', 'gray4', ['bold']], - \ 'N': ['gray7', 'gray0', ['bold']], - \ 'i': ['white', 'darkblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.filepath'], { - \ 'n': ['gray10'], - \ 'N': ['gray5'], - \ 'i': ['mediumcyan'], - \ }), - \ - \ Pl#Hi#Segments(['static_str'], { - \ 'n': ['white', 'gray4'], - \ 'N': ['gray7', 'gray1'], - \ 'i': ['white', 'darkblue'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.flags'], { - \ 'n': ['brightestred', ['bold']], - \ 'N': ['darkred'], - \ 'i': ['brightestred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { - \ 'n': ['gray8', 'gray2'], - \ 'i': ['mediumcyan', 'darkestblue'], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo'], { - \ 'n': ['gray2', 'gray10', ['bold']], - \ 'N': ['gray7', 'gray1', ['bold']], - \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['errors'], { - \ 'n': ['brightestorange', 'gray2', ['bold']], - \ 'i': ['brightestorange', 'darkestblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo.line.tot'], { - \ 'n': ['gray6'], - \ 'N': ['gray5'], - \ 'i': ['darkestcyan'], - \ }), - \ - \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { - \ 'n': ['white', 'brightred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { - \ 'n': ['white', 'mediumred', ['bold']], - \ 'N': ['brightred', 'darkestred', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { - \ 'n': ['white', 'darkred'], - \ 'N': ['brightred', 'darkestred'], - \ }), - \ - \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { - \ 'n': ['white', 'darkred'], - \ 'N': ['white', 'darkestred'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { - \ 'n': ['white', 'mediumgreen', ['bold']], - \ 'N': ['mediumgreen', 'darkestgreen', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { - \ 'n': ['brightgreen', 'darkgreen'], - \ 'N': ['mediumgreen', 'darkestgreen'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { - \ 'n': ['white', 'darkgreen'], - \ 'N': ['white', 'darkestgreen'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { - \ 'n': ['brightpurple', 'darkestpurple'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { - \ 'n': ['white', 'mediumpurple'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:item'], { - \ 'n': ['darkestpurple', 'white', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:marked'], { - \ 'n': ['brightestred', 'darkestpurple', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:count'], { - \ 'n': ['darkestpurple', 'white'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:SPLIT'], { - \ 'n': ['white', 'darkestpurple'], - \ }), - \ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim deleted file mode 100644 index 798caa44..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim +++ /dev/null @@ -1,192 +0,0 @@ -" This theme is based on Solarized-dark colors, combined -" with Powerline native colors -call Pl#Hi#Allocate({ - \ 'black' : 16, - \ 'white' : 231, - \ - \ 'darkestgreen' : 22, - \ 'darkgreen' : 28, - \ 'mediumgreen' : 70, - \ 'brightgreen' : 148, - \ - \ 'darkestcyan' : 23, - \ 'mediumcyan' : 117, - \ - \ 'darkestblue' : 24, - \ 'darkblue' : 31, - \ - \ 'darkestred' : 52, - \ 'darkred' : 88, - \ 'mediumred' : 124, - \ 'brightred' : 160, - \ 'brightestred' : 196, - \ - \ 'darkestpurple' : 55, - \ 'mediumpurple' : 98, - \ 'brightpurple' : 189, - \ - \ 'brightorange' : 208, - \ 'brightestorange': 214, - \ - \ 'gray0' : 233, - \ 'gray1' : 235, - \ 'gray2' : 236, - \ 'gray3' : 239, - \ 'gray4' : 240, - \ 'gray5' : 241, - \ 'gray6' : 244, - \ 'gray7' : 245, - \ 'gray8' : 247, - \ 'gray9' : 250, - \ 'gray10' : 252, - \ - \ 'base00' : [241, 0x657b83], - \ 'base01' : [240, 0x586e75], - \ 'base02' : [0, 0x073642], - \ 'base03' : [234, 0x002b36], - \ 'base0' : [244, 0x839496], - \ 'base1' : [245, 0x93a1a1], - \ 'base2' : [254, 0xeee8d5], - \ 'base3' : [230, 0xfdf6e3], - \ 'yellow' : [136, 0xb58900], - \ 'orange' : [166, 0xcb4b16], - \ 'red' : [160, 0xdc322f], - \ 'magenta' : [125, 0xd33682], - \ 'violet' : [61, 0x6c71c4], - \ 'blue' : [33, 0x268bd2], - \ 'cyan' : [37, 0x2aa198], - \ 'green' : [64, 0x859900], - \ }) - -let g:Powerline#Colorschemes#skwp#colorscheme = Pl#Colorscheme#Init([ - \ Pl#Hi#Segments(['SPLIT'], { - \ 'n': ['white', 'base02'], - \ 'N': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['mode_indicator'], { - \ 'n': ['darkestgreen', 'brightgreen', ['bold']], - \ 'i': ['darkestcyan', 'white', ['bold']], - \ 'v': ['red', 'brightorange', ['bold']], - \ 'r': ['white', 'violet', ['bold']], - \ 's': ['white', 'gray5', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['branch', 'raw', 'filesize'], { - \ 'n': ['base03', 'blue'], - \ 'N': ['gray5', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['scrollpercent'], { - \ 'n': ['gray7', 'gray2'], - \ 'N': ['base2', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo', 'filename', 'filepath'], { - \ 'n': ['base2', 'darkestblue', ['bold']], - \ 'N': ['base1', 'base02', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.filepath'], { - \ 'n': ['gray10'], - \ 'N': ['gray5'], - \ 'i': ['mediumcyan'], - \ }), - \ - \ Pl#Hi#Segments(['static_str'], { - \ 'n': ['base3', 'violet'], - \ 'N': ['base1', 'base02'], - \ 'i': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['fileinfo.flags'], { - \ 'n': ['base03', ['bold']], - \ 'N': ['gray5'], - \ 'i': ['base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['currenttag', 'fullcurrenttag', 'fileformat', 'fileencoding', 'pwd', 'filetype', 'rvm:string', 'rvm:statusline', 'virtualenv:statusline', 'charcode', 'currhigroup'], { - \ 'n': ['gray5', 'gray2'], - \ 'i': ['mediumcyan', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo'], { - \ 'n': ['gray2', 'gray10', ['bold']], - \ 'N': ['gray7', 'gray1', ['bold']], - \ 'i': ['darkestcyan', 'mediumcyan', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['errors'], { - \ 'n': ['orange', 'base02', ['bold']], - \ 'N': ['gray5', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lineinfo.line.tot'], { - \ 'n': ['gray6'], - \ 'N': ['gray5'], - \ 'i': ['darkestcyan'], - \ }), - \ - \ Pl#Hi#Segments(['paste_indicator', 'ws_marker'], { - \ 'n': ['base3', 'red', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.name', 'command_t:static_str.name'], { - \ 'n': ['base3', 'darkblue', ['bold']], - \ 'N': ['base1', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['gundo:static_str.buffer', 'command_t:raw.line'], { - \ 'n': ['white', 'base02'], - \ 'N': ['gray5', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['gundo:SPLIT', 'command_t:SPLIT'], { - \ 'n': ['white', 'base02'], - \ 'N': ['white', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.name', 'minibufexplorer:static_str.name', 'nerdtree:raw.name', 'tagbar:static_str.name'], { - \ 'n': ['gray10', 'darkestblue', ['bold']], - \ 'N': ['gray3', 'base02', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:static_str.buffer', 'tagbar:static_str.buffer'], { - \ 'n': ['base3', 'blue'], - \ 'N': ['gray5', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['lustyexplorer:SPLIT', 'minibufexplorer:SPLIT', 'nerdtree:SPLIT', 'tagbar:SPLIT'], { - \ 'n': ['gray3', 'base02'], - \ 'N': ['gray3', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:focus', 'ctrlp:byfname'], { - \ 'n': ['green', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:prev', 'ctrlp:next', 'ctrlp:pwd'], { - \ 'n': ['green', 'base02'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:item'], { - \ 'n': ['base2', 'darkestblue', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:marked'], { - \ 'n': ['brightgreen', 'base03', ['bold']], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:count'], { - \ 'n': ['base0', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['ctrlp:SPLIT'], { - \ 'n': ['white', 'base03'], - \ }), - \ - \ Pl#Hi#Segments(['status'], { - \ 'n': ['green', 'base02'], - \ 'N': ['gray5', 'base02'], - \ }), -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Functions.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Functions.vim deleted file mode 100644 index 26db9b36..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Functions.vim +++ /dev/null @@ -1,141 +0,0 @@ -" Recalculate the trailing whitespace warning when idle, and after saving -autocmd CursorHold,BufWritePost,InsertLeave * unlet! b:statusline_trailing_space_warning - -function! Powerline#Functions#GetFilepath() " {{{ - " Recalculate the filepath when cwd changes. - let cwd = getcwd() - if exists("b:Powerline_cwd") && cwd != b:Powerline_cwd - unlet! b:Powerline_filepath - endif - let b:Powerline_cwd = cwd - - if exists('b:Powerline_filepath') - return b:Powerline_filepath - endif - - let dirsep = has('win32') && ! &shellslash ? '\' : '/' - let filepath = expand('%:p') - - if empty(filepath) - return '' - endif - - let ret = '' - - if g:Powerline_stl_path_style == 'short' - " Display a short path where the first directory is displayed with its - " full name, and the subsequent directories are shortened to their - " first letter, i.e. "/home/user/foo/foo/bar/baz.vim" becomes - " "~/foo/f/b/baz.vim" - " - " This displays the shortest possible path, relative to ~ or the - " current directory. - let mod = (exists('+acd') && &acd) ? ':~:h' : ':~:.:h' - let fpath = split(fnamemodify(filepath, mod), dirsep) - let fpath_shortparts = map(fpath[1:], 'v:val[0]') - let ret = join(extend([fpath[0]], fpath_shortparts), dirsep) . dirsep - elseif g:Powerline_stl_path_style == 'relative' - " Display a relative path, similar to the %f statusline item - let ret = fnamemodify(filepath, ':~:.:h') . dirsep - elseif g:Powerline_stl_path_style == 'full' - " Display the full path, similar to the %F statusline item - let ret = fnamemodify(filepath, ':h') . dirsep - endif - - if ret == ('.' . dirsep) - let ret = '' - endif - - let b:Powerline_filepath = ret - return ret -endfunction " }}} -function! Powerline#Functions#GetShortPath(threshold) " {{{ - let fullpath = split(substitute(expand('%:p:h'), $HOME, '~', 'g'), '/') - - if len(fullpath) > a:threshold - let fullpath = [fullpath[0], '…'] + fullpath[-a:threshold + 1 :] - endif - - return join(fullpath, '/') -endfunction " }}} -function! Powerline#Functions#GetMode() " {{{ - let mode = mode() - - if mode ==# 'v' - let mode = get(g:, "Powerline_mode_v", "VISUAL") - elseif mode ==# 'V' - let mode = get(g:, "Powerline_mode_V", "V⋅LINE") - elseif mode ==# '' - let mode = get(g:, "Powerline_mode_cv", "V⋅BLOCK") - elseif mode ==# 's' - let mode = get(g:, "Powerline_mode_s", "SELECT") - elseif mode ==# 'S' - let mode = get(g:, "Powerline_mode_S", "S⋅LINE") - elseif mode ==# '' - let mode = get(g:, "Powerline_mode_cs", "S⋅BLOCK") - elseif mode =~# '\vi' - let mode = get(g:, "Powerline_mode_i", "INSERT") - elseif mode =~# '\v(R|Rv)' - let mode = get(g:, "Powerline_mode_R", "REPLACE") - else - " Fallback to normal mode - let mode = get(g:, "Powerline_mode_n", "NORMAL") - endif - - return mode -endfunction " }}} -function! Powerline#Functions#GetFilesize() " {{{ - let bytes = getfsize(expand("%:p")) - - if bytes <= 0 - return '' - endif - - if bytes < 1024 - return bytes . 'B' - else - return (bytes / 1024) . 'kB' - endif -endfunction "}}} -function! Powerline#Functions#GetCharCode() " {{{ - " Get the output of :ascii - redir => ascii - silent! ascii - redir END - - if match(ascii, 'NUL') != -1 - return 'NUL' - endif - - " Zero pad hex values - let nrformat = '0x%02x' - - let encoding = (&fenc == '' ? &enc : &fenc) - - if encoding == 'utf-8' - " Zero pad with 4 zeroes in unicode files - let nrformat = '0x%04x' - endif - - " Get the character and the numeric value from the return value of :ascii - " This matches the two first pieces of the return value, e.g. - " " 70" => char: 'F', nr: '70' - let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)') - - " Format the numeric value - let nr = printf(nrformat, nr) - - return "'". char ."' ". nr -endfunction "}}} -function! Powerline#Functions#GetWSMarker() " {{{ - " Return '...' if trailing white space is detected - " Return '' otherwise - if ! exists("b:statusline_trailing_space_warning") - if search('\s$', 'nw') != 0 - let b:statusline_trailing_space_warning = ' … ' - else - let b:statusline_trailing_space_warning = '' - endif - endif - return b:statusline_trailing_space_warning -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim deleted file mode 100644 index 29135e43..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/ft_man.vim +++ /dev/null @@ -1,12 +0,0 @@ -function! Powerline#Functions#ft_man#GetName() " {{{ - let matches = matchlist(getline(1), '\v^([a-zA-Z_\.\-]+)\((\d+)\)') - - if ! len(matches) - return 'n/a' - endif - - let file = tolower(matches[1]) - let num = matches[2] - - return file -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim deleted file mode 100644 index bb001315..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/fugitive.vim +++ /dev/null @@ -1,7 +0,0 @@ -function! Powerline#Functions#fugitive#GetBranch(symbol) " {{{ - let ret = fugitive#statusline() - - let ret = substitute(ret, '\c\v\[?GIT\(([a-z0-9\-_\./:]+)\)\]?', a:symbol .' \1', 'g') - - return ret -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim deleted file mode 100644 index 61d94adf..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/hgrev.vim +++ /dev/null @@ -1,17 +0,0 @@ -function! Powerline#Functions#hgrev#Status(symbol) " {{{ - if ! exists('*HGRev') - " HGRev hasn't been loaded yet - return '' - endif - if !exists("b:statusline_hg_status") - silent execute "RefreshMercurialRev" - endif - let b:statusline_hg_status=HGRev() - if b:statusline_hg_status != '-' - let ret = "\u26A1". '' . substitute(b:statusline_hg_status, '^[^ ]*', '\1', 'g') - let ret=substitute(ret,' M$','+','g') - else - let ret='' - endif - return ret -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim deleted file mode 100644 index 70c8849e..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Functions/syntastic.vim +++ /dev/null @@ -1,16 +0,0 @@ -function! Powerline#Functions#syntastic#GetErrors(line_symbol) " {{{ - if ! exists('g:syntastic_stl_format') - " Syntastic hasn't been loaded yet - return '' - endif - - " Temporarily change syntastic output format - let old_stl_format = g:syntastic_stl_format - let g:syntastic_stl_format = '%E{ ERRORS (%e) '. a:line_symbol .' %fe }%W{ WARNINGS (%w) '. a:line_symbol .' %fw }' - - let ret = SyntasticStatuslineFlag() - - let g:syntastic_stl_format = old_stl_format - - return ret -endfunction " }}} diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Matches.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Matches.vim deleted file mode 100644 index 5cce4756..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Matches.vim +++ /dev/null @@ -1,13 +0,0 @@ -let g:Powerline#Matches#matches = { - \ 'command_t' : Pl#Match#Add('bufname("%")', 'GoToFile'), - \ 'bt_help' : Pl#Match#Add('&bt' , 'help'), - \ 'ft_man' : Pl#Match#Add('&ft' , 'man'), - \ 'ft_qf' : Pl#Match#Add('&ft' , 'qf'), - \ 'ft_vimpager' : Pl#Match#Add('&ft' , 'vimpager'), - \ 'gundo_preview' : Pl#Match#Add('bufname("%")', '__Gundo_Preview__'), - \ 'gundo_tree' : Pl#Match#Add('bufname("%")', '__Gundo__'), - \ 'lustyexplorer' : Pl#Match#Add('bufname("%")', '\[LustyExplorer-Buffers\]'), - \ 'minibufexplorer' : Pl#Match#Add('bufname("%")', '\-MiniBufExplorer\-'), - \ 'tagbar' : Pl#Match#Add('&ft' , 'tagbar'), - \ 'nerdtree' : Pl#Match#Add('&ft' , 'nerdtree'), -\ } diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments.vim deleted file mode 100644 index c74c34f3..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments.vim +++ /dev/null @@ -1,30 +0,0 @@ -let g:Powerline#Segments#segments = Pl#Segment#Init([ - \ Pl#Segment#Create('SPLIT' , '__split__'), - \ Pl#Segment#Create('TRUNCATE', '__truncate__'), - \ - \ Pl#Segment#Create('paste_indicator' , '%{&paste ? "PASTE" : ""}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('mode_indicator' , '%{Powerline#Functions#GetMode()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fileinfo', - \ Pl#Segment#Create('flags.ro' , '%{&readonly ? "$RO" : ""}'), - \ Pl#Segment#Create('filepath' , '%{Powerline#Functions#GetFilepath()}', Pl#Segment#NoPadding()), - \ Pl#Segment#Create('filename' , '%t'), - \ Pl#Segment#Create('flags.mod' , '%M'), - \ Pl#Segment#Create('flags.type' , '%H%W'), - \ ), - \ Pl#Segment#Create('filename' , '%t'), - \ Pl#Segment#Create('filesize' , '%{Powerline#Functions#GetFilesize()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('pwd' , '%{substitute(getcwd(), expand("$HOME"), "~", "g")}'), - \ Pl#Segment#Create('static_str' , '%%{"%s"}'), - \ Pl#Segment#Create('raw' , '%s'), - \ Pl#Segment#Create('fileformat' , '%{&fileformat}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fileencoding' , '%{(&fenc == "" ? &enc : &fenc)}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('filetype' , '%{strlen(&ft) ? &ft : "no ft"}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('scrollpercent' , '%3p%%'), - \ Pl#Segment#Create('lineinfo', - \ Pl#Segment#Create('line.cur' , '$LINE %3l'), - \ Pl#Segment#Create('line.tot' , ':%-2v', Pl#Segment#NoPadding()), - \ ), - \ Pl#Segment#Create('charcode' , '%{Powerline#Functions#GetCharCode()}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('currhigroup' , '%{synIDattr(synID(line("."), col("."), 1), "name")}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('ws_marker' , '%{Powerline#Functions#GetWSMarker()}', Pl#Segment#Modes('!N')), -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim deleted file mode 100755 index 41c5ebfc..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ctrlp.vim +++ /dev/null @@ -1,20 +0,0 @@ -if !exists("g:Powerline#Segments#ctrlp#segments#focus ") - let g:Powerline#Segments#ctrlp#segments#focus = '%{"%0"}' -endif -if !exists("g:Powerline#Segments#ctrlp#segments#prev ") - let g:Powerline#Segments#ctrlp#segments#prev = '%-3{"%3"}' -endif -if !exists("g:Powerline#Segments#ctrlp#segments#next ") - let g:Powerline#Segments#ctrlp#segments#next = '%-3{"%5"}' -endif - -let g:Powerline#Segments#ctrlp#segments = Pl#Segment#Init(['ctrlp' - \ , Pl#Segment#Create('focus', g:Powerline#Segments#ctrlp#segments#focus) - \ , Pl#Segment#Create('byfname', '%{"%1"}') - \ , Pl#Segment#Create('prev', g:Powerline#Segments#ctrlp#segments#prev) - \ , Pl#Segment#Create('item', '%-9{"%4"}') - \ , Pl#Segment#Create('next', g:Powerline#Segments#ctrlp#segments#next) - \ , Pl#Segment#Create('marked', '%{"%6" == " <+>" ? "" : strpart("%6", 2, len("%6") - 3)}') - \ - \ , Pl#Segment#Create('count', '%-6{"%0"}') -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim deleted file mode 100644 index 6ed0cc30..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/ft_man.vim +++ /dev/null @@ -1,3 +0,0 @@ -let g:Powerline#Segments#ft_man#segments = Pl#Segment#Init(['ft_man', - \ Pl#Segment#Create('filename', '%{Powerline#Functions#ft_man#GetName()}') -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim deleted file mode 100644 index bb46eeca..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/fugitive.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#fugitive#segments = Pl#Segment#Init(['fugitive', - \ (exists('g:loaded_fugitive') && g:loaded_fugitive == 1), - \ - \ Pl#Segment#Create('branch', '%{Powerline#Functions#fugitive#GetBranch("$BRANCH")}') -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim deleted file mode 100644 index 3e651d13..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/hgrev.vim +++ /dev/null @@ -1,4 +0,0 @@ -let g:Powerline#Segments#hgrev#segments = Pl#Segment#Init(['hgrev', - \ (exists('hgrev_loaded')), - \ Pl#Segment#Create('branch', '%{Powerline#Functions#hgrev#Status("$BRANCH")}') - \ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim deleted file mode 100644 index c840632d..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/rvm.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:Powerline#Segments#rvm#segments = Pl#Segment#Init(['rvm', - \ (exists('g:loaded_rvm') && g:loaded_rvm == 1), - \ - \ Pl#Segment#Create('string', '%{rvm#string()}'), - \ Pl#Segment#Create('statusline', '%{rvm#statusline()}') -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim deleted file mode 100644 index 5a893d6e..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/syntastic.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#syntastic#segments = Pl#Segment#Init(['syntastic', - \ (exists('g:loaded_syntastic_plugin') && g:loaded_syntastic_plugin == 1), - \ - \ Pl#Segment#Create('errors', '%{Powerline#Functions#syntastic#GetErrors("$LINE")}', Pl#Segment#Modes('!N')) -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim deleted file mode 100644 index 5db8cd95..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/tagbar.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:Powerline#Segments#tagbar#segments = Pl#Segment#Init(['tagbar', - \ (exists(':Tagbar') > 0), - \ - \ Pl#Segment#Create('currenttag', '%{tagbar#currenttag("%s", "")}', Pl#Segment#Modes('!N')), - \ Pl#Segment#Create('fullcurrenttag', '%{tagbar#currenttag("%s", "", "f")}', Pl#Segment#Modes('!N')) -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim deleted file mode 100644 index 8c7d6fb5..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Segments/virtualenv.vim +++ /dev/null @@ -1,5 +0,0 @@ -let g:Powerline#Segments#virtualenv#segments = Pl#Segment#Init(['virtualenv', - \ has('python') && (exists('g:virtualenv_loaded') && g:virtualenv_loaded == 1), - \ - \ Pl#Segment#Create('statusline', '%{virtualenv#statusline()}') -\ ]) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Themes/default.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Themes/default.vim deleted file mode 100644 index a97d5b9c..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Themes/default.vim +++ /dev/null @@ -1,116 +0,0 @@ -let g:Powerline#Themes#default#theme = Pl#Theme#Create( - \ Pl#Theme#Buffer('' - \ , 'paste_indicator' - \ , 'mode_indicator' - \ , 'fugitive:branch' - \ , 'hgrev:branch' - \ , 'fileinfo' - \ , 'syntastic:errors' - \ , Pl#Segment#Truncate() - \ , 'tagbar:currenttag' - \ , Pl#Segment#Split() - \ , 'rvm:string' - \ , 'virtualenv:statusline' - \ , 'fileformat' - \ , 'fileencoding' - \ , 'filetype' - \ , 'scrollpercent' - \ , 'lineinfo' - \ ), - \ - \ Pl#Theme#Buffer('command_t' - \ , ['static_str.name', 'Command-T'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , ['raw.line', '%10(Match #%l%)'] - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Undo tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Diff preview'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('bt_help' - \ , ['static_str.name', 'Help'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('ft_vimpager' - \ , ['static_str.name', 'Pager'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('lustyexplorer' - \ , ['static_str.name', 'LustyExplorer'] - \ , ['static_str.buffer', 'Buffer list'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_man' - \ , ['static_str.name', 'Man page'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('minibufexplorer' - \ , ['static_str.name', 'MiniBufExplorer'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_qf' - \ , ['static_str.name', 'Quickfix'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('tagbar' - \ , ['static_str.name', 'Tagbar'] - \ , ['static_str.buffer', 'Tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') - \ , 'ctrlp:prev' - \ , 'ctrlp:item' - \ , 'ctrlp:next' - \ , 'ctrlp:marked' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'ctrlp:focus' - \ , 'ctrlp:byfname' - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') - \ , 'ctrlp:count' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('nerdtree' - \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ) -\ ) diff --git a/sources_non_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim b/sources_non_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim deleted file mode 100644 index 64ed1342..00000000 --- a/sources_non_forked/vim-powerline/autoload/Powerline/Themes/skwp.vim +++ /dev/null @@ -1,116 +0,0 @@ -" Disabled: -" Add the following line into the first theme group to see the highlight -" group -" \ , 'currhigroup' -" -" Line info taken out - I know which line number I'm on from the gutter -"\ , 'lineinfo' -let g:Powerline#Themes#skwp#theme = Pl#Theme#Create( - \ Pl#Theme#Buffer('' - \ , 'fugitive:branch' - \ , 'fileinfo' - \ , 'flags.mod' - \ , 'syntastic:errors' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'sass:status' - \ , 'rvm:string' - \ , 'paste_indicator' - \ ), - \ - \ Pl#Theme#Buffer('command_t' - \ , ['static_str.name', 'Command-T'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , ['raw.line', '%10(Match #%l%)'] - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_tree') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Undo tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('gundo', Pl#Match#Any('gundo_preview') - \ , ['static_str.name', 'Gundo'] - \ , ['static_str.buffer', 'Diff preview'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('bt_help' - \ , ['static_str.name', 'Help'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('ft_vimpager' - \ , ['static_str.name', 'Pager'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('lustyexplorer' - \ , ['static_str.name', 'LustyExplorer'] - \ , ['static_str.buffer', 'Buffer list'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_man' - \ , ['static_str.name', 'Man page'] - \ , 'filename' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'scrollpercent' - \ ), - \ - \ Pl#Theme#Buffer('minibufexplorer' - \ , ['static_str.name', 'MiniBufExplorer'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ft_qf' - \ , ['static_str.name', 'Quickfix'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('tagbar' - \ , ['static_str.name', 'Tagbar'] - \ , ['static_str.buffer', 'Tree'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_main', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.main = "%s"') - \ , 'ctrlp:prev' - \ , 'ctrlp:item' - \ , 'ctrlp:next' - \ , 'ctrlp:marked' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'ctrlp:focus' - \ , 'ctrlp:byfname' - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('ctrlp', Pl#Theme#Callback('ctrlp_prog', 'if ! exists("g:ctrlp_status_func") | let g:ctrlp_status_func = {} | endif | let g:ctrlp_status_func.prog = "%s"') - \ , 'ctrlp:count' - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ , 'pwd' - \ ), - \ - \ Pl#Theme#Buffer('nerdtree' - \ , ['raw.name', '%{Powerline#Functions#GetShortPath(4)}'] - \ , Pl#Segment#Truncate() - \ , Pl#Segment#Split() - \ ) -\ ) diff --git a/sources_non_forked/vim-powerline/doc/Powerline.txt b/sources_non_forked/vim-powerline/doc/Powerline.txt deleted file mode 100644 index 33d136fd..00000000 --- a/sources_non_forked/vim-powerline/doc/Powerline.txt +++ /dev/null @@ -1,429 +0,0 @@ -*Powerline.txt* For Vim version 7.3. Last change: 2011 Nov 23 - - ______ - _________ \ /__ - \_____ \______ _ _____________ / /'__' ___ ____ - | ___/ _ \ \/ \/ / __ \_ ___\ / | |/ \_/ __ \ - | | | (_) \ _ / ___/| | / /__| | | \ ___/ - '___' \____/ \/ \/ \___ |__' /___ /'__'__| /\___ \ - \/ / / \/ \/ - | / - |/ - ' - -============================================================================== -CONTENTS *Powerline-contents* - - 1. Introduction ....................... |Powerline-introduction| - 2. Usage .............................. |Powerline-usage| - 3. Requirements ....................... |Powerline-requirements| - 3.1 Recommended settings ........... |Powerline-recommended-settings| - 4. Configuration ...................... |Powerline-configuration| - 4.1 Powerline_cache_file ........... |Powerline_cache_file| - 4.1.1 Clearing the cache ....... |:PowerlineClearCache| - 4.2 Powerline_cache_enabled ........ |Powerline_cache_enabled| - 4.3 Powerline_symbols .............. |Powerline_symbols| - 4.3.1 Compatible symbols ....... |Powerline-symbols-compatible| - 4.3.2 Fancy symbols ............ |Powerline-symbols-fancy| - 4.3.3 Overriding symbols ....... |Powerline_symbols_override| - 4.3.4 Overriding dividers ...... |Powerline_dividers_override| - 4.4 Powerline_theme ................ |Powerline_theme| - 4.5 Powerline_colorscheme .......... |Powerline_colorscheme| - 4.6 Powerline_stl_path_style ....... |Powerline_stl_path_style| - 5. Fonts .............................. |Powerline-fonts| - 6. Customization ...................... |Powerline-customization| - 6.1 Basic customization ............ |Powerline-basic-customization| - 6.2 Advanced customization ......... |Powerline-advanced-customization| - 6.2.1 Colorschemes ............. |Powerline-cust-colorschemes| - 6.2.2 Functions ................ |Powerline-cust-functions| - 6.2.3 Segments ................. |Powerline-cust-segments| - 6.2.4 Themes ................... |Powerline-cust-themes| - 7. License ............................ |Powerline-license| - 8. Known issues ....................... |Powerline-known-issues| - 9. Contributing ....................... |Powerline-contributing| - -============================================================================== -1. Introduction *Powerline* *Powerline-introduction* - -Powerline is a utility plugin which allows you to create better-looking, more -functional Vim statuslines. - -============================================================================== -2. Usage *Powerline-usage* - -Powerline is automatically enabled when it's installed, either by unzipping -the provided archive or by adding it as a Pathogen/Vundle bundle. - -Powerline replaces the standard Vim 'statusline' with a custom statusline made -up of Powerline segments. - -Powerline ignores any 'statusline' customizations you have defined in your -|vimrc|. If you remove Powerline, your 'statusline' customizations are -restored. - -============================================================================== -3. Requirements *Powerline-requirements* - -Powerline has been developed and tested in Vim 7.3, but it should run without -any problems in Vim 7.2. The default configuration requires a Unix-like system -to work properly. - -The plugin only works with Vim running in an 88/256-color terminal or Gvim. - -Vi-compatible mode must be disabled. - ------------------------------------------------------------------------------- -3.1 Recommended settings *Powerline-recommended-settings* - -The following configuration options should be set in your |vimrc|: > - - set nocompatible " Disable vi-compatibility - set laststatus=2 " Always show the statusline - set encoding=utf-8 " Necessary to show Unicode glyphs - -Note: If you're using an 88/256-color terminal but still don't see the colored -statusline, you may have to set the following option as well: > - - set t_Co=256 " Explicitly tell Vim that the terminal supports 256 colors - -============================================================================== -4. Configuration *Powerline-configuration* - -Powerline will work fine without any user configuration, but default behavior -can be overridden by setting configuration variables globally in your |vimrc| -file. - ------------------------------------------------------------------------------- -4.1 Powerline_cache_file *Powerline_cache_file* - -By default Powerline caches all the statuslines and colors in a cache file in -the plugin's directory (or the Vim directory, depending on the installation -method used). - -It's recommended that you enable the cache, as this dramatically improves Vim -startup time after the cache file has been generated (the plugin usually loads -within ~100ms without the cache and ~1ms with the cache). - -Note: The default cache filename includes the current theme, colorscheme and -symbol settings in order to tie the cache file to your current configuration, -so the cache file will be regenerated when you change any settings. This may -leave several old cache files in your Vim folder, and these may safely be -deleted. - -Defaults: "/Powerline___.cache" - ------------------------------------------------------------------------------- -4.1.1 Clearing the cache *:PowerlineClearCache* - -Powerline provides a command to easily clear the cache after changing your -settings or updating your theme. Simply run the following command to clear -your cache, and restart Vim afterwards: > - - :PowerlineClearCache -< ------------------------------------------------------------------------------- -4.2 Powerline_cache_enabled *Powerline_cache_enabled* - -It's possible to disable statusline caching by setting this option to 0. This -is mostly useful when developing statuslines. - -Example: > - - let g:Powerline_cache_enabled = 0 -< - -Default: 1 - ------------------------------------------------------------------------------- -4.3 Powerline_symbols *Powerline_symbols* - -This option defines which set of symbols and dividers you want to use. There -are currently three available options: "compatible", "unicode" and "fancy". - - TYPE DESCRIPTION ~ - compatible Doesn't use any special characters. - unicode Simulates icons and arrows using similar Unicode glyphs. - fancy Custom icons and arrows. Requires a patched font. - -Example: > - - let g:Powerline_symbols = 'fancy' -< - -Default: "compatible" - -Symbols can be inserted into statuslines by using the following variables -(just insert the variables as text in your segments): - - VARIABLE DESCRIPTION ~ - $BRANCH Inserts a branch symbol - $RO Inserts a read-only symbol - $FT Inserts a filetype symbol - $LINE Inserts a line number symbol - ------------------------------------------------------------------------------- -4.3.1 Compatible symbols *Powerline-symbols-compatible* - -These symbols will work in any configuration, and do not require a special -font to work. This option will replace the fancy icons with plain text, and -the pointy dividers with straight lines. - ------------------------------------------------------------------------------- -4.3.2 Fancy symbols *Powerline-symbols-fancy* - -These symbols require a custom font to work. A font patcher is provided for -adding the required symbols to any outline font and some bitmap fonts, see -|Powerline-fonts| and the provided README file for usage details. - ------------------------------------------------------------------------------- -4.3.3 Overriding symbols *Powerline_symbols_override* - -You can override symbols by adding your symbols to the -g:Powerline_symbols_override dictionary. Example: If you want the branch -symbol to be "∓" (hex code 0x2213) and the line symbol to be "L" you can add -the following to your |vimrc|: > - - let g:Powerline_symbols_override = { - \ 'BRANCH': [0x2213], - \ 'LINE': 'L', - \ } -< ------------------------------------------------------------------------------- -4.3.4 Overriding dividers *Powerline_dividers_override* - -If you for some reason want to override the dividers then you can set -g:Powerline_dividers_override to a list with exactly four elements: - - 1: Hard right-pointing arrow - 2: Soft right-pointing arrow - 3: Hard left-pointing arrow - 4: Soft left-pointing arrow - -Example: > - - let g:Powerline_dividers_override = ['>>', '>', '<<', '<'] -< - ------------------------------------------------------------------------------- -4.3.5 Overriding mode names *Powerline_mode* - -You can change the names used for modes at the far left by setting some -variables in your |vimrc|. For example you can change "N" to "NORMAL" with: > - - let g:Powerline_mode_n = 'NORMAL' -< -The variables are all named beginning with 'g:Powerline_mode_', as follows: - -mode name default note ~ -Normal n ' N ' (surrounded by spaces) -Insert i INSERT -Replace R REPLACE |Replace-mode| -Visual v VISUAL |Visual-mode| -Visual linewise V V⋅LINE -Visual blockwise cv V⋅BLOCK -Select s SELECT |Select-mode| -Select linewise S S⋅LINE -Select blockwise cs S⋅BLOCK - ------------------------------------------------------------------------------ -4.4 Powerline_theme *Powerline_theme* - -This option defines the theme Powerline uses. The available themes are located -in autoload/Powerline/Themes/. A theme is a pre-defined set of Powerline -segments which make up the statusline. - -Example: > - - let g:Powerline_theme = 'skwp' -< - -Default: "default" - ------------------------------------------------------------------------------- -4.5 Powerline_colorscheme *Powerline_colorscheme* - -This option defines the colorscheme Powerline uses. The available colorschemes -are located in autoload/Powerline/Colorschemes/. - -Example: > - - let g:Powerline_colorscheme = 'skwp' -< - -Default: "default" - ------------------------------------------------------------------------------- -4.6 Powerline_stl_path_style *Powerline_stl_path_style* - -There are currently four ways to display the current path and file name. The -default is to only display the file name like the %t statusline item. By -setting this configuration value you can choose from the following ways -display the current path and file name: - - VALUE DESCRIPTION ~ - filename Display only the file name using the %t statusline item. - short Display a short path. The home directory is substituted with - "~", the first directory is displayed with its full name, and - subsequent directories are shortened to their first letter. - I.e. "/home/user/foo/bar/baz.vim" becomes "~/f/b/baz.vim" and - "long/relative/path/foo/bar/baz.vim becomes - "long/r/p/f/b/baz.vim". - relative Display a relative path, similar to the %f statusline item. - full Display the full path, similar to the %F statusline item. - -Example: > - - let g:Powerline_stl_path_style = 'full' -< - -Default: "relative" - -============================================================================== -5. Fonts *Powerline-fonts* - -TODO - -============================================================================== -6. Customization *Powerline-customization* - -There are currently two ways of customizing Powerline: Basic customization -using a couple of functions to insert and remove existing segments from the -statusline, and advanced customization using your own autoload files. The -customization features of Powerline allow you to create your own statuslines -without ever touching the original source code. - ------------------------------------------------------------------------------- -6.1 Basic customization *Powerline-basic-customization* - -Powerline provides the following functions to alter the default statusline -look. These functions should be called from your |vimrc| file or another file -which is sourced at Vim startup. - -Note: These functions are currently applied to all statuslines, so if you -insert a segment after a segment which is present in many statuslines (e.g. -the "filename" segment), all the statuslines will have the inserted segment. -This behavior may be changed in a future version of Powerline. - -Note: Remember to clear your cache with |:PowerlineClearCache| after changing -your statusline! - -Example: > - - " Insert the charcode segment after the filetype segment - call Pl#Theme#InsertSegment('charcode', 'after', 'filetype') - - " Replace the scrollpercent segment with the charcode segment - call Pl#Theme#ReplaceSegment('scrollpercent', 'fileinfo') -< - *Pl#Theme#InsertSegment* -Pl#Theme#InsertSegment({newsegment}, {location}, {targetsegment}) - -This function inserts {newsegment} before or after {targetsegment}. The -{location} parameter specifies the location of the new segment, valid values -are "before" and "after". You can see all the available segments in -autoload/Powerline/Segments.vim and the files specified in -|Powerline-cust-segments|. - -Pl#Theme#RemoveSegment({targetsegment}) *Pl#Theme#RemoveSegment* - -This function removes the {targetsegment} segment entirely. - -Pl#Theme#ReplaceSegment({oldsegment}, {newsegment}) *Pl#Theme#ReplaceSegment* - -This function replaces {oldsegment} with {newsegment}. - ------------------------------------------------------------------------------- -6.2 Advanced customization *Powerline-advanced-customization* - -Because Powerline utilizes Vim's autoload functionality, you can easily create -your own segments, themes, functions and colorschemes without touching the -original source code. This is a bit more complex than using the utility -functions, but it allows you to do a lot more with your statusline. - -Your custom autoload files should be stored in your |runtimepath| (usually in -"~/.vim/autoload/Powerline/*"). - -Note: Remember to clear your cache with |:PowerlineClearCache| after changing -your statusline! - -6.2.1 Colorschemes *Powerline-cust-colorschemes* ------------------------------------------------------------------------------- - -Colorschemes should be stored as separate files in -{runtimepath}/autoload/Powerline/Colorschemes/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.2 Functions *Powerline-cust-functions* ------------------------------------------------------------------------------- - -Functions should be stored as separate files in -{runtimepath}/autoload/Powerline/Functions/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.3 Segments *Powerline-cust-segments* ------------------------------------------------------------------------------- - -Segments should be stored as separate files in -{runtimepath}/autoload/Powerline/Segments/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -6.2.4 Themes *Powerline-cust-themes* ------------------------------------------------------------------------------- - -Themes should be stored as separate files in -{runtimepath}/autoload/Powerline/Themes/. - -SYNTAX ~ - -TODO - -EXAMPLE ~ - -TODO - -============================================================================== -7. License *Powerline-license* - -Creative Commons Attribution-ShareAlike 3.0 Unported - -http://creativecommons.org/licenses/by-sa/3.0/ - -============================================================================== -8. Known issues *Powerline-known-issues* - -See the issue tracker at -https://github.com/Lokaltog/vim-powerline/issues - -============================================================================== -9. Contributing *Powerline-contributing* - -If you experience any bugs or have feature requests, please open an issue on -GitHub. Fork the source repository on GitHub and send a pull request if you -have any code improvements. - -Author: Kim Silkebækken -Source repository: https://github.com/Lokaltog/vim-powerline - -============================================================================== -vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd b/sources_non_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd deleted file mode 100644 index 34d7d0c8..00000000 --- a/sources_non_forked/vim-powerline/fontpatcher/PowerlineSymbols.sfd +++ /dev/null @@ -1,319 +0,0 @@ -SplineFontDB: 3.0 -FontName: PowerlineSymbols -FullName: PowerlineSymbols -FamilyName: PowerlineSymbols -Weight: Medium -Copyright: -UComments: "2011-11-21: Created." -Version: 001.000 -ItalicAngle: 0 -UnderlinePosition: -98.6328 -UnderlineWidth: 48.8281 -Ascent: 800 -Descent: 200 -LayerCount: 2 -Layer: 0 0 "Back" 1 -Layer: 1 0 "Fore" 0 -XUID: [1021 211 26716215 11021609] -FSType: 0 -OS2Version: 0 -OS2_WeightWidthSlopeOnly: 0 -OS2_UseTypoMetrics: 1 -CreationTime: 1321867751 -ModificationTime: 1326665029 -OS2TypoAscent: 0 -OS2TypoAOffset: 1 -OS2TypoDescent: 0 -OS2TypoDOffset: 1 -OS2TypoLinegap: 90 -OS2WinAscent: 0 -OS2WinAOffset: 1 -OS2WinDescent: 0 -OS2WinDOffset: 1 -HheadAscent: 0 -HheadAOffset: 1 -HheadDescent: 0 -HheadDOffset: 1 -OS2Vendor: 'PfEd' -MarkAttachClasses: 1 -DEI: 91125 -Encoding: UnicodeFull -Compacted: 1 -UnicodeInterp: none -NameList: Adobe Glyph List -DisplaySize: -24 -AntiAlias: 1 -FitToEm: 1 -WinInfo: 0 31 18 -BeginPrivate: 0 -EndPrivate -BeginChars: 1114112 9 - -StartChar: uni2B80 -Encoding: 11136 11136 0 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 1000 m 1 - 621 379 l 1 - 0 -243 l 1 - 0 1000 l 1 -EndSplineSet -EndChar - -StartChar: uni2B81 -Encoding: 11137 11137 1 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -10 991 m 0 - 16 997 23 1000 32 1000 c 0 - 41 1000 48 996 54 990 c 2 - 613 400 l 2 - 619 394 621 386 621 378 c 0 - 621 370 618 362 613 357 c 2 - 54 -233 l 2 - 48 -239 41 -242 32 -242 c 0 - 23 -242 16 -240 10 -234 c 0 - 4 -228 0 -221 0 -212 c 0 - 0 -203 3 -196 8 -190 c 2 - 547 379 l 1 - 8 948 l 2 - 3 954 0 961 0 970 c 0 - 0 979 4 985 10 991 c 0 -EndSplineSet -EndChar - -StartChar: uni2B82 -Encoding: 11138 11138 2 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -621 1000 m 5 - 621 -243 l 5 - 0 379 l 5 - 621 1000 l 5 -EndSplineSet -EndChar - -StartChar: uni2B83 -Encoding: 11139 11139 3 -Width: 621 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -612 991 m 0 - 618 985 621 979 621 970 c 0 - 621 961 619 954 613 948 c 2 - 74 379 l 1 - 613 -190 l 2 - 619 -196 621 -203 621 -212 c 0 - 621 -221 618 -228 612 -234 c 0 - 606 -240 598 -242 589 -242 c 0 - 580 -242 574 -239 568 -233 c 2 - 8 357 l 2 - 3 362 0 370 0 378 c 0 - 0 386 3 394 8 400 c 2 - 568 990 l 2 - 574 996 580 1000 589 1000 c 0 - 598 1000 606 997 612 991 c 0 -EndSplineSet -EndChar - -StartChar: uni2B61 -Encoding: 11105 11105 4 -Width: 555 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 800 m 5 - 92 800 l 5 - 92 513 l 5 - 253 513 l 5 - 253 444 l 5 - 0 444 l 5 - 0 800 l 5 -236 312 m 5 - 339 312 l 5 - 468 67 l 5 - 468 312 l 5 - 555 312 l 5 - 555 -44 l 5 - 453 -44 l 5 - 323 200 l 5 - 323 -44 l 5 - 236 -44 l 5 - 236 312 l 5 -EndSplineSet -EndChar - -StartChar: uni2B60 -Encoding: 11104 11104 5 -Width: 676 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 197 m 1 - 94 207 419 279 419 384 c 2 - 419 537 l 1 - 278 501 l 1 - 478 794 l 1 - 677 501 l 1 - 536 537 l 1 - 536 384 l 2 - 536 196 208 126 208 21 c 2 - 208 -244 l 1 - 0 -244 l 1 - 0 197 l 1 -0 288 m 1 - 0 405 0 944 0 944 c 1 - 208 944 l 1 - 208 944 208 451 208 334 c 1 - 185 311 12 288 0 288 c 1 -EndSplineSet -EndChar - -StartChar: uni2B62 -Encoding: 11106 11106 6 -Width: 428 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -88 677 m 2 - 429 677 l 1 - 429 589 l 1 - 88 589 l 1 - 88 162 l 1 - 198 162 l 1 - 198 343 l 1 - 374 343 l 1 - 374 427 l 1 - 198 427 l 1 - 198 506 l 1 - 429 506 l 1 - 429 274 l 1 - 416 263 391 255 374 255 c 2 - 286 255 l 1 - 286 162 l 2 - 286 114 246 74 198 74 c 2 - 88 74 l 2 - 40 74 0 114 0 162 c 2 - 0 589 l 2 - 0 637 40 677 88 677 c 2 -EndSplineSet -EndChar - -StartChar: uni2B63 -Encoding: 11107 11107 7 -Width: 428 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -0 677 m 5 - 341 677 l 6 - 389 677 429 637 429 589 c 6 - 429 506 l 6 - 429 458 389 418 341 418 c 6 - 287 418 l 5 - 287 162 l 6 - 287 114 247 74 199 74 c 6 - 89 74 l 6 - 41 74 1 114 1 162 c 6 - 1 274 l 6 - 0 274 l 6 - 0 506 l 5 - 89 506 l 5 - 89 162 l 5 - 199 162 l 5 - 199 506 l 5 - 341 506 l 5 - 341 589 l 5 - 0 589 l 5 - 0 677 l 5 -EndSplineSet -EndChar - -StartChar: uni2B64 -Encoding: 11108 11108 8 -Width: 546 -VWidth: 0 -Flags: HMW -LayerCount: 2 -Fore -SplineSet -273 733 m 4 - 429 733 430 538 430 538 c 5 - 430 420 l 5 - 547 420 l 5 - 547 303 l 5 - 547 303 546 -9 273 -9 c 4 - 0 -9 0 303 0 303 c 5 - 0 420 l 5 - 117 420 l 5 - 117 538 l 5 - 117 538 117 733 273 733 c 4 -273 655 m 4 - 195 655 195 576 195 420 c 5 - 352 420 l 5 - 352 576 351 655 273 655 c 4 -273 342 m 4 - 195 342 195 147 273 147 c 4 - 351 147 351 342 273 342 c 4 -EndSplineSet -EndChar -EndChars -BitmapFont: 10 10 8 2 1 -BDFChar: 0 11136 6 0 4 -2 7 -JAC+4q"X@:^jlCb -BDFChar: 1 11137 6 0 4 -2 7 -J3Y4g#RCta5_&h7 -BDFChar: 2 11138 6 1 5 -2 7 -#T,OGq"T(n(^L*A -BDFChar: 3 11139 6 1 5 -2 7 -#S8+DJ:Km-&-r79 -BDFChar: 4 11105 6 1 4 -1 7 -J:N1>!0GR3O8o7\ -BDFChar: 5 11104 7 0 5 -2 7 -^rYQ3 -BDFChar: 8 11108 5 0 5 0 6 -0M"b4bku\c -EndBitmapFont -BitmapFont: 12 10 10 2 1 -BDFChar: 0 11136 7 0 6 -2 11 -!!%Pbi:-O>r:od>^jlCb -BDFChar: 1 11137 7 0 6 -3 11 -!!%O7+:ne]":,P]5_&h7 -BDFChar: 2 11138 7 0 6 -2 11 -!!!-1*'AWHr-UUH$j6P1 -BDFChar: 3 11139 7 0 6 -2 11 -!!!--&0O5gJ3Y4g#Qt,- -BDFChar: 4 11105 7 0 5 0 8 -J:N1>!$jBP,QIfE -BDFChar: 5 11104 8 0 8 -3 11 -z^];.Ma8juqa8j9]a8jQehuLOm^];.Mz -BDFChar: 6 11106 5 1 6 0 8 -!-j$]R"1Qc?iU0, -BDFChar: 7 11107 5 0 5 0 7 -p]QtGOH>Q3 -BDFChar: 8 11108 7 0 5 0 8 -0M"`*r63C_GQ7^D -EndBitmapFont -EndSplineFont diff --git a/sources_non_forked/vim-powerline/fontpatcher/README.rst b/sources_non_forked/vim-powerline/fontpatcher/README.rst deleted file mode 100644 index 35b3d5d0..00000000 --- a/sources_non_forked/vim-powerline/fontpatcher/README.rst +++ /dev/null @@ -1,164 +0,0 @@ -====================== -Powerline font patcher -====================== - -:Author: Kim Silkebækken (kim.silkebaekken+vim@gmail.com) - -Description ------------ - -This font patcher creates dividers and symbols for use with Powerline. The -script requires Python 2 and FontForge compiled with Python bindings. - -Patched fonts are renamed by default (" for Powerline" is added to the font -name) so they don't conflict with existing fonts. Use the ``--no-rename`` -option to disable font renaming. - -Glyph table ------------ - -All the glyphs are stored in the ``U+2B60``-``U+2BFF`` range ("Misc symbols -and arrows"). - -+------------+-------------------+ -| Code point | Description | -+============+===================+ -| ``U+2B60`` | Branch symbol | -+------------+-------------------+ -| ``U+2B61`` | LN (line) symbol | -+------------+-------------------+ -| ``U+2B62`` | FT symbol, part 1 | -+------------+-------------------+ -| ``U+2B63`` | FT symbol, part 2 | -+------------+-------------------+ -| ``U+2B64`` | Padlock (closed) | -+------------+-------------------+ -| ``U+2B80`` | Hard right arrow | -+------------+-------------------+ -| ``U+2B81`` | Soft right arrow | -+------------+-------------------+ -| ``U+2B82`` | Hard left arrow | -+------------+-------------------+ -| ``U+2B83`` | Soft left arrow | -+------------+-------------------+ - -=================== -Font patching guide -=================== - -There's a `GitHub wiki page`_ dedicated to community-contributed patched -fonts. You may download one of the fonts on that page if you don't want to -patch the fonts yourself. - -If you do patch a font that's not included in the wiki (and you have -permission to distribute it), please include it on the wiki page. - -**Note:** The fonts in the wiki may be outdated, and may have different -glyphs than the ones provided in the latest version of Powerline. It's -recommended that you always patch your fonts yourself if you have the -required software. - -.. _`GitHub wiki page`: https://github.com/Lokaltog/vim-powerline/wiki/Patched-fonts - -Linux ------ - -1. Install fontforge with Python bindings. For Ubuntu users the required - package is ``python-fontforge``, for Arch Linux users the required - package is ``fontforge``. It should be something similar for other - distros. - -2. Run the font patcher:: - - $ /path/to/fontpatcher MyFontFile.ttf - -3. Copy the font file into ``~/.fonts`` (or another X font directory):: - - $ cp MyFontFile-Powerline.otf ~/.fonts - - **Note:** If the font is a pure bitmap font (e.g. a PCF font) it will be - stored in the BDF format. This is usually not a problem, and you may - convert the font back to the PCF format using ``bdftopcf`` if you want - to. All other fonts will be stored in the OTF format regardless of the - original format. - -4. Update your font cache:: - - $ sudo fc-cache -vf - - **Note:** If you use vim in rxvt-unicode in the client/daemon mode, you - may need to close all running terminals as well for the font to be - updated. - -5. **For gvim users:** Update the GUI font in your ``vimrc`` file:: - - set guifont=MyFont\ for\ Powerline - - **For terminal users:** Update your terminal configuration to use the - patched font. - -6. Update your ``vimrc`` configuration to use the new symbols:: - - let g:Powerline_symbols = 'fancy' - -7. Make sure that the cache file is deleted:: - - $ rm /tmp/Powerline.cache - -8. Start vim and enjoy your new statusline! - -OS X ----- - -1. Check if you have a FontForge version with Python support by running - ``fontforge -version``. You should see something like this:: - - $ fontforge -version - Copyright (c) 2000-2011 by George Williams. - Executable based on sources from 13:48 GMT 22-Feb-2011-D. - Library based on sources from 13:48 GMT 22-Feb-2011. - fontforge 20110222 - libfontforge 20110222 - - Make sure that the executable version number doesn't have ``NoPython`` in - it. If everything looks OK, skip ahead to step 4. - -2. If you have FontForge but with ``NoPython`` in the version number, please - try to update to a later version:: - - $ brew uninstall fontforge - $ brew update - $ brew install --use-gcc fontforge - - **Note:** You may have to use ``--use-clang`` instead of ``--use-gcc`` - when compiling FontForge. - -3. If you don't have FontForge, install it with Homebrew:: - - $ brew update - $ brew install --use-gcc fontforge - -4. Patch your fonts by passing the ``fontpatcher`` script as a parameter to - FontForge:: - - $ fontforge -script /path/to/fontpatcher MyFontFile.ttf - -5. Install the font by double-clicking the font file in Finder and click - "Install this font" from the preview window. - -6. **For gvim users:** Update the GUI font in your ``vimrc`` file:: - - set guifont=MyFont\ for\ Powerline - - **For terminal users:** Update your terminal configuration to use the - patched font. - -7. Update your ``vimrc`` configuration to use the new symbols:: - - let g:Powerline_symbols = 'fancy' - -8. Make sure that the cache file is deleted:: - - $ rm /tmp/Powerline.cache - -9. Start vim and enjoy your new statusline! diff --git a/sources_non_forked/vim-powerline/fontpatcher/fontpatcher b/sources_non_forked/vim-powerline/fontpatcher/fontpatcher deleted file mode 100755 index 2c54a3fa..00000000 --- a/sources_non_forked/vim-powerline/fontpatcher/fontpatcher +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env python - -"""Font patcher for Powerline. - -Creates dividers and symbols for use with Powerline. Requires FontForge with Python bindings. - -Stores glyphs in the 2b60-2bff Unicode range ("Misc symbols and arrows"). - -[2b60] Branch symbol -[2b61] LN (line) symbol -[2b62] FT symbol 1 -[2b63] FT symbol 2 -[2b64] Padlock (closed) symbol -[2b80] Hard right arrow -[2b81] Soft right arrow -[2b82] Hard left arrow -[2b83] Soft left arrow -""" - -from __future__ import division - -import argparse -import os -import sys -import re - -try: - import fontforge - import psMat -except ImportError: - sys.stderr.write('The required FontForge modules could not be loaded.\n\n') - - if sys.version_info.major > 2: - sys.stderr.write('FontForge only supports Python 2. Please run this script with the Python 2 executable - e.g. "python2 {0}"\n'.format(sys.argv[0])) - else: - sys.stderr.write('You need FontForge with Python bindings for this script to work.\n') - - sys.exit(1) - -# Handle command-line arguments -parser = argparse.ArgumentParser(description='Font patcher for Powerline. Creates dividers and symbols in FontForge-compatible font files. Requires FontForge with Python bindings. Stores glyphs in the U+2B80-U+2BFF range ("Miscellaneous symbols and arrows"). Stores the patched font as a new, renamed font file by default.') - -parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') -parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') -parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) -parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono') -parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin') - -args = parser.parse_args() - -SYM_ATTR = { - # Right/left-aligned glyphs will have their advance width reduced in order to overlap the next glyph slightly - 0x2b60: { 'align': 'c', 'stretch': 'y' , 'overlap': False }, - 0x2b61: { 'align': 'c', 'stretch': '' , 'overlap': False }, - 0x2b62: { 'align': 'r', 'stretch': '' , 'overlap': False }, - 0x2b63: { 'align': 'l', 'stretch': '' , 'overlap': False }, - 0x2b64: { 'align': 'c', 'stretch': '' , 'overlap': False }, - 0x2b80: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, - 0x2b81: { 'align': 'l', 'stretch': 'xy', 'overlap': True }, - 0x2b82: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, - 0x2b83: { 'align': 'r', 'stretch': 'xy', 'overlap': True }, -} - -# Open symbol font -try: - symbols = fontforge.open(args.symbol_font) -except EnvironmentError: - sys.exit(1) - -# Patch provided fonts -for font_path in args.fonts: - try: - font = fontforge.open(font_path) - except EnvironmentError: - sys.exit(1) - - # Rename font - if args.rename: - font.familyname += ' for Powerline' - font.fullname += ' for Powerline' - font.fontname += 'ForPowerline' - font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) - font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) - if args.fixwin: - font.fontname = re.sub(r'\W', '', font.familyname) - - # Force the em size to be equal - symbols.em = font.em - - # Initial font dimensions - font_dim = { - 'xmin' : 0, - 'ymin' : -font.descent, - 'xmax' : 0, - 'ymax' : font.ascent, - - 'width' : 0, - 'height': 0, - } - - # Find the biggest char width and height - # - # 0x00-0x17f is the Latin Extended-A range - # 0x2500-0x2600 is the box drawing range - for glyph in range(0x00, 0x17f) + range(0x2500, 0x2600): - try: - (xmin, ymin, xmax, ymax) = font[glyph].boundingBox() - except TypeError: - continue - - if font_dim['width'] == 0: - font_dim['width'] = font[glyph].width - - if ymin < font_dim['ymin']: font_dim['ymin'] = ymin - if ymax > font_dim['ymax']: font_dim['ymax'] = ymax - if xmax > font_dim['xmax']: font_dim['xmax'] = xmax - - # Calculate font height - font_dim['height'] = abs(font_dim['ymin']) + font_dim['ymax'] - - # Update the font encoding to ensure that the Unicode glyphs are available - font.encoding = 'ISO10646' - - # Fetch this property before adding outlines - onlybitmaps = font.onlybitmaps - - def get_dim(glyph): - bbox = glyph.boundingBox() - - return { - 'xmin' : bbox[0], - 'ymin' : bbox[1], - 'xmax' : bbox[2], - 'ymax' : bbox[3], - - 'width' : bbox[2] + (-bbox[0]), - 'height': bbox[3] + (-bbox[1]), - } - - # Create glyphs from symbol font - for sym_glyph in symbols.glyphs(): - sym_attr = SYM_ATTR[sym_glyph.unicode] - - # Prepare symbol glyph dimensions - sym_dim = get_dim(sym_glyph) - - # Select and copy symbol from its encoding point - symbols.selection.select(sym_glyph.encoding) - symbols.copy() - - # Select and paste symbol to its unicode code point - font.selection.select(sym_glyph.unicode) - font.paste() - - # Now that we have copy/pasted the glyph, it's time to scale and move it - - # Handle glyph stretching - if 'x' in sym_attr['stretch']: - # Stretch the glyph horizontally - scale_ratio = font_dim['width'] / sym_dim['width'] - - font.transform(psMat.scale(scale_ratio, 1)) - if 'y' in sym_attr['stretch']: - # Stretch the glyph vertically - scale_ratio = font_dim['height'] / sym_dim['height'] - - font.transform(psMat.scale(1, scale_ratio)) - - # Use the dimensions from the pasted and stretched glyph - sym_dim = get_dim(font[sym_glyph.unicode]) - - # Center-align the glyph vertically - font_ycenter = font_dim['height'] / 2 - sym_ycenter = sym_dim['height'] / 2 - - # First move it to the ymax (top) - font.transform(psMat.translate(0, font_dim['ymax'] - sym_dim['ymax'])) - - # Then move it the y center difference - font.transform(psMat.translate(0, sym_ycenter - font_ycenter)) - - # Ensure that the glyph doesn't extend outside the font's bounding box - if sym_dim['width'] > font_dim['width']: - # The glyph is too wide, scale it down to fit - scale_matrix = psMat.scale(font_dim['width'] / sym_dim['width'], 1) - - font.transform(scale_matrix) - - # Use the dimensions from the stretched glyph - sym_dim = get_dim(font[sym_glyph.unicode]) - - # Handle glyph alignment - if sym_attr['align'] == 'c': - # Center align - align_matrix = psMat.translate(font_dim['width'] / 2 - sym_dim['width'] / 2 , 0) - elif sym_attr['align'] == 'r': - # Right align - align_matrix = psMat.translate(font_dim['width'] - sym_dim['width'], 0) - else: - # No alignment (left alignment) - align_matrix = psMat.translate(0, 0) - - font.transform(align_matrix) - - if sym_attr['overlap'] is True: - overlap_width = font.em / 48 - - # Stretch the glyph slightly horizontally if it should overlap - font.transform(psMat.scale((sym_dim['width'] + overlap_width) / sym_dim['width'], 1)) - - if sym_attr['align'] == 'l': - # The glyph should be left-aligned, so it must be moved overlap_width to the left - # This only applies to left-aligned glyphs because the glyph is scaled to the right - font.transform(psMat.translate(-overlap_width, 0)) - - # Ensure the font is considered monospaced on Windows - font[sym_glyph.unicode].width = font_dim['width'] - - if font.bitmapSizes and not onlybitmaps: - # If this is an outline font with bitmaps, regenerate bitmaps for the changed glyphs - font.selection.changed() - - for size in font.bitmapSizes: - font.regenBitmaps((size, )) - - output_name, extension = os.path.split(font_path)[1].rsplit('.', 1) - if extension.lower() not in ['ttf', 'otf']: - # Default to OpenType if input is not TrueType/OpenType - extension = 'otf' - if args.fixmono: - for glyph in font.glyphs(): - if glyph.width == 0: glyph.width = font_dim['width'] - - if onlybitmaps: - # Generate BDF font - font.generate('{0}-Powerline.bdf'.format(output_name, bitmap_type='bdf')) - else: - # Generate OTF/TTF font - font.generate('{0}-Powerline.{1}'.format(output_name, extension)) - diff --git a/sources_non_forked/vim-powerline/plugin/Powerline.vim b/sources_non_forked/vim-powerline/plugin/Powerline.vim deleted file mode 100644 index 5454aa49..00000000 --- a/sources_non_forked/vim-powerline/plugin/Powerline.vim +++ /dev/null @@ -1,69 +0,0 @@ -" Powerline - The ultimate statusline utility -" -" Author: Kim Silkebækken -" Source repository: https://github.com/Lokaltog/vim-powerline - -" Script initialization {{{ - if exists('g:Powerline_loaded') || &compatible || version < 702 - finish - endif - - let g:Powerline_loaded = 1 -" }}} -" Commands {{{ - command! PowerlineClearCache call Pl#ClearCache() - command! PowerlineReloadColorscheme call Pl#ReloadColorscheme() -" }}} -" Set default options {{{ - for [s:key, s:value] in items({ - \ 'theme' : 'default' - \ , 'colorscheme' : 'default' - \ , 'symbols' : 'compatible' - \ , 'symbols_override' : {} - \ , 'dividers_override': [] - \ , 'stl_path_style' : 'relative' - \ , 'cache_enabled' : 1 - \ }) - - if ! exists('g:Powerline_' . s:key) - exec printf('let g:Powerline_%s = %s', s:key, string(s:value)) - endif - - unlet! s:key s:value - endfor - - if ! exists('g:Powerline_cache_file') - exec 'let g:Powerline_cache_file = '. string(printf('%s/Powerline_%s_%s_%s.cache' - \ , simplify(expand(':p:h') .'/..') - \ , g:Powerline_theme - \ , g:Powerline_colorscheme - \ , g:Powerline_symbols - \ )) - endif -" }}} -" Autocommands {{{ - function! s:CreateAutocmds() - augroup PowerlineMain - autocmd! - - " Reload statuslines when changing color scheme - autocmd ColorScheme * - \ call Pl#Load() - - autocmd BufEnter,WinEnter,FileType,BufUnload * - \ call Pl#UpdateStatusline(1) - - autocmd BufLeave,WinLeave * - \ call Pl#UpdateStatusline(0) - - autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim - \ :PowerlineReloadColorscheme - augroup END - endfunction - - augroup PowerlineStartup - autocmd! - - autocmd VimEnter * call s:CreateAutocmds() | call Pl#UpdateStatusline(1) - augroup END -" }}} diff --git a/sources_non_forked/vim-snipmate/README.rst b/sources_non_forked/vim-snipmate/README.rst index 55dae899..26916e6e 100644 --- a/sources_non_forked/vim-snipmate/README.rst +++ b/sources_non_forked/vim-snipmate/README.rst @@ -2,8 +2,17 @@ snipmate.vim ============ +IMPORTANT: comment on: [What about merging whith Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114) +status: snipmate-snippet files are read by Ultisnip flawlessly. See +snipmate-snippets readme about how to configure and use Ultisnips as alternative +That branch also supports completion menu now +Thus there is only one reason left to keep using snipmate from my point of +view: not having python support. +In other words: upstream of snipmate is almost dead. (Better to say Marc Weber is not going to fix any bugs anymore) + + :Author: `Michael Sanders`_ -:Maintainer: `Rok Garbas`_ +:Maintainer: `Adnan Zafar`_ & `Rok Garbas`_ & `Marc Weber`_ :Homepage: http://www.vim.org/scripts/script.php?script_id=2540 :Contributors: `MarcWeber`_, `lilydjwg`_, `henrik`_, `steveno`_, `asymmetric`_, `jherdman`_, `ironcamel`_, `honza`_, `jb55`_, `robhudson`_, `kozo2`_, `MicahElliott`_, `darkwise`_, `redpill`_, `thisgeek`_, `sickill`_, `pose`_, `marutanm`_, `r00k`_, `jbernard`_, `holizz`_, `muffinresearch`_, `statik`_, `taq`_, `alderz`_, `pielgrzym`_ @@ -11,79 +20,46 @@ snipmate.vim .. contents:: -Changelog +ChangeLog ========= -1.0 [Unreleased] ----------------- +0.85 [2013-04-03] +----------------- - * Split snippet files into separate git repository (github/honza/snipmate-snippets). [2011-06-20, `honza`_] - See 'Snippets repository' below. +* Allow trigger key customization +* Enable undoing of snippet expansion +* Support backslash escaping in snippets +* Add support for {VISUAL} +* Expand filetype extension with scope_aliases +* Add expansion guards +* Enable per-buffer expansion of snippets +* Fix 'cpo' compatibility +* Update supertab compatibility +* Enable customization of various things through g:snipMate - * Adding general snippets to ``css.snippets`` and ``htmldjango.snippets`` - [2011-06-10, `pielgrzym`_] +* Disable spelling in snippet files +* Highlight trigger names in .snippets files - * Adding ``css.snippets`` from `tisho`_ - (https://github.com/tisho/css-snippets-snipmate) - [2011-04-17, `garbas`_] +* Update many snippets +* Separate sample snippets into separate repository - * Lots of updates to snippets. - - * Made the trigger key configurable, https://github.com/garbas/vim-snipmate/pull/4. - [2011-04-13, `thenoseman`_] - - * Handle single-line or multiline snippets. - [2011-03-22, `johnbintz`_] - - * If there is only one snippet choose it directly. - [2011-03-16, `blueyed`_] - - * Add snippets file for "diff" filetype and add bang to function - definitons, allowing for reload. - [2011-03-06, `blueyed`_] - - * Update snipmate to handle latest supertab version. - [2011-02-09, `ervandew`_] - - * Updated README: added contributors, instructions how to install snipMate, - some spellchecking of my wonderful English, added this Changelog - [2011-02-07, `garbas`_] - - * Fixed bug: When leaving a placeholder unchanged and trying to jump to the - next placeholder, the text of the first placeholder would get cleared. - [2011-06-16, `jgosmann`_] - - * From below mentioned merges I must specially mention `MarcWeber`_'s patch - which brought quite a few functionalities/improvements: - - snippets are loaded lazily. - - snippets are no longer cached. Thus you always get the snippets you - just wrote to a file without reloading anything. - - When visually selecting a snippet in a .snippets file you can press - to replace spaces by tabs automatically in a smart way. - Big +1 to `MarcWeber`_ for this. Important to note is that we now depend - on `vim-addon-mw-utils`_ and `tlib`_. - [2011-02-02, `garbas`_] - - * Merged pull requests of `MarcWeber`_, `lilydjwg`_, `henrik`_, `steveno`_, - `asymmetric`_, `jherdman`_, `ironcamel`_, `honza`_, `jb55`_, - `robhudson`_, `kozo2`_, `MicahElliott`_, `darkwise`_, `redpill`_, - `thisgeek`_, `sickill`_, `pose`_, - [2011-02-02, `garbas`_] +0.84 +---- +* Unreleased version by `Michael Sanders`_. Available on `GitHub`_. 0.83 [2009-07-13] ----------------- - * last release done by `Michael Sanders`_, you can find it here: - http://www.vim.org/scripts/download_script.php?src_id=11006 +* Last release done by `Michael Sanders`_. Available on `vim.org`_. How to install ============== -Unfortunately there are many ways to how to install vim plugins. If you don't -see your preferred way of installation plugins please consider updating +Unfortunately there are many ways to install vim plugins. If you don't +see your preferred way of installation, please consider updating this section. Basically, installation consists of 2 simple steps: 1. Install vim-snipmate @@ -92,7 +68,7 @@ this section. Basically, installation consists of 2 simple steps: snipmate dependencies ============== -Important to note is that since version 1.0 we depend on this 2 vim plugins: +Important to note is that since version 0.85 we depend on 2 vim plugins: * `vim-addon-mw-utils`_ providing the implementation for caching parsed .snippets files. @@ -106,12 +82,11 @@ Important to note is that since version 1.0 we depend on this 2 vim plugins: Using `VAM`_ (recommended) ------------ -:: +- Add `snipmate-snippets` to the names to be installed. Or use + "github:name/repo" if you want to use a non standard upstream. - Add snipmate-snippets to the names to be installed. Or use - "github:name/repo" if you want to use a non standard upstream. - The default snippets depend on "snipmate" so VAM will fetch the core along - with its dependencies automatically +The default snippets depend on "snipmate" so VAM will fetch the core along +with its dependencies automatically. Using `pathogen`_ -------------------------------------- @@ -126,7 +101,7 @@ Using `pathogen`_ # Install dependencies: % git clone https://github.com/tomtom/tlib_vim.git % git clone https://github.com/MarcWeber/vim-addon-mw-utils.git - % git clone https://github.com/honza/snipmate-snippets.git + % git clone https://github.com/honza/vim-snippets.git Using `Vundle`_ --------------- @@ -136,7 +111,7 @@ Using `Vundle`_ Install dependencies: Bundle "MarcWeber/vim-addon-mw-utils" Bundle "tomtom/tlib_vim" - Bundle "honza/snipmate-snippets" + Bundle "honza/vim-snippets" Install: Bundle "garbas/vim-snipmate" @@ -150,7 +125,7 @@ Manually (not recommended!) :: - % git clone git://github.com/honza/snipmate-snippets.git + % git clone git://github.com/honza/vim-snippets.git % git clone git://github.com/garbas/vim-snipmate.git % cd snipmate.vim % cp -R * ~/.vim @@ -166,20 +141,13 @@ Snippets repository There is now one snippet repo containing almost all snippets. You are encouraged to submit any fixes and new snippets there. -https://github.com/honza/snipmate-snippets +https://github.com/honza/vim-snippets -We also encourage people to maintain sets of snippets for particular use cases. -That all users can benefit from them people can list their snippet repositories here: - - * https://github.com/rbonvall/snipmate-snippets-bib (snippets for BibTeX files) - -Installation using VAM: "github:rbonvall/snipmate-snippets-bib" +More snippet repositories are listed at that repository's README file. Why forking snipMate? ===================== -:: - After several unsuccessful attempts of contacting Michael Sanders, no commits in last half year and long pull request line on github (none of pull requests were commented/replied/rejected) I decided to take action, @@ -197,18 +165,22 @@ Why forking snipMate? Maybe I will only maintain it for a while until Michael Sanders takes things back into his hand or until some other super-hero shows up. - Tnx and happy snipmating, Rok Garbas, 2011-02-02 + Tnx and happy snipmating, Rok Garbas & Marc Weber, 2011-02-02 +related work +============= +See doc/snipMate.txt + Known Bugs ============= - * Set one value default as input of another value. https://github.com/garbas/vim-snipmate/issues/59 [2011-10-18, `bogdan`_] + TODO / Future ============= @@ -230,8 +202,17 @@ TODO / Future If you volunteer tell me so that I can reference the link. [2011-02-02, `MarcWeber`_] + * tcomment claims to know which language mode you're editing in even if its + JS in PHP or HTML within PHP. It would be great if that functionality could be + moved into its own plugirn (vim-detect-language-at-cursor) or such. + Then a lot of the scoped_aliases (which causes collisions easily) could + be enhanced. + + .. _`Michael Sanders`: http://www.vim.org/account/profile.php?user_id=16544 +.. _`Adnan Zafar`: https://github.com/ajzafar .. _`Rok Garbas`: rok@garbas.si +.. _`Marc Weber`: marco-oweber@gmx.de .. _`VAM`: https://github.com/MarcWeber/vim-addon-manager .. _`pathogen`: http://www.vim.org/scripts/script.php?script_id=2332 .. _`vim-addon-mw-utils`: https://github.com/MarcWeber/vim-addon-mw-utils @@ -270,4 +251,6 @@ TODO / Future .. _`tisho`: https://github.com/tisho .. _`pielgrzym`: https://github.com/pielgrzym .. _`jgosmann`: https://github.com/jgosmann -.. _`taq': https://github.com/taq +.. _`taq`: https://github.com/taq +.. _`vim.org`: http://www.vim.org/scripts/script.php?script_id=2540 +.. _`GitHub`: http://github.com/msanders/snipmate.vim diff --git a/sources_non_forked/vim-snipmate/addon-info.json b/sources_non_forked/vim-snipmate/addon-info.json index 66c18c41..94903731 100644 --- a/sources_non_forked/vim-snipmate/addon-info.json +++ b/sources_non_forked/vim-snipmate/addon-info.json @@ -2,8 +2,8 @@ "name" : "snipMate", "version" : "dev", "author" : "Michael Sanders -> original project http://github.com/msanders/snipmate.vim", - "maintainer" : "Marc Weber (I maintain this fork only)", - "repository" : {"type": "git", "url": "git://github.com/MarcWeber/snipMate.vim.git"}, + "maintainer" : "Rok Garbas / Marc Weber", + "repository" : {"type": "git", "url": "git://github.com/garbas/vim-snipmate.git"}, "dependencies" : { "vim-addon-mw-utils": {}, "tlib": {} diff --git a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim index 4f51d246..76460826 100644 --- a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim @@ -4,6 +4,9 @@ if !exists('loaded_snips') || exists('s:did_snips_mappings') finish endif let s:did_snips_mappings = 1 +" save and reset 'cpo' +let s:save_cpo = &cpo +set cpo&vim " This is put here in the 'after' directory in order for snipMate to override " other plugin mappings (e.g., supertab). @@ -15,13 +18,13 @@ if !exists('g:snips_trigger_key') endif if !exists('g:snips_trigger_key_backwards') - let g:snips_trigger_key_backwards = ']', '', 'g') + let g:snips_trigger_key_backwards = ']', '', 'g') . '>' endif -exec 'ino ' . g:snips_trigger_key . ' u=snipMate#TriggerSnippet()' +exec 'ino ' . g:snips_trigger_key . ' =snipMate#TriggerSnippet()' exec 'snor ' . g:snips_trigger_key . ' i=snipMate#TriggerSnippet()' -exec 'ino ' . g:snips_trigger_key_backwards . '> =snipMate#BackwardsSnippet()' -exec 'snor ' . g:snips_trigger_key_backwards . '> i=snipMate#BackwardsSnippet()' +exec 'ino ' . g:snips_trigger_key_backwards . ' =snipMate#BackwardsSnippet()' +exec 'snor ' . g:snips_trigger_key_backwards . ' i=snipMate#BackwardsSnippet()' exec 'ino ' . g:snips_trigger_key . ' =snipMate#ShowAvailableSnips()' " maybe there is a better way without polluting registers ? @@ -45,4 +48,7 @@ if empty(snippets_dir) finish endif +" restore 'cpo' +let &cpo = s:save_cpo + " vim:noet:sw=4:ts=4:ft=vim diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 3ea6aab0..db254c30 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -10,6 +10,9 @@ catch /.*/ echoe "you're missing tlib. See install instructions at ".expand(':h:h').'/README.rst' endtry +" match $ which doesn't follow a \ +let s:d = '\%([\\]\@ endf fun! snipMate#expandSnip(snip, col) @@ -61,7 +61,7 @@ fun! snipMate#expandSnip(snip, col) if snippet == '' | return '' | endif " Expand snippet onto current position with the tab stops removed - let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1) + let snipLines = split(substitute(snippet, ''.s:d .'\d\+\|'.s:d .'{\d\+.\{-}}', '', 'g'), "\n", 1) let line = getline(lnum) let afterCursor = strpart(line, col - 1) @@ -86,23 +86,18 @@ fun! snipMate#expandSnip(snip, col) " Open any folds snippet expands into if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif - let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent) + let b:snip_state = copy(s:state_proto) + let [b:snip_state.stops, b:snip_state.stop_count] = s:BuildTabStops(snippet, lnum, col - indent, indent) - if s:snipLen - aug snipMateAutocmds - au CursorMovedI * call s:UpdateChangedSnip(0) - au InsertEnter * call s:UpdateChangedSnip(1) + if b:snip_state.stop_count + aug snipmate_changes + au CursorMovedI,InsertEnter call b:snip_state.update_changes() aug END - let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer - let s:curPos = 0 - let s:endCol = g:snipPos[s:curPos][1] - let s:endLine = g:snipPos[s:curPos][0] + call b:snip_state.set_stop(0) - call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1]) - let s:prevLen = [line('$'), col('$')] - if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif + return b:snip_state.select_word() else - unl g:snipPos s:snipLen + unlet b:snip_state " Place cursor at end of snippet if no tab stop is given let newlines = len(snipLines) - 1 call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor) @@ -111,6 +106,18 @@ fun! snipMate#expandSnip(snip, col) return '' endf +" Update state information to correspond to the given tab stop +function! s:state_proto.set_stop(stop) + let self.stop_no = a:stop + let self.cur_stop = self.stops[self.stop_no] + let self.end_col = self.cur_stop[1] + self.cur_stop[2] + let self.start_col = self.cur_stop[1] + call cursor(self.cur_stop[0], self.cur_stop[1]) + let self.prev_len = col('$') + let self.has_vars = exists('self.cur_stop[3]') + let self.old_vars = self.has_vars ? deepcopy(self.cur_stop[3]) : [] +endfunction + " Prepare snippet to be processed by s:BuildTabStops fun! s:ProcessSnippet(snip) let snippet = a:snip @@ -147,16 +154,16 @@ fun! s:ProcessSnippet(snip) " Place all text after a colon in a tab stop after the tab stop " (e.g. "${#:foo}" becomes "${:foo}foo"). " This helps tell the position of the tab stops later. - let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g') + let snippet = substitute(snippet, s:d.'{\d\+:\(.\{-}\)}', '&\1', 'g') " Update the a:snip so that all the $# become the text after " the colon in their associated ${#}. " (e.g. "${1:foo}" turns all "$1"'s into "foo") let i = 1 - while stridx(snippet, '${'.i) != -1 - let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}') + while snippet =~ s:d.'{'.i + let s = matchstr(snippet, s:d.'{'.i.':\zs.\{-}\ze}') if s != '' - let snippet = substitute(snippet, '$'.i, s.'&', 'g') + let snippet = substitute(snippet, s:d.i, s.'&', 'g') endif let i += 1 endw @@ -184,7 +191,7 @@ endf " (by getting the length of the string between the last "\n" and the " tab stop). " 3.) The length of the text after the colon for the current tab stop -" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned. +" (e.g. "${1:foo}" would return 3). " 4.) If the "${#:}" construct is given, another list containing all " the matches of "$#", to be replaced with the placeholder. This list is " composed the same way as the parent; the first item is the line number, @@ -193,30 +200,30 @@ fun! s:BuildTabStops(snip, lnum, col, indent) let snipPos = [] let i = 1 let withoutVars = substitute(a:snip, '$\d\+', '', 'g') - while stridx(a:snip, '${'.i) != -1 - let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D') - let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g') + while a:snip =~ s:d.'{'.i + let beforeTabStop = matchstr(withoutVars, '^.*\ze'.s:d .'{'.i.'\D') + let withoutOthers = substitute(withoutVars, ''.s:d .'{\('.i.'\D\)\@!\d\+.\{-}}', '', 'g') let j = i - 1 - call add(snipPos, [0, 0, -1]) + call add(snipPos, [0, 0, 0]) let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n") - let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D')) + let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze'.s:d .'{'.i.'\D')) if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif " Get all $# matches in another list, if ${#:name} is given - if stridx(withoutVars, '${'.i.':') != -1 - let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}')) + if withoutVars =~ ''.s:d .'{'.i.':' + let snipPos[j][2] = len(matchstr(withoutVars, ''.s:d .'{'.i.':\zs.\{-}\ze}')) let dots = repeat('.', snipPos[j][2]) call add(snipPos[j], []) - let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g') - while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1 - let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)') + let withoutOthers = substitute(a:snip, ''.s:d .'{\d\+.\{-}}\|'.s:d .''.i.'\@!\d\+', '', 'g') + while match(withoutOthers, ''.s:d .''.i.'\(\D\|$\)') != -1 + let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.''.s:d .''.i.'\(\D\|$\)') call add(snipPos[j][3], [0, 0]) let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n") let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum \ ? len(matchstr(beforeMark, '.*\n\zs.*')) \ : a:col + len(beforeMark)) - let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '') + let withoutOthers = substitute(withoutOthers, ''.s:d .''.i.'\ze\(\D\|$\)', '', '') endw endif let i += 1 @@ -224,65 +231,48 @@ fun! s:BuildTabStops(snip, lnum, col, indent) return [snipPos, i - 1] endf -fun! snipMate#jumpTabStop(backwards) - let leftPlaceholder = exists('s:origWordLen') - \ && s:origWordLen != g:snipPos[s:curPos][2] - if leftPlaceholder && exists('s:oldEndCol') - let startPlaceholder = s:oldEndCol + 1 - endif +function! s:state_proto.jump_stop(backwards) + " Update changes just in case + " This seems to be only needed because insert completion does not trigger + " the CursorMovedI event + call self.update_changes() - if exists('s:update') - call s:UpdatePlaceholderTabStops() - else - call s:UpdateTabStops() - endif + " Update stop and var locations + call self.update_stops() - " Don't reselect placeholder if it has been modified - if leftPlaceholder && g:snipPos[s:curPos][2] != -1 - if exists('startPlaceholder') - let g:snipPos[s:curPos][1] = startPlaceholder - else - let g:snipPos[s:curPos][1] = col('.') - let g:snipPos[s:curPos][2] = 0 - endif - endif + " Store the changed col/length of the current stop + let self.cur_stop[1] = self.start_col + let self.cur_stop[2] = self.end_col - self.start_col - let s:curPos += a:backwards ? -1 : 1 + let self.stop_no += a:backwards ? -1 : 1 " Loop over the snippet when going backwards from the beginning - if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif + if self.stop_no < 0 | let self.stop_no = self.stop_count - 1 | endif - if s:curPos == s:snipLen - let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2] - call s:RemoveSnippet() - return sMode ? "\" : snipMate#TriggerSnippet() + if self.stop_no == self.stop_count + call self.remove() + return -1 endif - call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1]) + call self.set_stop(self.stop_no) + return self.select_word() +endfunction - let s:endLine = g:snipPos[s:curPos][0] - let s:endCol = g:snipPos[s:curPos][1] - let s:prevLen = [line('$'), col('$')] - - return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord() -endf - -fun! s:UpdatePlaceholderTabStops() - let changeLen = s:origWordLen - g:snipPos[s:curPos][2] - unl s:startCol s:origWordLen s:update - if !exists('s:oldVars') | return | endif +" Updates tab stops/vars +function! s:state_proto.update_stops() + let changeLen = self.end_col - self.cur_stop[2] - self.start_col " Update tab stops in snippet if text has been added via "$#" " (e.g., in "${1:foo}bar$1${2}"). if changeLen != 0 let curLine = line('.') - for pos in g:snipPos - if pos == g:snipPos[s:curPos] | continue | endif - let changed = pos[0] == curLine && pos[1] > s:oldEndCol + for pos in self.stops + if pos == self.cur_stop | continue | endif + let changed = pos[0] == curLine && pos[1] > self.start_col let changedVars = 0 let endPlaceholder = pos[2] - 1 + pos[1] " Subtract changeLen from each tab stop that was after any of " the current tab stop's placeholders. - for [lnum, col] in s:oldVars + for [lnum, col] in self.old_vars if lnum > pos[0] | break | endif if pos[0] == lnum if pos[1] > col || (pos[2] == -1 && pos[1] == col) @@ -292,202 +282,95 @@ fun! s:UpdatePlaceholderTabStops() endif endif endfor - let pos[1] -= changeLen * changed - let pos[2] -= changeLen * changedVars " Parse variables within placeholders - " e.g., "${1:foo} ${2:$1bar}" + let pos[1] += changeLen * changed + " Parse variables within placeholders, e.g., "${1:foo} ${2:$1bar}" + let pos[2] += changeLen * changedVars - if pos[2] == -1 | continue | endif " Do the same to any placeholders in the other tab stops. - for nPos in pos[3] - let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol - for [lnum, col] in s:oldVars - if lnum > nPos[0] | break | endif - if nPos[0] == lnum && nPos[1] > col - let changed += 1 - endif + if exists('pos[3]') + for nPos in pos[3] + let changed = nPos[0] == curLine && nPos[1] > self.start_col + for [lnum, col] in self.old_vars + if lnum > nPos[0] | break | endif + if nPos[0] == lnum && nPos[1] > col + let changed += 1 + endif + endfor + let nPos[1] += changeLen * changed endfor - let nPos[1] -= changeLen * changed - endfor - endfor - endif - unl s:endCol s:oldVars s:oldEndCol -endf - -fun! s:UpdateTabStops() - let changeLine = s:endLine - g:snipPos[s:curPos][0] - let changeCol = s:endCol - g:snipPos[s:curPos][1] - if exists('s:origWordLen') - let changeCol -= s:origWordLen - unl s:origWordLen - endif - let lnum = g:snipPos[s:curPos][0] - let col = g:snipPos[s:curPos][1] - " Update the line number of all proceeding tab stops if has - " been inserted. - if changeLine != 0 - let changeLine -= 1 - for pos in g:snipPos - if pos[0] >= lnum - if pos[0] == lnum | let pos[1] += changeCol | endif - let pos[0] += changeLine endif - if pos[2] == -1 | continue | endif - for nPos in pos[3] - if nPos[0] >= lnum - if nPos[0] == lnum | let nPos[1] += changeCol | endif - let nPos[0] += changeLine - endif - endfor - endfor - elseif changeCol != 0 - " Update the column of all proceeding tab stops if text has - " been inserted/deleted in the current line. - for pos in g:snipPos - if pos[1] >= col && pos[0] == lnum - let pos[1] += changeCol - endif - if pos[2] == -1 | continue | endif - for nPos in pos[3] - if nPos[0] > lnum | break | endif - if nPos[0] == lnum && nPos[1] >= col - let nPos[1] += changeCol - endif - endfor endfor endif -endf +endfunction -fun! s:SelectWord() - let s:origWordLen = g:snipPos[s:curPos][2] - let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1, - \ s:origWordLen) - let s:prevLen[1] -= s:origWordLen - if !empty(g:snipPos[s:curPos][3]) - let s:update = 1 - let s:endCol = -1 - let s:startCol = g:snipPos[s:curPos][1] - 1 - endif - if !s:origWordLen | return '' | endif +" Select the placeholder for the current tab stop +function! s:state_proto.select_word() + let len = self.cur_stop[2] + if !len | return '' | endif let l = col('.') != 1 ? 'l' : '' if &sel == 'exclusive' - return "\".l.'v'.s:origWordLen."l\" + return "\".l.'v'.len."l\" endif - return s:origWordLen == 1 ? "\".l.'gh' - \ : "\".l.'v'.(s:origWordLen - 1)."l\" -endf + return len == 1 ? "\".l.'gh' : "\".l.'v'.(len - 1)."l\" +endfunction -" This updates the snippet as you type when text needs to be inserted -" into multiple places (e.g. in "${1:default text}foo$1bar$1", -" "default text" would be highlighted, and if the user types something, -" UpdateChangedSnip() would be called so that the text after "foo" & "bar" -" are updated accordingly) -" -" It also automatically quits the snippet if the cursor is moved out of it -" while in insert mode. -fun! s:UpdateChangedSnip(entering) - if exists('g:snipPos') && bufnr(0) != s:lastBuf - call s:RemoveSnippet() - elseif exists('s:update') " If modifying a placeholder - if !exists('s:oldVars') && s:curPos + 1 < s:snipLen - " Save the old snippet & word length before it's updated - " s:startCol must be saved too, in case text is added - " before the snippet (e.g. in "foo$1${2}bar${1:foo}"). - let s:oldEndCol = s:startCol - let s:oldVars = deepcopy(g:snipPos[s:curPos][3]) - endif - let col = col('.') - 1 +" Update the snippet as text is typed. The self.update_vars() function does +" the actual work. +" If the cursor moves outside of a placeholder, call self.remove() +function! s:state_proto.update_changes() + let change_len = col('$') - self.prev_len + let self.end_col += change_len - if s:endCol != -1 - let changeLen = col('$') - s:prevLen[1] - let s:endCol += changeLen - else " When being updated the first time, after leaving select mode - if a:entering | return | endif - let s:endCol = col - 1 - endif - - " If the cursor moves outside the snippet, quit it - if line('.') != g:snipPos[s:curPos][0] || col < s:startCol || - \ col - 1 > s:endCol - unl! s:startCol s:origWordLen s:oldVars s:update - return s:RemoveSnippet() - endif - - call s:UpdateVars() - let s:prevLen[1] = col('$') - elseif exists('g:snipPos') - if !a:entering && g:snipPos[s:curPos][2] != -1 - let g:snipPos[s:curPos][2] = -2 - endif - - let col = col('.') - let lnum = line('.') - let changeLine = line('$') - s:prevLen[0] - - if lnum == s:endLine - let s:endCol += col('$') - s:prevLen[1] - let s:prevLen = [line('$'), col('$')] - endif - if changeLine != 0 - let s:endLine += changeLine - let s:endCol = col - endif - - " Delete snippet if cursor moves out of it in insert mode - if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1])) - \ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0] - call s:RemoveSnippet() - endif - endif -endf - -" This updates the variables in a snippet when a placeholder has been edited. -" (e.g., each "$1" in "${1:foo} $1bar $1bar") -fun! s:UpdateVars() - let newWordLen = s:endCol - s:startCol + 1 - let newWord = strpart(getline('.'), s:startCol, newWordLen) - if newWord == s:oldWord || empty(g:snipPos[s:curPos][3]) - return + let col = col('.') + if line('.') != self.cur_stop[0] || col < self.start_col || col > self.end_col + call self.remove() endif - let changeLen = g:snipPos[s:curPos][2] - newWordLen + if self.has_vars + call self.update_vars(change_len) + endif + + let self.prev_len = col('$') +endfunction + +" Actually update the vars for any changed text +function! s:state_proto.update_vars(change) + let newWordLen = self.end_col - self.start_col + let newWord = strpart(getline('.'), self.start_col - 1, newWordLen) + let changeLen = a:change let curLine = line('.') let startCol = col('.') - let oldStartSnip = s:startCol + let oldStartSnip = self.start_col let updateTabStops = changeLen != 0 let i = 0 - for [lnum, col] in g:snipPos[s:curPos][3] + for [lnum, col] in self.cur_stop[3] if updateTabStops - let start = s:startCol + let start = self.start_col if lnum == curLine && col <= start - let s:startCol -= changeLen - let s:endCol -= changeLen + let self.start_col += changeLen + let self.end_col += changeLen endif - for nPos in g:snipPos[s:curPos][3][(i):] + for nPos in self.cur_stop[3][(i):] " This list is in ascending order, so quit if we've gone too far. if nPos[0] > lnum | break | endif if nPos[0] == lnum && nPos[1] > col - let nPos[1] -= changeLen + let nPos[1] += changeLen endif endfor if lnum == curLine && col > start - let col -= changeLen - let g:snipPos[s:curPos][3][i][1] = col + let col += changeLen + let self.cur_stop[3][i][1] = col endif let i += 1 endif - " "Very nomagic" is used here to allow special characters. - call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'. - \ escape(s:oldWord, '\'), escape(newWord, '\&'), '')) + let theline = getline(lnum) + " subtract -1 to go from column byte index to string byte index + " subtract another -1 to exclude the col'th element + call setline(lnum, theline[0:(col-2)] . newWord . theline[(col+self.end_col-self.start_col-a:change-1):]) endfor - if oldStartSnip != s:startCol - call cursor(0, startCol + s:startCol - oldStartSnip) - endif - - let s:oldWord = newWord - let g:snipPos[s:curPos][2] = newWordLen -endf +endfunction " should be moved to utils or such? fun! snipMate#SetByPath(dict, path, value) @@ -506,7 +389,7 @@ endf fun! snipMate#ReadSnippetsFile(file) let result = [] if !filereadable(a:file) | return result | endif - let r_guard = 'guard\s\+\zs.*' + let r_guard = '^guard\s\+\zs.*' let inSnip = 0 let guard = 1 for line in readfile(a:file) + ["\n"] @@ -565,7 +448,19 @@ endf fun! s:Glob(dir, file) let f = a:dir.a:file if a:dir =~ '\*' || isdirectory(a:dir) - return split(glob(escape(f,"{}")),"\n") + " vim's glob() is somewhat unreliable since it uses the + " user's current shell which may accept different patterns + " (POSIX vs. zsh vs. bash vs. ...). On my system, that + " leads to glob() sometimes returning files that don't + " exist, so filter the returned list to make sure that the + " files really exist in the filesystem. + let res = split(glob(escape(f,"{}")), "\n") + + if !empty(res) + return filter(res, 'filereadable(v:val)') + else + return [] + endif else return filereadable(f) ? [f] : [] endif @@ -650,7 +545,7 @@ fun! snipMate#DefaultPool(scopes, trigger, result) for [f,opts] in items(snipMate#GetSnippetFiles(1, a:scopes, a:trigger)) if opts.type == 'snippets' for [trigger, name, contents, guard] in cached_file_contents#CachedFileContents(f, s:c.read_snippets_cached, 0) - if trigger !~ triggerR | continue | endif + if trigger !~ escape(triggerR,'~') | continue | endif if snipMate#EvalGuard(guard) call snipMate#SetByPath(a:result, [trigger, opts.name_prefix.' '.name], contents) endif @@ -809,23 +704,11 @@ fun! s:ChooseSnippet(snippets) endf fun! snipMate#ShowAvailableSnips() - let line = getline('.') let col = col('.') - let word = matchstr(line, '\S\+\%'.col.'c') - let matchlen = 0 - let matches = [] + let word = matchstr(getline('.'), '\S\+\%'.col.'c') - let snippet_triggers = map(snipMate#GetSnippetsForWordBelowCursor(word, '*', 0),'v:val[0]') - - for trigger in snippet_triggers - if word == '' - let matches += [trigger] " Show all matches if word is empty - elseif trigger =~ '^'.word - let matches += [trigger] - let len = len(word) - if len > matchlen | let matchlen = len | endif - endif - endfor + let snippets = map(snipMate#GetSnippetsForWordBelowCursor(word, '*', 0),'v:val[0]') + let matches = filter(snippets, "v:val =~# '\\V\\^" . escape(word, '\') . "'") " Pretty hacky, but really can't have the tab swallowed! if len(matches) == 0 @@ -833,10 +716,7 @@ fun! snipMate#ShowAvailableSnips() return "" endif - " This is to avoid a bug with Vim when using complete(col - matchlen, matches) - " (Issue#46 on the Google Code snipMate issue tracker). - call setline(line('.'), substitute(line, repeat('.', matchlen).'\%'.col.'c', '', '')) - call complete(col, sort(matches)) + call complete(col - len(word), sort(matches)) return '' endf @@ -870,7 +750,12 @@ fun! snipMate#TriggerSnippet() call feedkeys("\") | return '' endif - if exists('g:snipPos') | return snipMate#jumpTabStop(0) | endif + if exists('b:snip_state') + let jump = b:snip_state.jump_stop(0) + if type(jump) == 1 " returned a string + return jump + endif + endif let word = matchstr(getline('.'), '\S\+\%'.col('.').'c') let list = snipMate#GetSnippetsForWordBelowCursor(word, '', 1) @@ -886,7 +771,8 @@ fun! snipMate#TriggerSnippet() let snippet = s end - let &undolevels = &undolevels " create new undo point + " Before expanding snippet, create new undo point |i_CTRL-G| + let &undolevels = &undolevels let col = col('.') - len(trigger) sil exe 's/\V'.escape(trigger, '/\.').'\%#//' return snipMate#expandSnip(snippet, col) @@ -904,7 +790,7 @@ endf fun! snipMate#BackwardsSnippet() - if exists('g:snipPos') | return snipMate#jumpTabStop(1) | endif + if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif if exists('g:SuperTabMappingForward') if g:SuperTabMappingForward == "" diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index 72077b3d..ced9d55f 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -49,6 +49,8 @@ There are some alternatives: - ultisnips (python based) - xptemplate which is probably a much more powerful but also more complex +- neosnippets - which seems to be able to read snippet +files when swiching on compatible mode - (..?) snipmate is not perfect - however it gets its job done perfectly and gets out @@ -113,8 +115,8 @@ The parsed .snippets files are cached. in the current buffer to show a list via. ------------------------------------------------------------------------------- -SNIPPET SOURCES *snippet-sources* +============================================================================== +SNIPPET SOURCES *snipMate-snippet-sources* snipMate is configurable. @@ -178,7 +180,7 @@ More details about all possible relative locations to |rtp| can be found in SYNTAX *snippet-syntax* *snipMate-syntax* Default snippet sources [1], you can add your own as illustrated in -|snippet-sources|. +|snipMate-snippet-sources|. trigger: the snippet's name. |rtp| : Vim's |runtimepath| path list @@ -409,6 +411,7 @@ Perhaps some of these features will be added in a later release. CONTACT *snipMate-contact* *snipMate-author* current maintainers: + - Adnan Zafar - garbas - Marc Weber (marco-oweber@gmx.de) You should consider creating a github ticket or contacting us because the diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 8de4878a..5dbe0cbc 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -1,6 +1,6 @@ " File: snipMate.vim " Author: Michael Sanders -" Version: 0.84 +" Version: 0.85 " Description: snipMate.vim implements some of TextMate's snippets features in " Vim. A snippet is a piece of often-typed text that you can " insert into your document using a trigger word followed by a "". diff --git a/sources_non_forked/snipmate-snippets/AUTHORS b/sources_non_forked/vim-snippets/AUTHORS similarity index 78% rename from sources_non_forked/snipmate-snippets/AUTHORS rename to sources_non_forked/vim-snippets/AUTHORS index 30c65d9e..22a32290 100644 --- a/sources_non_forked/snipmate-snippets/AUTHORS +++ b/sources_non_forked/vim-snippets/AUTHORS @@ -1,3 +1,4 @@ +Aaron Broder Adam Folmert Alberto Pose Angel Alonso @@ -36,3 +37,7 @@ Povilas Balzaravičius Pawka Dmitry Dementev Travis Holton Chrisyue +Erik Westrup + +TODO: add contributors from github.com/SirVer/Ultisnip having contributed to +github.com/SirVer/Ultisnip/UltiSnips/* files diff --git a/sources_non_forked/snipmate-snippets/LICENSE b/sources_non_forked/vim-snippets/LICENSE similarity index 100% rename from sources_non_forked/snipmate-snippets/LICENSE rename to sources_non_forked/vim-snippets/LICENSE diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md new file mode 100644 index 00000000..17a73739 --- /dev/null +++ b/sources_non_forked/vim-snippets/README.md @@ -0,0 +1,118 @@ +IMPORTANT: comment on: [What about merging whith Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114) + +Snipmate & UltiSnip Snippets +============================ + +This repository contains snippets files for various programming languages. + +It is community-maintained and many people have contributed snippet files and other +improvements already. + +Contents +======== + + snippets/*: snippets using snipmate format + UltiSnips/*: snippets using UltiSnips format + +Snippet engines +=============== + +There are different forks of snippet engines which allow the user to insert +sippets by typing the name of a snippet hitting the expansion mapping. + + garbas/vim-snipmate [4]: + VimL, snipmate-snippets, engine sometimes behaves strange, supports + rewriting snippets on the fly (eg adding a second version with folding + markers) + + MarcWeber/UltiSnips [6]: + python, snipmate-snippets and UltiSnips-snippets + + SirVer/ultisnips [7]: + python, UltiSnips-snippets + + github.com/Shougo/neosnippet [5]: + viml, has a compatible mode allowing to reuse most snipmate snippets ? + + XPTemplate: + totally different syntax, does not read snippets contained in this file, + but it is also very powerful + + ... there are some more, but they have less features which is why I don't + mention them here + +UltiSnips engine has additional features such as "nested snippets". + +Which one to use? If you have python give MarcWeber/UltiSnips a try because its +fast and supports all important features. You can prefer the UltiSnip versions +of the snippets by setting the "always_use_first_snippet" option to 1. + +If you have VimL only (vim without python support) your best option is using +garbas/vim-snipmate and cope with the minor bugs found in the engine. + +Related repositories +==================== +We also encourage people to maintain sets of snippets for particular use cases +so that all users can benefit from them. People can list their snippet repositories here: + + * https://github.com/rbonvall/snipmate-snippets-bib (snippets for BibTeX files) + * https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files) + * https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML) + * https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml) + +Installation using VAM: "github:rbonvall/snipmate-snippets-bib" + +Historical notes +================ + +[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now +unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a +[fork][4] of the project in hopes of improving the existing code base. + + +Language maintainers +-------------------- + +No one can really be proficient in all programming languages. If you would like +to maintain snippets for a language, please get in touch. + +* Python - [honza](http://github.com/honza) +* Javascript - [honza](http://github.com/honza) +* HTML Django - [honza](http://github.com/honza) +* Markdown - [honza](http://github.com/honza) +* Ruby - [taq](http://github.com/taq) +* PHP - [chrisyue](http://github.com/chrisyue) + +Contributing notes +------------------ + +Until further work is done on `vim-snipmate`, please don't add folding markers +into snippets. `vim-snipmate` has some comments about how to patch all snippets +on the fly adding those. + +Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no +need to duplicate all snippets - only those snippets who use advanced UltiSnips +features should be duplicated in UltiSnips (?) + +Currently all snippets from UltiSnips have been put into UltiSnips - some work +on merging should be done (dropping duplicates etc) + +Authors +------- + +For a list of authors, please see the `AUTHORS` files. + +License +------- + +Just as the original snipMate plugin, all the snippets are licensed under the +terms of the MIT license. + + +[1]: http://github.com/garbas/vim-snipmate +[2]: http://github.com/msanders +[3]: http://github.com/garbas +[4]: http://github.com/garbas/vim-snipmate +[5]: http://github.com/Shougo/neosnippet +[6]: http://github.com/MarcWeber/UltiSnips +[7]: http://github.com/SirVer/ultisnips diff --git a/sources_non_forked/vim-snippets/UltiSnips/README b/sources_non_forked/vim-snippets/UltiSnips/README new file mode 100644 index 00000000..eafd0866 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/README @@ -0,0 +1,21 @@ +This directory contains the main scripts that come bundled with UltiSnips. + +Standing On The Shoulders of Giants +=================================== + +The snippets have been collected from various other project which I want to +express my gratitude for. My main source for inspiration where the following +two projects: + + TextMate: http://svn.textmate.org/trunk/Bundles/ + SnipMate: http://code.google.com/p/snipmate/ + +All snippets from those sources were copied and cleaned up, so that they are + - not using shell script, only python (so they are cross platform compatible) + - not using any feature that UltiSnips doesn't offer + +UltiSnips has seen contributions by various individuals. Those contributions +have been merged into this collection seamlessly and without further comments. + +-- vim:ft=rst:nospell: + diff --git a/sources_non_forked/vim-snippets/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets similarity index 100% rename from sources_non_forked/vim-snippets/all.snippets rename to sources_non_forked/vim-snippets/UltiSnips/all.snippets diff --git a/sources_non_forked/vim-snippets/bindzone.snippets b/sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets similarity index 100% rename from sources_non_forked/vim-snippets/bindzone.snippets rename to sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets diff --git a/sources_non_forked/vim-snippets/c.snippets b/sources_non_forked/vim-snippets/UltiSnips/c.snippets similarity index 89% rename from sources_non_forked/vim-snippets/c.snippets rename to sources_non_forked/vim-snippets/UltiSnips/c.snippets index 532fe173..062a36ae 100644 --- a/sources_non_forked/vim-snippets/c.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/c.snippets @@ -1,8 +1,12 @@ - ########################################################################### # TextMate Snippets # ########################################################################### -snippet def "#ifndef ... #define ... #endif" + +snippet def "#define ..." +#define ${1} +endsnippet + +snippet ifndef "#ifndef ... #define ... #endif" #ifndef ${1/([A-Za-z0-9_]+).*/$1/} #define ${1:SYMBOL} ${2:value} #endif @@ -88,6 +92,17 @@ if (${1:/* condition */}) } endsnippet +snippet ife "if .. else (ife)" +if (${1:/* condition */}) +{ + ${2:/* code */} +} +else +{ + ${3:/* else */} +} +endsnippet + snippet printf "printf .. (printf)" printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} endsnippet diff --git a/sources_non_forked/vim-snippets/coffee.snippets b/sources_non_forked/vim-snippets/UltiSnips/coffee.snippets similarity index 100% rename from sources_non_forked/vim-snippets/coffee.snippets rename to sources_non_forked/vim-snippets/UltiSnips/coffee.snippets diff --git a/sources_non_forked/vim-snippets/coffee_jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets similarity index 100% rename from sources_non_forked/vim-snippets/coffee_jasmine.snippets rename to sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets diff --git a/sources_non_forked/vim-snippets/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets similarity index 99% rename from sources_non_forked/vim-snippets/cpp.snippets rename to sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index 9d2eb868..6999c1f9 100644 --- a/sources_non_forked/vim-snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -1,5 +1,3 @@ -extends c - ########################################################################### # TextMate Snippets # ########################################################################### diff --git a/sources_non_forked/vim-snippets/css.snippets b/sources_non_forked/vim-snippets/UltiSnips/css.snippets similarity index 100% rename from sources_non_forked/vim-snippets/css.snippets rename to sources_non_forked/vim-snippets/UltiSnips/css.snippets diff --git a/sources_non_forked/vim-snippets/UltiSnips/d.snippets b/sources_non_forked/vim-snippets/UltiSnips/d.snippets new file mode 100644 index 00000000..8ed9b417 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/d.snippets @@ -0,0 +1,583 @@ +# Simple shortcuts + +snippet imp "import (imp)" b +import ${1:std.stdio}; +endsnippet + +snippet pimp "public import (pimp)" b +public import ${1:/*module*/}; +endsnippet + +snippet over "override (over)" b +override ${1:/*function*/} +endsnippet + +snippet al "alias (al)" +alias ${1:/*orig*/} ${2:/*alias*/}; +endsnippet + +snippet mixin "mixin (mixin)" b +mixin ${1:/*mixed_in*/} ${2:/*name*/}; +endsnippet + +snippet new "new (new)" +new ${1}(${2}); +endsnippet + +snippet scpn "@safe const pure nothrow (scpn)" +@safe const pure nothrow +endsnippet + +snippet spn "@safe pure nothrow (spn)" +@safe pure nothrow +endsnippet + +snippet cont "continue (cont)" +continue; +endsnippet + +snippet dis "@disable (dis)" b +@disable ${1:/*method*/}; +endsnippet + +snippet pub "public (pub)" b +public: + ${1:/*members*/} +endsnippet + +snippet priv "private (priv)" b +private: + ${1:/*members*/} +endsnippet + +snippet prot "protected (prot)" b +protected: + ${1:/*members*/} +endsnippet + +snippet pack "package (pack)" b +package: + ${1:/*members*/} +endsnippet + +snippet ret "return (ret)" +return ${1:/*value to return*/}; +endsnippet + +snippet auto "auto (auto)" b +auto ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet con "const (con)" b +const ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet siz "size_t (siz)" b +size_t ${1:/*variable*/} = ${2:/*value*/}; +endsnippet + +snippet sup "super (sup)" b +super(${1:/*args*/}); +endsnippet + +# Phobos + +snippet tup "tuple (tup)" +tuple(${1:/*args*/}) +endsnippet + +snippet wr "writeln (wr)" +writeln(${1:/*args*/}); +endsnippet + +snippet to "to (to)" +to!(${1:/*type*/})(${2:/*arg*/}) +endsnippet + +snippet enf "enforce (enf)" b +enforce(${1:/*condition*/}, + new ${2}Exception(${3:/*args*/})); +endsnippet + +# Branches + +snippet if "if .. (if)" +if(${1:/*condition*/}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet ife "if .. else (ife)" b +if(${1:/*condition*/}) +{ + ${2:/*code*/} +} +else +{ + ${3:/*else*/} +} +endsnippet + +snippet el "else (el)" b +else +{ + ${VISUAL}${1:/*code*/} +} +endsnippet + +snippet elif "else if (elif)" b +else if(${1:/*condition*/}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet sw "switch (sw)" +switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + ${3:/*code*/} + break; + case ${4:/*value*/}: + ${5:/*code*/} + break; + ${7:/*more cases*/} + default: + ${6:assert(false);} +} +endsnippet + +snippet fsw "final switch (fsw)" +switch(${1:/*var*/}) +{ + case ${2:/*value*/}: + ${3:/*code*/} + break; + case ${4:/*value*/}: + ${5:/*code*/} + break; + ${7:/*more cases*/} +} +endsnippet + +snippet case "case (case)" b +case ${1:/*value*/}: + ${2:/*code*/} + break; +endsnippet + +snippet ?: "ternary operator (?:)" +${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4 +endsnippet + +# Loops + +snippet do "do while (do)" b +do +{ + ${VISUAL}${2:/*code*/} +} while(${1:/*condition*/}); +endsnippet + +snippet wh "while (wh)" b +while(${1:/*condition*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet for "for (for)" b +for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet forever "forever (forever)" b +for(;;) +{ + ${VISUAL}${0:/*code*/} +} +endsnippet + +snippet fore "foreach (fore)" +foreach(${1:/*elem*/}; ${2:/*range*/}) +{ + ${VISUAL}${3:/*code*/} +} +endsnippet + +snippet forif "foreach if (forif)" b +foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) +{ + ${VISUAL}${4:/*code*/} +} +endsnippet + +# Contracts +snippet in "in contract (in)" b +in +{ + assert(${1:/*condition*/}, "${2:error message}"); + ${3} +} +body +endsnippet + +snippet out "out contract (out)" b +out${1:(result)} +{ + assert(${2:/*condition*/}, "${3:error message}"); + ${4} +} +body +endsnippet + +snippet inv "invariant (inv)" b +invariant() +{ + assert(${1:/*condition*/}, "${2:error message}"); + ${3} +} +endsnippet + +# Functions (generic) + +snippet fun "function definition (fun)" +${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} +{ + ${VISUAL}${5:/*code*/} +} +endsnippet + +snippet void "void function definition (void)" +void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} +{ + ${VISUAL}${4:/*code*/} +} +endsnippet + +snippet this "ctor (this)" w +this(${1:/*args*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet get "getter property (get)" ! +@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};} +endsnippet + +snippet set "setter property (set)" ! +@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;} +endsnippet + +# Functions (concrete) + +snippet main "Main" b +void main(string[] args) +{ + ${VISUAL}${0: /*code*/} +} +endsnippet + +# Mixins + +snippet signal "signal (signal)" b +mixin Signal!(${1:/*args*/}) ${2:/*name*/}; +endsnippet + +# Scope + +snippet scope "scope (scope)" b +scope(${1:exit}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +# With + +snippet with "with (with)" +with(${1}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +# Exception handling + +snippet try "try/catch (try)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch(${2}Exception e) +{ + ${3:/*handle exception*/} +} +endsnippet + +snippet tryf "try/catch/finally (tryf)" b +try +{ + ${VISUAL}${1:/*code to try*/} +} +catch(${2}Exception e) +{ + ${3:/*handle exception*/} +} +finally +{ + ${4:/*cleanup*/} +} +endsnippet + +snippet catch "catch (catch)" b +catch(${1}Exception e) +{ + ${2:/*handle exception*/} +} +endsnippet + +snippet thr "throw (thr)" +throw new ${1}Exception("${2}"); +endsnippet + + +# Type declarations + +snippet struct "struct (struct)" +struct ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet union "union (union)" +union ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet class "class (class)" +class ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet inter "interface (inter)" +interface ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + +snippet enum "enum (enum)" +enum ${1:`!p snip.rv = (snip.basename or "name")`} +{ + ${2} +} +endsnippet + + +# Exception declarations + +snippet exc "exception declaration (exc)" b +/// ${3:/*documentation*/} +class ${1}Exception : ${2}Exception +{ + public this(string msg, string file = __FILE__, int line = __LINE__) + { + super(msg, file, line); + } +} +endsnippet + + +# Conditional compilation + +snippet version "version (version)" b +version(${1:/*version name*/}) +{ + ${VISUAL}${2:/*code*/} +} +endsnippet + +snippet debug "debug" b +debug +{ + ${VISUAL}${1:/*code*/} +} +endsnippet + + +# Templates + +snippet temp "template (temp)" b +template ${2:/*name*/}(${1:/*args*/}) +{ + ${3:/*code*/} +} +endsnippet + + +# Asserts + +snippet ass "assert (ass)" b +assert(${1:false}, "${2:TODO}"); + +endsnippet + + +# Unittests + +snippet unittest "unittest (unittest)" b +unittest +{ + ${1:/*code*/} +} +endsnippet + + +# Common member functions + +snippet opDis "opDispatch (opDis)" b +${1:/*return type*/} opDispatch(string s)() +{ + ${2:/*code*/}; +} +endsnippet + +snippet op= "opAssign (op=)" b +void opAssign(${1} rhs) ${2:@safe pure nothrow} +{ + ${2:/*code*/} +} +endsnippet + +snippet opCmp "opCmp (opCmp)" b +int opCmp(${1} rhs) @safe const pure nothrow +{ + ${2:/*code*/} +} +endsnippet + +snippet opApply "opApply (opApply)" b +int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg) +{ + int result = 0; + ${2:/*loop*/} + { + result = dg(${3:/*arg/s*/}); + if(result){break;} + } + return result; +} +endsnippet + +snippet toString "toString (toString)" b +string toString() @safe const pure nothrow +{ + ${1:/*code*/} +} +endsnippet + + +# Comments + + +snippet todo "TODO (todo)" ! +// TODO: ${1} +endsnippet + + + +# DDoc + +snippet doc "generic ddoc block (doc)" b +/// ${1:description} +/// +/// ${2:details} +endsnippet + +snippet fdoc "function ddoc block (fdoc)" b +/// ${1:description} +/// +/// ${2:Params: ${3:param} = ${4:param description} +/// ${5}} +/// +/// ${6:Returns: ${7:return value}} +/// +/// ${8:Throws: ${9}Exception ${10}} +endsnippet + +snippet Par "Params (Par)" +Params: ${1:param} = ${2:param description} +/// ${3} +endsnippet + +snippet Ret "Returns (Ret)" +Returns: ${1:return value/s} +endsnippet + +snippet Thr "Throws (Thr)" +Throws: ${1}Exception ${2} +endsnippet + +snippet Example "Examples (Example)" +Examples: +/// -------------------- +/// ${1:example code} +/// -------------------- +endsnippet + + +# License blocks + +snippet gpl "GPL (gpl)" b +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// Copyright (C) ${1:Author}, `!v strftime("%Y")` + +${2} +endsnippet + +snippet boost "Boost (boost)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +${2} +endsnippet + + +# New module + +snippet module "New module (module)" b +// Copyright ${1:Author} `!v strftime("%Y")`. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +module ${2}.`!v Filename('$1', 'name')`; + + +${3} +endsnippet diff --git a/sources_non_forked/vim-snippets/django.snippets b/sources_non_forked/vim-snippets/UltiSnips/django.snippets similarity index 100% rename from sources_non_forked/vim-snippets/django.snippets rename to sources_non_forked/vim-snippets/UltiSnips/django.snippets diff --git a/sources_non_forked/vim-snippets/erlang.snippets b/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets similarity index 100% rename from sources_non_forked/vim-snippets/erlang.snippets rename to sources_non_forked/vim-snippets/UltiSnips/erlang.snippets diff --git a/sources_non_forked/vim-snippets/eruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets similarity index 100% rename from sources_non_forked/vim-snippets/eruby.snippets rename to sources_non_forked/vim-snippets/UltiSnips/eruby.snippets diff --git a/sources_non_forked/vim-snippets/go.snippets b/sources_non_forked/vim-snippets/UltiSnips/go.snippets similarity index 100% rename from sources_non_forked/vim-snippets/go.snippets rename to sources_non_forked/vim-snippets/UltiSnips/go.snippets diff --git a/sources_non_forked/vim-snippets/haskell.snippets b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets similarity index 100% rename from sources_non_forked/vim-snippets/haskell.snippets rename to sources_non_forked/vim-snippets/UltiSnips/haskell.snippets diff --git a/sources_non_forked/vim-snippets/help.snippets b/sources_non_forked/vim-snippets/UltiSnips/help.snippets similarity index 88% rename from sources_non_forked/vim-snippets/help.snippets rename to sources_non_forked/vim-snippets/UltiSnips/help.snippets index bfa7bc05..bd0bb12f 100644 --- a/sources_non_forked/vim-snippets/help.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/help.snippets @@ -4,11 +4,11 @@ global !p def sec_title(snip, t): file_start = snip.fn.split('.')[0] sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') - return ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1])) + return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) endglobal snippet sec "Section marker" b -============================================================================= +============================================================================== ${1:SECTION}`!p snip.rv = sec_title(snip, t)` $0 diff --git a/sources_non_forked/vim-snippets/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets similarity index 84% rename from sources_non_forked/vim-snippets/html.snippets rename to sources_non_forked/vim-snippets/UltiSnips/html.snippets index aa5ebe17..bb074789 100644 --- a/sources_non_forked/vim-snippets/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -120,17 +120,9 @@ snippet ! "IE Conditional Comment: NOT Internet Explorer" ${1: IE Conditional Comment: NOT Internet Explorer }$0 endsnippet -########### -# Forms # -########### -snippet form "XHTML
            " - - $0 - -

            -
            -endsnippet - +############# +# HTML TAGS # +############# snippet input "Input with Label" @@ -140,8 +132,9 @@ snippet input "XHTML " endsnippet -snippet textarea "XHTML + +snippet opt "Option" +${3:$2} endsnippet snippet select "Select Box" @@ -152,8 +145,9 @@ snippet select "Select Box" endsnippet -snippet opt "Option" -${3:$2} + +snippet textarea "XHTML endsnippet snippet mailto "XHTML " @@ -165,25 +159,31 @@ snippet base "XHTML " endsnippet snippet body "XHTML " - + $0 endsnippet snippet div "XHTML
            " -${3}
            ${4} + + $0 + +endsnippet + +snippet form "XHTML
            " + + $0 + +

            +
            endsnippet snippet h1 "XHTML

            " -

            ${1}

            ${2} -endsnippet - -snippet h2 "XHTML

            " -

            ${1}

            ${2} -endsnippet - -snippet h3 "XHTML

            " -

            ${1}

            ${2} +

            ${1}

            endsnippet snippet head "XHTML " @@ -208,8 +208,8 @@ endsnippet snippet script "XHTML ${2} + $0 + endsnippet snippet style "XHTML endsnippet -snippet a "Link" w -
            ${4:Anchor Text} +snippet table "XHTML " +
            + + +
            ${5:Header}
            ${0:Data}
            +endsnippet + +snippet a "Link" +${4:Anchor Text} endsnippet snippet p "paragraph" -

            ${1}

            ${2} -endsnippet - -########## -# List # -########## -snippet ul "unordered list" - - ${2} -${3} -endsnippet - -snippet ol "unordered list" - - ${2} -$0 +

            $0

            endsnippet snippet li "list item" -
          • ${1}
          • -li${2} +
          • endsnippet -snippet dl "dl" !b -
            ${1}
            -dl${2} -endsnippet - -snippet . "class" -class="${1}"${2} -endsnippet - -snippet # "id" -id="${1}"${2} -endsnippet - - -########### -# Table # -########### -snippet table "XHTML " - - ${2} -
            ${3} -endsnippet - -snippet thead "XHTML " - - ${1} -${2} -endsnippet - -snippet tbody "XHTML " - - ${1} -${2} -endsnippet - -snippet tfoot "XHTML " - - ${1} -${2} -endsnippet - -snippet tr "table row" -${1} -tr${2} +snippet ul "unordered list" +
              +$0 +
            endsnippet snippet td "table cell" -${1} -td${2} +$0 endsnippet -snippet th "table cell" -${1} -th${2} +snippet tr "table row" +$0 endsnippet snippet title "XHTML " @@ -314,10 +263,6 @@ snippet fieldset "Fieldset" </fieldset> endsnippet -snippet pre "XHTML pre" !b -<pre>${1}</pre>${2} -endsnippet - snippet movie "Embed QT movie (movie)" b <object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="$1"`!p x(snip)`> @@ -332,4 +277,21 @@ snippet movie "Embed QT movie (movie)" b </object> endsnippet +snippet html5 "HTML5 Template" +<!DOCTYPE html> +<html> +<head> + <title>${1} + + + +
            + ${2} +
            +
            + ${4} +
            + + +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/htmldjango.snippets b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets similarity index 100% rename from sources_non_forked/vim-snippets/htmldjango.snippets rename to sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets diff --git a/sources_non_forked/vim-snippets/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets similarity index 100% rename from sources_non_forked/vim-snippets/java.snippets rename to sources_non_forked/vim-snippets/UltiSnips/java.snippets diff --git a/sources_non_forked/vim-snippets/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets similarity index 100% rename from sources_non_forked/vim-snippets/javascript.snippets rename to sources_non_forked/vim-snippets/UltiSnips/javascript.snippets diff --git a/sources_non_forked/vim-snippets/javascript_jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets similarity index 100% rename from sources_non_forked/vim-snippets/javascript_jasmine.snippets rename to sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets diff --git a/sources_non_forked/vim-snippets/jinja2.snippets b/sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets similarity index 100% rename from sources_non_forked/vim-snippets/jinja2.snippets rename to sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets diff --git a/sources_non_forked/vim-snippets/json.snippets b/sources_non_forked/vim-snippets/UltiSnips/json.snippets similarity index 100% rename from sources_non_forked/vim-snippets/json.snippets rename to sources_non_forked/vim-snippets/UltiSnips/json.snippets diff --git a/sources_non_forked/vim-snippets/lua.snippets b/sources_non_forked/vim-snippets/UltiSnips/lua.snippets similarity index 100% rename from sources_non_forked/vim-snippets/lua.snippets rename to sources_non_forked/vim-snippets/UltiSnips/lua.snippets diff --git a/sources_non_forked/vim-snippets/mako.snippets b/sources_non_forked/vim-snippets/UltiSnips/mako.snippets similarity index 100% rename from sources_non_forked/vim-snippets/mako.snippets rename to sources_non_forked/vim-snippets/UltiSnips/mako.snippets diff --git a/sources_non_forked/vim-snippets/mkd.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets similarity index 92% rename from sources_non_forked/vim-snippets/mkd.snippets rename to sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index eebab1ac..c3189b8a 100644 --- a/sources_non_forked/vim-snippets/mkd.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -33,11 +33,11 @@ endsnippet ################ # Common stuff # ################ -snippet link "Link to something" +snippet link "Link to something" [${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0 endsnippet -snippet img "Link to something" +snippet img "Image" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet diff --git a/sources_non_forked/vim-snippets/objc.snippets b/sources_non_forked/vim-snippets/UltiSnips/objc.snippets similarity index 100% rename from sources_non_forked/vim-snippets/objc.snippets rename to sources_non_forked/vim-snippets/UltiSnips/objc.snippets diff --git a/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets new file mode 100644 index 00000000..8aefef3a --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets @@ -0,0 +1,172 @@ +snippet rs "raise" b +raise (${1:Not_found}) +endsnippet + +snippet open "open" +let open ${1:module} in +${2:e} +endsnippet + +snippet try "try" +try ${1:e} +with ${2:Not_found} -> ${3:()} +endsnippet + +snippet ref "ref" +let ${1:name} = ref ${2:val} in +${3:e} +endsnippet + +snippet matchl "pattern match on a list" +match ${1:list} with +| [] -> ${2:()} +| x::xs -> ${3:()} +endsnippet + +snippet matcho "pattern match on an option type" +match ${1:x} with +| Some(${2:y}) -> ${3:()} +| None -> ${4:()} +endsnippet + +snippet fun "anonymous function" +(fun ${1:x} -> ${2:x}) +endsnippet + +snippet cc "commment" +(* ${1:comment} *) +endsnippet + +snippet let "let .. in binding" +let ${1:x} = ${2:v} in +${3:e} +endsnippet + +snippet lr "let rec" +let rec ${1:f} = + ${2:expr} +endsnippet + +snippet if "if" +if ${1:(* condition *)} then + ${2:(* A *)} +else + ${3:(* B *)} +endsnippet + +snippet If "If" +if ${1:(* condition *)} then + ${2:(* A *)} +endsnippet + +snippet while "while" +while ${1:(* condition *)} do + ${2:(* A *)} +done +endsnippet + +snippet for "for" +for ${1:i} = ${2:1} to ${3:10} do + ${4:(* BODY *)} +done +endsnippet + +snippet match "match" +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} +endsnippet + +snippet Match "match" +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} +endsnippet + +snippet class "class" +class ${1:name} = object + ${2:methods} +end +endsnippet + +snippet obj "obj" +object + ${2:methods} +end +endsnippet + +snippet Obj "object" +object (self) + ${2:methods} +end +endsnippet + +snippet {{ "object functional update" +{< ${1:x} = ${2:y} >} +endsnippet + +snippet beg "beg" +begin + ${1:block} +end +endsnippet + +snippet ml "module instantiantion with functor" +module ${1:Mod} = ${2:Functor}(${3:Arg}) +endsnippet + +snippet mod "module - no signature" +module ${1:(* Name *)} = struct + ${2:(* BODY *)} +end +endsnippet + +snippet Mod "module with signature" +module ${1:(* Name *)} : ${2:(* SIG *)} = struct + ${3:(* BODY *)} +end +endsnippet + +snippet sig "anonymous signature" +sig + ${2:(* BODY *)} +end +endsnippet + +snippet sigf "functor signature or anonymous functor" +functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)} +endsnippet + +snippet func "define functor - no signature" +module ${1:M} (${2:Arg} : ${3:ARG}) = struct + ${4:(* BODY *)} +end +endsnippet + +snippet Func "define functor - with signature" +module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct + ${5:(* BODY *)} +end +endsnippet + +snippet mot "Declare module signature" +module type ${1:(* Name *)} = sig + ${2:(* BODY *)} +end +endsnippet + +snippet module "Module with anonymous signature" +module ${1:(* Name *)} : sig + ${2:(* SIGNATURE *)} +end = struct + ${3:(* BODY *)} +end +endsnippet + +snippet oo "odoc" +(** ${1:odoc} *) +endsnippet + +snippet qt "inline qtest" +(*$T ${1:name} + ${2:test} +*) +endsnippet diff --git a/sources_non_forked/vim-snippets/perl.snippets b/sources_non_forked/vim-snippets/UltiSnips/perl.snippets similarity index 100% rename from sources_non_forked/vim-snippets/perl.snippets rename to sources_non_forked/vim-snippets/UltiSnips/perl.snippets diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets new file mode 100644 index 00000000..40461d29 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -0,0 +1,258 @@ +## Snippets from SnipMate, taken from +## https://github.com/scrooloose/snipmate-snippets.git + +snippet array "array" +$${1:arrayName} = array('${2}' => ${3});${4} +endsnippet + +snippet def "def" +define('${1}'${2});${3} +endsnippet + +snippet do "do" +do { + ${2:// code... } +} while (${1:/* condition */});" +endsnippet + +snippet doc_f "doc_f" +/** + * $2 + * @return ${4:void} + * @author ${5:`!v g:snips_author`} + **/ +${1:public }function ${2:someFunc}(${3}) +{${6} +} +endsnippet + +snippet doc_i "doc_i" +/** + * $1 + * @package ${2:default} + * @author ${3:`!v g:snips_author`} + **/ +interface ${1:someClass} +{${4} +} // END interface $1" +endsnippet + +snippet else "else" +else { + ${1:// code...} +} +endsnippet + +snippet for "for" +for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4:// code...} +} +endsnippet + +snippet foreachk "foreachk" +foreach ($${1:variable} as $${2:key} => $${3:value}){ + ${4:// code...} +} +endsnippet + +snippet get "get" +$_GET['${1}']${2} +endsnippet + +snippet if "if" +if (${1:/* condition */}) { + ${2:// code...} +} +endsnippet + +snippet inc "inc" +include '${1:file}';${2} +endsnippet + +snippet log "log" +error_log(var_export(${1}, true));${2} +endsnippet + +snippet post "post" +$_POST['${1}']${2} +endsnippet + +snippet req1 "req1" +require_once '${1:file}';${2} +endsnippet + +snippet session "session" +$_SESSION['${1}']${2} +endsnippet + +snippet t "t" +$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} +endsnippet + +snippet var "var" +var_export(${1});${2} +endsnippet + +snippet getter "PHP Class Getter" !b +/* + * Getter for $1 + */ +public function get${1/\w+\s*/\u$0/}() +{ + return $this->$1;$2 +} +$4 +endsnippet + +snippet setter "PHP Class Setter" !b +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} +} +$0 +endsnippet + +snippet gs "PHP Class Getter Setter" !b +protected $$1 + +/* + * Getter for $1 + */ +public function get${1/\w+\s*/\u$0/}() +{ + return $this->$1;$2 +} + +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} +} +$0 +endsnippet + +snippet pub "Public function" !b +public function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pro "Protected function" !b +protected function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pri "Private function" !b +private function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pubs "Public static function" !b +public static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pros "Protected static function" !b +protected static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pris "Private static function" !b +private static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet fu "Function snip" !b +function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet +# :vim:ft=snippets + +snippet fore "Foreach loop" +foreach ($${1:variable} as $${3:value}){ + ${VISUAL}${4} +} +$0 +endsnippet + +snippet new "New class instance" !b +$$1 = new $1($2); +$0 +endsnippet + + +snippet ife "if else" +if (${1:/* condition */}) { + ${2:// code...} +} else { + ${3:// code...} +} +$0 +endsnippet + + +snippet class "Class declaration template" !b +/** + * Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`} + * @author $2 + */ +class $1 +{ + public function ${3:__construct}(${4:$options}) + { + ${4:// code} + } +} +$0 +endsnippet + +snippet pr "Dumb debug helper in HTML" +echo '
            ' . var_export($1, 1) . '
            ';$0 +endsnippet + +snippet pc "Dumb debug helper in cli" +var_export($1);$0 +endsnippet + +# Symfony 2 based snippets +snippet sfa "Symfony 2 Controller action" +/** +* @Route("/${1:route_name}", name="$1") +* @Template() +*/ +public function $1Action($2) +{ + $3 + return ${4:array();}$0 +} +endsnippet + +# :vim:ft=snippets: + diff --git a/sources_non_forked/vim-snippets/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets similarity index 100% rename from sources_non_forked/vim-snippets/puppet.snippets rename to sources_non_forked/vim-snippets/UltiSnips/puppet.snippets diff --git a/sources_non_forked/vim-snippets/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets similarity index 98% rename from sources_non_forked/vim-snippets/python.snippets rename to sources_non_forked/vim-snippets/UltiSnips/python.snippets index 462bf20c..a770d2a9 100644 --- a/sources_non_forked/vim-snippets/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -368,7 +368,12 @@ endsnippet snippet rwprop "Read write property" b def ${1:property}(): - ${2/.+/(?0:""")/}${2:The RW property $1}${2/.+/(?0:"""\n )/}def fget(self): + ${2/.+/(?0:""")/}${2:The RW property $1}`!p if t[2]: + snip.rv += '"""' + snip >> 1 + snip += "" +else: + snip.rv = ""`def fget(self): return self._$1$0 def fset(self, value): self._$1 = value diff --git a/sources_non_forked/vim-snippets/rails.snippets b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets similarity index 100% rename from sources_non_forked/vim-snippets/rails.snippets rename to sources_non_forked/vim-snippets/UltiSnips/rails.snippets diff --git a/sources_non_forked/vim-snippets/rst.snippets b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets similarity index 100% rename from sources_non_forked/vim-snippets/rst.snippets rename to sources_non_forked/vim-snippets/UltiSnips/rst.snippets diff --git a/sources_non_forked/vim-snippets/ruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets similarity index 100% rename from sources_non_forked/vim-snippets/ruby.snippets rename to sources_non_forked/vim-snippets/UltiSnips/ruby.snippets diff --git a/sources_non_forked/vim-snippets/sh.snippets b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets similarity index 67% rename from sources_non_forked/vim-snippets/sh.snippets rename to sources_non_forked/vim-snippets/UltiSnips/sh.snippets index 1085d869..915c0df9 100644 --- a/sources_non_forked/vim-snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets @@ -1,15 +1,32 @@ +global !p +import vim + +# Tests for the existence of a variable declared by Vim's filetype detection +# suggesting the type of shell script of the current file +def testShell(scope, shell): + return vim.eval("exists('" + scope + ":is_" + shell + "')") + +# Loops over the possible variables, checking for global variables +# first since they indicate an override by the user. +def getShell(): + for scope in ["g", "b"]: + for shell in ["bash", "sh", "kornshell"]: + if testShell(scope, shell) == "1": + if shell == "kornshell": + return "ksh" + return shell + return "sh" +endglobal ########################################################################### # TextMate Snippets # ########################################################################### snippet #! -#!/bin/sh - +`!p snip.rv = '#!/bin/' + getShell() + "\n\n" ` endsnippet snippet !env "#!/usr/bin/env (!env)" -#!/usr/bin/env bash - +`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" ` endsnippet snippet temp "Tempfile" diff --git a/sources_non_forked/vim-snippets/snippets.snippets b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets similarity index 100% rename from sources_non_forked/vim-snippets/snippets.snippets rename to sources_non_forked/vim-snippets/UltiSnips/snippets.snippets diff --git a/sources_non_forked/vim-snippets/tcl.snippets b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets similarity index 100% rename from sources_non_forked/vim-snippets/tcl.snippets rename to sources_non_forked/vim-snippets/UltiSnips/tcl.snippets diff --git a/sources_non_forked/vim-snippets/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets similarity index 99% rename from sources_non_forked/vim-snippets/tex.snippets rename to sources_non_forked/vim-snippets/UltiSnips/tex.snippets index d6e62fce..97ea8a82 100644 --- a/sources_non_forked/vim-snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -1,4 +1,3 @@ -extends texmath ########################################################################### # LATEX SNIPPETS # diff --git a/sources_non_forked/vim-snippets/texmath.snippets b/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets similarity index 100% rename from sources_non_forked/vim-snippets/texmath.snippets rename to sources_non_forked/vim-snippets/UltiSnips/texmath.snippets diff --git a/sources_non_forked/vim-snippets/vim.snippets b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets similarity index 100% rename from sources_non_forked/vim-snippets/vim.snippets rename to sources_non_forked/vim-snippets/UltiSnips/vim.snippets diff --git a/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets b/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-snippets/UltiSnips/xml.snippets b/sources_non_forked/vim-snippets/UltiSnips/xml.snippets new file mode 100644 index 00000000..80b017ce --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/xml.snippets @@ -0,0 +1,9 @@ +snippet t "Simple tag" b +<${1:tag}> + ${2:content} + +endsnippet + +snippet ti "Inline tag" b +<${1:tag}>${2:content} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets b/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets new file mode 100644 index 00000000..80394597 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets @@ -0,0 +1,11 @@ +snippet #! "shebang" ! +#!/bin/zsh + +endsnippet + +snippet !env "#!/usr/bin/env (!env)" ! +#!/usr/bin/env zsh + +endsnippet + +# vim:ft=snippets: diff --git a/sources_non_forked/snipmate-snippets/addon-info.json b/sources_non_forked/vim-snippets/addon-info.json similarity index 93% rename from sources_non_forked/snipmate-snippets/addon-info.json rename to sources_non_forked/vim-snippets/addon-info.json index 1f37bed8..303bf285 100644 --- a/sources_non_forked/snipmate-snippets/addon-info.json +++ b/sources_non_forked/vim-snippets/addon-info.json @@ -4,7 +4,6 @@ "maintainer" : "honza @ github & others", "repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"}, "dependencies" : { - "snipmate": {} }, "description" : "community driven set of snippets for snipmate" } diff --git a/sources_non_forked/vim-snippets/pascal.snippets b/sources_non_forked/vim-snippets/pascal.snippets deleted file mode 100644 index 33006269..00000000 --- a/sources_non_forked/vim-snippets/pascal.snippets +++ /dev/null @@ -1,122 +0,0 @@ -snippet cls -clrscr;${1} -endsnippet - -snippet tbg -textbackground(${1});${2} -endsnippet - -snippet tc -textcolor(${1});${2} -endsnippet - -snippet var -${1:varName} := ${2:value}; -endsnippet - -snippet program -program ${1:`!p snip.rv = snip.basename or "ProgramName"`}; -uses crt; - -var - ${2} - -begin -${3} -end. -endsnippet - -snippet bg -begin - ${1} -end${2} -endsnippet - -snippet bg; -begin - ${1} -end;${2} -endsnippet - -snippet rec -type ${1} = record - ${2} -end;${3} -endsnippet - -snippet if -if ${1} then - ${2} -endsnippet - -snippet ife -if ${1} then - ${2} -else - ${3}; -endsnippet - -snippet wrl -writeln(${1});${2} -endsnippet - -snippet wr -write(${1});${2} -endsnippet - -snippet rd -read(${1});${2} -endsnippet - -snippet rdl -readln(${1});${2} -endsnippet - -snippet rdk -readkey;${1} -endsnippet - -snippet gt -gotoxy(${1:0}, ${2:0});${3} -endsnippet - -snippet case -case ${1} of - ${2} -end;${3} -endsnippet - -snippet for -for ${1:i} := ${2:0} to ${3:10} do - ${4} -endsnippet - -snippet wh -while ${1} do - ${2} -endsnippet - -snippet rep -repeat - ${2} -until ${1}; -endsnippet - -snippet fun -function ${1:name} : ${2}; -var - ${3} -begin - ${4} -end; -endsnippet - -snippet pro -procedure ${1:name}; -var - ${2} -begin - ${3} -end; -endsnippet - diff --git a/sources_non_forked/vim-snippets/php.snippets b/sources_non_forked/vim-snippets/php.snippets deleted file mode 100644 index 84f6bb46..00000000 --- a/sources_non_forked/vim-snippets/php.snippets +++ /dev/null @@ -1,236 +0,0 @@ -## Snippets from SnipMate, taken from -## https://github.com/scrooloose/snipmate-snippets.git - - -############## -# Comments # -############## -snippet /* "docblock" -/** - * ${1} - */ -${2} -endsnippet - -snippet doc_f "doc_f" -/** - * $2 - * @return ${4:void} - * @author ${5:`!v g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{ - ${6} -}$0 -endsnippet - -snippet doc_i "doc_i" -/** - * $1 - * @package ${2:default} - * @author ${3:`!v g:snips_author`} - **/ -interface ${1:someClass} -{ - ${4} -} // END interface $1" -endsnippet - -########### -# Array # -########### -snippet array "PHP array" -$${1:var} = array(${2});${3} -endsnippet - -snippet key "PHP array key" -'${1}' => ${2} -endsnippet - -############ -# CLasss # -############ -snippet class "PHP class" -/** - * ${1} - */ -class ${2:ClassName} -{ - ${3} - function ${4:__construct}(${5:argument}) - { - ${6:// code...} - } -} -endsnippet - -snippet . "PHP $this->" w -$this->${1:name} -endsnippet - -############################## -# constant # -############################## -snippet def "PHP define" -define('${1}', ${2});${3} -endsnippet - -snippet def? "PHP definied" w -defined('${1}')${2} -endsnippet - -############################## -# ties # -############################## -snippet wh -while (${1:/* condition */}) { - ${2:// code...} -} -endsnippet - -snippet do "PHP do" -do { - ${2:// code... } -} while (${1:/* condition */});" -endsnippet - -snippet foreach "PHP foreach" -foreach ($${1:variable} as $${2:value}){ - ${3:// code...} -} -endsnippet - -snippet foreachk "PHP foreachk" -foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4:// code...} -} -endsnippet - -snippet for "PHP for" -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} -} -endsnippet - -############################## -# condition # -############################## -snippet ife "PHP if else" -if (${1:/* condition */}) { - ${2:// code...} -} -else { - ${3:// code...} -} -${4} -endsnippet - -snippet if "PHP if" -if (${1:/* condition */}) { - ${2:// code...} -} -endsnippet - -snippet el "PHP else" -else { - ${1:// code...} -}${2} -endsnippet - -snippet elf "PHP elseif" -elseif (${1:/* condition */}) { - ${2:// code...} -}${3} -endsnippet - -snippet t "PHP t" -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} -endsnippet - -snippet inc "PHP include" -include '${1:file}';${2} -endsnippet - -snippet inc1 "PHP include_once" -include_once '${1:file}';${2} -endsnippet - -snippet req "PHP require" -require_once '${1:file}';${2} -endsnippet - -snippet req1 "PHP require_once" -require_once '${1:file}';${2} -endsnippet - -snippet log "PHP error_log" -error_log(var_export(${1}, true));${2} -endsnippet - -snippet G "PHP GLOBALS" -$GLOBALS['${1:variable}']${2} -endsnippet - -snippet $_ "PHP COOKIE['...']" -$_COOKIE['${1:variable}']${2} -endsnippet - -snippet $_ "PHP ENV['...']" -$_ENV['${1:variable}']${2} -endsnippet - -snippet $_ "PHP FILES['...']" -$_FILES['${1:variable}']${2} -endsnippet - -snippet $_ "PHP GET['...']" -$_GET['${1:variable}']${2} -endsnippet - -snippet $_ "PHP POST['...']" -$_POST['${1:variable}']${2} -endsnippet - -snippet $_ "PHP REQUEST['...']" -$_REQUEST['${1:variable}']${2} -endsnippet - -snippet $_ "PHP SERVER['...']" -$_SERVER['${1:variable}']${2} -endsnippet - -snippet $_ "PHP SESSION['...']" -$_SESSION['${1:variable}']${2} -endsnippet - -snippet try "PHP try catch" -try { - ${2} -} catch (${1:Exception} $e) { -} -endsnippet - -snippet vare "PHP var_export" -var_export(${1});${2} -endsnippet - -############################## -# write # -############################## -snippet ec "PHP echo" -echo ${1} -endsnippet - -snippet pr "PHP print" -print ${1:$var}; -endsnippet - -snippet prf "PHP printf" -printf('${1:%s}', ${2});${3} -endsnippet - -snippet sprf "PHP sprintf" -sprintf('${1:%s}', ${2});${3} -endsnippet - -# :vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/phtml.snippets b/sources_non_forked/vim-snippets/phtml.snippets deleted file mode 100644 index 73f3b340..00000000 --- a/sources_non_forked/vim-snippets/phtml.snippets +++ /dev/null @@ -1,74 +0,0 @@ -snippet ec "PHTML echo" -${2} -endsnippet - -snippet inc "PHTML include" -${2} -endsnippet - -snippet inc1 "PHTML include_once" -${2} -endsnippet - -snippet req "PHTML require" -${2} -endsnippet - -snippet req1 "PHTML require_once" -${2} -endsnippet - -snippet if "PHTML if" - - ${2:// code...} - -endsnippet - -snippet ife "PHTML if else" - - ${2:// code...} - - ${3:// code...} - -${4} -endsnippet - -snippet el "PHTML else" - -endsnippet - -snippet elf "PHTML elseif" - - ${2:// code...} -endsnippet - -snippet wh "PHTML while" - - ${2:// code...} - -endsnippet - -snippet do "PHTML do" - - ${2:// code... } - -endsnippet - -snippet for "PHTML for" - - ${4: // code...} - -endsnippet - -snippet foreach "PHTML foreach" - - ${3:// code...} - -endsnippet - -snippet foreachk "PHTML foreach $key => $value" - $${3:value}): ?> - ${4:// code...} - -endsnippet - diff --git a/sources_non_forked/snipmate-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets similarity index 93% rename from sources_non_forked/snipmate-snippets/snippets/_.snippets rename to sources_non_forked/vim-snippets/snippets/_.snippets index 081db1c5..85759848 100644 --- a/sources_non_forked/snipmate-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -26,8 +26,7 @@ snippet GPL2 GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this program; if not, see . ${3} snippet LGPL2 @@ -45,8 +44,7 @@ snippet LGPL2 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this library; if not, see . ${3} snippet GPL3 @@ -82,8 +80,7 @@ snippet LGPL3 GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this library; if not, see . ${3} snippet BSD2 @@ -216,12 +213,27 @@ snippet APACHE ${3} snippet BEERWARE - ${1:one line to give the program's name and a brief description} - Copyright `strftime("%Y")` ${2:copyright holder} + ${2:one line to give the program's name and a brief description} + Copyright `strftime("%Y")` ${3:copyright holder} Licensed under the "THE BEER-WARE LICENSE" (Revision 42): ${1:`g:snips_author`} wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer or coffee in return - ${3} + ${4} + +snippet WTFPL + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright `strftime("%Y")` ${1:copyright holder} + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/sources_non_forked/snipmate-snippets/snippets/actionscript.snippets b/sources_non_forked/vim-snippets/snippets/actionscript.snippets similarity index 99% rename from sources_non_forked/snipmate-snippets/snippets/actionscript.snippets rename to sources_non_forked/vim-snippets/snippets/actionscript.snippets index 999b8a30..af9611c3 100644 --- a/sources_non_forked/snipmate-snippets/snippets/actionscript.snippets +++ b/sources_non_forked/vim-snippets/snippets/actionscript.snippets @@ -107,7 +107,7 @@ snippet try ${3} } # For Loop (same as c.snippet) -snippet for +snippet for for (..) {..} for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} } diff --git a/sources_non_forked/snipmate-snippets/snippets/apache.snippets b/sources_non_forked/vim-snippets/snippets/apache.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/apache.snippets rename to sources_non_forked/vim-snippets/snippets/apache.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/autoit.snippets b/sources_non_forked/vim-snippets/snippets/autoit.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/autoit.snippets rename to sources_non_forked/vim-snippets/snippets/autoit.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets similarity index 52% rename from sources_non_forked/snipmate-snippets/snippets/c.snippets rename to sources_non_forked/vim-snippets/snippets/c.snippets index 38e8d9eb..de6d6a93 100644 --- a/sources_non_forked/snipmate-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -1,38 +1,45 @@ -# main() +## Main +# main snippet main int main(int argc, const char *argv[]) { ${1} return 0; } +# main(void) snippet mainn int main(void) { ${1} return 0; } +## +## Preprocessor # #include <...> snippet inc #include <${1:stdio}.h>${2} # #include "..." snippet Inc #include "${1:`Filename("$1.h")`}"${2} -# #ifndef ... #define ... #endif -snippet Def +# ifndef...define...endif +snippet ndef #ifndef $1 #define ${1:SYMBOL} ${2:value} #endif${3} +# define snippet def #define +# ifdef...endif snippet ifdef #ifdef ${1:FOO} ${2:#define } - #endif + #endif${3} +# if snippet #if #if ${1:FOO} ${2} #endif -# Header Include-Guard +# header include guard snippet once #ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`} @@ -41,73 +48,167 @@ snippet once ${2} #endif /* end of include guard: $1 */ -# If Condition +## +## Control Statements +# if snippet if if (${1:/* condition */}) { ${2:/* code */} - } + }${3} +# else snippet el else { ${1} - } -# Ternary conditional + }${2} +# else if +snippet elif + else if (${1:/* condition */}) { + ${2:/* code */} + }${3} +# ternary snippet t ${1:/* condition */} ? ${2:a} : ${3:b} -# Do While Loop -snippet do - do { - ${2:/* code */} - } while (${1:/* condition */}); -# While Loop -snippet wh - while (${1:/* condition */}) { - ${2:/* code */} - } -# For Loop +# switch +snippet switch + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + default: + ${6} + }${7} +# switch without default +snippet switchndef + switch (${1:/* variable */}) { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + }${6} +# case +snippet case + case ${1:/* variable case */}: + ${2} + ${3:break;}${4} +## +## Loops +# for snippet for for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { ${4:/* code */} - } -# Custom For Loop + }${5} +# for (custom) snippet forr for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { ${5:/* code */} - } -# Function + }${6} +# while +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + }${3} +# do... while +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */});${3} +## +## Functions +# function definition snippet fun ${1:void} ${2:function_name}(${3}) { ${4:/* code */} - } -# Function Declaration + }${5} +# function declaration snippet fund ${1:void} ${2:function_name}(${3});${4} -# Typedef +## +## Types +# typedef snippet td typedef ${1:int} ${2:MyCustomType};${3} -# Struct +# struct snippet st struct ${1:`Filename('$1_t', 'name')`} { ${2:/* data */} }${3: /* optional variable list */};${4} -# Typedef struct +# typedef struct snippet tds typedef struct ${2:_$1 }{ ${3:/* data */} - } ${1:`Filename('$1_t', 'name')`}; -# Typdef enum + } ${1:`Filename('$1_t', 'name')`};${4} +# typedef enum snippet tde typedef enum { ${1:/* data */} - } ${2:foo}; + } ${2:foo};${3} +## +## Input/Output # printf -# unfortunately version this isn't as nice as TextMates's, given the lack of a -# dynamic `...` snippet pr printf("${1:%s}\n"${2});${3} # fprintf (again, this isn't as nice as TextMate's version, but it works) snippet fpr fprintf(${1:stderr}, "${2:%s}\n"${3});${4} +# getopt +snippet getopt + int choice; + while (1) + { + static struct option long_options[] = + { + /* Use flags like so: + {"verbose", no_argument, &verbose_flag, 'V'}*/ + /* Argument styles: no_argument, required_argument, optional_argument */ + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + ${1} + {0,0,0,0} + }; + + int option_index = 0; + + /* Argument parameters: + no_argument: " " + required_argument: ":" + optional_argument: "::" */ + + choice = getopt_long( argc, argv, "vh", + long_options, &option_index); + + if (choice == -1) + break; + + switch( choice ) + { + case 'v': + ${2} + break; + + case 'h': + ${3} + break; + + case '?': + /* getopt_long will have already printed an error */ + break; + + default: + /* Not sure how to get here... */ + return EXIT_FAILURE; + } + } + + /* Deal with non-option arguments here */ + if ( optind < argc ) + { + while ( optind < argc ) + { + ${4} + } + } +## +## Miscellaneous # This is kind of convenient snippet . [${1}]${2} @@ -125,8 +226,7 @@ snippet gpl * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, see . * * Copyright (C) ${1:Author}, `strftime("%Y")` */ diff --git a/sources_non_forked/snipmate-snippets/snippets/chef.snippets b/sources_non_forked/vim-snippets/snippets/chef.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/chef.snippets rename to sources_non_forked/vim-snippets/snippets/chef.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/clojure.snippets b/sources_non_forked/vim-snippets/snippets/clojure.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/clojure.snippets rename to sources_non_forked/vim-snippets/snippets/clojure.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/cmake.snippets b/sources_non_forked/vim-snippets/snippets/cmake.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/cmake.snippets rename to sources_non_forked/vim-snippets/snippets/cmake.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee.snippets similarity index 93% rename from sources_non_forked/snipmate-snippets/snippets/coffee.snippets rename to sources_non_forked/vim-snippets/snippets/coffee.snippets index dfe3658c..83b77eba 100644 --- a/sources_non_forked/snipmate-snippets/snippets/coffee.snippets +++ b/sources_non_forked/vim-snippets/snippets/coffee.snippets @@ -1,3 +1,8 @@ +# Closure loop +snippet forindo + for ${1:name} in ${2:array} + do ($1) -> + ${3:// body} # Array comprehension snippet fora for ${1:name} in ${2:array} @@ -85,3 +90,6 @@ snippet try # Require snippet req ${2:$1} = require '${1:sys}'${3} +# Export +snippet exp + ${1:root} = exports ? this diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets new file mode 100644 index 00000000..c3e19fe9 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -0,0 +1,131 @@ +## STL Collections +# std::array +snippet array + std::array<${1:T}, ${2:N}> ${3};${4} +# std::vector +snippet vector + std::vector<${1:T}> ${2};${3} +# std::deque +snippet deque + std::deque<${1:T}> ${2};${3} +# std::forward_list +snippet flist + std::forward_list<${1:T}> ${2};${3} +# std::list +snippet list + std::list<${1:T}> ${2};${3} +# std::set +snippet set + std::set<${1:T}> ${2};${3} +# std::map +snippet map + std::map<${1:Key}, ${2:T}> ${3};${4} +# std::multiset +snippet mset + std::multiset<${1:T}> ${2};${3} +# std::multimap +snippet mmap + std::multimap<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_set +snippet uset + std::unordered_set<${1:T}> ${2};${3} +# std::unordered_map +snippet umap + std::unordered_map<${1:Key}, ${2:T}> ${3};${4} +# std::unordered_multiset +snippet umset + std::unordered_multiset<${1:T}> ${2};${3} +# std::unordered_multimap +snippet ummap + std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4} +# std::stack +snippet stack + std::stack<${1:T}> ${2};${3} +# std::queue +snippet queue + std::queue<${1:T}> ${2};${3} +# std::priority_queue +snippet pqueue + std::priority_queue<${1:T}> ${2};${3} +## +## Access Modifiers +# private +snippet pri + private +# protected +snippet pro + protected +# public +snippet pub + public +# friend +snippet fr + friend +# mutable +snippet mu + mutable +## +## Class +# class +snippet cl + class ${1:`Filename('$1', 'name')`} + { + public: + $1(${2}); + ~$1(); + + private: + ${3:/* data */} + }; +# member function implementation +snippet mfun + ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) { + ${5:/* code */} + } +# namespace +snippet ns + namespace ${1:`Filename('', 'my')`} { + ${2} + } /* namespace $1 */ +## +## Input/Output +# std::cout +snippet cout + std::cout << ${1} << std::endl;${2} +# std::cin +snippet cin + std::cin >> ${1};${2} +## +## Iteration +# for i +snippet fori + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + }${5} + +# foreach +snippet fore + for (${1:auto} ${2:i} : ${3:container}) { + ${4:/* code */} + }${5} +# iterator +snippet iter + for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) { + ${6} + }${7} + +# auto iterator +snippet itera + for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) { + ${2:std::cout << *$1 << std::endl;} + }${3} +## +## Lambdas +# lamda (one line) +snippet ld + [${1}](${2}){${3:/* code */}}${4} +# lambda (multi-line) +snippet lld + [${1}](${2}){ + ${3:/* code */} + }${4} diff --git a/sources_non_forked/snipmate-snippets/snippets/cs.snippets b/sources_non_forked/vim-snippets/snippets/cs.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/cs.snippets rename to sources_non_forked/vim-snippets/snippets/cs.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/css.snippets b/sources_non_forked/vim-snippets/snippets/css.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/css.snippets rename to sources_non_forked/vim-snippets/snippets/css.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/dart.snippets b/sources_non_forked/vim-snippets/snippets/dart.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/dart.snippets rename to sources_non_forked/vim-snippets/snippets/dart.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/diff.snippets b/sources_non_forked/vim-snippets/snippets/diff.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/diff.snippets rename to sources_non_forked/vim-snippets/snippets/diff.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/django.snippets b/sources_non_forked/vim-snippets/snippets/django.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/django.snippets rename to sources_non_forked/vim-snippets/snippets/django.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/erlang.snippets rename to sources_non_forked/vim-snippets/snippets/erlang.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/eruby.snippets b/sources_non_forked/vim-snippets/snippets/eruby.snippets similarity index 98% rename from sources_non_forked/snipmate-snippets/snippets/eruby.snippets rename to sources_non_forked/vim-snippets/snippets/eruby.snippets index be1c7ec4..f96ca846 100644 --- a/sources_non_forked/snipmate-snippets/snippets/eruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/eruby.snippets @@ -81,10 +81,6 @@ snippet fields <% fields_for :${1:model}, @$1 do |${2:f}| %> ${3} <% end %> -snippet ff - <%= form_for @${1:model} do |f| %> - ${2} - <% end %> snippet i18 I18n.t('${1:type.key}')${2} snippet it diff --git a/sources_non_forked/snipmate-snippets/snippets/falcon.snippets b/sources_non_forked/vim-snippets/snippets/falcon.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/falcon.snippets rename to sources_non_forked/vim-snippets/snippets/falcon.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets similarity index 85% rename from sources_non_forked/snipmate-snippets/snippets/go.snippets rename to sources_non_forked/vim-snippets/snippets/go.snippets index 0e4fe61d..c64db91f 100644 --- a/sources_non_forked/snipmate-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -53,8 +53,7 @@ snippet gpl * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * along with this program; if not, see . * * Copyright (C) ${1:Author}, `strftime("%Y")` */ @@ -67,7 +66,7 @@ snippet i snippet im import ( "${1:package}" - ) + )${2} # interface snippet in interface{} @@ -80,12 +79,12 @@ snippet inf snippet if if ${1:/* condition */} { ${2:/* code */} - } + }${2} # else snippet snippet el else { ${1} - } + }${2} # error snippet snippet ir if err != nil { @@ -114,26 +113,37 @@ snippet ie } else { ${3} } + ${4} # for loop snippet fo - for ${2:i} = 0; $2 < ${1:count}; $2${3:++} { + for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { ${4:/* code */} } + ${5} # for range loop snippet fr for ${1:k}, ${2:v} := range ${3} { ${4:/* code */} } + ${5} # function simple snippet fun - func ${1:funcName}(${2}) ${3:os.Error} { + func ${1:funcName}(${2}) ${3:error} { ${4:/* code */} } + ${5} # function on receiver snippet fum - func (self ${1:type}) ${2:funcName}(${3}) ${4:os.Error} { + func (self ${1:type}) ${2:funcName}(${3}) ${4:error} { ${5:/* code */} } + ${6} +# log printf +snippet lf + log.Printf("%${1:s}", ${2:var})${3} +# log printf +snippet lp + log.Println("${1}")${2} # make snippet mk make(${1:[]string}, ${2:0}) @@ -145,6 +155,7 @@ snippet main func main() { ${1:/* code */} } + ${2} # new snippet nw new(${1:type}) @@ -153,7 +164,7 @@ snippet pn panic("${1:msg}") # print snippet pr - fmt.Printf("${1:%s}\n", ${2:var})${3} + fmt.Printf("%${1:s}\n", ${2:var})${3} # range snippet rn range ${1} @@ -180,7 +191,8 @@ snippet sr snippet st struct ${1:name} { ${2:/* data */} - }${4} + } + ${3} # switch snippet sw switch ${1:var} { @@ -192,7 +204,7 @@ snippet sw ${6:/* code */} } snippet sp - fmt.Sprintf("${1:%s}", ${2:var})${3} + fmt.Sprintf("%${1:s}", ${2:var})${3} # true snippet t true diff --git a/sources_non_forked/snipmate-snippets/snippets/haml.snippets b/sources_non_forked/vim-snippets/snippets/haml.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/haml.snippets rename to sources_non_forked/vim-snippets/snippets/haml.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/haskell.snippets b/sources_non_forked/vim-snippets/snippets/haskell.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/haskell.snippets rename to sources_non_forked/vim-snippets/snippets/haskell.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets similarity index 97% rename from sources_non_forked/snipmate-snippets/snippets/html.snippets rename to sources_non_forked/vim-snippets/snippets/html.snippets index be8b0f65..cfc44ad1 100644 --- a/sources_non_forked/snipmate-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -353,11 +353,11 @@ snippet footer ${1} snippet footer. -
            ${2}
            snippet footer# -
            ${2}
            snippet form @@ -445,6 +445,18 @@ snippet xhtml ${1} +snippet html5 + + + + + ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${2:meta} + + + ${3:body} + + snippet i ${1} snippet iframe @@ -544,7 +556,7 @@ snippet link snippet link:atom ${2} snippet link:css - ${4} + ${3} snippet link:favicon ${2} snippet link:rss @@ -777,7 +789,7 @@ snippet thead ${1} snippet time - snippet title ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} snippet tr diff --git a/sources_non_forked/snipmate-snippets/snippets/htmldjango.snippets b/sources_non_forked/vim-snippets/snippets/htmldjango.snippets similarity index 97% rename from sources_non_forked/snipmate-snippets/snippets/htmldjango.snippets rename to sources_non_forked/vim-snippets/snippets/htmldjango.snippets index 38f836bf..09cf98ec 100644 --- a/sources_non_forked/snipmate-snippets/snippets/htmldjango.snippets +++ b/sources_non_forked/vim-snippets/snippets/htmldjango.snippets @@ -50,6 +50,9 @@ snippet if snippet else {% else %} ${1} +snippet elif + {% elif ${1} %} + ${2} snippet ifchanged {% ifchanged %}${1}{% endifchanged %} snippet ifequal @@ -80,6 +83,8 @@ snippet widthratio {% widthratio ${1:this_value} ${2:max_value} ${3:100} %} snippet with {% with ${1} as ${2} %} + ${3} + {% endwith %} # Template Filters diff --git a/sources_non_forked/snipmate-snippets/snippets/htmltornado.snippets b/sources_non_forked/vim-snippets/snippets/htmltornado.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/htmltornado.snippets rename to sources_non_forked/vim-snippets/snippets/htmltornado.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets similarity index 97% rename from sources_non_forked/snipmate-snippets/snippets/java.snippets rename to sources_non_forked/vim-snippets/snippets/java.snippets index fb27b9c1..854f14ac 100644 --- a/sources_non_forked/snipmate-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -140,7 +140,7 @@ snippet /** * ${1} */ snippet @au - @author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5")` + @author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")` snippet @br @brief ${1:Description} snippet @fi @@ -176,9 +176,9 @@ snippet main ## ## Print Methods snippet print - System.out.print("${1:Message"); + System.out.print("${1:Message}"); snippet printf - System.out.printf("${1:Message", ${2:args}); + System.out.printf("${1:Message}", ${2:args}); snippet println System.out.println(${1}); ## diff --git a/sources_non_forked/snipmate-snippets/snippets/javascript-jquery.snippets b/sources_non_forked/vim-snippets/snippets/javascript-jquery.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/javascript-jquery.snippets rename to sources_non_forked/vim-snippets/snippets/javascript-jquery.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript.snippets similarity index 82% rename from sources_non_forked/snipmate-snippets/snippets/javascript.snippets rename to sources_non_forked/vim-snippets/snippets/javascript.snippets index de50a0cf..2901587f 100644 --- a/sources_non_forked/snipmate-snippets/snippets/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript.snippets @@ -11,12 +11,12 @@ snippet fun } # Anonymous Function snippet f - function(${1}) { + function (${1}) { ${3} }${2:;} # Immediate function snippet (f - (function(${1}) { + (function (${1}) { ${3:/* code */} }(${2})); # if @@ -32,11 +32,11 @@ snippet ife ${3} } # tertiary conditional -snippet t +snippet ter ${1:/* condition */} ? ${2:a} : ${3:b} # switch snippet switch - switch(${1:expression}) { + switch (${1:expression}) { case '${3:case}': ${4:// code} break; @@ -52,13 +52,13 @@ snippet case ${3} # for (...) {...} snippet for - for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3: += 1}) { - ${4:$1[$2]} + for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) { + var ${3:v} = $1[$2];${4:} } # for (...) {...} (Improved Native For-Loop) snippet forr - for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3: -= 1}) { - ${4:$1[$2]} + for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) { + var ${3:v} = $1[$2];${4:} } # while (...) {...} snippet wh @@ -69,7 +69,7 @@ snippet wh snippet try try { ${1:/* code */} - } catch(${2:e}) { + } catch (${2:e}) { ${3:/* handle error */} } # do...while @@ -79,12 +79,12 @@ snippet do } while (${1:/* condition */}); # Object Method snippet :f - ${1:method_name}: function(${2:attribute}) { + ${1:method_name}: function (${2:attribute}) { ${4} }${3:,} # setTimeout function snippet timeout - setTimeout(function() {${3}}${2}, ${1:10}); + setTimeout(function () {${3}}${2}, ${1:10}); # Get Elements snippet get getElementsBy${1:TagName}('${2}')${3} @@ -129,7 +129,7 @@ snippet sdf $1 = function ($2) { ${4:// main code} }; - } + }; # singleton snippet sing function ${1:Singleton} (${2:argument}) { @@ -154,3 +154,10 @@ snippet sing return instance; } +# Crockford's object function +snippet obj + function object(o) { + function F() {} + F.prototype = o; + return new F(); + } diff --git a/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets b/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets new file mode 100644 index 00000000..9b4966db --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets @@ -0,0 +1 @@ +javascript-jquery.snippets \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/snippets/jsp.snippets b/sources_non_forked/vim-snippets/snippets/jsp.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/jsp.snippets rename to sources_non_forked/vim-snippets/snippets/jsp.snippets diff --git a/sources_non_forked/vim-snippets/snippets/ledger.snippets b/sources_non_forked/vim-snippets/snippets/ledger.snippets new file mode 100644 index 00000000..293d4b65 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/ledger.snippets @@ -0,0 +1,5 @@ +# Ledger +snippet ent + `strftime("%Y/%m/%d")` ${1:transaction} + ${2:account} ${3:value} + ${4:account} diff --git a/sources_non_forked/snipmate-snippets/snippets/lua.snippets b/sources_non_forked/vim-snippets/snippets/lua.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/lua.snippets rename to sources_non_forked/vim-snippets/snippets/lua.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/make.snippets b/sources_non_forked/vim-snippets/snippets/make.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/make.snippets rename to sources_non_forked/vim-snippets/snippets/make.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/mako.snippets b/sources_non_forked/vim-snippets/snippets/mako.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/mako.snippets rename to sources_non_forked/vim-snippets/snippets/mako.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/markdown.snippets b/sources_non_forked/vim-snippets/snippets/markdown.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/markdown.snippets rename to sources_non_forked/vim-snippets/snippets/markdown.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/objc.snippets b/sources_non_forked/vim-snippets/snippets/objc.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/objc.snippets rename to sources_non_forked/vim-snippets/snippets/objc.snippets diff --git a/sources_non_forked/vim-snippets/snippets/openfoam.snippets b/sources_non_forked/vim-snippets/snippets/openfoam.snippets new file mode 100644 index 00000000..ff690cca --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/openfoam.snippets @@ -0,0 +1,53 @@ +# 0/* +snippet fv + type fixedValue; + value uniform ${1}; +snippet zg + type zeroGradient; +snippet sym + type symmetryPlane; +# system/controlDict +snippet forces + forces + { + type forces; + functionObjectLibs ("libforces.so"); + enabled true; + outputControl ${1:timeStep}; + outputInterval ${2:1}; + patches (${3}); + log ${4:true}; + CofR (${5:0 0 0}); + } +# system/fvSolution +# solvers +snippet gamg + ${1:p} + { + solver GAMG; + tolerance 1e-${2:6}; + relTol ${3:0.0}; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } +snippet pbicg + ${1:U} + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-${2:6}; + relTol ${3:0.0}; + } +# PIMPLE +snippet pimple + PIMPLE + { + nOuterCorrectors ${1:outer}; + nCorrectors ${2:inner}; + nNonOrthogonalCorrectors ${3:nonOrtho}; + pRefCell ${4:cell}; + pRefValue ${5:value for $4}; + } diff --git a/sources_non_forked/snipmate-snippets/snippets/perl.snippets b/sources_non_forked/vim-snippets/snippets/perl.snippets similarity index 83% rename from sources_non_forked/snipmate-snippets/snippets/perl.snippets rename to sources_non_forked/vim-snippets/snippets/perl.snippets index 4ba985db..9cebedea 100644 --- a/sources_non_forked/snipmate-snippets/snippets/perl.snippets +++ b/sources_non_forked/vim-snippets/snippets/perl.snippets @@ -79,48 +79,54 @@ snippet for snippet fore ${1:expression} foreach @${2:array};${3} # Package -snippet cl - package ${1:ClassName}; +snippet package + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}; - use base qw(${2:ParentClass}); + ${2} - sub new { - my $class = shift; - $class = ref $class if ref $class; - my $self = bless {}, $class; - $self; - } + 1; - 1;${3} + __END__ +# Package syntax perl >= 5.14 +snippet packagev514 + package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99}; + + ${3} + + 1; + + __END__ +#moose +snippet moose + use Moose; + use namespace::autoclean; + ${1:#}BEGIN {extends '${2:ParentClass}'}; + + ${3} +# parent +snippet parent + use parent qw(${1:Parent Class}); # Read File snippet slurp my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; ${3} - - # strict warnings snippet strwar use strict; use warnings; - - -# standard versioning with perlcritic bypass +# older versioning with perlcritic bypass snippet vers ## no critic our $VERSION = '${1:version}'; eval $VERSION; ## use critic - - # new 'switch' like feature snippet switch use feature 'switch'; - - # Anonymous subroutine snippet asub - sub { + sub { ${1:# body } } @@ -133,19 +139,19 @@ snippet begin } # call package function with some parameter -snippet pkgmv +snippet pkgmv __PACKAGE__->${1:package_method}(${2:var}) # call package function without a parameter -snippet pkgm +snippet pkgm __PACKAGE__->${1:package_method}() # call package "get_" function without a parameter -snippet pkget +snippet pkget __PACKAGE__->get_${1:package_method}() # call package function with a parameter -snippet pkgetv +snippet pkgetv __PACKAGE__->get_${1:package_method}(${2:var}) # complex regex @@ -160,10 +166,10 @@ snippet qr/ #given snippet given - given ($${1:var}) { + given ($${1:var}) { ${2:# cases} ${3:# default} - } + } # switch-like case snippet when @@ -176,7 +182,6 @@ snippet hslice @{ ${1:hash} }{ ${2:array} } - # map snippet map map { ${2: body } } ${1: @array } ; @@ -190,7 +195,7 @@ snippet ppod ${1:ClassName} - ${2:ShortDesc} =head1 SYNOPSIS - + use $1; ${3:# synopsis...} @@ -202,7 +207,7 @@ snippet ppod =head1 INTERFACE - + =head1 DEPENDENCIES @@ -223,8 +228,17 @@ snippet psubi =cut +# inline documented subroutine +snippet subpod + =head2 $1 + Summary of $1 + =cut + + sub ${1:subroutine_name} { + ${2:# body...} + } # Subroutine signature snippet parg =over 2 @@ -232,7 +246,7 @@ snippet parg =item Arguments - + =over 3 =item @@ -255,47 +269,21 @@ snippet parg =back - =back -# Moose package -snippet moosecl - package ${1:ClassName}; - - use Moose; - #extends '${2:# ParentClass}'; - - ${6:# body of class} - - 1; - - - __END__ - - =head1 NAME - - $1 - ${3:ShortDesc} - - =head1 SYNOPSIS - - ${4:# synopsis...} - - =head1 DESCRIPTION - - ${5:# longer description...} - - # Moose has snippet has has ${1:attribute} => ( - is => '${2:ro|rw}', + is => '${2:ro|rw}', isa => '${3:Str|Int|HashRef|ArrayRef|etc}', - default => ${4:defaultvalue} - ,${5:# other attributes} + default => sub { + ${4:defaultvalue} + }, + ${5:# other attributes} ); @@ -303,14 +291,14 @@ snippet has snippet override override ${1:attribute} => sub { ${2:# my $self = shift;}; - ${3:# my ($self,$args) = @_;}; + ${3:# my ($self, $args) = @_;}; }; # use test classes snippet tuse use Test::More; - use Test::Deep (); + use Test::Deep; # (); # uncomment to stop prototype errors use Test::Exception; # local test lib @@ -331,7 +319,7 @@ snippet tsub sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { my $self = shift; ${4:# body} - + } # Test::Routine-style test @@ -347,6 +335,7 @@ snippet tprep my $self = shift; ${4:# body} } + # cause failures to print stack trace snippet debug_trace use Carp; # 'verbose'; diff --git a/sources_non_forked/snipmate-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets similarity index 83% rename from sources_non_forked/snipmate-snippets/snippets/php.snippets rename to sources_non_forked/vim-snippets/snippets/php.snippets index 9ce93d47..513ee9b6 100644 --- a/sources_non_forked/snipmate-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -39,23 +39,30 @@ snippet m ${7} } # setter method -# I think vim's functions will not be called at the snipMate's runtime -# but `compile` time -# so `tolower` here won't work -# but it would be wonderful if we could make the property and parameter to lower case snippet sm - ${1:public} function set${2:Foo}(${3:$2 }$${4:`tolower('$2')`}) + /** + * Sets the value of ${1:foo} + * + * @param ${2:$1} $$1 ${3:description} + * + * @return ${4:`Filename()`} + */ + ${5:public} function set${6:$2}(${7:$2 }$$1) { - $this->${5:$4} = $$4; - ${6} + $this->${8:$1} = $$1; return $this; - } + }${9} # getter method snippet gm - ${1:public} function get${2:Foo}() + /** + * Gets the value of ${1:foo} + * + * @return ${2:$1} + */ + ${3:public} function get${4:$2}() { - return $this->${3:$2}; - } + return $this->${5:$1}; + }${6} #setter snippet $s ${1:$foo}->set${2:Bar}(${3}); @@ -195,7 +202,7 @@ snippet interface * @package ${3:default} * @author ${4:`g:snips_author`} */ - interface ${1:} + interface ${1:`Filename()`} { ${5} } @@ -204,7 +211,7 @@ snippet class /** * ${1} */ - class ${2:ClassName} + class ${2:`Filename()`} { ${3} /** @@ -215,6 +222,13 @@ snippet class ${8:// code...} } } +snippet nc + namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`}; + + ${2:abstract }class ${3:`Filename()`} + { + ${4} + } # define(...) snippet def define('${1}'${2});${3} @@ -322,25 +336,46 @@ snippet http_redirect header ("Location: ".URL); exit(); # Getters & Setters -snippet getset +snippet gs /** - * Gets the value of ${1:} + * Gets the value of ${1:foo} * - * @return ${2} + * @return ${2:$1} */ - public function get$1() + public function get${3:$2}() { - return $this->$1; + return $this->${4:$1}; } /** * Sets the value of $1 * - * @param mixed $$1 ${3} + * @param $2 $$1 ${5:description} + * + * @return ${6:`Filename()`} */ - public function set$1($$1) + public function set$3(${7:$2 }$$1) { - $this->$1 = $$1; + $this->$4 = $$1; + return $this; + }${8} +# anotation, get, and set, useful for doctrine +snippet ags + /** + * ${1:description} + * + * @${7} + */ + ${2:protected} $${3:foo}; + + public function get${4:$3}() + { + return $this->$3; + } + + public function set$4(${5:$4 }$${6:$3}) + { + $this->$3 = $$6; return $this; } snippet rett diff --git a/sources_non_forked/vim-snippets/snippets/plsql.snippets b/sources_non_forked/vim-snippets/snippets/plsql.snippets new file mode 100644 index 00000000..dba25eee --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/plsql.snippets @@ -0,0 +1,109 @@ +# create package spec +snippet ps + create or replace package ${1:name} + as + ${2:-- spec} + end; -- end of package spec $1 +# create package body +snippet pb + create or replace package body ${1:name} + as + ${2:-- body} + end; -- end of package body $1; +# package procedure spec +snippet pps + procedure ${1:name}(${2:args}); +# package procedure body +snippet ppb + procedure ${1:name}(${2:args}) + as + begin + ${3:-- body} + end $2; +# package function spec +snippet pfs + function ${1:name}(${2:args}) + return ${3:type}; +# package function body +snippet pfb + function ${1:name}(${2:args}) + return ${3:type} + as + l_res $3; + begin + ${4:-- body}; + return l_res; + end $1; +# snow errors +snippet err + show errors; +# proc/func in parameter +snippet p + ${1:name} ${2:in} ${3:type} ${4: := null} +# package type: record +snippet tr + type tr_${1:name} is record (${2:/* columns */}); +# package type: nested table +snippet tt + type tt_${1:name} is table of tr_${2:name}; +# package type: indexed table +snippet tti + type tt_${1:name} is table of tr_${2:name} index by binary_integer; +# proc/func comment +snippet doc + /* + * ${1: comment ...} + */ +# plsql block +snippet beg + begin + ${1} + end; +# plsql block with declare part +snippet dec + declare + ${1} + begin + ${2} + end; +# return pipe row +snippet rpipe + for ${1:i} in 1 .. ${2:l_res}.count loop + pipe row( $2($1) ); + end loop; + return; +# bulk collect +snippet bc + bulk collect into ${1} +# local variable +snippet l + l_${1} ${2:number}; +# output +snippet log + dbms_output.put_line('${1}'); +# for loop +snippet for + for ${1:i} in ${2:1}..${3:42} loop + ${3} + end loop; +# for loop with select +snippet fors + for ${1:rec} in (${2: select}) loop + ${3} + end loop; +# for loop with collection +snippet forc + for ${1:i} in ${2:l_var}.first .. $2.last loop + ${3: -- dbms_output.put_line($2($1)); } + end loop; +# if +snippet if + if ${1} then + ${2} + end if; +snippet ife + if ${1} then + ${2} + else + ${3} + end if; diff --git a/sources_non_forked/snipmate-snippets/snippets/po.snippets b/sources_non_forked/vim-snippets/snippets/po.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/po.snippets rename to sources_non_forked/vim-snippets/snippets/po.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/processing.snippets b/sources_non_forked/vim-snippets/snippets/processing.snippets old mode 100755 new mode 100644 similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/processing.snippets rename to sources_non_forked/vim-snippets/snippets/processing.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/progress.snippets b/sources_non_forked/vim-snippets/snippets/progress.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/progress.snippets rename to sources_non_forked/vim-snippets/snippets/progress.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/puppet.snippets rename to sources_non_forked/vim-snippets/snippets/puppet.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets similarity index 66% rename from sources_non_forked/snipmate-snippets/snippets/python.snippets rename to sources_non_forked/vim-snippets/snippets/python.snippets index b3b1e9b2..9cb21135 100644 --- a/sources_non_forked/snipmate-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -6,23 +6,25 @@ snippet from from ${1:package} import ${2:module} # Module Docstring snippet docs - ''' + """ File: ${1:`Filename('$1.py', 'foo.py')`} - Author: ${2:`g:snips_author`} - Description: ${3} - ''' + Author: `g:snips_author` + Email: `g:snips_email` + Github: `g:snips_github` + Description: ${2} + """ snippet wh while ${1:condition}: - ${2:# code...} + ${2:# TODO: write code...} # dowh - does the same as do...while in other languages snippet dowh while True: - ${1:# code...} + ${1:# TODO: write code...} if ${2:condition}: break snippet with with ${1:expr} as ${2:var}: - ${3:# code...} + ${3:# TODO: write code...} # New Class snippet cl class ${1:ClassName}(${2:object}): @@ -35,14 +37,14 @@ snippet cl snippet def def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): """${3:docstring for $1}""" - ${4:pass} + ${4:# TODO: write code...} snippet deff def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${3} + ${3:# TODO: write code...} # New Method snippet defs def ${1:mname}(self, ${2:arg}): - ${3:pass} + ${3:# TODO: write code...} # New Property snippet property def ${1:foo}(): @@ -51,20 +53,24 @@ snippet property ${3:return self._$1} def fset(self, value): ${4:self._$1 = value} + def fdel(self): + ${5:del self._$1} + return locals() + $1 = property(**$1()) # Ifs snippet if if ${1:condition}: - ${2:code...} + ${2:# TODO: write code...} snippet el else: - ${1:code...} + ${1:# TODO: write code...} snippet ei elif ${1:condition}: - ${2:code...} + ${2:# TODO: write code...} # For snippet for for ${1:item} in ${2:items}: - ${3:code...} + ${3:# TODO: write code...} # Encodes snippet cutf8 # -*- coding: utf-8 -*- @@ -79,32 +85,32 @@ snippet . self. snippet try Try/Except try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} snippet try Try/Except/Else try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:pass} + ${5:# TODO: write code...} snippet try Try/Except/Finally try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} finally: - ${5:pass} + ${5:# TODO: write code...} snippet try Try/Except/Else/Finally try: - ${1:pass} + ${1:# TODO: write code...} except ${2:Exception}, ${3:e}: ${4:raise $3} else: - ${5:pass} + ${5:# TODO: write code...} finally: - ${6:pass} + ${6:# TODO: write code...} # if __name__ == '__main__': snippet ifmain if __name__ == '__main__': @@ -130,12 +136,29 @@ snippet " # test function/method snippet test def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): - ${3:pass} + ${3:# TODO: write code...} # test case snippet testcase class ${1:ExampleCase}(unittest.TestCase): def test_${2:description}(self): - ${3:pass} + ${3:# TODO: write code...} snippet fut from __future__ import ${1} +#getopt +snippet getopt + try: + # Short option syntax: "hv:" + # Long option syntax: "help" or "verbose=" + opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}]) + + except getopt.GetoptError, err: + # Print debug info + print str(err) + ${3:error_action} + + for option, argument in opts: + if option in ("-h", "--help"): + ${4} + elif option in ("-v", "--verbose"): + verbose = argument diff --git a/sources_non_forked/snipmate-snippets/snippets/r.snippets b/sources_non_forked/vim-snippets/snippets/r.snippets similarity index 77% rename from sources_non_forked/snipmate-snippets/snippets/r.snippets rename to sources_non_forked/vim-snippets/snippets/r.snippets index 909e70d9..71186e35 100644 --- a/sources_non_forked/snipmate-snippets/snippets/r.snippets +++ b/sources_non_forked/vim-snippets/snippets/r.snippets @@ -93,3 +93,29 @@ snippet ma maply(${1:matrix}, ${2:function}) snippet m_ m_ply(${1:matrix}, ${2:function}) + +# plot functions +snippet pl + plot(${1:x}, ${2:y}) +snippet ggp + ggplot(${1:data}, aes(${2:aesthetics})) +snippet img + ${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}") + ${6:plot} + dev.off() + +# statistical test functions +snippet fis + fisher.test(${1:x}, ${2:y}) +snippet chi + chisq.test(${1:x}, ${2:y}) +snippet tt + t.test(${1:x}, ${2:y}) +snippet wil + wilcox.test(${1:x}, ${2:y}) +snippet cor + cor.test(${1:x}, ${2:y}) +snippet fte + var.test(${1:x}, ${2:y}) +snippet kvt + kv.test(${1:x}, ${2:y}) diff --git a/sources_non_forked/snipmate-snippets/snippets/rst.snippets b/sources_non_forked/vim-snippets/snippets/rst.snippets similarity index 69% rename from sources_non_forked/snipmate-snippets/snippets/rst.snippets rename to sources_non_forked/vim-snippets/snippets/rst.snippets index d31a13ff..97845de3 100644 --- a/sources_non_forked/snipmate-snippets/snippets/rst.snippets +++ b/sources_non_forked/vim-snippets/snippets/rst.snippets @@ -1,14 +1,14 @@ # rst snippet : - :${1:Text}: ${2:blah blah} + :${1:field name}: ${2:field body} snippet * *${1:Emphasis}* snippet ** **${1:Strong emphasis}** snippet _ - \`${1:Text}\`_ - .. _\`$1\`: ${2:blah blah} + \`${1:hyperlink-name}\`_ + .. _\`$1\`: ${2:link-block} snippet = ${1:Title} =====${2:=} diff --git a/sources_non_forked/snipmate-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets similarity index 95% rename from sources_non_forked/snipmate-snippets/snippets/ruby.snippets rename to sources_non_forked/vim-snippets/snippets/ruby.snippets index 26bdfa5a..a9b45ad4 100644 --- a/sources_non_forked/snipmate-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -2,6 +2,10 @@ # Ruby snippets - for Rails, see below # ######################################## +# encoding for Ruby 1.9 +snippet enc + # encoding: utf-8 + # #!/usr/bin/env ruby snippet #! #!/usr/bin/env ruby @@ -22,8 +26,10 @@ snippet beg rescue ${1:Exception} => ${2:e} end -snippet req +snippet req require require "${1}"${2} +snippet reqr + require_relative "${1}"${2} snippet # # => snippet end @@ -282,9 +288,15 @@ snippet eavd snippet eawi each_with_index { |${1:e}, ${2:i}| ${3} } snippet eawid - each_with_index do |${1:e},${2:i}| + each_with_index do |${1:e}, ${2:i}| ${3} end +snippet eawo + each_with_object(${1:init}) { |${2:e}, ${3:var}| ${4} } +snippet eawod + each_with_object(${1:init}) do |${2:e}, ${3:var}| + ${4} + end snippet reve reverse_each { |${1:e}| ${2} } snippet reved @@ -390,7 +402,7 @@ snippet : snippet ope open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} } # path_from_here() -snippet patfh +snippet fpath File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2} # unix_filter {} snippet unif @@ -571,7 +583,7 @@ snippet asre assert_response :${1:success}, @response.body${2} snippet asrj assert_rjs :${1:replace}, "${2:dom id}" -snippet ass +snippet ass assert_select(..) assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do} snippet bf before_filter :${1:method} @@ -650,6 +662,10 @@ snippet defupdate end end end${3} +snippet dele delegate .. to + delegate :${1:methods}, :to => :${2:object} +snippet dele delegate .. to .. prefix .. allow_nil + delegate :${1:methods}, :to => :${2:object}, :prefix => :${3:prefix}, :allow_nil => ${4:allow_nil} snippet flash flash[:${1:notice}] = "${2}" snippet habtm @@ -865,7 +881,6 @@ snippet test test "should ${1:do something}" do ${2} end - #migrations snippet mac add_column :${1:table_name}, :${2:column_name}, :${3:data_type} @@ -907,6 +922,11 @@ snippet it snippet itp it "${1:spec_name}" ${2} +snippet its + its(:${1:method}) { should ${2} } +snippet itsn + its(:${1:method}) { should_not ${2} } + snippet desc describe ${1:class_name} do ${2} @@ -923,3 +943,19 @@ snippet aft after :${1:each} do ${2} end +snippet let + let(:${1:method}) { ${2} } +snippet subj + subject { ${1} } +snippet spec + specify { subject.${1} } +snippet exp + expect(${1:object}).to ${2} +snippet btr + be_true +snippet bfa + be_false +snippet shared + shared_examples "${1:shared examples name}" ${2} +snippet itb + it_behaves_like "${1:shared examples name}"${2} diff --git a/sources_non_forked/vim-snippets/snippets/scala.snippets b/sources_non_forked/vim-snippets/snippets/scala.snippets new file mode 100644 index 00000000..c342228a --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/scala.snippets @@ -0,0 +1,349 @@ +################################################################ +# © Copyright 2011 Konstantin Gorodinskiy. All Rights Reserved.# +# Do What The Fuck You Want To Public License, Version 2. # +# See http://sam.zoy.org/wtfpl/COPYING for more details. # +################################################################ +# Scala lang +#if +snippet if + if(${1:obj}) { + ${2:/* code */} + } +#if not +snippet ifn + if(!${1:obj}) { + ${2:/* code */} + } +#if-else +snippet ifel + if(${1:obj}) { + ${2:/* code */} + } else { + ${3:/* code */} + } +#if-else-if +snippet ifelif + if(${1:obj}) { + ${2:/* code */} + } else if(${3:obj}) { + ${4:/* code */} + } +#while loop +snippet while + while (${1:obj}) { + ${2:/* code */} + } +#for loop(classic) +snippet for + for (${1:item} <- ${2:obj}) { + ${3:/* code */} + } +#for loop(indexed) +snippet fori + for (${1:i} <- ${2:0} to ${3:obj}.length) { + ${4:/* code */} + } +#exceptions +snippet try + try { + ${1:/* code */} + } catch { + case e: FileNotFoundException => ${2:/* code */} + case e: IOException => ${3:/* code */} + } finally { + ${4:/* code */} + } +#match +snippet match + ${1: obj} match { + case ${2:e} => ${3:/* code */} + case _ => ${4:/* code */} + } +#case +snippet case + case ${1:value} => ${2:/* code */} +############################ +# methods and arguments +# +#arg +snippet arg + ${1:a}: ${2:T}${3:, arg} +#args +snippet args + ${1:args}: ${2:T}* +#def +snippet def + def ${1:name}(${2:arg}) = ${3:} +#private def +snippet prdef + private def ${1:name}(${2:arg}) = ${3:} +#override def +snippet ovdef + override def ${1:name}(${2:arg}) = ${3:} +#first class function(see scalabook p 188) +snippet fcf + (${1:a}: ${2:T}) => $1 ${3:/* code */} +snippet => + ${1:name} => ${2:/* code */} +#recursion +snippet rec + def ${1:name}(${2:arg}) = + if($2) $2 + else $1($2) +#curried method +snippet crdef + def ${1:name}(${2:arg})(${3:arg}) = ${4:} +#main method +#check validity of T +snippet main + def main(args: Array[String]):${1:T} = ${2:} +############################ +# basic types(general purpose) +# you might want to use basic types snippets + +#1 +snippet T Double + dbl +#2 +snippet T Int + int +#3 +snippet T Long + lng +#4 +snippet T Char + chr +#5 +snippet T String + str +#6 +snippet T Array + arr +#7 +snippet T Buffer + buf +#8 +snippet T List + list +#9 +snippet T Tuple + tpl +#10 +snippet T Set + set +#11 +snippet T Map + map +#12 +snippet T HashSet + hset +#13 +snippet T HashMap + hmap +#14 +snippet T Boolean + bool +#end + +#named snippets for types +snippet bool + Boolean +snippet anyr + AnyRef +snippet dbl + Double +snippet int + Int +snippet str + String +snippet chr + Char +snippet lng + Long +snippet arr + Array${1:[T]}${2:()} +snippet buf + Buffer${1:[T]}${2:()} +snippet list + List${1:[T]}${2:()} +snippet tpl + Tuple${1:2}[${2:T},${3:T}] +snippet set + Set${1:[T]}${2:()} +snippet hset + HashSet${1:[T]}${2:()} +snippet mhset + mutable.HashSet${1:[T]}${2:()} +#for maps +snippet keyval + ${1:key}->${2:val}${3:, keyval} +snippet map + Map[${1:T},${2:T}]${3:(keyval)} +snippet hmap + HashMap[${1:T},${2:T}]${3:(keyval)} +snippet mmap + mutable.Map[${1:T},${2:T}]${3:(keyval)} +snippet mhmap + mutable.HashMap[${1:T},${2:T}]${3:(keyval)} +#TODO add TreeMap and TreeSet +#asInstanceOf[] +snippet as + ${1:name}.asInstanceOf[${2:T}] +#isInstanceOf[] + ${1:name}.isInstanceOf[${2:T}] +#end +#collections methods + +#scope() with one arg +snippet (a + (${1:a} => ${2:/* code */}) +#scope() with two args +snippet {( + {(${1:a},${2:b}) => + ${3:/* code */} + } +#filter +snippet filter + ${1:name}.filter (a +#map function +snippet mapf + ${1:name}.map (a +#flatmap +snippet flatmap + ${1:name}.flatMap${2:[T]}(a +#fold left +snippet fldl + ${1:name}.foldLeft(${2:first}) {( +#fold right +snippet fldr + ${1:name}.foldRight(${2:first}) {( +#fold left operator(if u wanna reduce readability of ur code) +#use wildcard symbols +snippet /: + (${1:first}/:${2:name})(${3:/* code */}) +#fold right operator +snippet :\ + (${1:first}:\${2:name})(${3:/* code */}) +#reduce left +snippet redl + ${1:name}.reduceLeft[${2:T}] {( +#reduce right +snippet redr + ${1:name}.reduceRight[${2:T}] {( +#zipWithIndex(safe way). +#see http://daily-scala.blogspot.com/2010/05/zipwithindex.html +snippet zipwi + ${1:name}.view.zipWithIndex +#split +snippet spl + ${1:name}.split("${2:,}") +#end +snippet val + val ${1:name}${2:: T} = ${3:value} +snippet var + var ${1:name}${2:: T} = ${3:value} +############################ +# classes +# +#extends +snippet extends + extends ${1:what} +#with +snippet with + with ${1:what}${2: with} +#auxiliary constructor(a. this) +snippet athis + def this(arg) = this(arg) +#abstract class +snippet abstract + abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#class +snippet class + class ${1:name}${2:(arg)}${3: extends }${4: with} { + ${5:override def toString = "$1"} + ${6:/* code */} + } +#object +snippet object + object ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +#trait +snippet trait + trait ${1:name}${2: extends }${3: with} { + ${4:} + } +#class with trait Ordered(page 265) +snippet ordered + class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { + ${4:override def toString = "$1"} + def compare(that: $1) = ${5:this - that} + ${6:/* code */} + } +#case class +snippet casecl + case class ${1:name}${2:(arg)}${3: extends }${4: with} ${5:} +############################ +# testing +# +#scalatest imports +snippet scalatest + ${1:import org.scalatest.Suite} + ${2:import org.scalatest.FunSuite} +#assert +snippet assert + assert(${1:a}==${2:b}) +#ensuring(p 296) +snippet ensuring + ifel ensuring(${1:a}==${2:b}) +#expect +snippet expect + expect(${1:what}) { +#intercept +snippet intercept + intercept[${1:IllegalArgumentException}] { +#test +snippet test + test("${1:description}") { +#suite +snippet suite + class ${1:name} extends Suite { + def test() { + } +#funsuite +snippet fsuite + class ${1:name} extends FunSuite { + test("${2:description}") { + } +############################ +# SBT +# +snippet webproject + import sbt._ + + class ${1:Name}(info: ProjectInfo) extends DefaultWebProject(info) { + val liftVersion = "${2:2.3}" + + override def libraryDependencies = Set( + + ) ++ super.libraryDependencies + + val snapshots = ScalaToolsSnapshots + } +#depencies +snippet liftjar + "net.liftweb" %% "${1:lib}" % liftVersion % "compile->default", +snippet jettyjar + "org.mortbay.jetty" % "jetty" % "${1:version}" % "test->default", +############################ +# Lift +# +#lift imports +snippet liftimports + import _root_.net.liftweb.http._ + import S._ + import _root_.net.liftweb.util._ + import Helpers._ + import _root_.scala.xml._ +#TODO LIFT,SBT,WEB.XML,HTML snippets diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets new file mode 100644 index 00000000..b0736208 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -0,0 +1,86 @@ +# Shebang. Executing bash via /usr/bin/env makes scripts more portable. +snippet #! + #!/usr/bin/env bash + +snippet if + if [[ ${1:condition} ]]; then + ${2:#statements} + fi +snippet elif + elif [[ ${1:condition} ]]; then + ${2:#statements} +snippet for + for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do + ${3:#statements} + done +snippet fori + for ${1:needle} in ${2:haystack} ; do + ${3:#statements} + done +snippet wh + while [[ ${1:condition} ]]; do + ${2:#statements} + done +snippet until + until [[ ${1:condition} ]]; do + ${2:#statements} + done +snippet case + case ${1:word} in + ${2:pattern}) + ${3};; + esac +snippet go + while getopts '${1:o}' ${2:opts} + do + case $$2 in + ${3:o0}) + ${4:#staments};; + esac + done +# Set SCRIPT_DIR variable to directory script is located. +snippet sdir + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# getopt +snippet getopt + __ScriptVersion="${1:version}" + + #=== FUNCTION ================================================================ + # NAME: usage + # DESCRIPTION: Display usage information. + #=============================================================================== + function usage () + { + cat <<- EOT + + Usage : $${0:0} [options] [--] + + Options: + -h|help Display this message + -v|version Display script version + + EOT + } # ---------- end of function usage ---------- + + #----------------------------------------------------------------------- + # Handle command line arguments + #----------------------------------------------------------------------- + + while getopts ":hv" opt + do + case $opt in + + h|help ) usage; exit 0 ;; + + v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;; + + \? ) echo -e "\n Option does not exist : $OPTARG\n" + usage; exit 1 ;; + + esac # --- end of case --- + done + shift $(($OPTIND-1)) + + +snippet root + if [ $(id -u) -ne 0 ]; then exec sudo $0; fi diff --git a/sources_non_forked/snipmate-snippets/snippets/snippets.snippets b/sources_non_forked/vim-snippets/snippets/snippets.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/snippets.snippets rename to sources_non_forked/vim-snippets/snippets/snippets.snippets diff --git a/sources_non_forked/vim-snippets/snippets/sql.snippets b/sources_non_forked/vim-snippets/snippets/sql.snippets new file mode 100644 index 00000000..eb4b37ca --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/sql.snippets @@ -0,0 +1,26 @@ +snippet tbl + create table ${1:table} ( + ${2:columns} + ); +snippet col + ${1:name} ${2:type} ${3:default ''} ${4:not null} +snippet ccol + ${1:name} varchar2(${2:size}) ${3:default ''} ${4:not null} +snippet ncol + ${1:name} number ${3:default 0} ${4:not null} +snippet dcol + ${1:name} date ${3:default sysdate} ${4:not null} +snippet ind + create index ${3:$1_$2} on ${1:table}(${2:column}); +snippet uind + create unique index ${1:name} on ${2:table}(${3:column}); +snippet tblcom + comment on table ${1:table} is '${2:comment}'; +snippet colcom + comment on column ${1:table}.${2:column} is '${3:comment}'; +snippet addcol + alter table ${1:table} add (${2:column} ${3:type}); +snippet seq + create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1}; +snippet s* + select * from ${1:table} diff --git a/sources_non_forked/snipmate-snippets/snippets/tcl.snippets b/sources_non_forked/vim-snippets/snippets/tcl.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/tcl.snippets rename to sources_non_forked/vim-snippets/snippets/tcl.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets similarity index 84% rename from sources_non_forked/snipmate-snippets/snippets/tex.snippets rename to sources_non_forked/vim-snippets/snippets/tex.snippets index 511a4c9e..10fa82ef 100644 --- a/sources_non_forked/snipmate-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -1,5 +1,3 @@ -# recomendation: change the fold marker from {{{,}}} to (fold),(end) ; tex uses "{" and "}" a lot - #PREAMBLE #newcommand snippet nc @@ -97,40 +95,34 @@ snippet part % part $2 (end) # Chapter snippet cha - \chapter{${1:chapter name}} % (fold) + \chapter{${1:chapter name}} \label{cha:${2:$1}} ${3} - % chapter $2 (end) # Section snippet sec - \section{${1:section name}} % (fold) + \section{${1:section name}} \label{sec:${2:$1}} ${3} - % section $2 (end) # Sub Section snippet sub - \subsection{${1:subsection name}} % (fold) + \subsection{${1:subsection name}} \label{sub:${2:$1}} ${3} - % subsection $2 (end) # Sub Sub Section snippet subs - \subsubsection{${1:subsubsection name}} % (fold) + \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${3} - % subsubsection $2 (end) # Paragraph snippet par - \paragraph{${1:paragraph name}} % (fold) + \paragraph{${1:paragraph name}} \label{par:${2:$1}} ${3} - % paragraph $2 (end) # Sub Paragraph snippet subp - \subparagraph{${1:subparagraph name}} % (fold) + \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${3} - % subparagraph $2 (end) #References snippet itd \item[${1:description}] ${2:item} @@ -146,9 +138,11 @@ snippet page ${1:page}~\pageref{${2}}${3} snippet index \index{${1:index}}${2} -#cite +#Citations snippet cite - \cite{${1}}${2} + \cite[${1}]{${2}}${3} +snippet fcite + \footcite[${1}]{${2}}${3} #Formating text: italic, bold, underline, small capital, emphase .. snippet it \textit{${1:text}} diff --git a/sources_non_forked/snipmate-snippets/snippets/textile.snippets b/sources_non_forked/vim-snippets/snippets/textile.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/textile.snippets rename to sources_non_forked/vim-snippets/snippets/textile.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/vim.snippets rename to sources_non_forked/vim-snippets/snippets/vim.snippets diff --git a/sources_non_forked/snipmate-snippets/snippets/xslt.snippets b/sources_non_forked/vim-snippets/snippets/xslt.snippets similarity index 98% rename from sources_non_forked/snipmate-snippets/snippets/xslt.snippets rename to sources_non_forked/vim-snippets/snippets/xslt.snippets index 892e9dbe..e7abdf3f 100644 --- a/sources_non_forked/snipmate-snippets/snippets/xslt.snippets +++ b/sources_non_forked/vim-snippets/snippets/xslt.snippets @@ -8,7 +8,7 @@ snippet apply-templates sort-by ${5} ${6} -snippet apply-templates +snippet apply-templates plain ${2} snippet attribute blank diff --git a/sources_non_forked/vim-snippets/snippets/yii-chtml.snippets b/sources_non_forked/vim-snippets/snippets/yii-chtml.snippets new file mode 100644 index 00000000..91c65b92 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/yii-chtml.snippets @@ -0,0 +1,248 @@ +#--------------------Yii CHtml--------------------------------- +#Yii CHtml::radioButton +snippet yhrb + echo CHtml::radioButton('${1:name}', ${2:false},array(${3:optionName}=>${4:optionValue} ); + +#Yii CHtml::asset +snippet yhass + echo CHtml::asset('${1:path}'); + +#Yii CHtml::activeLabelEx +snippet yhale + echo CHtml::activeLabelEx(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::encodeArray +snippet yheca + echo CHtml::encodeArray(array(${1})); + +#Yii CHtml::normalizeUrl +snippet yhnurl + echo CHtml::normalizeUrl(array('${1}')); + +#Yii CHtml::resetButton +snippet yhsb + echo CHtml::submitButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::linkButton +snippet yhlinkb + echo CHtml::linkButton('${1:lable}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::activeTextArea +snippet yhata + echo CHtml::activeTextArea(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::ajaxButton +snippet yhajb + echo CHtml::ajaxButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::activeId +snippet yhai + echo CHtml::activeId(${1:model}, '${2:attribute}'); + +#Yii CHtml::activeCheckBox +snippet yhacb + echo CHtml::activeCheckBox(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeHiddenField +snippet yhahf + echo CHtml::activeHiddenField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::encode +snippet yhec + echo CHtml::encode(${1:text}); + +#Yii CHtml::metaTag +snippet yhmtag + echo CHtml::metaTag('${1:content}', '${2:name}', '${3:httpEquiv}',array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::dropDownList +snippet yhddl + echo CHtml::dropDownList('${1:name}', '${2:select}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::listBox +snippet yhlb + echo CHtml::listBox('${1:name}', '${2:select}',array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::script +snippet yhjs + echo CHtml::script('${1:test}'); + +#Yii CHtml::ajax +snippet yhaj + echo CHtml::ajax(array(${1})); + +#Yii CHtml::textField +snippet yhtf + echo CHtml::textField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activePasswordField +snippet yhapf + echo CHtml::activePasswordField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::listData +snippet yhld + echo CHtml::listData(array(${1}),'${2:valueField}', '${3:textField}','${4:groupField}'); + +#Yii CHtml::mailto +snippet yhmt + echo CHtml::mailto('${1:text}', '${2:email}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::image +snippet yhimg + echo CHtml::image('${1:src}', '${2:alt}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeListBox +snippet yhalb + echo CHtml::activeListBox(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::activeFileField +snippet yhaff + echo CHtml::activeFileField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::closeTag +snippet yhct + echo CHtml::closeTag('${1:tag}'); + +#Yii CHtml::activeInputField +snippet yhaif + echo CHtml::activeInputField('${1:type}', ${2:model}, '${3:attribute}',array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::scriptFile +snippet yhjsf + echo CHtml::scriptFile('${1:url}'); + +#Yii CHtml::radioButtonList +snippet yhrbl + echo CHtml::radioButtonList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::cssFile +snippet yhcssf + echo CHtml::cssFile('${1:url}','${2:media}'); + +#Yii CHtml::error +snippet yherr + echo CHtml::error(${1:model}, '${2:attribute}'); + +#Yii CHtml::passwordField +snippet yhpf + echo CHtml::passwordField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::hiddenField +snippet yhhf + echo CHtml::hiddenField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::cdata +snippet yhc + echo CHtml::cdata(${1:text}); + +#Yii CHtml::link +snippet yhlink + echo CHtml::link('${1:text}',array(${2}),array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::errorSummary +snippet yherrs + echo CHtml::errorSummary(${1:model},'${2:headerHtml}','${3:footerHtml}'); + +#Yii CHtml::tag +snippet yht + echo CHtml::tag('${1:tag}',array('${2:optionName}'=>${3:optionValue}),${4:false},${5:true}); + +#Yii CHtml::ajaxLink +snippet yhajl + echo CHtml::ajaxLink('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::label +snippet yhlabel + echo CHtml::label('${1:label}', '${2:for}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeName +snippet yhan + echo CHtml::activeName(${1:model}, '${2:attribute}'); + +#Yii CHtml::statefulForm +snippet yhsform + echo CHtml::statefulForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::fileField +snippet yhff + echo CHtml::fileField('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeTextField +snippet yhatf + echo CHtml::activeTextField(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::css +snippet yhcss + echo CHtml::css('${1:test}','${2:media}'); + +#Yii CHtml::imageButton +snippet yhimgb + echo CHtml::imageButton('${1:src}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::ajaxSubmitButton +snippet yhajsb + echo CHtml::ajaxSubmitButton('${1:label}', '${2:url}',array('${3:ajaxOptionName}'=>${4:ajaxOptionValue}),array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::button +snippet yhb + echo CHtml::button('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::listOptions +snippet yhlo + echo CHtml::listOptions('${1:selection}', array(${2}), array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeCheckBoxList +snippet yhacbl + echo CHtml::activeCheckBoxList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::openTag +snippet yhot + echo CHtml::openTag('${1:tag}', array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::checkBox +snippet yhcb + echo CHtml::checkBox('${1:name}', ${2:false}, array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::textArea +snippet yhta + echo CHtml::textArea('${1:name}', '${2:value}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::linkTag +snippet yhlinkt + echo CHtml::linkTag('${1:relation}', '${2:type}', '${3:href}', '${4:media}',array('${5:optionName}'=>${6:optionValue})); + +#Yii CHtml::resetButton +snippet yhrsb + echo CHtml::resetButton('${1:label}',array('${2:optionName}'=>${3:optionValue})); + +#Yii CHtml::activeRadioButtonList +snippet yharbl + echo CHtml::activeRadioButtonList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::checkBoxList +snippet yhcbl + echo CHtml::checkBoxList('${1:name}', ${2:select}, array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::form +snippet yhform + echo CHtml::form(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::beginForm +snippet yhbeform + echo CHtml::beginForm(array('${1}'), '${2:post}',array('${3:optionName}'=>${4:optionValue})); + ${5} + echo CHtml::endForm(); + +#Yii CHtml::activeDropDownList +snippet yhaddl + echo CHtml::activeDropDownList(${1:model}, '${2:attribute}', array(${3}),array('${4:optionName}'=>${5:optionValue})); + +#Yii CHtml::activeRadioButton +snippet yharb + echo CHtml::activeRadioButton(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + +#Yii CHtml::activeLabel +snippet yhal + echo CHtml::activeLabel(${1:model}, '${2:attribute}',array('${3:optionName}'=>${4:optionValue})); + + diff --git a/sources_non_forked/vim-snippets/snippets/yii.snippets b/sources_non_forked/vim-snippets/snippets/yii.snippets new file mode 100644 index 00000000..9f29eaf1 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/yii.snippets @@ -0,0 +1,300 @@ +#Yii session offset +snippet yse + Yii::app()->session['${1}']; + +#Yii renderDynamic +snippet yrd + $this->renderDynamic('${1:callback}'); + +#Yii set cache +snippet ycas + Yii::app()->cache->set('${1:key}', ${2:value}, ${3:expire}, new C${4:}CacheDependency(${5})); + +#Yii Add cache +snippet ycad + Yii::app()->cache->add('${1:key}', ${2:value}, ${3:expire}, new C${4}CacheDependency(${5})); + +#Yii register CSS file +snippet yregcf + Yii::app()->clientScript->registerCssFile('${1:file}'); + +#Yii requestType +snippet yreqtype + Yii::app()->request->requestType + +#Yii isAjaxRequest +snippet yisajax + Yii::app()->request->isAjaxRequest + +#Yii translate +snippet yt + Yii::t('${1:category}', '${2:message}',array(${3})); + +#Yii register CSS +snippet yregc + Yii::app()->clientScript->registerCss('${1:id}', '${2}'); + +#Yii log +snippet ylog + Yii::log('${1:msg}', '${2:info}'); + +#Yii userHostAddress +snippet yuserip + YYii::app()->request->userHostAddress + +#Yii register script file +snippet yregsf + Yii::app()->clientScript->registerScriptFile('${1:scriptUrl}', CClientScript::POS_${2:END}); + +#Yii CLinkPager +snippet ylinkpager + $this->widget('CLinkPager', array('pages'=>$pages,'header'=>'${1}'})) + +#Yii CJSON::encode +snippet yjec + CJSON::encode(${1:text}); + +#CActiveDataProvider +snippet yadp + $dataProvider = new CActiveDataProvider('${1}', array( + 'criteria' => array( + 'condition' => '${2}', + 'order' => '${3}', + 'with' => array('${4}') + ), + //'pagination' => false, + 'pagination' => array( + 'pageSize'=>${5}, + ), + )); + ${6} + // $dataProvider->getData() will return a list of Post objects + +#Yii renderDynamic internal +snippet yrdi + $this->renderDynamic('${1:callback}', array('${2:key}'=>${3:value})); + +#Yii register script +snippet yregs + Yii::app()->clientScript->registerScript('${1:id}', '${2}', CClientScript::POS_${3:READY}); + +#Yii Flush cache +snippet ycaf + Yii::app()->cache->flush(); + +#Yii Yii::app()->request->cookies +snippet yco + Yii::app()->request->cookies['${1}'] + +#Yii user-> +snippet yuser + Yii::app()->user->${1} + +#Yii refresh +snippet yrf + $this->refresh(); + +#Yii import +snippet yimp + Yii::import('${1}'); + +#Yii trace +snippet ytrace + Yii::trace('${1:msg}'); + +#Yii params +snippet ypar + Yii::app()->params['${1}'] + +#Yii isPostRequest +snippet yispost + Yii::app()->request->isPostRequest + +#Yii IF isAjaxRequest +snippet yifisajax + if(Yii::app()->request->isAjaxRequest == TRUE) + { + ${1} + } + +#Yii Yii::app()->cache->delete +snippet ydelcache + Yii::app()->cache->delete('${1:key}'); + +#Yii render view +snippet yr + $this->render('${1:view}',array('${2:key}'=>${3:value})); + +#Yii redirect +snippet yre + $this->redirect(array('${1:controller}/${2:action}')); + +#Yii Get cache +snippet ycag + Yii::app()->cache->get('${1:key}'); + +#Yii render text +snippet yrt + $this->renderText('${1}'); + +#Yii render partial +snippet yrp + $this->renderPartial('${1:view}',array('${2:key}'=>${3:value})); + +#----------------Yii Model----------------------------- +#Yii Model count +snippet ycountm + ${1:ModelName}::model()->count(${2:condition}, array('${3:key}'=>${4:value})); + +#Yii Model countBySql +snippet ycountbs + ${1:ModelName}::model()->countBySql(${2:sql},array('${3:key}'=>${4:value})); + +#Yii Model updateAll +snippet yupdatea + ${1:ModelName}::model()->updateAll(${2:array('attributes')}, ${3:condition},array('${4:key}'=>${5:value})); + +#Yii Model updateByPk +snippet yupdatebp + ${1:ModelName}::model()->updateByPk(${2:pk}, ${3:array('attributes')}, ${4:condition},array('${5:key}'=>${6:value})); + +#Yii Model deleteAll +snippet ydela + ${1:ModelName}::model()->deleteAll(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model deleteByPk +snippet ydelbp + ${1:ModelName}::model()->deleteByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + +#Yii Model find +snippet yfind + ${1:ModelName}::model()->find(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model findAll +snippet yfinda + ${1:ModelName}::model()->findAll(${2:condition},array('${3:key}'=>${4:value})); + +#Yii Model findByPk +snippet yfindbp + ${1:ModelName}::model()->findByPk(${2:pk}, ${3:condition}, array('${4:key}'=>${5:value})); + +#Yii Model findAllByPk +snippet yfindabp + ${1:ModelName}::model()->findAllByPk(${2:pk}, ${3:condition},array('${4:key}'=>${5:value})); + +#Yii Model findBySql +snippet yfindbs + ${1:ModelName}::model()->findBySql(${2:sql}, array('${3:key}'=>${4:value})); + +#Yii Model findAllByAttributes +snippet yfindaba + ${1:ModelName}::model()->findAllByAttributes(array('${2:attributeName}'=>${3:attributeValue}), ${4:condition}, array('${5:key}'=>${6:value})); + +#Yii Model exists +snippet yexists + ${1:ModelName}::model()->exists(${2:condition}, array('${3:key}'=>${4:value})); + +#Yii Create model class +snippet ymodel + 'path.to.FilterClass', + 'propertyName'=>'propertyValue', + ), + ); + } + + public function actions() + { + // return external action classes, e.g.: + return array( + 'action1'=>'path.to.ActionClass', + 'action2'=>array( + 'class'=>'path.to.AnotherActionClass', + 'propertyName'=>'propertyValue', + ), + ); + } + */ + } + +#Yii Create controller action method +snippet yact + public function action${1:Index}(${2:params}) + { + ${3} + } + + diff --git a/sources_non_forked/snipmate-snippets/snippets/zsh.snippets b/sources_non_forked/vim-snippets/snippets/zsh.snippets similarity index 100% rename from sources_non_forked/snipmate-snippets/snippets/zsh.snippets rename to sources_non_forked/vim-snippets/snippets/zsh.snippets diff --git a/sources_non_forked/vim-snippets/xhtml.snippets b/sources_non_forked/vim-snippets/xhtml.snippets deleted file mode 100644 index cc31dbc7..00000000 --- a/sources_non_forked/vim-snippets/xhtml.snippets +++ /dev/null @@ -1 +0,0 @@ -extends html diff --git a/sources_non_forked/vim-surround/doc/surround.txt b/sources_non_forked/vim-surround/doc/surround.txt index 6c959847..30a642ae 100644 --- a/sources_non_forked/vim-surround/doc/surround.txt +++ b/sources_non_forked/vim-surround/doc/surround.txt @@ -133,15 +133,9 @@ attributes here and they will be stripped from the closing tag. End your input by pressing or >. If is used, the tags will appear on lines by themselves. -A deprecated replacement of a LaTeX environment is provided on \ and l. The -name of the environment and any arguments will be input from a prompt. This -will be removed once a more fully functional customization system is -implemented. The following shows the resulting environment from -csp\tabular}{lc -> - \begin{tabular}{lc} - \end{tabular} -< +If s is used, a leading but not trailing space is added. This is useful for +removing parentheses from a function call with csbs. + CUSTOMIZING *surround-customizing* The following adds a potential replacement on "-" (ASCII 45) in PHP files. diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 8b882dd7..e3871570 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -1,6 +1,6 @@ " surround.vim - Surroundings " Author: Tim Pope -" Version: 1.90 +" Version: 2.0 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim if exists("g:loaded_surround") || &cp || v:version < 700 @@ -159,6 +159,12 @@ function! s:wrap(string,char,type,...) elseif newchar ==# "p" let before = "\n" let after = "\n\n" + elseif newchar ==# 's' + let before = ' ' + let after = '' + elseif newchar ==# ':' + let before = ':' + let after = '' elseif newchar =~# "[tT\<,]" let dounmapp = 0 let dounmapb = 0 @@ -218,6 +224,10 @@ function! s:wrap(string,char,type,...) let after = ' ' . after endif endif + elseif newchar ==# "\" + let fnc = input('function: ') + let before = '('.fnc.' ' + let after = ')' elseif idx >= 0 let spc = (idx % 3) == 1 ? " " : "" let idx = idx / 3 * 3 @@ -330,7 +340,7 @@ function! s:insert(...) " {{{1 endfunction " }}}1 function! s:reindent() " {{{1 - if exists("b:surround_indent") ? b:surround_indent : (exists("g:surround_indent") && g:surround_indent) + if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) silent norm! '[='] endif endfunction " }}}1 @@ -415,7 +425,7 @@ function! s:dosurround(...) " {{{1 else let pcmd = "P" endif - if line('.') < oldlnum && regtype ==# "V" + if line('.') + 1 < oldlnum && regtype ==# "V" let pcmd = "p" endif call setreg('"',keeper,regtype) @@ -557,11 +567,13 @@ if !exists("g:surround_no_mappings") || ! g:surround_no_mappings nmap ySS YSsurround xmap S VSurround xmap gS VgSurround - if !hasmapto("Isurround","i") && "" == mapcheck("","i") - imap Isurround + if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings + if !hasmapto("Isurround","i") && "" == mapcheck("","i") + imap Isurround + endif + imap s Isurround + imap S ISurround endif - imap s Isurround - imap S ISurround endif " vim:set ft=vim sw=2 sts=2 et: diff --git a/update_plugins.py b/update_plugins.py new file mode 100644 index 00000000..16cfea3f --- /dev/null +++ b/update_plugins.py @@ -0,0 +1,76 @@ +import zipfile +import shutil +import tempfile +import requests + +from os import path + + +#--- Globals ---------------------------------------------- +PLUGINS = """ +ack.vim https://github.com/mileszs/ack.vim +bufexplorer https://github.com/corntrace/bufexplorer +ctrlp.vim https://github.com/kien/ctrlp.vim +mayansmoke https://github.com/vim-scripts/mayansmoke +nerdtree https://github.com/scrooloose/nerdtree +nginx.vim https://github.com/vim-scripts/nginx.vim +open_file_under_cursor.vim https://github.com/amix/open_file_under_cursor.vim +snipmate-snippets https://github.com/scrooloose/snipmate-snippets +taglist.vim https://github.com/vim-scripts/taglist.vim +tlib https://github.com/vim-scripts/tlib +vim-addon-mw-utils https://github.com/MarcWeber/vim-addon-mw-utils +vim-bundle-mako https://github.com/sophacles/vim-bundle-mako +vim-coffee-script https://github.com/kchmck/vim-coffee-script +vim-colors-solarized https://github.com/altercation/vim-colors-solarized +vim-indent-object https://github.com/michaeljsmith/vim-indent-object +vim-less https://github.com/groenewege/vim-less +vim-markdown https://github.com/tpope/vim-markdown +vim-powerline https://github.com/Lokaltog/vim-powerline +vim-pyte https://github.com/therubymug/vim-pyte +vim-snipmate https://github.com/garbas/vim-snipmate +vim-snippets https://github.com/honza/vim-snippets +vim-surround https://github.com/tpope/vim-surround +""".strip() + +GITHUB_ZIP = '%s/archive/master.zip' + +SOURCE_DIR = path.join( path.dirname(__file__), 'sources_non_forked' ) + + +def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): + temp_zip_path = path.join(temp_dir, plugin_name) + + # Download and extract file in temp dir + req = requests.get(zip_path) + open(temp_zip_path, 'wb').write(req.content) + + zip_f = zipfile.ZipFile(temp_zip_path) + zip_f.extractall(temp_dir) + + plugin_temp_path = path.join(temp_dir, + path.join(temp_dir, '%s-master' % plugin_name)) + + # Remove the current plugin and replace it with the extracted + plugin_dest_path = path.join(source_dir, plugin_name) + + try: + shutil.rmtree(plugin_dest_path) + except OSError: + pass + + shutil.move(plugin_temp_path, plugin_dest_path) + + print 'Updated %s' % plugin_name + + +if __name__ == '__main__': + temp_directory = tempfile.mkdtemp() + + try: + for line in PLUGINS.splitlines(): + name, github_url = line.split(' ') + zip_path = GITHUB_ZIP % github_url + download_extract_replace(name, zip_path, + temp_directory, SOURCE_DIR) + finally: + shutil.rmtree(temp_directory) diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index cebedd39..2e31754d 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -61,6 +61,10 @@ let g:mapleader = "," " Fast saving nmap w :w! +" :W sudo saves the file +" (useful for handling the permission-denied error) +command W w !sudo tee % > /dev/null + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => VIM user interface diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index fb50a3b5..28f257f5 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -57,6 +57,14 @@ let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' map j :PeepOpen + +"""""""""""""""""""""""""""""" +" => ZenCoding +"""""""""""""""""""""""""""""" +" Enable all functions in all modes +let g:user_zen_mode='a' + + """""""""""""""""""""""""""""" " => snipMate (beside support ) """"""""""""""""""""""""""""""