Jun 04, 2022
💻 Configuring Vim to work with xdebug [PHP]
Requirements:
Configure:
- Install the
vdebug
plugin. The installation process depends on which plugin manager you are using. (I recommend vim-plug). In my case, installing the plugin is by adding the following line to the config filevim
(.vimrc
forvim
,init.vim
forneovim
).
Plug 'vim-vdebug/vdebug'
- Add the following code to the config
vim
.
let g:vdebug_options = {}
let g:vdebug_options["port"] = 7000
- Add to
php.ini
xdebug.start_with_request=yes
xdebug.mode=debug,trace
xdebug.client_host=127.0.0.1
xdebug.client_port=7000
Please note, that Xdebug 3
has changed the name of many options. And these instructions will not work for you if you are using an older version of Xdebug
.
Done, you can now debug the php-scripts.
- F2: Step over.
- F5: Start debug / to next breakpoint.
- F6: Stop debugging (kills script).
- F10: Toggle line breakpoint.
- Double F6: Close the debugger interface.
For more information see documentation.