Created
September 18, 2010 17:59
-
-
Save mmisono/585897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:aojproblem(id,lang) | |
let base_url = "http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=" | |
let url = '"' . base_url.printf("%04d",a:id) . "&lang=" . a:lang . '"' | |
let winnum = bufwinnr(bufnr('AOJ:Problem')) | |
if winnum != -1 | |
if winnum != bufwinnr('%') | |
exe "normal \<c-w>".winnum."w" | |
endif | |
setl modifiable | |
setl noreadonly | |
normal ggdG | |
else | |
exec 'silent top split AOJ:Problem' | |
endif | |
exec "silent! r! w3m -dump " . url | |
normal gg | |
call search("\\[submitIcon]") | |
normal jdgg | |
silent! g/Submit : Statistics/d | |
silent! %s/\n\n\n//g | |
silent! nohl | |
setl nomodified | |
setl nomodifiable | |
setl readonly | |
setl bufhidden=delete | |
endfunction | |
command! -nargs=1 AOJProblem call s:aojproblem(<args>,"en") | |
command! -nargs=1 AOJProblemJa call s:aojproblem(<args>,"jp") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment