title: Indenting Fortran code in Vim
body: <p>I have a fortran code which looks like this: </p>
  
  <pre><code>   open(2,file=filenm(i),status='unknown')
           do j=1,num_lines
              do k=1,dime
                       read(2,*) z(k)
              enddo
                 if( j .ge. 1000 ) then
                       do k=1,dime
                                sumz(k)=sumz(k)+z(k)
                       enddo
                       nsteps=nsteps+1.0
                 endif
           enddo
     close(2)
  </code></pre>
  
  <p>as you can see the indentation is not even, I would like to have something 
  like this:</p>
  
  <pre><code>   open(2,file=filenm(i),status='unknown')
            do j=1,num_lines
                   do k=1,dime
                          read(2,*) z(k)
                   enddo
                   if( j .ge. 1000 ) then
                          do k=1,dime
                                 sumz(k)=sumz(k)+z(k)
                          enddo
                          nsteps=nsteps+1.0
                   endif
            enddo
     close(2)
  </code></pre>
  
  <p>I can go line by line fixing the indentation but the code is kind of big.
  I appreciate any comment.</p>