Vim field guide · dot-files

vim-endwise

Automatically adds closing keywords after you press `<Enter>` in insert mode. Works for Ruby, Bash, Vim script, Lua, Elixir, and more.

How it works

Type an opening keyword and press <Enter> — vim-endwise appends the matching closer and positions the cursor in between.

Ruby

def greet        →  <Enter>  →   def greet
                                   |          (cursor here)
                                 end
if condition     →  <Enter>  →   if condition
                                   |
                                 end
do               →  <Enter>  →   do
                                   |
                                 end

Bash / Zsh

if [ ... ]; then    →  <Enter>  →   if [ ... ]; then
                                       |
                                     fi
for i in ...; do    →  <Enter>  →   for i in ...; do
                                       |
                                     done

Vim script

function! Foo()    →  <Enter>  →   function! Foo()
                                     |
                                   endfunction

No configuration needed

vim-endwise detects the filetype automatically and applies the right closer. It does nothing in filetypes it doesn't recognise.