"============================================================================= " File: zencoding.vim " Author: Yasuhiro Matsumoto " Last Change: 22-Nov-2011. " Version: 0.58 " 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' 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() for item in [ \ {'mode': 'i', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandAbbr', 'func': 'u:call zencoding#expandAbbr(0)a'}, \ {'mode': 'v', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandVisual', 'func': ':call zencoding#expandAbbr(2)'}, \ {'mode': 'n', 'var': 'user_zen_expandabbr_key', 'key': ',', 'plug': 'ZenCodingExpandNormal', 'func': ':call zencoding#expandAbbr(3)'}, \ {'mode': 'i', 'var': 'user_zen_expandword_key', 'key': ';', 'plug': 'ZenCodingExpandWord', 'func': 'u:call zencoding#expandAbbr(1)a'}, \ {'mode': 'n', 'var': 'user_zen_expandword_key', 'key': ',', 'plug': 'ZenCodingExpandWord', 'func': ':call zencoding#expandAbbr(1)'}, \ {'mode': 'i', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardInsert', 'func': ':call zencoding#balanceTag(1)a'}, \ {'mode': 'n', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardNormal', 'func': ':call zencoding#balanceTag(1)'}, \ {'mode': 'v', 'var': 'user_zen_balancetaginward_key', 'key': 'd', 'plug': 'ZenCodingBalanceTagInwardVisual', 'func': ':call zencoding#balanceTag(2)'}, \ {'mode': 'i', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardInsert', 'func': ':call zencoding#balanceTag(-1)a'}, \ {'mode': 'n', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardNormal', 'func': ':call zencoding#balanceTag(-1)'}, \ {'mode': 'v', 'var': 'user_zen_balancetagoutward_key', 'key': 'D', 'plug': 'ZenCodingBalanceTagOutwardVisual', 'func': ':call zencoding#balanceTag(-2)'}, \ {'mode': 'i', 'var': 'user_zen_next_key', 'key': 'n', 'plug': 'ZenCodingNext', 'func': ':call zencoding#moveNextPrev(0)'}, \ {'mode': 'n', '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': 'n', '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': 'n', 'var': 'user_zen_imagesize_key', 'key': 'i', 'plug': 'ZenCodingImageSize', 'func': ':call zencoding#imageSize()'}, \ {'mode': 'i', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()a'}, \ {'mode': 'n', 'var': 'user_zen_togglecomment_key', 'key': '/', 'plug': 'ZenCodingToggleComment', 'func': ':call zencoding#toggleComment()'}, \ {'mode': 'i', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagInsert', 'func': ':call zencoding#splitJoinTag()a'}, \ {'mode': 'n', 'var': 'user_zen_splitjointag_key', 'key': 'j', 'plug': 'ZenCodingSplitJoinTagNormal', 'func': ':call zencoding#splitJoinTag()'}, \ {'mode': 'i', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()a'}, \ {'mode': 'n', 'var': 'user_zen_removetag_key', 'key': 'k', 'plug': 'ZenCodingRemoveTag', 'func': ':call zencoding#removeTag()'}, \ {'mode': 'i', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)a'}, \ {'mode': 'n', 'var': 'user_zen_anchorizeurl_key', 'key': 'a', 'plug': 'ZenCodingAnchorizeURL', 'func': ':call zencoding#anchorizeURL(0)'}, \ {'mode': 'i', 'var': 'user_zen_anchorizesummary_key', 'key': 'A', 'plug': 'ZenCodingAnchorizeSummary', 'func': ':call zencoding#anchorizeURL(1)a'}, \ {'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) exe 'let g:' . item.var . " = '" . g:user_zen_leader_key . item.key . "'" endif if len(maparg(eval('g:' . item.var), item.mode)) == 0 exe item.mode . 'map ' . eval('g:' . item.var) . ' ' . item.plug endif endfor endfunction call s:install_plugin() delfunction s:install_plugin let &cpo = s:save_cpo unlet s:save_cpo let g:user_zen_settings = { \ 'indentation' : ' ', \ 'php' : { \ 'extends': 'html', \ 'aliases' : { \ }, \ 'snippets' : { \ 'php': "", \ 'sf:exe' : "public function |Action()\n{\n\n}", \ 'pf' : "public function |()\n{\n\n}", \ 'ppf' : "protected function |()\n{\n\n}", \ 'pppf' : "private function |()\n{\n\n}", \ 'sf:wsdl' : "/**\n * My Action\n *\n * @WSMethod(name='foo', webservice='myWs')\n * \n * @param type $name desc\n * \n * @return Foo[] Foo's\n */\npublic function execute|(sfWebRequest $request) {\n\n}", \ 'sf:route': "foo:\n url:'/'\n param: { module: page, action: foo }\n", \ 'sf:url': "url_for('@|');", \ 'sf:link': "link_to('title', 'module/action');", \ 'sf:cont': "sfContext::getInstance()->", \ 'sf:form': "
\" method=\"post\">\n\t
renderHiddenFields() ?>
\n\t
\n\t\t|\n\t
\n
\n", \ 'sf:pdo': "$con = Propel::getConnection();\n$stmt = $con->prepare('|');\n$stmt->bindValue();\n$stmt->execute();\n$results = $stmt->fetchAll();", \ 'b:add': "$builder->add(\n '|',\n 'text',\n [\n 'label' => '',\n 'required' => true,\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n);", \ 'b:addfile': "$builder->add(\n $builder->create(\n '|',\n 'file',\n [\n 'label' => '',\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n )->addModelTransformer(new \\Trinity\\Component\\Form\\DataTransformer\\StringToFileTransformer($builder->getData(), 'file'))\n);\n\n$builder->addEventSubscriber(\n new \\Trinity\\Component\\Form\\EventListener\\FileDeleteFormListener(\n $builder->getFormFactory(),\n [\n '|',\n ]\n )\n);", \ 'foreach': "foreach($| as $k => $v) {\n\t\n}", \ 'vard': "echo '
', var_dump(|), '
';\n", \ 'vardd': "echo '
', var_dump(|), '
';\ndie;\n", \ 'class': "class | {\n\tpublic function __construct() {\n\t\n\t}\n}\n", \ 'cc': "/**\n * @var type\n */\n", \ 'if': "if (|) {\n\n}", \ 'for': "for ($u = 0; $u < |; $u++) {\n\t\n}", \ 'while': "while(|) {\n\n}", \ } \ }, \ 'javascript' : { \ 'aliases' : { \ }, \ 'snippets' : { \ 'ready': "$(document).ready(function() {\n\t|\n});", \ 'closure': "(function($) {\n\t|\n})(jQuery);", \ 'load': "$(|).load('', function(datas) {});", \ 'if': "if (|) {\n\n}", \ 'for': "for(var u=0; u<|; u++) {\n\t\n}", \ 'while': "while(|) {\n\n}", \ } \ }, \ 'xml' : { \ 'aliases' : { \ }, \ 'snippets' : { \ 'table': "\n\t\n
", \ 'column': "\n", \ 'fkey': "\n\t\n\n", \ 'reference': "\n" \ } \ }, \ 'twig' : { \ 'extends': 'html', \ 'aliases' : { \ }, \ 'snippets' : { \ 'if': "{% if | %}\n\n{% endif %}\n", \ 'else': "{% else %}\n", \ 'twig': "{% | %}\n", \ 'include': "{% include \"|\" %}\n", \ 'render': "{% render \"|\" %}\n", \ 'vard': "
{{ dump(|) }}
\n", \ 'vardd': "
{{ dump(|) }}
\n", \ 'debug': "
{{ dump(|) }}
\n", \ 'dump': "
{{ dump(|) }}
\n", \ 'for': "{% for key, value in | %}\n\n{% endfor %}\n" \ } \ } \} " vim:set et: