Skip to content

Commit 0224a78

Browse files
author
ryanss
committed
Switch syntax to markdown when viewing article text
1 parent 9335513 commit 0224a78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ftplugin/hackernews.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def link(external=False):
178178
print("HackerNews.vim Error: HTTP Request Timeout")
179179
return
180180
save_pos()
181+
vim.command("set syntax=hackernews")
181182
del vim.current.buffer[:]
182183
if 'title' in item:
183184
if 'domain' in item:
@@ -235,6 +236,7 @@ def link(external=False):
235236
return
236237
content = re.sub(r"(http\S+?)([\<\>\s\n])", "[\g<1>]\g<2>", content)
237238
save_pos()
239+
vim.command("set syntax=markdown")
238240
del vim.current.buffer[:]
239241
for i, line in enumerate(content.split('\n')):
240242
if not line:
@@ -249,6 +251,7 @@ def save_pos():
249251
marks = vim.eval("g:hackernews_marks")
250252
m = hex(vim.current.buffer[0])
251253
marks[m] = list(vim.current.window.cursor)
254+
marks[m].append(vim.eval("&syntax"))
252255
vim.command("let g:hackernews_marks = %s" % str(marks))
253256

254257

@@ -258,6 +261,7 @@ def recall_pos():
258261
if m in marks:
259262
mark = marks[m]
260263
vim.current.window.cursor = (int(mark[0]), int(mark[1]))
264+
vim.command("set syntax=%s" % mark[2])
261265

262266

263267
def print_comments(comments, level=0):

0 commit comments

Comments
 (0)