summaryrefslogtreecommitdiff
path: root/ftplugin
diff options
context:
space:
mode:
authorryanss2015-04-05 23:59:00 -0400
committerryanss2015-04-05 23:59:00 -0400
commit0417f51e8a1ef251353db05daaa3867d49e73ec4 (patch)
treeb39fca3e32dda71a46d91f7940defcc3fc495b44 /ftplugin
parent055445cf43b379d713e0a2b1a4704605cfd5f661 (diff)
downloadvim-hn-0417f51e8a1ef251353db05daaa3867d49e73ec4.tar.gz
Fix error when undoing too far
Remove undo history before story list is written to buffer so it is no longer possible to undo all the way back to an empty buffer which would cause an error in the Python save_pos() and recall_pos() functions.
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/hackernews.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ftplugin/hackernews.py b/ftplugin/hackernews.py
index 999ff43..7e2057e 100644
--- a/ftplugin/hackernews.py
+++ b/ftplugin/hackernews.py
@@ -72,6 +72,9 @@ def main():
vim.command("setlocal noswapfile")
vim.command("setlocal buftype=nofile")
+ if vim.eval("changenr()") == "1":
+ vim.command("setlocal undolevels=-1")
+
bwrite("┌───┐")
bwrite("│ Y │ Hacker News (news.ycombinator.com)")
bwrite("└───┘")
@@ -116,6 +119,7 @@ def main():
line %= (" "*4, item['time_ago'], item['id'])
bwrite(line)
bwrite("")
+ vim.command("setlocal undolevels=100")
def link(external=False):