sponsor Vim development Vim logo Vim Book Ad

cake.vim : Utility for CakePHP developers.

 script karma  Rating 45/14, Downloaded by 6191  Comments, bugs, improvements  Vim wiki

created by
Yuhei Kagaya
 
script type
utility
 
description
cake.vim is for easy jumping between Controller, Model and View files when developing in CakePHP.

The latest version is in github.
https://github.com/violetyk/cake.vim

Requirements:
- Vim ver.7.3 or heigher
- CakePHP ver.1.3.x or ver.2.x

Easy to use:

At the first, specified the app directory of your CakePHP.

:Cakephp /path/to/cakephp_app/


If you write the following key-mappings in your .vimrc, it will
perform automatically at startup.

    let g:cakephp_enable_fix_mode = 1
    let g:cakephp_app = "/path/to/cakephp_app/"

When you find a project from open file automatically,
please set it as follows.

    let g:cakephp_enable_auto_mode = 1


Edit the specified or current controller.
:Ccontroller hogehoges
It guess the Controller when current buffer is View or Model.
:Controller


Edit the specified controller's view.
when current buffer is controller.
:Cview index

Edit the specified or current view( and use theme name).
:Cview index mytheme


Edit the specified or current model.
:Cmodel hogehoge
It guess the Model when current buffer is Controller.
:Cmodel


Edit the specified config.
:Cconfig hogehoge


Edit the specified component.
:Ccomponent hogehoge


Edit the specified behavior.
:Cbehavior hogehoge


Edit the specified helper.
:Chelper hogehoge


Edit the specified shell.
:Cshell hogehoge


Edit the specified task.
:Ctask hogehoge


Edit the specified test case.
:Ctestmodel hoge
:Ctestbehavior hoge
:Ctestcomponent hoge
:Ctestcontroller hoge
:Ctesthelper hoge

when current buffer is Model or Behavior or Component,
or Controller or Helper or Fixture.
:Ctest


Edit the specified fixture.
:Cfixture hoge
It guess the Fixture when current buffer is Model.
:Cfixture


Edit the debug.log.
:Clog debug
 
install details
1: Extract the file and Put files in your Vim directory
   (usually ~/.vim/).
2: Execute |:Cakephp| <Space> /path/to/cakephp_app/ command or
let g:cakephp_enable_fix_mode = 1
let g:cakephp_app = "/path/to/cakephp_app/"
in your .vimrc.

When you find a project from open file automatically,
please set it as follows.

    let g:cakephp_enable_auto_mode = 1


And if you would like to use divided view themed such as "front" and "admin",
let g:cakephp_use_theme = "admin"
add the comment in your .vimrc.


MySQL and Apache logs to see the log quickly, and write the following.
>
    let g:cakephp_log = {
          \ 'query' : '/var/log/mysqld-query.log',
          \ 'access': '/usr/local/apache2/logs/access_log'
          \ }
<

Sorry, this plugin will not work well for windows at this time.


More comfortable to use cake.vim, if you write key-mappings in your .vimrc.
Here is recommended key-mappings.

    " Recommended  key-mappings.
    nnoremap <Space>cc :<C-u>Ccontroller
    nnoremap <Space>cm :<C-u>Cmodel
    nnoremap <Space>cv :<C-u>Cview
    nnoremap <Space>cl :<C-u>Clog
    nnoremap <Space>ccv :<C-u>Ccontrollerview
    nnoremap <Space>ccm :<C-u>Ccomponent
    nnoremap <Space>ccf :<C-u>Cconfig
    nnoremap <Space>cb :<C-u>Cbehavior
    nnoremap <Space>ch :<C-u>Chelper
    nnoremap <Space>ct :<C-u>Ctest
    nnoremap <Space>cf :<C-u>Cfixture
    nnoremap <Space>cs :<C-u>Cshell
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cake.zip 2.13 2013-10-10 7.3 Yuhei Kagaya - Add New gf pattern. "$this->extend('/Common/view')" jump to the View file.
- Fix bug.
cake.zip 2.12 2013-09-13 7.3 Yuhei Kagaya - Change from :Clib to :Ccore the name of command
- Change from cake_lib to cake_core the name of unite source name
- Add the feature to jump to the 1st party libraries
  :Clib
  Unite cake_lib
- Improve mapping method, thanks to pekepeke.
- Add g:cakephp_no_default_keymappings
- Add autocmd event PluginCakephpInitializeAfter
- Add g:cakephp_gf_fallback_n
- Add g:cakephp_gf_fallback_s
- Add g:cakephp_gf_fallback_t
- Support Event, Test, TestSuite in cakephp2.x
- Improve Ctestrun that can run single test case in cakephp2.x
- Improve Ctestrun that can run asynchronously
- Add :Ctestrunmethod
- Add g:cakephp_test_window_vertical
- Add g:cakephp_test_window_height
- Add g:cakephp_test_window_width
- Fix bug.
cake.zip 2.11.1 2013-05-24 7.3 Yuhei Kagaya - Avoid error when g:cake is not initialized.
- Fix bug.
cake.zip 2.11 2013-05-11 7.3 Yuhei Kagaya - Add :Cbake
- Add :Ctestrun
- Add g:cakephp_enable_abbreviations
- Add unite-source cake_lib
- Fix a few bugs.
cake.zip 2.10.1 2013-03-06 7.3 Yuhei Kagaya - Add to the configuration file : core
- Fix a few bugs.
cake.zip 2.10 2013-01-08 7.3 Yuhei Kagaya - :Cview, To guess the name of the view from the current position if the argument is omitted.
- Improve boot speed.
- Add a new vertical split in gs command like gf.
- Add feature to jump to the build path configuration file written.
- Change the priority which jumped by gf command.
- Fix a few bugs.
cake.zip 2.8 2012-07-16 7.3 Yuhei Kagaya - Add New gf pattern.
  "array('controller' => 'hoges', 'action' => 'fuga') " jump to-
  "HogesController::fuga()" .
  "array('controller' => 'hoges', 'action' => 'fuga', 'admin' => true)" jump to-
  "HogesController::admin_fuga()" .
