I am writing a vim plugin for fortran
ft
the fortran filetype.
In my
In an autoload script, I have done:
" File Name: autoload/makes.vim
let s:Compiler = get(g:, "fortran_compiler", "gfortran")
let s:ObjExt = '.o'
let s:ModExt = '.mod'
let s:ExeExt = ''
let s:VimComp = 'gfortran'
let s:FCFlags = '-Wall -g -O0 -c'
let s:FLFlags = '-Wall -g -O0'
let s:OutputGvim= 'vim'
function! makes#Fcompile()
exe ":cclose"
exe ":update"
let sou = expand("%:p")
let obj = expand("%:p:r").s:ObjExt
if !filereadable(obj) || (filereadable(obj) && (getftime(obj)<getftime(sou)))
let makeprg_saved = '"'.&makeprg.'"'
exe "setlocal makeprg=".s:Compiler
let v:statusmsg = ''
exe "make ".s:FCFlags. " " .sou. " -o " .obj
if empty(v:statusmsg)
:let &statusline = "'".obj."':Compiled successfully"
endif
if v:shell_error !=0
:let &statusline = v:shell_error
endif
":redraw!
exe ":botright copen"
else
:let &statusline = "'".obj."':is up to date"
endif
endfunction
andI use it from ftplugin/fortran_mk.vim
aslike this:
function! Compile()
:call makes#Fcompile()
endfunction
Now, I compile a program, say, foo.f90
as:
Program foo
Implicit None
write (*, *) "Hello"+i
End Program foo
The problem is, that when compilation is successfulsucceeds (called using :exe Compile()
), it opens a buffer opens named ": -- NO NAME --""<Integer>: -- NO NAME --"
. If there is an error the buffer does not open and shows the error in quickfix
.
I want no buffer to open when executation is successful,compilation succeeds and a oneline error when it failed.
How I can do that? Kindly help.