Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Vim do Fortran completion of subroutine arguments

I don't know if this is possible at all, but still ... no harm in asking.

I'm using Vim to edit fortran files, old and new (.for and .f90). I'm trying to get completion, something alike Visual Studio's, so that when I have several subroutines defined in a file:

subroutine init ( ibc, nquad, ul, ur, xl, xr )
subroutine output ( f, ibc, indx, nsub, nu, ul, ur, xn )
subroutine phi ( il, x, phii, phiix, xleft, xrite )

and I call them somewhere:

call init(<cursor is here>

I get the list of arguments, so I don't have to remember them. If I understood right VS calls this "Intellisense".

Is something similar available in Vim (GVim72) and if it is, how to get it to work ? Any tips appreciated.


ldigas edit: I'd also be satisfied if I could just get the declaration line, as to say, when I type:

call init(<cursor is here>

and press completion key, Vim punches in the whole line, e.g.

call init( ibc, nquad, ul, ur, xl, xr )

ldigas edit2: 2 answers withdrawn so far ... interesting.


like image 431
Rook Avatar asked May 05 '09 03:05

Rook


2 Answers

The closest one should be vim intellisense. Unfortunately, it does not support Fortran yet...

like image 65
Francis Avatar answered Oct 19 '22 05:10

Francis


partial answer:

Okey, I got the first part:

Vim's whole line completion is called by

<Ctrl-X, Ctrl-L>

(if it is in a same file, which, btw, very often it isn't)

Unfortunatelly, if a subroutine declaration looks like

call assemble ( adiag, aleft, arite, f, h, indx, nl, node, nu, nquad, &
nsub, ul, ur, xn, xquad )

(where "&" is a continuation mark) that way won't work. Does anyone (come on you scripting vimmers) know of a way to avoid this behaviour ?

like image 32
Rook Avatar answered Oct 19 '22 04:10

Rook