Skip to content
Browse files

* 2 new jumps for symfony 2

* Updated README
  • Loading branch information...
1 parent 0255009 commit ebde2fcf6fe15097412ebb2aeeb32a712ce053f5 @zergu committed
Showing with 18 additions and 3 deletions.
  1. +6 −3 README.md
  2. +12 −0 project-jumper.vim
View
9 README.md
@@ -17,8 +17,9 @@ 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
@@ -26,7 +27,7 @@ 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
-----------------
@@ -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
-------------------
View
12 project-jumper.vim
@@ -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
@@ -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

0 comments on commit ebde2fc

Please sign in to comment.
Something went wrong with that request. Please try again.