From db1844928afa9d02abd80745bf7ea718ee73712d Mon Sep 17 00:00:00 2001 From: ryanss Date: Sat, 10 Jan 2015 23:59:00 -0500 Subject: Add syntax highlighting of comment headers --- plugin/hackernews.py | 4 ++-- plugin/hackernews.vim | 3 +++ syntax/hackernews.vim | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 syntax/hackernews.vim diff --git a/plugin/hackernews.py b/plugin/hackernews.py index e3a85fe..b924468 100644 --- a/plugin/hackernews.py +++ b/plugin/hackernews.py @@ -10,7 +10,7 @@ API_URL = "http://node-hnapi.herokuapp.com" def hacker_news(): - vim.command("edit -HackerNews-") + vim.command("edit .hackernews") vim.command("setlocal noswapfile") vim.command("setlocal buftype=nofile") @@ -38,7 +38,7 @@ def hacker_news_item(): item = json.loads(urllib2.urlopen(API_URL+"/item/"+id).read()) - vim.command("edit -HackerNews-") + vim.command("edit .hackernews") b = vim.current.buffer b[0] = item['title'] b.append("Posted %s by %s" % (item['time_ago'], item['user'])) diff --git a/plugin/hackernews.vim b/plugin/hackernews.vim index 90d8b81..b405253 100644 --- a/plugin/hackernews.vim +++ b/plugin/hackernews.vim @@ -12,3 +12,6 @@ execute "pyfile " . s:path . "/hackernews.py" command! HackerNews python hacker_news() map :python hacker_news_item() + + +au! BufRead,BufNewFile *.hackernews set filetype=hackernews diff --git a/syntax/hackernews.vim b/syntax/hackernews.vim new file mode 100644 index 0000000..314c889 --- /dev/null +++ b/syntax/hackernews.vim @@ -0,0 +1,12 @@ +" Vim syntax file + + +if exists("b:current_syntax") + finish +endif + + +syn match Comment /^\s*Comment.*$/ + + +let b:current_syntax = "hackernews" -- cgit v1.2.3