Configure VDebug for Drupal on Ubuntu 16.04

Install XDebug for PHP

sudo apt-get install php-xdebug

To check whether the xdebug module is installed, run

php -m

Edit /etc/php/7.x/mods-available/xdebug.ini to enable stack traces:
xdebug.show_error_trace = 1

Here are the settings to put in xdebug.ini:

xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=vim-xdebug
xdebug.profiler_enable=0

For instructions on Docker specific setup, visit this page.

Install the VIM VDebug Plugin

Add this to the Vundle configuration:
Plugin 'joonty/vdebug'

Then run :PluginInstall in vi

In your .vimrc you need:

" no vi compat
set nocompatible

" filetype func off
filetype off

" initialize vundle
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()
" start- all plugins below

Plugin 'VundleVim/Vundle.vim'
Plugin 'joonty/vdebug'

" stop - all plugins above
call vundle#end()

" filetype func on
filetype plugin indent on

" Settings
set wrap
set syn=auto
set ul=150
set bs=2
set et
set sw=2
set ts=2
set st=2
set ai!
set smartindent
set nu!
set hlsearch
set incsearch
set laststatus=2
set title

" Debugging
let g:vdebug_options = {'ide_key': 'vim-xdebug'}
let g:vdebug_options = {'break_on_open': 0}
let g:vdebug_options = {'server': '127.0.0.1'}
let g:vdebug_options = {'port': '9000'}