diff options
| author | ryanss | 2015-01-10 23:59:00 -0500 |
|---|---|---|
| committer | ryanss | 2015-01-10 23:59:00 -0500 |
| commit | db1844928afa9d02abd80745bf7ea718ee73712d (patch) | |
| tree | 2d67d02d8ce092beebf4b612a836bd430d6f3f26 | |
| parent | 236651561cb716dccaa50d444922d02777e0f766 (diff) | |
| download | vim-hn-db1844928afa9d02abd80745bf7ea718ee73712d.tar.gz | |
Add syntax highlighting of comment headers
| -rw-r--r-- | plugin/hackernews.py | 4 | ||||
| -rw-r--r-- | plugin/hackernews.vim | 3 | ||||
| -rw-r--r-- | syntax/hackernews.vim | 12 |
3 files changed, 17 insertions, 2 deletions
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 <return> :python hacker_news_item()<cr> + + +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" |
