Skip to content

Commit

Permalink
* Remapped shortcuts to Alt key.
Browse files Browse the repository at this point in the history
* New: alt+a - application main dir
* New: alt+t - project main dir
  • Loading branch information
zergu committed Aug 20, 2011
1 parent a873d66 commit 7602248
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 41 deletions.
46 changes: 25 additions & 21 deletions README.md
Expand Up @@ -14,40 +14,44 @@ Latest version of Vim Project Jumper can be found at https://github.com/zergu/Vi
Installation Installation
------------ ------------


Unpack all *.vim files and this README into ~/.vim/plugin/project-jumper/ directory. Restart Vim if necessary. Unpack all *.vim files and this README into `~/.vim/plugin/project-jumper/` directory. Restart Vim if necessary.


Usage Usage
----- -----


Default shortucts work from Vim edit mode. To invoke a jump keep @ctrl@ presses and then type @j@ and other key depending whare you're trying to jump. Default shortucts work from Vim edit mode. To invoke a jump keep `alt` presses and then type `j` and other key depending whare you're trying to jump to.


Shortcuts are working only when current directory (you can check it with :pwd command) is from inside a project. Avoid using shortucts elsewhere cause it can do some heavy and unsuccessful file searching. Shortcuts are working only when current directory (you can check it with `:pwd` command) is from inside a project. Avoid using shortucts elsewhere cause it can do some heavy and unsuccessful file searching.


Default shortcuts Default shortcuts
----------------- -----------------


