diff --git a/README b/README index dea5730..361516a 100644 --- a/README +++ b/README @@ -4,15 +4,37 @@ Symfony2 plugin for ViM This plugin handles: * symfony routing autocompletion * symfony DIC autocompletion + * symfony console * 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. -In other terms, check that ``app/console container:debug`` and ``app/console router:debug`` are working well. +Variables: + +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 (user completion feature) to see all routes and DIC services with some extra informations in the ViM's menu popup. +**Symfony interactive console** + + 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 + map *MY KEY* :execute ":!"g:symfony_enable_shell_cmd + + + ========================= 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' VimExceptionHandler::register(); + + diff --git a/plugin/symfonycomplete.vim b/plugin/symfonycomplete.vim index 099e24b..781ab49 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -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) - 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) if v:shell_error return 0 @@ -19,7 +30,7 @@ fun! CompleteSymfonyContainer(base, res) endfun 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) if v:shell_error return 0 @@ -55,3 +66,11 @@ fun! CompleteSymfony(findstart, base) return res endfun 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 :execute ":!"g:symfony_enable_shell_cmd +endif