I often insert binding.pry
to my ruby files when I debug them. As I use Vim I\'d love to automate it to avoid retyping it every time. How could I do it?
Th
Based on Fredrik's idea, you can define and store a macro in your .vimrc
, say g
:
let @g = "Obinding.pry^["
Note that to type the escape character you hit CTRL-V then ESC.
You can then do @g
to perform the macro.
In general, if you want to save a macro, one easy way would be to record the macro, say in register q
, then do "qp
(where q
is the macro name) to paste the macro. Then surround it with
let @x = "..."
where x
is the macro name you want it to always have and put it in the .vimrc
file.