-1

I have used standard SystemVerilog syntax packages but not able to match(with % move the cursor between) these strings. This is in the context of matchit function in Vim(https://www.vim.org/scripts/script.php?script_id=39). The problem seems to be with backtick.

I tried:

\u0060

and

`ifdef\>|`ifndef\>:`endif\>,

but it does not work.

3
  • 1
    I edited your post to hopefully show your code properly. If it's not correct then please fix as needed. Commented Feb 11, 2021 at 18:13
  • "Match" can mean quite a few things depending on the context. What are you trying to do, exactly? Commented Feb 11, 2021 at 19:48
  • This is a mistake in vim.org/scripts/script.php?script_id=1586 Systemverilog highlight package Commented Feb 13, 2021 at 14:34

1 Answer 1

1

I'm assuming you have a file that looks like this:

stuff
`ifdef
    some code
`endif
stuff

With the cursor on `ifdef (or `ifndef), you want to jump to `endif with % then back to `ifdef if you press % again. I'm also assuming you're using the matchit plugin.

Solution:

:let b:match_words='`ifdef\>\|`ifndef\>:`endif\>'

Notice that the | has to be escaped with a backslash. Also, you need quotation marks '. So the backticks were not the problem.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks ! @ProgMetalSlug the | was not escaped with backslash. There are similar questions like stackoverflow.com/questions/27498221/…. I would like to use the package provided by @Vitor

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.