This Vim plugin implements interactive Ruby debugger in Vim.
This fork groups all mappings under <Leader>d to avoid conflicts with other plugins (like command-t).
- It can debug any Ruby application (Rails, by default), using ruby-debug-ide gem
- The debugger looks like in the Netbeans - you can go through the code, watch variables, breakpoints in separate window, set and remove breakpoints.
- It supports command-line rdebug commands. E.g., you can execute ':RdbCommand p User.all' in command line of VIM and it will display result like usual echo VIM command.
Vim >= 7.0, compiled with +signs and +clientserver. You can verify it by VIM command:
:echo has("signs") && has("clientserver") && v:version > 700
It should show result '1'.
- For linux: 'lsof' program.
Clone the repo
git clone git://github.com/astashov/vim-ruby-debugger.git
or just download the archive from here:
You will get the 'vim-ruby-debugger' dir with the plugin.
Copy contents of the 'vim-ruby-debugger' dir to your ~/.vim/ (or to ~/.vim/bundle/vim-ruby-debugger if you use pathogen).
Generate the local tags file
Now, you can use
to get help for the ruby-debugger plugin.
I've tested the plugin in Windows and Linux. All tests should be passed there.
Run Vim. If you use gvim, it will automatically start the server, but if you use vim, you need to set servername explicitly, e.g., vim --servername VIM
Go to the directory with some your Rails application.
Run Server with Debugger:
It will kill any listeners of ports 39767 and 39768 and run rdebug-ide and ~/.vim/bin/ruby_debugger.rb on these ports accordingly.
Set breakpoint somewhere by <Leader>db (e.g., '\db'). You should see 'xx' symbol at current line.
Open page with the breakpoint in the browser. Vim should automatically set current line to breakpoint.
After this, you can use commands:
<Leader>db - set breakpoint at current line <Leader>dv - open/close window with variables. You can expand/collapse variables by 'o' in normal mode or left-mouse double-click <Leader>dn - step over <Leader>ds - step into <Leader>dc - continue
If you want to run tests, replace in /autoload directory ruby_debugger.vim to ruby_debugger.vim from additionals/autoload directory. And then, in command mode execute
Special thanks to tpope (for rails.vim) and Marty Grenfell (for NERDTree), mostly, I learn Vim Scripting from their projects.