vim-magento


Ⅰ. 插件描述

Vim plugin that helps you build Magento modules.

Ⅱ. 基本信息

创建日期:  2014-07-28
使用用户:  2
Github星:  14
插件作者:  Michaël Joseph

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'mjoey/vim-magento'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'mjoey/vim-magento'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'mjoey/vim-magento'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/mjoey/vim-magento

Ⅳ. 文档说明

Author : Michael Joseph http://michael-joseph.me/en/>
Version : 0.9.0 beta

License : GPL 3.0

INTRODUCTION

Vim-Magento is a Vim plugin that helps you build Magento modules.

Vim-Magento has been tested successfully on Debian Wheezy and Mac OSX 10.6.8. It does not support Microsoft Windows OS yet.

Warning: This plugin is dedicated to advanced Magento developers. Before you use it, Magento framework knowledge is necessary. This is a tool to increase productivity.

INSTALLATION

I recommand to install Vim-Magento with Vundle.

SETUP

/! In order to work Vim-Magento needs XmlStarlet Command Line.
Please install this before everything.

XmlStarlet installation

sudo apt-get install xmlstarlet

Global variables

Vim-Magento generate automatically comments, you have to define the global variables below in your .vimrc:

let g:vimMagentoAuthor = "Michael Joseph <contact@michael-joseph.me>"
let g:vimMagentoCopyright = "Copyright 2016 Michael Joseph http://michael-joseph.me"
let g:vimMagentoLicense = "No License"

If you don't define g:vimMagentoLicense, the default license will be

'GPL 3.0 http://www.gnu.org/licenses/gpl-3.0.txt'

To disable Vim-Magento plugin's signature add this line in your .vimrc:

let g:vimMagentoSignature=0

USAGE

To run Vim-Magento, you must launch your vim instance at the Magento project root.

All actions begin with Magento command.

THE COMMAND

You only have one command to know:

:Magento

This command opens the Magento prompt.

For each Vim instance, the first time you call :Magento command
you have to define the module to be created or updated:

Pool name : Type <l> for Local or <c> for Community
Package name : Type the module package name without special characters
Extension name : Type the module extension name without special characters



Once module has been defined, two cases are possible:

    1- The module exists, the prompt invites you to choose actions.

    2- The module does not exist, the basic module is created.



Basic module's tree example

app
├── code
│   └── community
│       └── Mypackage
│           └── Myextension
│               ├── etc
│               │   └── config.xml
│               └── Helper
│                   └── Data.php
└── etc
    └── modules
        └── Mypackage_Myextension.xml

ACTIONS

The Magento prompt invites you to choose between actions below:

Select / Create a module

  • Type <s>



This action enables you to select or create another module
as if it was the first time you were calling |Magento| command.

Block creation

  • Type <b>



Define Block name:


        Type the block name without special characters.


        To create subfolders you can use <_> or </> in your block name.


             > Example: 'Mysubfolder_Myblock' or 'Mysubfolder/Myblock'

Front controller creation

  • Type <c>



Define Controller name:


        Type the controller name without special characters.


        To create 'Mypackage_Myextension_CustomController' class,


        please type only 'Custom'.


        If you leave this field empty 'Mypackage_Myextension_IndexController'


        class will be created automatically.

Model creation

  • Type <e>



Define Entity name:


        Type the entity name without special characters.


        This name will be the model class name.


        For example to create 'Mypackage_Myextension_Model_Mymodel' class,


        please type 'mymodel' or 'Mymodel'.


        To create subfolders you can use <_> or </> in your model name


             > Example: 'Mysubfolder_Mymodel' or 'Mysubfolder/Mymodel'




Define Table name :


        Type the table name without special characters.


        This name will be the database table name.


        In the config.xml file this corresponds to the table node:

<entities>
    <mymodel>
         <table>my_table_name</table>
    </mymodel>
</entities>

Observer creation

  • Type <o>



Define Area name:


        Type <g> for global, <f> for frontend or for adminhtml.


        This value defines the observer scope.




Define Event name:


        Type the event name to observe.




Define Observer name:


        Type the observer name without special characters.


        If you leave this field empty 'Mypackage_Myextension_Model_Observer' class


        will be created automatically.




Define Method name :


        Type the method name without special characters.


        This name will be the observer method name that will be fired on event.

THE ABBREVATIONS

In insert mode, you can type those abbreviations to save time:

log$    > Mage::log();
llog$   > Mage::log(__CLASS__.' : '.__LINE__);
flog$   > Mage::log(__CLASS__.' : '.__FUNCTION__);
sconf$  > Mage::getStoreConfig();
dat$    > Mage::app()->getLocale()->date()->toString('HH:mm')

You can complete or optimize those by editing ab.vim files.

添加新评论