Project project related: Project project related:
* <C-j><C-m> Model: Explore lib/model dir.
* <C-j><C-s> Schema: Edit config/*schema.yml (menu for multiple options). * `<M-j><M-t>` Root: Explore project main dir.
* <C-j><C-y> CSS: Explore web/css dir. * `<M-j><M-m>` Model: Explore lib/model dir.
* <C-j><C-j> JS: Explore web/js dir. * `<M-j><M-s>` Schema: Edit config/schema.yml (menu for multiple options).
* <C-j><C-t> Test: Explore test dir. * `<M-j><M-k>` CSS: Explore web/css dir.
* <C-j><C-h> Helper: Explore lib/helper dir. * `<M-j><M-j>` JS: Explore web/js dir.
* <C-j><C-f> Form: Explore lib/form dir. * `<M-j><M-e>` Test: Explore test dir.
* <C-j><C-i> Filter: Explore lib/filter dir. * `<M-j><M-h>` Helper: Explore lib/helper dir.
* <C-j><C-l> Lib: Explore lib dir. * `<M-j><M-f>` Form: Explore lib/form dir.
* <C-j><C-q> SQL: Explore data/sql dir. * `<M-j><M-i>` Filter: Explore lib/filter dir.
* <C-j><C-x> Fixtures: Explore data/fixtures dir. * `<M-j><M-l>` Lib: Explore lib dir.
* `<M-j><M-q>` SQL: Explore data/sql dir.
* `<M-j><M-x>` Fixtures: Explore data/fixtures dir.


Application related (if your project has more that one application avaiable options are shown): Application related (if your project has more that one application avaiable options are shown):
* <C-j><C-u> Layout: Edit $appname/templates/*layout*.php file (supports multiple options).
* <C-j><C-o> Modules: Explore $appname/modules dir. * `<M-j><M-c>` Controller: Edit actions.class.php when editing or exploring module templates.
* <C-j><C-r> Routing: Edit $appname/config/routing.yml file. * `<M-j><M-v>` View: While cursor is placed on function header tries to edit associaded view. If none could be found, explores views directory.
* <C-j><C-g> AppConfig: Edit $appname/config/app.yml file. * `<M-j><M-u>` Layout: Edit $appname/templates/*layout*.php file (supports multiple options).
* <C-j><C-a> Action: Edit actions.class.php when editing or exploring module templates. * `<M-j><M-o>` Modules: Explore $appname/modules dir.
* <C-j><C-v> View: While cursor is placed on function header tries to edit associaded view. If none could be found, explores views directory. * `<M-j><M-r>` Routing: Edit $appname/config/routing.yml file.
* `<M-j><M-g>` AppConfig: Edit $appname/config/app.yml file.
* `<M-j><M-a>` Application: Explore application maind dir.


Remapping shortucts Remapping shortucts
------------------- -------------------


Just copy mappings from the beginning of project-jumper.vim file to your .vimrc and modify it. Just copy mappings from the beginning of `project-jumper.vim` file to your `.vimrc` and modify it.
52 changes: 32 additions & 20 deletions project-jumper.vim
Expand Up @@ -4,24 +4,32 @@ if exists("g:loaded_Jumper")
endif endif
let g:loaded_Jumper = 1 " Version numbrer let g:loaded_Jumper = 1 " Version numbrer


" Key bindings " Key bindings: MVC
map <C-j><C-m> :call JumperJump("model")<CR> map <M-j><M-m> :call JumperJump("model")<CR>
map <C-j><C-s> :call JumperJump("schema")<CR> map <M-j><M-v> :call JumperJump("view")<CR>
map <C-j><C-y> :call JumperJump("css")<CR> map <M-j><M-c> :call JumperJump("contoller")<CR>
map <C-j><C-j> :call JumperJump("js")<CR>
map <C-j><C-t> :call JumperJump("test")<CR> " Key bindings: project
map <C-j><C-h> :call JumperJump("helper")<CR> map <M-j><M-t> :call JumperJump("root")<CR>
map <C-j><C-f> :call JumperJump("form")<CR> map <M-j><M-s> :call JumperJump("schema")<CR>
map <C-j><C-i> :call JumperJump("filter")<CR> map <M-j><M-e> :call JumperJump("test")<CR>
map <C-j><C-l> :call JumperJump("lib")<CR> map <M-j><M-h> :call JumperJump("helper")<CR>
map <C-j><C-q> :call JumperJump("sql")<CR> map <M-j><M-f> :call JumperJump("form")<CR>
map <C-j><C-x> :call JumperJump("fixtures")<CR> map <M-j><M-i> :call JumperJump("filter")<CR>
map <C-j><C-u> :call JumperJump("layout")<CR> map <M-j><M-l> :call JumperJump("lib")<CR>
map <C-j><C-o> :call JumperJump("modules")<CR> map <M-j><M-q> :call JumperJump("sql")<CR>
map <C-j><C-r> :call JumperJump("routing")<CR> map <M-j><M-x> :call JumperJump("fixtures")<CR>
map <C-j><C-g> :call JumperJump("appconfig")<CR>
map <C-j><C-a> :call JumperJump("action")<CR> " Key bindings: applications
map <C-j><C-v> :call JumperJump("view")<CR> map <M-j><M-a> :call JumperJump("application")<CR>
map <M-j><M-u> :call JumperJump("layout")<CR>
map <M-j><M-o> :call JumperJump("modules")<CR>
map <M-j><M-r> :call JumperJump("routing")<CR>
map <M-j><M-g> :call JumperJump("appconfig")<CR>
" Key bindings: frontend assets
map <M-j><M-j> :call JumperJump("js")<CR>
map <M-j><M-k> :call JumperJump("css")<CR>
" JUMP! " JUMP!
function! JumperJump(target) function! JumperJump(target)
Expand Down Expand Up @@ -89,12 +97,16 @@ function! JumperJump(target)
elseif a:target == "routing" elseif a:target == "routing"
let l:results = split(system("find ".l:maindir."apps -type d -mindepth 1 -maxdepth 1 | grep -v .svn")) let l:results = split(system("find ".l:maindir."apps -type d -mindepth 1 -maxdepth 1 | grep -v .svn"))
execute "edit ".l:results[s:MultipleChoice(l:results)]."/config/routing.yml" execute "edit ".l:results[s:MultipleChoice(l:results)]."/config/routing.yml"
" App main dir - explore
elseif a:target == "application"
let l:results = split(system("find ".l:maindir."apps -type d -mindepth 1 -maxdepth 1 | grep -v .svn"))
execute "Explore ".l:results[s:MultipleChoice(l:results)]
" App config - edit " App config - edit
elseif a:target == "appconfig" elseif a:target == "appconfig"
let l:results = split(system("find ".l:maindir."apps -type d -mindepth 1 -maxdepth 1 | grep -v .svn")) let l:results = split(system("find ".l:maindir."apps -type d -mindepth 1 -maxdepth 1 | grep -v .svn"))
execute "edit ".l:results[s:MultipleChoice(l:results)]."/config/app.yml" execute "edit ".l:results[s:MultipleChoice(l:results)]."/config/app.yml"
" Jump to actions from views (magical) " Jump to controller from views (magical)
elseif a:target == "action" elseif a:target == "controller"
let l:currdir = expand("%:p:h") let l:currdir = expand("%:p:h")
if matchend(l:currdir, "templates") != -1 " Check if we're in templates dir if matchend(l:currdir, "templates") != -1 " Check if we're in templates dir
silent execute "edit ".l:currdir."/../actions/actions.class.php" silent execute "edit ".l:currdir."/../actions/actions.class.php"
Expand Down

0 comments on commit 7602248

Please sign in to comment.