Wednesday, April 11, 2012

Re: Matching parentheses in Fortran code when using matchit does not work

On Wednesday, April 11, 2012 11:02:27 AM UTC-5, Thomas Mitterfellner wrote:
> Hello!
>
> I'm using the matchit plugin to match Fortran code structures with %,
> and it works as expected. But now it seems that normal parens are not
> matched with % anymore.
>
> In this code:
>
> do i = 1, 1000
> dep(i, 1) = 0.
> end do
>

I know nothing about Fortran, but this code segment highlights with errors in a new buffer with ft=fortran.

> when pressing % with the cursor on the ( on a freshly opened file, the
> cursor jumps to ). Pressing % again, nothing seems to happen, where the
> expected behavior would be for the cursor to jump back to the opening (.
> Now, when I go back to ( manually and hit %, again, nothing happens.
> When I use % on the 'do', matching still works.
>
> So, to sum up: after the first use of % (independent of whether a
> structure or a parenthesis is matched), parentheses are not matched any
> longer.
>
> My questions are:
> 1) Can you reproduce this behavior or is something wrong with my
> configuration?
> 2) Either way: do you have an idea how this could be fixed?
>

I can reproduce. There seems to be an omission in the fortran.vim ftplugin file, which for some reason doesn't include parentheses in the b:match_words variable.

You can get around the issue by appending the text, ',(:)' to b:match_words, like the following:

:let b:match_words.=',(:)'

This line could go in a ~/.vim/after/ftplugin/fortran.vim file, or a FileType autocmd.

I've copied the script maintainer, I would consider this a bug.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: