From c3d53ca44821eaaf07d7986e837b3bb7cbdebbd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20PY?= Date: Thu, 9 Feb 2012 21:04:14 +0100 Subject: [PATCH 1/4] Add command to enter on interactive shell of Symfony --- README | 10 +++++++++- plugin/symfonycomplete.vim | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README b/README index dea5730..9986cf4 100644 --- a/README +++ b/README @@ -4,15 +4,23 @@ 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. +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. Then you can use (user completion feature) to see all routes and DIC services with some extra informations in the ViM's menu popup. + +========================= + +To open the Symfony console, you must have a ``app/console`` script to enter on interactive console. + + To open the console. + ========================= To handle stack trace navigation with Symfony2, you can use this exception handler class: diff --git a/plugin/symfonycomplete.vim b/plugin/symfonycomplete.vim index 099e24b..6e236d7 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -55,3 +55,6 @@ fun! CompleteSymfony(findstart, base) return res endfun set completefunc=CompleteSymfony + +" Open console +map :! php app/console -s From 247be096d66c97934a77bce17f5a8b67b40621c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20PY?= Date: Fri, 10 Feb 2012 16:14:17 +0100 Subject: [PATCH 2/4] Let user choose his symfony console caller and path --- README | 19 ++++++++++++------- plugin/symfonycomplete.vim | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README b/README index 9986cf4..0162d37 100644 --- a/README +++ b/README @@ -9,17 +9,21 @@ This plugin handles: ========================= -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:SymfonyAppConsoleCaller = "php" + let g:SymfonyAppConsolePath = "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. -========================= - -To open the Symfony console, you must have a ``app/console`` script to enter on interactive console. - - To open the console. + To open the Symfony interactive console. ========================= @@ -41,3 +45,4 @@ 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 6e236d7..9c39be4 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -1,6 +1,13 @@ +if !exists("g:SymfonyAppConsolePath") + let g:SymfonyAppConsolePath = "app/console" +endif + +if !exists("g:SymfonyAppConsoleCaller") + let g:SymfonyAppConsoleCaller = "php" +endif fun! CompleteSymfonyContainer(base, res) - let shellcmd = 'php app/console container:debug' + let shellcmd = g:SymfonyAppConsoleCaller. ' '.g:SymfonyAppConsolePath.' container:debug' let output = system(shellcmd) if v:shell_error return 0 @@ -19,7 +26,7 @@ fun! CompleteSymfonyContainer(base, res) endfun fun! CompleteSymfonyRouter(base, res) - let shellcmd = 'php app/console router:debug' + let shellcmd = g:SymfonyAppConsoleCaller. ' '.g:SymfonyAppConsolePath.' router:debug' let output = system(shellcmd) if v:shell_error return 0 @@ -57,4 +64,6 @@ endfun set completefunc=CompleteSymfony " Open console -map :! php app/console -s + +let cmd = g:SymfonyAppConsoleCaller." ".g:SymfonyAppConsolePath." -s" +map :execute ":!"cmd From 1c74396f643f2a20a80a8536e4bc0084b823157b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20PY?= Date: Fri, 10 Feb 2012 16:26:20 +0100 Subject: [PATCH 3/4] User can choise to disable the mapping, or use his key --- README | 17 ++++++++++++++--- plugin/symfonycomplete.vim | 23 +++++++++++++++-------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/README b/README index 0162d37..014fe27 100644 --- a/README +++ b/README @@ -13,8 +13,8 @@ Variables: You can overwride two variables on your .vimrc: - let g:SymfonyAppConsoleCaller = "php" - let g:SymfonyAppConsolePath = "app/console" + let g:symfony_app_console_caller= "php" + let g:symfony_app_console_path= "app/console" ========================= @@ -22,8 +22,18 @@ To handle routing or DIC autocompletion, you must define the path to your app co 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 open the Symfony interactive console. ========================= @@ -46,3 +56,4 @@ 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 9c39be4..d5c509b 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -1,13 +1,17 @@ -if !exists("g:SymfonyAppConsolePath") - let g:SymfonyAppConsolePath = "app/console" +if !exists("g:symfony_app_console_path") + let g:symfony_app_console_path = "app/console" endif -if !exists("g:SymfonyAppConsoleCaller") - let g:SymfonyAppConsoleCaller = "php" +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 = g:SymfonyAppConsoleCaller. ' '.g:SymfonyAppConsolePath.' 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 @@ -26,7 +30,7 @@ fun! CompleteSymfonyContainer(base, res) endfun fun! CompleteSymfonyRouter(base, res) - let shellcmd = g:SymfonyAppConsoleCaller. ' '.g:SymfonyAppConsolePath.' 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 @@ -65,5 +69,8 @@ set completefunc=CompleteSymfony " Open console -let cmd = g:SymfonyAppConsoleCaller." ".g:SymfonyAppConsolePath." -s" -map :execute ":!"cmd +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 From 612f68824907dddd18c767011eba3e1f5226df5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20PY?= Date: Fri, 10 Feb 2012 16:58:31 +0100 Subject: [PATCH 4/4] Wtf, by adding it mapps to on my vim config ... i set by default so ... --- README | 4 ++-- plugin/symfonycomplete.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 014fe27..361516a 100644 --- a/README +++ b/README @@ -24,13 +24,13 @@ Then you can use (user completion feature) to see all routes and DIC **Symfony interactive console** - To open the 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 + " Use your key instead of default key which is map *MY KEY* :execute ":!"g:symfony_enable_shell_cmd diff --git a/plugin/symfonycomplete.vim b/plugin/symfonycomplete.vim index d5c509b..781ab49 100644 --- a/plugin/symfonycomplete.vim +++ b/plugin/symfonycomplete.vim @@ -72,5 +72,5 @@ set completefunc=CompleteSymfony 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 + map :execute ":!"g:symfony_enable_shell_cmd endif