Skip to content

mjoey/vim-magento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Under Debian distribution you can easily install XmlStarlet with this command line:
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 <[email protected]>"
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: ``` my_table_name
``` Observer creation ---- * Type \

Define **Area name**:
        Type for global, 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.

About

Vim plugin that helps you build Magento modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published