-
Notifications
You must be signed in to change notification settings - Fork 600
Terse Start
rking edited this page Oct 22, 2012
·
7 revisions
Saying require 'pry';binding.pry
is too much to type every time you want to drop into Pry from a script.
Here are some solutions.
" Make \\p add the pry debug line
map <Leader><Leader>p orequire 'pry';binding.pry<esc>:w<cr>
" …and use bpry from Insert Mode:
iabbr bpry require 'pry';binding.pry
" Nab the last line from ~/.pry_history. (TODO: Make another one like it that prompts for the #)
map <leader>pry1 o<esc>:.!tail -1 ~/.pry_history<cr>==
echo 'echo "require \"pry\"; binding.pry"' > ~/bin/dbg; chmod +x ~/bin/dbg
Then you're supposed to be able to dbg
, and it works except for a critical detail: when you do that the "binding" is wrong. Any ideas?
def dbg(b_ing = binding)
require 'pry'
b_ing.pry
end
-
(+)
It spares you the require part-
(-)
But not the binding, which is the way you most likely would use it
-
-
(-)
Has to be defined on a per-project basis, though it:-
(+)
Lets you use any editor -
(+)
Lets you use any CLI command (like cucumber, rails, etc...)
-