Vim finds the wrong matching bracket when using%

I am trying to learn VIM, buy, I noticed when I try to use the% command to go to the corresponding bracket, VIM sometimes finds the correct matching bracket and sometimes leaves. Has anyone ever come across this with a solution?

+5
source share
4 answers

This is because:

  • You have an actual syntax error with an inconsistent wig or brace somewhere.
  • You have a value in cpoptionswhich prevents the semi-smart bindings from matching. Find :help cpoptionsand :help %.
  • - Vim. matchit, . .
+13

-, vim , , , , vim , , , .

+4

matchit the plugin would save me hours of frustration if I found it earlier.

There is a small chance to insert this ugly command into your terminal to correctly configure the plugin:

wget http://www.vim.org/scripts/download_script.php?src_id=8196; unzip download_script.php?src_id=8196; echo >> ~/.vimrc; echo -ne "source " >> ~/.vimrc; pwd | tr -d '\n' >> ~/.vimrc; echo -ne "/plugin/matchit.vim" >> ~/.vimrc; rm download_script.php\?src_id\=8196

Then reinstall vimrc:

:source ~/.vimrc

+2
source

No no. This may mean that you do not have parentheses.

0
source

All Articles