Multiple path mappings support In Vdebug

To homepage

While working with PHP at Etsy, whenever I needed to debug a script I would fire up PHPStorm and set it up to work with the remote development web server. This worked well, but the problem was twofold: 1) I needed to have a licensed copy of PHPStorm on each of my computers 2) I couldn’t just use vim, my favorite editor! I’ve dabbled in the past with different vim Xdebug plugins, but they mostly proved to be half-baked and a pain to setup.

Recently I’ve stumbled upon the excellent vim plugin Vdebug by joonty and begun using it to debug PHP scripts for my work at Etsy. Setting it up was a breeze and its documentation and vim-help pages are impeccable. However, I faced one problem: I could only set up one remote path mapping between the scripts on the remote server and the scripts on the local machine.

To resolve that problem, I’ve implemented and sent a pull request to add support for multiple path mappings in Vdebug. Whereas before you had to specify the path mapping like this:

let g:vdebug_options['remote_path'] = '/home/user/scripts'
let g:vdebug_options['local_path'] = '/home/jon/scripts'

You can now specify as many path mappings as you want like this:

let g:vdebug_options['path_maps'] = { \
    '/home/user/scripts' : '/home/jon/scripts', \
    '/home/user/some_other_scripts' : '/home/jon/some_other_scripts' \
    '/home/user2/scripts' : '/home/other_dev/scripts' \

As of November 8th, 2012 the pull request has been accepted by joonty and has been merged upstream. Update your vdebug scripts to take advantage of this :)