On Wed, 10 Mar 2010, Jason wrote:

I am trying to get folds working for Java files in MacVim. To do so I added lines to

/usr/share/vim/vim72/syntax/java.vim

As recommended at http://vim.wikia.com/wiki/Java/C/C%2B%2B_folding

Now when I type "vim myfile.java" I get folds!  Great!

I believe it's generally best to avoid modifying manufacturer-supplied files like this; you should be able to achieve the same effect by putting your modified copy of java.vim in ~/.vim/syntax (thus, it'd be the file ~/.vim/syntax/java.vim). Vim, and MacVim, will read these first, before looking in the normal location. I have quite a few files in ~/.vim/syntax for languages that aren't supplied with the stock Vim, or various tweaks or updates to languages.

But when I run MacVim and open myfile.java... there are no folds and I get the error message "E490: No fold found" when I type "zc" on a foldable block of code.

Right... those files you were modifying, under /usr/share/vim/vim72 ? There's an entire (almost-but-not-quite) duplicate set of them under /Applications/MacVim.app/Contents/Resources/vim/runtime. You'd have to modify them there too. Another reason why ~/.vim is a good idea.

Cheers,
Carl

--
You received this message from the "vim_mac" 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

Reply via email to