blob: d6dafdcc88950aef002c1206cae7c8df8beaa4a2 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
" 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)
" Version: 0.1.1
" Filetype plugins need to be enabled
filetype plugin on
" Load ftplugin when opening .hackernews buffer
au! BufRead,BufNewFile *.hackernews set filetype=hackernews
" Prevent syntax highlighting issues in long comment threads with code blocks
au! BufEnter *.hackernews syntax sync fromstart
" Set required defaults
if !exists("g:hackernews_stories")
let g:hackernews_stories = 'news'
endif
if !exists("g:hackernews_marks")
let g:hackernews_marks = {}
endif
function! HackerNews(...)
if a:0 > 0
let available_lists = ['news', 'newest', 'ask', 'show', 'shownew',
\'jobs', 'best', 'active', 'noobstories']
if index(available_lists, a:1) >= 0
let g:hackernews_stories = a:1
else
let g:hackernews_stories = 'news'
end
else
let g:hackernews_stories = 'news'
end
edit .hackernews
normal! gg
endfunction
command! -nargs=? HackerNews call HackerNews(<q-args>)
|