basteln
basteln

Reputation: 2637

Vim: brace matching unreliable

I'm using Vim to edit JSP files with JavaScript. Somehow the % key (jump to matching brace) doesn't work most of the time: Sometimes it works, sometimes it works only in one direction, but most of the time it doesn't work at all. Of course Vim is able to highlight the right matching brace, but matchit.vim doesn't seem to find it. I'm using the latest version (1.13.2) of the plugin.

Example:

<s:layout-component name="extra_styles">
@import "${mediaPath}/css/whatever.css";
.test .someclassname {
    top: 5px;
    left: 32px;
}
</s:layout-component>

Here it won't find the matching curly brace.

Does anyone know a solution for this?

Upvotes: 2

Views: 655

Answers (2)

jbear
jbear

Reputation: 363

I had the same problem: % wouldn't jump to matching {}. This is my workaround:

:let b:match_debug=1

% starts dancing after that.

Hope it helps.

Upvotes: 6

romainl
romainl

Reputation: 196789

I think it has something to do with the JSP syntax definition: I changed the filetype on your example to css: matchit jumps correctly from one curly brace to the other. Changing the filetype back to jsp makes matchit all dizzy.

:set ft=css.jsp seems to allow both the correct matchit behaviour and CSS omni-completion. See if it doesn't break anything on the jsp front.

Upvotes: 2

Related Questions