Home Lazy way to insert debugging code for Elixir in Vim
Post
Cancel

Lazy way to insert debugging code for Elixir in Vim

When I’m writing Elixir code, I’ve been using require IEx; IEx.pry() a lot to debug my code that it became annoying having to type it all the time again and again. Hence I was thinking about a lazier way to have it inserted there in Vim and of course I was not the only one annoyed with this problem.

1
2
map ,P Orequire IEx; IEx.pry()<ESC>
map ,p orequire IEx; IEx.pry()<ESC>

After inserting above code into your .vimrc you can basically insert pry line into your code with the keyboard shortcuts ,p and ,P. Uppercase version of the shortcut inserts the line above the current line and lowercase version inserts the line below the current line.

This post is licensed under CC BY 4.0 by the author.