Useful Vim tip: adding ierr and CHKERRQ(ierr) to a line
Mads Hoel
mfhoel at student.matnat.uio.no
Tue Jan 15 14:25:25 CST 2008
Hi Petsc users!
The error handling in PETSc is really good! I have been using it to track
down errors. I found an extremely useful Vim mapping, that I would like to
share. It adds the PETSc error checking by pressing F2 on a line, (put it
into your ~/.vimrc file if you would like to use/try it):
map <F2> :s_^\([ \t]*\)\([^/]*\\|.*$\)_\1ierr = \2 CHKERRQ(ierr);_<cr>
So when pressing F2 one can change
MatSetValues(...);
to
ierr = MatSetValues(...); CHKERRQ(ierr);
--
Mads Hoel
More information about the petsc-users
mailing list