summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryanss2015-08-27 23:59:00 -0400
committerryanss2015-08-28 23:59:00 -0400
commitb3a25f78abc1455e7eebef00d212ff3ace798b1e (patch)
tree08a790e7ed955e93d0df5b02a113d6ba01b65312
parent0224a7839e4e47d4de1fe07514e19b16c0858d27 (diff)
downloadvim-hn-b3a25f78abc1455e7eebef00d212ff3ace798b1e.tar.gz
Prevent syntax issues in long threads with code blocks
Example comments [10114881]
-rw-r--r--ftplugin/hackernews.py6
-rw-r--r--plugin/hackernews.vim3
2 files changed, 4 insertions, 5 deletions
diff --git a/ftplugin/hackernews.py b/ftplugin/hackernews.py
index f081733..94f1a90 100644
--- a/ftplugin/hackernews.py
+++ b/ftplugin/hackernews.py
@@ -215,10 +215,12 @@ def link(external=False):
print_comments([item])
else:
print_comments(item['comments'])
+ # Prevent syntax issues in long comment threads with code blocks
+ vim.command("syntax sync fromstart")
# Highlight OP username in comment titles
if 'level' not in item:
- vim.command("syn clear Question")
- vim.command("syn match Question /%s/ contained" % item['user'])
+ vim.command("syntax clear Question")
+ vim.command("syntax match Question /%s/ contained" % item['user'])
elif url:
if external:
diff --git a/plugin/hackernews.vim b/plugin/hackernews.vim
index c4e060b..bbe8200 100644
--- a/plugin/hackernews.vim
+++ b/plugin/hackernews.vim
@@ -14,9 +14,6 @@ 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")