In C and C-like languages, I can use %
to jump to the corresponding curly brace that the cursor is on. This is a well-known "trick".
But in Ruby for example:
def fun
[1, 2].each do |n|
end
end
This doesn't work, since ruby doesn't use the characters in matchpairs
(set to (:),{:},[:],<:>
by default.
I tried setting that, but it doesn't work:
:set matchpairs=def:end
E474: Invalid argument: matchpairs=def:end
Can I get this to work with languages such as Ruby as well? Note this is not a Ruby-specific question, other examples might be shell scripts (if
/fi
) or Lua (function
/end
), and many many more.