Skip to content

Commit

Permalink
* 2 new jumps for symfony 2
Browse files Browse the repository at this point in the history
* Updated README
  • Loading branch information
zergu committed Sep 15, 2012
1 parent 0255009 commit ebde2fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -17,16 +17,17 @@ Installation

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

''Important notice for Symfony 2 users''. In order Project-Jumper to work you need to create a file 'symfony2' in your project main directory.
It may be empty but is better to use is as wrapper for app/console with content like that (also executable permissions need to be set):
**Important notice for Symfony 2 users:** In order Project-Jumper to work you need to create a `symfony2` file in your project main directory.
It may be empty but it's better to use is as wrapper for app/console with content like this (also executable permissions need to be set for convenient
use):
`php app/console $@`

Usage
-----

Default shortcuts work from Vim edit mode. To invoke a jump, keep `ctrl` and `alt` pressed and then type a 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.
Project is determined during first jump and valid until Vim window is closed.

Default shortcuts
-----------------
Expand Down Expand Up @@ -73,6 +74,8 @@ Project related:

* `<C-M-t>` Root: Explore project main dir.
* `<C-M-g>` AppConfig: Explore app/config/ dir.
* `<C-M-b>` Bundles: Explore src/\*/ dir.
* `<C-M-n>` Vendor: Explore vendor/ dir.

Remapping shortucts
-------------------
Expand Down
12 changes: 12 additions & 0 deletions project-jumper.vim
Expand Up @@ -43,6 +43,10 @@ map <M-9> :call JumperJump("application_num", 9)<CR>
map <C-M-j> :call JumperJump("js")<CR>
map <C-M-k> :call JumperJump("css")<CR>
" Key bindings: Symfony2 specific
map <C-M-b> :call JumperJump("bundles")<CR>
map <C-M-n> :call JumperJump("vendor")<CR>
" JUMP!
function! JumperJump(target, ...)
try
Expand Down Expand Up @@ -173,6 +177,14 @@ function! JumperJump(target, ...)
" App config dir - explore
elseif a:target == "appconfig"
execute "Explore ".w:maindir."/app/config"
" Bundles - explore
elseif a:target == "bundles"
let l:results = split(system("find ".w:maindir."src -mindepth 1 -maxdepth 1 -type d | grep -v .svn "))
execute "Explore ".l:results[s:MultipleChoice(l:results)]."/"
" Vendor - explore
elseif a:target == "vendor"
let l:results = split(system("find ".w:maindir."vendor -mindepth 1 -maxdepth 1 -type d | grep -v .svn "))
execute "Explore ".l:results[s:MultipleChoice(l:results)]."/"
else
throw "Unrecognized target ".a:target
endif
Expand Down

0 comments on commit ebde2fc

Please sign in to comment.