Merge pull request #2 from stephpy/master

Interactive shell map
This commit is contained in:
Klein Florian 2012-02-10 15:16:35 -08:00
commit f45d493d55
2 changed files with 47 additions and 4 deletions

28
README
View File

@ -4,15 +4,37 @@ Symfony2 plugin for ViM
This plugin handles: This plugin handles:
* symfony routing autocompletion * symfony routing autocompletion
* symfony DIC autocompletion * symfony DIC autocompletion
* symfony console
* php stack trace navigation using quickfix list * php stack trace navigation using quickfix list
========================= =========================
To handle routing or DIC autocompletion, you must have a ``app/console`` script that returns valid output concerning dic and routing. Variables:
In other terms, check that ``app/console container:debug`` and ``app/console router:debug`` are working well.
You can overwride two variables on your .vimrc:
let g:symfony_app_console_caller= "php"
let g:symfony_app_console_path= "app/console"
=========================
To handle routing or DIC autocompletion, you must define the path to your app console that returns valid output concerning dic and routing.
Then you can use <C-x><C-u> (user completion feature) to see all routes and DIC services with some extra informations in the ViM's menu popup. Then you can use <C-x><C-u> (user completion feature) to see all routes and DIC services with some extra informations in the ViM's menu popup.
**Symfony interactive console**
<C-F> To open the Symfony interactive console.
If you want to change this:
let g:symfony_enable_shell_mapping = 0 "disable the mapping of symfony console
" Use your key instead of default key which is <C-F>
map *MY KEY* :execute ":!"g:symfony_enable_shell_cmd<CR>
========================= =========================
To handle stack trace navigation with Symfony2, you can use this exception handler class: To handle stack trace navigation with Symfony2, you can use this exception handler class:
@ -33,3 +55,5 @@ To use it in another system, just use the same class by typing:
// require 'VimExceptionHandler.php' // require 'VimExceptionHandler.php'
VimExceptionHandler::register(); VimExceptionHandler::register();

View File

@ -1,6 +1,17 @@
if !exists("g:symfony_app_console_path")
let g:symfony_app_console_path = "app/console"
endif
if !exists("g:symfony_app_console_caller")
let g:symfony_app_console_caller = "php"
endif
if !exists("g:symfony_enable_shell_mapping")
let g:symfony_enable_shell_mapping = 1
endif
fun! CompleteSymfonyContainer(base, res) fun! CompleteSymfonyContainer(base, res)
let shellcmd = 'php app/console container:debug' let shellcmd = g:symfony_app_console_caller. ' '.g:symfony_app_console_path.' container:debug'
let output = system(shellcmd) let output = system(shellcmd)
if v:shell_error if v:shell_error
return 0 return 0
@ -19,7 +30,7 @@ fun! CompleteSymfonyContainer(base, res)
endfun endfun
fun! CompleteSymfonyRouter(base, res) fun! CompleteSymfonyRouter(base, res)
let shellcmd = 'php app/console router:debug' let shellcmd = g:symfony_app_console_caller. ' '.g:symfony_app_console_path.' router:debug'
let output = system(shellcmd) let output = system(shellcmd)
if v:shell_error if v:shell_error
return 0 return 0
@ -55,3 +66,11 @@ fun! CompleteSymfony(findstart, base)
return res return res
endfun endfun
set completefunc=CompleteSymfony set completefunc=CompleteSymfony
" Open console
let g:symfony_enable_shell_cmd = g:symfony_app_console_caller." ".g:symfony_app_console_path." -s"
if(g:symfony_enable_shell_mapping == 1)
map <C-F> :execute ":!"g:symfony_enable_shell_cmd<CR>
endif