Giter Club home page Giter Club logo

vim-ruby-debugger's Introduction

Description

This Vim plugin implements interactive Ruby debugger in Vim.

Features

  1. It can debug any Ruby application (Rails, by default), using ruby-debug-ide gem
  2. The debugger looks like in the Netbeans - you can go through the code, watch variables, breakpoints in separate window, set and remove breakpoints.
  3. 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.

Requirements

  1. 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'.

  2. ruby-debug-ide gem.

  3. For linux: 'lsof' program.

Installation

  1. Clone the repo

    git clone git://github.com/astashov/vim-ruby-debugger.git
    

    or just download the archive from here:

    http://github.com/astashov/vim-ruby-debugger/tarball/master
    

    You will get the 'vim-ruby-debugger' dir with the plugin.

  2. Copy contents of the 'vim-ruby-debugger' dir to your ~/.vim/ (or to ~/.vim/bundle/vim-ruby-debugger if you use pathogen).

  3. Generate the local tags file

    :helptags ~/.vim/doc
    

    Now, you can use

    :help ruby-debugger
    

    to get help for the ruby-debugger plugin.

I've tested the plugin in Windows and Linux. All tests should be passed there.

Using#

  1. 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

  2. Go to the directory with some your Rails application.

     :cd ~/projects/rails
    
  3. Run Server with Debugger:

     :Rdebugger
    

    It will kill any listeners of ports 39767 and 39768 and run rdebug-ide and ~/.vim/bin/ruby_debugger.rb on these ports accordingly.

  4. Set breakpoint somewhere by <Leader>b (e.g., '\b'). You should see 'xx' symbol at current line.

  5. Open page with the breakpoint in the browser. Vim should automatically set current line to breakpoint.

  6. After this, you can use commands:

     <Leader>b - set breakpoint at current line
     <Leader>v - open/close window with variables. You can expand/collapse variables by 'o' in normal mode or left-mouse double-click
     <Leader>n - step over
     <Leader>s - step into
     <Leader>c - continue
    

Testing

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

     :call g:TU.run()

Screenshot

Screenshot

Thanks

Special thanks to tpope (for rails.vim) and Marty Grenfell (for NERDTree), mostly, I learn Vim Scripting from their projects.

vim-ruby-debugger's People

Contributors

antonwiklund99 avatar marcus avatar rweng avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.