Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically append "end" to ruby code blocks in vim?

Tags:

vim

ruby

This is a feature I miss from Textmate. When you type out a def, if, block, etc. and hit enter, the editor automatically appends "end" to the code block and puts the cursor in between.

How do I set this up in vim?

Thanks!

like image 579
widgetycrank Avatar asked Feb 02 '23 23:02

widgetycrank


2 Answers

There is a plugin that does just that: endwise.vim.

like image 106
psyho Avatar answered Feb 05 '23 14:02

psyho


Two vim plugins come to mind that get a lot of recommendations:

  • snipMate. See the screencast for an overview.
  • rails.vim

I'll also recommend the Surround and Align plugins as being really useful. And, I just just started working with Command-T and it looks useful too.

like image 40
the Tin Man Avatar answered Feb 05 '23 12:02

the Tin Man