Created
November 30, 2012 02:52
-
-
Save mattn/4173500 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: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() |
Author
mattn
commented
Nov 30, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment