Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This is a plugin to enable php debug in VIM with Xdebug, with a new debug engine.
Python VimL
tree: 3588816299

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


This is a plugin to enable php debug in VIM with Xdebug, which originates from But most of the code, especially the debugger backend has been rewritten.

Tested with --

  • XDebug 2.2 - PHP 5.4 - GVIM 7.3 - Python 2.7 @ Windows 7
  • XDebug 2.0 - PHP 5.2 - VIM 7.3 - Python 2.7 @ Linux
  • XDebug 2.0 - PHP 5.2 - VIM 7.3 - Python 2.3 @ Linux
  • XDebug 2.2 - PHP 5.2 - VIM 7.3 - Python 2.7 @ Linux

Some screenshots (under Windows 7) are here at

The enhancements are --

Non blocking debugger backend.

So that VIM users do not need to wait for connection from apache server. No timeout things, users press F5 to start debugger backend, and uses his/her VIM normally. Debug backend won't stop users to interact with VIM. Users can press F6 to stop debugger backend anytime.

Catch all connections from apache server.

This is very important for a large website, especially for thoes pages who contain AJAX requests. In that case, one reload of a page may trigger dozens of http request, each of them goes to a different URL. The new debugger backend will catch all connections from apache server. Users can debug all of them without missing anyone.

Break only at breakpoints

Now the debugger backend breaks only at breakpoints by default, if you would like the debugger backend to break at entry, then add below line to your vimrc --
let g:dbgPavimBreakAtEntry = 1

new commands and function keys

In normal mode

<F5>      => start debugger backend
<F6>      => stop debugger backend
<F8>      => toggle dbgPavimBreakAtEntry, when g:dbgPavimBreakAtEntry=0, debugger backend breaks only at breakpoints.

:Bl        => to list all breakpoints
:Bp        => toggle breakpoint on current line

In debuggin mode

<F1>      => toggle help window
<F2>      => step into 
<F3>      => step over 
<F4>      => step out 
<F5>      => start debugging / run
<F6>      => stop debugging 
<F7>      => evalute expression and display result. cursor is automatically move to watch window. type line and just press enter. 
<F9>      => toggle layout
<F11>     => shows all variables 
<F12>     => shows variable on current cursor 

:Pg        => to print value of complex variables like $this->savings[3]
:Up        => goto upper level of stack 
:Dn        => goto lower level of stack 

In Watch window

If you press Enter key at a line which ends with --

(object)  => to get value of an object.
(array)   => to get value of an array.

If you press Enter key at a line of output from command :Bl, that breakpoint will be located.

In Stack window

If you press Enter key at a line, stack level will be set.

Windows Support

Status line for debugger backend

After user press <F5> to start debugger backend, a string like "PHP-bae-LISN" will show up at the right side of status line.

The status string looks like -- 


bae       => means Break At Entry
bap       => means Break only At breakPoints

LISN      => means the debugger backend is listening.
PENDn     => means there are n connections waiting for debugging.
CONN      => means debug session has been established, and being debugged.
CLSD      => means the debugger backend has stopped.

New layout of windows

Remote debugging

In case that you need run VIM on a different machine from server where apache httpd runs, configuration for DBGPavim --

let g:dbgPavimPathMap = [['D:/works/php','/var/www'],]

Some change for Apache configuration is also necessary --

php_value xdebug.remote_host <ip_address_where_you_run_vim>


  • Make sure your vim has python(at least 2.3) supported, in vim with command


    In case of your VIM don't support python, download VIM source package from, then build your own VIM with commands --

    ./configure --prefix=/opt/vim --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.4/config
    make install
  • Install xdebug for php, and edit php.ini
  • Edit your ~/.vimrc

    let g:dbgPavimPort = 9009
    let g:dbgPavimBreakAtEntry = 0
  • Edit your apche configure file

    In your VirtualHost section, set debugger port same as the one in your vimrc

    php_value xdebug.remote_port 9009
  • Save and dbgpavim.vim to your ~/.vim/plugin

  • Open your php file, use :Bp to set breakpoints

  • Now, press F5 to start debugger backend

  • Back to your browser, add XDEBUG_SESSION_START=1 to your URL, for example, http://localhost/index.php?XDEBUG_SESSION_START=1. If you would like to debug from CLI, start your php script like

    php -dxdebug.remote_autostart=1 -dxdebug.remote_port=9009 test.php

If you are tied of adding XDEBUG_SESSION_START=1 in query string, there is a XDEBUG_SESSION helper at, a user script for Google Chrome. It also works for Firefox with help of GreaseMonkey.

Or modify your apache configuration(httpd.conf) --

... php_value xdebug.remote_port 9009 php_value xdebug.remote_autostart 1

Something went wrong with that request. Please try again.