You are not logged in.

#1 2009-03-25 22:32:55

horsecool
Member
Registered: 2008-12-22
Posts: 55

[solved] vim folding for fortran

Hello, I am doing some programming in Fortran(90) by vim now. One thing I cound not figure out is how to make the folding work. It works great for Latex(latexSuite). Anyone had the same problem?

By the way, it does not work for Python neither sad

Last edited by horsecool (2009-03-28 05:59:02)

Offline

#2 2009-03-26 00:35:09

N30N
Member
Registered: 2007-04-08
Posts: 273

Re: [solved] vim folding for fortran

horsecool wrote:

One thing I cound not figure out is how to make the folding work. It works great for Latex(latexSuite). Anyone had the same problem?

Vim supports different styles of folding, check which one your Latex setup is using with ":set foldmethod?". For more info see ":h folding".

Offline

#3 2009-03-26 01:48:49

horsecool
Member
Registered: 2008-12-22
Posts: 55

Re: [solved] vim folding for fortran

For latex it is :

foldmethod = manual

But it still does not work for Fortran or python even I already set foldmethod as syntax in .vimrc  sad

Offline

#4 2009-03-26 02:03:30

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: [solved] vim folding for fortran

Manual folding will work with any type of file.  You must create your own folds with zf<movement>


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#5 2009-03-26 02:11:35

horsecool
Member
Registered: 2008-12-22
Posts: 55

Re: [solved] vim folding for fortran

well, what I want is: when I open the code, it's already folded, just like what vim does in latexSuite.

Isn't that what vim should do when I set foldmethod to be syntax?

Offline

#6 2009-03-26 11:34:16

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [solved] vim folding for fortran

It depends on the foldlevel setting, too. See :help fold-foldlevel


To know or not to know ...
... the questions remain forever.

Offline

#7 2009-03-26 12:12:55

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: [solved] vim folding for fortran

I know nothing about fortran, but try different foldmethods.  There may not be a syntax fold method for it.  Try foldmethod=indent for instance.

Edit: Have you seen this? http://www.unb.ca/fredericton/science/chem/ajit/vim.htm

Last edited by rson451 (2009-03-26 12:27:30)


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#8 2009-03-26 13:15:50

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [solved] vim folding for fortran

There is fortran folding implemented in the /usr/share/vim/syntax/fortran.vim syntax module.
Just look at :help fortran -> Sntax folding of fortran files
It requires that you explicitely enable fortran folding by
:let fortran_fold=1
Additionally you can force folding on conditionals and multiline comments trhough
:let fortran_fold_conditionals=1
:let fortran_fold_multilinecomments=1

Folding will then work with the usual foldmethod=syntax setting.

Last edited by bernarcher (2009-03-26 13:21:57)


To know or not to know ...
... the questions remain forever.

Offline

#9 2009-03-28 05:58:41

horsecool
Member
Registered: 2008-12-22
Posts: 55

Re: [solved] vim folding for fortran

:let fortran_fold=1 works!!!

Haha, thanks a lot!!!
I am so happy~

Offline

Board footer

Powered by FluxBB