1

Neovim .6.1

Got this line:

add_post_meta($this->cmr_id, 'intro_paragraph', 'Hello');

With:

add_post_meta($this->cmr_id, 'intro_paragraph', 'Hello');
                                 ^ cursor here

Hitting '%' key jumps to opening paren as expected.

But with:

add_post_meta($this->cmr_id, 'intro_paragraph', 'Hello');
                 ^ cursor here

Nothing happens. If I remove the $, it works.

8
  • 1
    I can't reproduce your issue with nvim 0.6.1 you probably want to check how do I debug my vimrc or maybe check if you have a mapping on % which causes an issue (How to debug a mapping). EDIT: Or it is a filetype issue. It would be worth checking that the issue still happens after using set ft= or if it happens with different filetypes.
    – statox
    Feb 22, 2022 at 11:14
  • 1
    Ok I actually can reproduce in both vim and nvim if I set the filetype to php. That looks like a bug in the matchit plugin when using php... Maybe it would be worth creating an issue on Github. Also @ChristianBrabandt is listed as the maintainer of matchit in the source code, maybe he is the right person to ask this question to.
    – statox
    Feb 22, 2022 at 11:19
  • 1
    OK, yeah, I was just about to come here and report I think it's a filetype issue. Thanks!
    – StevieD
    Feb 22, 2022 at 11:28
  • 1
    So, turns out the php.vim script in vim calls html.vim script. html.vim script is the culprit. If I comment out the line that loads it, things works as expected.
    – StevieD
    Feb 22, 2022 at 12:41
  • 1
    Yeah I think neovim gets the matchit plugin from the vim repo so it makes sense they ask you to create it there. Your second solution is nice
    – statox
    Feb 22, 2022 at 18:00

2 Answers 2

1

OK, here's a much better fix, albeit probably not perfect.

In after/ftplugin/php.vim, add the following 3 lines:

let b:match_words .= '<?php:[^-]>'
set matchpairs-=<:>
let b:match_words = substitute(b:match_words, '<:>', '<:\@<=[^-]>', '')
0

Looks to be a bug in html.vim which gets loaded by php.vim.

Hack fix:

Comment out:

"setlocal matchpairs+=<:>

And:

"if exists("loaded_matchit")
"    let b:match_ignorecase = 1
"    let b:match_words = '<:>,' .
"    \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
"    \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
"    \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
"endif

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.