summaryrefslogtreecommitdiff
path: root/ftplugin/hackernews.py
diff options
context:
space:
mode:
authorryanss2015-04-04 23:59:00 -0400
committerryanss2015-04-04 23:59:00 -0400
commit055445cf43b379d713e0a2b1a4704605cfd5f661 (patch)
treefe2a343d5a2251e2078cd47d671171ae890992c6 /ftplugin/hackernews.py
parent704f5a5970b8bd7b346d49cd66cbf132e3870610 (diff)
downloadvim-hn-055445cf43b379d713e0a2b1a4704605cfd5f661.tar.gz
Open different story lists in different buffers
Before this change trying to open a second, different story list using the optional HackerNews command arugment would not do anything if a .hackernews buffer was already open.
Diffstat (limited to 'ftplugin/hackernews.py')
-rw-r--r--ftplugin/hackernews.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ftplugin/hackernews.py b/ftplugin/hackernews.py
index f6fd974..999ff43 100644
--- a/ftplugin/hackernews.py
+++ b/ftplugin/hackernews.py
@@ -67,7 +67,8 @@ def hex(s):
def main():
- vim.command("edit .hackernews")
+ stories = vim.eval("g:hackernews_stories") or "news"
+ vim.command("edit %s.hackernews" % (stories if stories != "news" else ""))
vim.command("setlocal noswapfile")
vim.command("setlocal buftype=nofile")
@@ -77,7 +78,6 @@ def main():
bwrite("")
try:
- stories = vim.eval("g:hackernews_stories") or "news"
if stories == "news":
news1 = json.loads(urlopen(API_URL+"/news", timeout=5)
.read().decode('utf-8'))