Skip to content

Instantly share code, notes, and snippets.

@mattn
Created November 30, 2012 02:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/4173500 to your computer and use it in GitHub Desktop.
Save mattn/4173500 to your computer and use it in GitHub Desktop.
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
Copy link
Author

mattn commented Nov 30, 2012

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