1

I upgraded to Ubuntu 18.04 and this has Vim version 8.0.

This newer version has MatchIt setup to ignore parenthesis, brackets, etc. found inside comments and strings. Although it is at times useful, I prefer to be able to match all of those characters because I often write code in my comments (i.e. for documentation purposes, showing examples).

Although there are times when it is nice to have it this way (ignoring comments/strings), for me it is really rarely useful.

Is there a way for me to turn off that feature with one flag or another?

1 Answer 1

2

Just looking at :h matchit should reveal the answer. I see variable b:match_skip is relevant.

Per the docs the default value of this would be set with:

:let b:match_skip = 's:comment\|string'

With that setting % ignores brackets within or partially within comments, for instance.

Setting it to something that evaluates to 0 (i.e. nothing is skipped)

:let b:match_skip = "0"

and now I'm able to % jump to/from brackets that are within or partially within comments.

5
  • 1
    Oh! The docs did not work as is. I had to run packadd! matchit. Yet the highlighting and % were already working... Commented Dec 9, 2019 at 4:32
  • In fact, % doesn't work the same way before and after (if you have the opening bracket in comment and the closing outside comments then % will do something different out-of-the-box vs. after running that second :let). If you have a specific example of something not working please specify. (I'm only dealing with post :packadd btw)
    – B Layer
    Commented Dec 9, 2019 at 4:45
  • Actually I tested with and without the matchit package. The % navigation works (possibly differently, but I only testing simple cases), however, the highlighting is missing within comments and strings. Commented Dec 9, 2019 at 5:21
  • That's a different/separate question. It's frowned upon to change the meaning of a submitted question. Particularly so after answers have been submitted for the original meaning. You'll need to create a new question. If you really don't need answers to the original question, despite it being a legitimate query, then I guess you can ask for it to be closed.
    – B Layer
    Commented Dec 9, 2019 at 5:29
  • BTW, if you are going to open a new question make sure you search this site for the same/similar questions first. (And read :h matchit if you haven't already.)
    – B Layer
    Commented Dec 9, 2019 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.