Disclaimer: Due to my use of complex regular expressions, this script is not suitable for use by Andrew Dalke, nor for any SDF file provided by same. If this script is used on a SDF file provided by Andrew Dalke, it may result in the summoning of Cthulhu. You have been warned.
function! SDFToAscii(width) let prev = search("$$$$", "nbW") + 1 let end = search("$$$$", "nW") if end == 0 let end = line('$') endif silent execute prev.",".end."yank" let output = system("obabel -isdf -oascii -d -xa 2.0 -xw ".a:width, @") botright new setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap put =output setlocal nomodifiable 1 endfunction noremap <silent> <leader>a :call SDFToAscii(79)<CR> noremap <silent> <leader>A :call SDFToAscii(189)<CR>