Vim
Goal
Integrate codee format
with Vim to format Fortran code.
Prerequisites
You should have filetype on
in your .vimrc
so that the filetype of Fortran
files gets autodetected.
Install ALE
To easily format code using external "fixers" like codee format
, it is
recommended to use the ALE
extension.
If you aren't using ALE
yet, follow its installation
instructions.
Configure ALE
for codee format
Add the following configuration to your .vimrc
configuration file:
function! CodeeFormat(buffer) abort
return {
\ 'command': 'codee format -'
\}
endfunction
execute ale#fix#registry#Add('codee-format', 'CodeeFormat', ['fortran'], 'codee format for fortran')
let g:ale_fixers = {
\ 'fortran': ['codee-format']
\}
You can use the :ALEFix
command or set let g:ale_fix_on_save = 1
to
automatically format the file with codee format
upon saving.