summaryrefslogtreecommitdiff
path: root/syntax/hackernews.vim
blob: cdd191d837e671bc63ec233cd67c4fe285af8d9a (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
"  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 exists("b:current_syntax")
  finish
endif


" Hide hacker news item id at end of main page lines
syn match Ignore /\s\[[0-9]\{3,}\]$/

" Remove emphesis from all components of main page item except title
syn match Comment /^\s*[0-9]\{1,2}\.\s/
syn match Comment /\s(\S\+\.\S\+)/
syn match Comment /^\s\{4}.*ago/
syn match Comment /^.*ago\s|.*comments/

" Comment titles
syn match Comment /^\s*Comment.*$/

" Highlight links
syn region Constant start="\[http" end="\]"

" Highlight code blocks
syn region Statement start="^\s+ " end="^\s "

" Highlight Hacker News header orange
syn match Title /^┌.*$/
syn match Title /^│.*$/
syn match Title /^└.*$/
highlight Title ctermfg=208 guifg=#ff6600


let b:current_syntax = "hackernews"