Skip to content
Utility for CakePHP developers.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


<< description >>
cake.vim is for easy jumping between Controller, Model and View files when developing in CakePHP.

- Vim ver.7.0 or heigher
- CakePHP ver.1.3.x or ver.2.0.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.

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.

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.

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

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.

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
Something went wrong with that request. Please try again.