I have created a mwe
plugin to show my problem for fortran ft
.
tree ftrial
ftrial
├── autoload
│ └── makes.vim
└── ftplugin
└── fortran_mk.vim
with
cat ftrial/autoload/makes.vim
" Variables {{{1
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 = get(g:, "fortran_fcflags", '-Wall -O0 -c')
let s:FLFlags = get(g:, "fortran_flflags", '-Wall -O0')
let s:OutputGvim= 'vim'
"}}}1
" Compile current buffer {{{1
function! makes#Fcompile()
cclose
update
let sou = expand("%:p")
let obj = expand("%:p:r").s:ObjExt
let s:fortran_comp_success = 0
setlocal efm=%E%f:%l.%c:,%E%f:%l:,%C,%C%p%*[0123456789^],%ZError:\ %m,%C%.%#
" Don't process any further if the compilation is up to date
if filereadable(obj) && (getftime(obj)>getftime(sou))
let &statusline = "'" . obj . "':is up to date"
let s:fortran_comp_success=1
return
endif
let makeprg_saved = '"' . &makeprg . '"'
execute "setlocal makeprg=" . s:Compiler
let v:statusmsg = ''
execute "make " . s:FCFlags . " " . sou . " -o " . obj
" Don't process any further if the compilation was sucessful
if empty(v:statusmsg)
let &statusline = "'" . obj . "':Compiled successfully"
let s:fortran_comp_success=1
return
endif
if v:shell_error !=0
let &statusline = v:shell_error
endif
botright copen
endfunction
"}}}1
and cat ftrial/ftplugin/fortran_mk.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! Compile()
:call makes#Fcompile()
endfunction
with compiling with makeprg
and efm
set, I am expecting the error should be nicely formatted, but that is not hapenning. Rather I am getting the error as shown in the screenshots
What I am doing wrong here?
A sample hello.f90 with error is:
program hello
implicit none
write (*, *) "Hello"+i
write(*,*) q
end program
Screenshots:
This is what I am getting with :call Compile()
After I press Enter key after I got the last screen, this is what I get:
Update
I have tried to solve this with gvim --clean
, dismiss effect of any other plugin, and it shows a new empty buffer.
Kindly have a look at this screencast.
gvim --clean
, this is I am not getting any quickfix at all.