- Fix a few bugs.
cake.zip 2.7 2012-06-16 7.3 Yuhei Kagaya - :Cdesc performed setting of the database connection automatically.It look up $useDbConfig, $useTable, and database.php .
cake.zip 2.5 2012-05-21 7.3 Yuhei Kagaya - Update gf algorithm. Searched for view files, script files, CSS files recursively.
- Fix a few bugs.
cake.zip 2.4.1 2012-04-21 7.3 Yuhei Kagaya - When an object was not found by gf command, I did the gf command of the default.
- Fix a few bugs.
cake.zip 2.4 2012-04-07 7.3 Yuhei Kagaya - Add Commands.
  :Clib
  :Clibsp
  :Clibvsp
  :Clibtab
- Add New gf algorithm that could jump to a core of CakePHP.
- Improved Auto Mode.
  At the time of auto_mode, it prevented you from losing sight of a path of app
  when you opened the file except CakePHP once.
cake.zip 2.3.2 2012-03-12 7.3 Yuhei Kagaya - Add New gf algorithm.
- in Controller, "class HogesController extends AppController" -> AppController
- in Model, "class Hoge extends AppModel"  -> AppModel
cake.zip 2.3.1 2012-02-11 7.3 Yuhei Kagaya - Fix a few bugs.
cake.zip 2.3 2012-02-04 7.3 Yuhei Kagaya - Add Commands.
  :Celement
cake.zip 2.2 2012-01-21 7.0 Yuhei Kagaya - Add the mode which automatically set a project.
(g:cakephp_enable_auto_mode)
- Add g:cakephp_enable_fix_mode  
- Deprecated g:cakephp_auto_set_project
cake.zip 2.1.1 2011-12-19 7.0 Yuhei Kagaya - Fix a few bugs.
cake.zip 2.1 2011-12-15 7.0 Yuhei Kagaya - Fix a few bugs.
- Open the plural files at a time.
- Add gf(C-w f, C-w gf) algorithm.
  in Controller:
    function xxx -> View
    $this->render('xxx') -> View
    var $layout = 'xxx'; -> Layout
    $this->layout = 'xxx'; -> Layout
  in View:
    $this->element('xxx') -> Element
    $html->css('xxx') -> Css
    $html->script('xxx') -> Script
  Anywhere:
    Configure::load('list') -> Config

  By the word under the cursor, you can jump:
    in Controller -> Model or Behavior or Component or Helper or Controller
    in Model -> Model or Behavior or Controller
    in View -> Helper or Model or Controller
    in Helper -> Helper or Controller
    in Component -> Model or Behavior or Component or Controller
    in Behavior -> Model or Behavior
    in TestController -> Fixture or Controller
    in TestModel -> Fixture or Model-
    in TestBehavior -> Fixture or Behavior
    in TestComponent -> Fixture or Component
    in TestHelper -> Fixture or Helper
    in Fixture -> Model
    in Shell -> Task or Model
    in Task -> Model
cake.zip 2.0.1 2011-12-02 7.0 Yuhei Kagaya - Fix a few bugs.
cake.zip 2.0 2011-12-02 7.0 Yuhei Kagaya - It work in CakePHP1.3, both CakePHP2.0.
cake.tar.gz 1.4 2011-11-04 7.0 Yuhei Kagaya - Add unite-sources.
  :Unite cake_controller
  :Unite cake_model
  :Unite cake_view
  :Unite cake_behavior
  :Unite cake_helper
  :Unite cake_component
  :Unite cake_fixture
  :Unite cake_config
  :Unite cake_shell
  :Unite cake_task
cake.tar.gz 1.3 2011-11-03 7.0 Yuhei Kagaya - Fix a few bugs.
- Support Behavior.
- Support Helper.
- Support Test(Model/Behavior/Component/Controller,Helper)
- Support Fixture.
cake.tar.gz 1.2 2011-06-07 7.0 Yuhei Kagaya - Fix a few bugs.
- g:cakephp_root was removed. g:cakephp_app was added instead.
- Add Commands.
  :Ccontrollerview
  :Ccontrollerviewsp
  :Ccontrollerviewvsp
  :Ccontrollerviewtab
  :Config
  :Configsp
  :Configvsp
  :Configtab
  :Ccomponent
  :Ccomponentsp
  :Ccomponentvsp
  :Ccomponenttab
  :Cshell
  :Cshellsp
  :Cshellvsp
  :Cshelltab
  :Ctask
  :Ctasksp
  :Ctaskvsp
  :Ctasktab
  :Clog
cake.tar.gz 1.1.0 2011-05-17 7.0 Yuhei Kagaya Initial upload
ip used for rating: 44.202.183.118

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github