User can choise to disable the mapping, or use his key

This commit is contained in:
Stéphane PY 2012-02-10 16:26:20 +01:00
parent 247be096d6
commit 1c74396f64
2 changed files with 29 additions and 11 deletions

17
README
View File

@ -13,8 +13,8 @@ Variables:
You can overwride two variables on your .vimrc: You can overwride two variables on your .vimrc:
let g:SymfonyAppConsoleCaller = "php" let g:symfony_app_console_caller= "php"
let g:SymfonyAppConsolePath = "app/console" 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 <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-M> 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-M>
map *MY KEY* :execute ":!"g:symfony_enable_shell_cmd<CR>
<C-M> 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' // require 'VimExceptionHandler.php'
VimExceptionHandler::register(); VimExceptionHandler::register();

View File

@ -1,13 +1,17 @@
if !exists("g:SymfonyAppConsolePath") if !exists("g:symfony_app_console_path")
let g:SymfonyAppConsolePath = "app/console" let g:symfony_app_console_path = "app/console"
endif endif
if !exists("g:SymfonyAppConsoleCaller") if !exists("g:symfony_app_console_caller")
let g:SymfonyAppConsoleCaller = "php" let g:symfony_app_console_caller = "php"
endif
if !exists("g:symfony_enable_shell_mapping")
let g:symfony_enable_shell_mapping = 1
endif endif
fun! CompleteSymfonyContainer(base, res) 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) let output = system(shellcmd)
if v:shell_error if v:shell_error
return 0 return 0
@ -26,7 +30,7 @@ fun! CompleteSymfonyContainer(base, res)
endfun endfun
fun! CompleteSymfonyRouter(base, res) 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) let output = system(shellcmd)
if v:shell_error if v:shell_error
return 0 return 0
@ -65,5 +69,8 @@ set completefunc=CompleteSymfony
" Open console " Open console
let cmd = g:SymfonyAppConsoleCaller." ".g:SymfonyAppConsolePath." -s" let g:symfony_enable_shell_cmd = g:symfony_app_console_caller." ".g:symfony_app_console_path." -s"
map <C-M> :execute ":!"cmd<CR>
if(g:symfony_enable_shell_mapping == 1)
map <C-M> :execute ":!"g:symfony_enable_shell_cmd<CR>
endif