2

At the moment I'm writing, I removed the matchit plugin and the % works well, making the cursor jump from a (, [, or { to the corresponding closing character and vice versa.

Now I installed matchit again, adding Plugin 'vim-scripts/matchit.zip' to my .vimrc and then running Vundle's :PluginInstall. Having done so, I can now jump back and forth from subroutine to end subroutine in my .f90 files and so on (and I can do it with .cpp and so on).

But I cannot make this jumps with parenthesis and brackets and other "standard" pairs.

I have no idea what could be the reason of such strange behavior in Vim. I hope the following observations can be useful for you to help me.

  • Wherever I press % (to jump between a standard or non standard pair, or on an empty line with no reason), then I cannot use it anymore, as well as the cursor remains in the buffer related to a .f90 file.
  • If I move to another buffer/window related to a NON .f90 file (by :n<CR>, :N<CR>, <C-W><C-W> and so on, or simply :help<CR>) and press % at least once (to jump between ... as before), then I can go back to a .f90 buffer/window and use % with standard pairs once (just once!) again.
  • Jumping between new pairs (IF, DO, and so on) is not affected.

Maybe I should underline that I got the feeling that this happens only with Fortran files (.f90 and .f95), since it doesn't happen with help pages (.txt) nor with .cpp files.

  • 1
    I don't know the vim-script/matchit.zip plugin you're talking about but in my .vimrc I have runtime macros/matchit.vim which enables the defaut matchit plugin and % works on brackets as well as on subroutine maybe you should try that. – statox Jul 21 '16 at 9:32
  • 1
    On GitHub I read "Since vim 6.0, matchit.vim has been included in the standard vim distribution, under the macros/ directory; the version here may be more recent.". Anyway I followed your advice. Still I have exactly the same behavior. – Enrico Maria De Angelis Jul 21 '16 at 9:46
  • 5
    :h matchit.txt and especially :h matchit-debug. The Github mirror is older then the distributed version with Vim. – Christian Brabandt Jul 21 '16 at 9:53
  • 1
    Do I understand correctly, matching with matchit works only once and then not anymore? I think this was fixed with a recent runtime file update – Christian Brabandt Jul 21 '16 at 10:06
  • 2
    I think this commit fixed the problem. – Christian Brabandt Jul 21 '16 at 12:11
0

The solution is that provided by @ChristianBrabandt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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