This VIM plugin inserts a debugger statement or wraps a selection with an exception catching debugger statement
Vim script
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
plugin
LICENSE
README.md

README.md

Insert-Debugger

About

This plugin inserts a debugger statement at the current position or alternatively wraps a visual selection with exception handling+debugger statement.

Installation

I recommend Vundle

Plugin 'codegourmet/insert-debugger'

Usage

Setup the method via your preferred keybinding inside .vimrc:

nmap <Leader>i :InsertDebugger<CR>
vmap <Leader>i :InsertDebuggerBlock<CR>

Settings

g:insert_debugger_language

let g:insert_debugger_language = 'ruby'

Default: 'ruby' Available: 'ruby', 'php'

Setting language dependent on filetype

autocmd FileType php let g:insert_debugger_language = 'php'
autocmd FileType ruby let g:insert_debugger_language = 'ruby'

Example for ruby

Before

previous_line()
cursor_line()

After execution without selection

previous_line()
require 'pry'; binding.pry
cursor_line()

After execution with visual selection

begin
  previous_line()
  cursor_line()
rescue
  require 'pry'; binding.pry
end

Example for php

Before

previousLine();
cursorLine();

After execution without selection

previousLine();
eval(\Psy\sh());
cursorLine();

After execution with visual selection

try {
  previousLine();
  cursorLine();
} catch (\Exception $e) {
  eval(\Psy\sh());
}

Contributing

If you think anything's missing or buggy please drop me a line or a pull request.

TODO

vim docs

License

MIT