Create a gist now

Instantly share code, notes, and snippets.

function! s:reddit()
tabnew
let res = webapi#json#decode(webapi#http#get('http://www.reddit.com/r/vim.json').content)
let lines = []
for item in res.data.children
call add(lines, "* " . item.data.title)
call add(lines, " " . item.data.url)
let lines += [""] + map(split(item.data.selftext, "\n"), "' '.v:val") + [""]
endfor
call setline(1, lines)
match Title /^\* .*/
endfunction
command! Reddit call s:reddit()
@mattn
Owner
mattn commented Nov 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment