Skip to content

Commit b3a25f7

Browse files
author
ryanss
committed
Prevent syntax issues in long threads with code blocks
Example comments [10114881]
1 parent 0224a78 commit b3a25f7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

ftplugin/hackernews.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,12 @@ def link(external=False):
215215
print_comments([item])
216216
else:
217217
print_comments(item['comments'])
218+
# Prevent syntax issues in long comment threads with code blocks
219+
vim.command("syntax sync fromstart")
218220
# Highlight OP username in comment titles
219221
if 'level' not in item:
220-
vim.command("syn clear Question")
221-
vim.command("syn match Question /%s/ contained" % item['user'])
222+
vim.command("syntax clear Question")
223+
vim.command("syntax match Question /%s/ contained" % item['user'])
222224

223225
elif url:
224226
if external:

plugin/hackernews.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ filetype plugin on
1414
" Load ftplugin when opening .hackernews buffer
1515
au! BufRead,BufNewFile *.hackernews set filetype=hackernews
1616

17-
" Prevent syntax highlighting issues in long comment threads with code blocks
18-
au! BufEnter *.hackernews syntax sync fromstart
19-
2017

2118
" Set required defaults
2219
if !exists("g:hackernews_stories")

0 commit comments

Comments
 (0)