Ⅰ. 插件描述
minimal ruby-debug-ide implementation for Vim based on vim-addon-async supporting breakpoints, stepping, ..Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'marcweber/vim-addon-ruby-debug-ide'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'marcweber/vim-addon-ruby-debug-ide'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'marcweber/vim-addon-ruby-debug-ide'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/marcweber/vim-addon-ruby-debug-ide
Ⅳ. 文档说明
Implement ruby-debug-ide19 client for Vim
tested with ruby-1.9.2 (1.9.3 causes errors with ruby-debug19)
STATUS: This is working:
- stepping
- breakpoints
- var view, watching, evaling, sending commands to debug process manually
- restarting
USAGE:
! Requires client-server, thus X or patched Vim (eg nox patch, see vim-addon-async)
1)
# this installs ruby-debug19 and linecache19 as well:
gem install ruby-debug-ide19
The following steps are only necessary until my changes are accepted
upstream.
# get my patched version of ruby-debug-ide19
# I'm trying to feed these changes upstream
# thus the next two commands will not be needed in the future.
git clone -b json https://github.com/MarcWeber/ruby-debug-ide.git
# make sure the files of my version are found first:
RUBYLIB=`pwd`/lib:$RUBYLIB
chmod +x bin/rdebug-ide
PATH=`pwd`/bin:$PATH
2) start Vim after having set PATH and RUBYLIB as shown above.
:e test.rb (your script to be debugged)
:RDStart
You'll be asked for the script name to be debugged.
Keep empty to connect to already running rdebug-ide process.
You can start the server manually this way: rdebug-ide -J script.rb
You can set breakpoints by F9 and add conditions in the RDEBUG_BREAK_POINTS_VIEW buffer
Yes - there are some segfaults sometimes. Using latest mercurial dev version
of Vim seems to fix most issues?
3) hit F8 to start process
6) step by F6 etc, see plugin/vim-addon-ruby-debug-ide.vim fun RDMappings
INSTALLATION:
dependencies:
- see addon-info.json
- socat executable (probably nc/netcat works as well)
Using VAM:
add the name "vim-addon-ruby-debug-ide" to the list of plugins to be
installed.
related work:
github.com/MarcWeber/vim-addon-rdebug
An implementation which works with require 'debug' only.
https://github.com/astashov/vim-ruby-debugger
So why did it start this project? I want maintainable minimal and reusable code.
That's why this implementation is based on vim-addons-signs and vim-addon-async.
The code in this repo is about 500 LOC currently, not 2000.
It works nice and fast (but may crash vim sometimes), vim-ruby-debugger fails
pointing to the current breakpoint when using this mapping and hitting hit a
couple of times fast.
noremap <F6> :call ruby_debugger#load_debugger() <bar> call g:RubyDebugger.step()<CR>
The author told me it may happen occasionally - but did not for him. Well - I
want to work fast.
There are some more debugger script at www.vim.org which work with any
commandline related debugger or can be extended to work with those.
I haven't tried them. Example:
http://www.vim.org/scripts/script.php?script_id=1703
TODO / BUGS
- upload json protocol implementation for ruby-debug-ide19 to my github page (done)
and submit merge request when done (requested) - check which features of implementation are missing
thread support (continue which one when hitting F8?) - implemennt support for enabling / disabling breakpoints ?
(because lines in the breakpoint view can be commented this is not urgent) - somewhen fix the segfault which sometimes occurs in Vim
TROUBLE SHOOTING:
invalid option: -J, you have the wrong ruby-debug-ide19 version which does not
have my json protocl patch. See INSTALLATION.
You can't set breakpoints? Make sure you pass -J (json protocol) to rdebug-ide