summaryrefslogtreecommitdiff
path: root/plugin/hackernews.vim
blob: d93195aaa0968f71a35b854ae7f3c99603638694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"  vim-hackernews
"  --------------
"  Browse Hacker News (news.ycombinator.com) inside Vim.
"
"  Author:  ryanss <ryanssdev@icloud.com>
"  Website: https://github.com/ryanss/vim-hackernews
"  License: MIT (see LICENSE file)


if !has('python')
    echo "HackerNews.vim Error: Requires Vim compiled with +python"
    finish
endif


" Import Python code
execute "python import sys"
execute "python sys.path.append('" . expand("<sfile>:p:h") . "')"
execute "python from hackernews import hacker_news, hacker_news_link"


command! HackerNews python hacker_news()


au! BufRead,BufNewFile *.hackernews set filetype=hackernews