···11+function! CobolFmt()
22+ " Save the current buffer to a temporary input file
33+ let l:input = tempname()
44+ let l:output = tempname()
55+66+ " Write the current buffer to the temporary input file
77+ silent! execute 'write!' fnameescape(l:input)
88+99+ " Run the formatter
1010+ silent! execute '!./changeformat' shellescape(l:input) shellescape(l:output) "TOFIXED"
1111+1212+1313+ " Check if the output file was successfully created
1414+ if filereadable(l:output)
1515+ " Replace the buffer content with the formatted output
1616+ silent! execute '%delete _'
1717+ silent! execute '0read ' . fnameescape(l:output)
1818+ silent! execute 'normal! gg'
1919+ " Clean up temporary files
2020+ call delete(l:input)
2121+ call delete(l:output)
2222+ else
2323+ " Notify the user if formatting failed
2424+ echoerr "Formatter failed to produce output."
2525+ call delete(l:input)
2626+ endif
2727+endfunction
2828+set formatprg=rustfmt