diff --git a/README.markdown b/README.markdown index 453bd1b..5db28ac 100644 --- a/README.markdown +++ b/README.markdown @@ -17,6 +17,10 @@ Oh, and it can also handle PDFs (with Word Documents (read-only, with [Antiword](http://www.winfield.demon.nl/)), and Mac OS X plist files. +If you are more scientifically inclined it also lets you edit +[NetCDF](http://www.opengeospatial.org/standards/netcdf) files in their +CDL form. + Installation ------------ diff --git a/doc/afterimage.txt b/doc/afterimage.txt index ac87a8f..dc8695b 100644 --- a/doc/afterimage.txt +++ b/doc/afterimage.txt @@ -19,6 +19,9 @@ Word documents have their text extracted (one way) with antiword. OS X binary plists are converted to/from XML with plutil. +NetCDF files are converted to CDL with ncdump for editing and back to NetCDF +with ncgen + CUSTOMIZATION *afterimage-customization* The easiest way to provide custom handlers is to learn from the source to the diff --git a/plugin/afterimage.vim b/plugin/afterimage.vim index 872e526..22586da 100644 --- a/plugin/afterimage.vim +++ b/plugin/afterimage.vim @@ -21,6 +21,13 @@ augroup afterimage autocmd BufWriteCmd,FileWriteCmd *.ico call AfterimageWriteCmd("convert %s ico:%s") endif + " Convert NetCDF files to cdl for editing (http://www.unidata.ucar.edu/software/netcdf/) + if !exists("#BufWriteCmd#*.nc") + autocmd BufReadPre,FileReadPre *.nc setlocal bin + autocmd BufReadPost,FileReadPost *.nc if AfterimageReadPost("ncdump %s >%s") | set ft=c | endif + autocmd BufWriteCmd,FileWriteCmd *.nc call AfterimageWriteCmd("cat %s | ncgen -o %s") + endif + if !exists("#BufWriteCmd#*.pdf") autocmd BufReadPre,FileReadPre *.pdf setlocal bin autocmd BufReadPost,FileReadPost *.pdf call AfterimageReadPost("pdftk %s output %s uncompress")