Insert predefined text on keyboard shortcut

后端 未结 6 952
悲&欢浪女
悲&欢浪女 2021-02-07 04:27

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

6条回答
  •  别那么骄傲
    2021-02-07 05:05

    A great quandary I found myself in. To solve this I placed the following mappings in my .vimrc:

    imap  binding.pry 
    nnoremap bp O<% binding.pry %>
    

    The first allows me to use to insert a binding.pry when already in insert mode.

    The second lets me use my leader+bp to place a binding.pry above the current line.

提交回复
热议问题