Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ Then you can use <C-x><C-u> (user completion feature) to see all routes and DIC

**Symfony interactive console**

<C-F> To open the Symfony interactive console.
If you want to active <Leader>f maps to launch interactive shell:

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>
let g:symfony_enable_shell_mapping = 1

If you want to change it:

map *MY KEY* :call SymfonyInteractiveShell()<CR>

=========================

Expand Down
13 changes: 8 additions & 5 deletions plugin/symfonycomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if !exists("g:symfony_app_console_caller")
endif

if !exists("g:symfony_enable_shell_mapping")
let g:symfony_enable_shell_mapping = 1
let g:symfony_enable_shell_mapping = 0
endif

fun! CompleteSymfonyContainer(base, res)
Expand Down Expand Up @@ -65,12 +65,15 @@ fun! CompleteSymfony(findstart, base)

return res
endfun
set completefunc=CompleteSymfony

" Open console
fun! SymfonyInteractiveShell()
let g:symfony_enable_shell_cmd = g:symfony_app_console_caller." ".g:symfony_app_console_path." -s"
exe ":! echo Waiting for Symfony2 Shell interactive ... && "g:symfony_enable_shell_cmd
endfun

let g:symfony_enable_shell_cmd = g:symfony_app_console_caller." ".g:symfony_app_console_path." -s"
set completefunc=CompleteSymfony

" if default mapping
if(g:symfony_enable_shell_mapping == 1)
map <C-F> :execute ":!"g:symfony_enable_shell_cmd<CR>
map <Leader>f :call SymfonyInteractiveShell()<CR>
endif
22 changes: 22 additions & 0 deletions plugin/view.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
" @author: http://knplabs.fr/blog/boost-your-productivity-with-sf2-and-vim
" first set path
set path+=**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this set path+=** slowen things a lot. Maybe we can find a way to configure/disable it ?
Also, it only permits to jump to the first result. If many index.html.twig for example (which happens all the time), you're blocked.

I personally use ctags to jump to views: https://github.com/docteurklein/dot-files/blob/master/ctags#L4-L11

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, ** is only available on bash 4.0+ (if activated using shopt -s globstar), or zsh.


" jump to a twig view in symfony
function! s:SfJumpToView()
mark C
normal! ]M
let end = line(".")
normal! [m
try
call search('\v[^.:]+\.html\.twig', '', end)
normal! gf
catch
normal! g`C
echohl WarningMsg | echomsg "Template file not found" | echohl None
endtry
endfunction
com! SfJumpToView call s:SfJumpToView()

" create a mapping only in a Controller file
autocmd BufEnter *Controller.php nmap <buffer><leader>v :SfJumpToView<CR>