summary refs log tree commit diff
path: root/.vim/lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2021-11-02 19:11:49 +0100
committerRobert Günzler <r@gnzler.io>2021-11-02 19:11:49 +0100
commit4208ff58c13d9e02ea4ba737cabfdb952dd6eabb (patch)
tree11117cd0c893bc3ffd123199268b40b8783bd810 /.vim/lua
parent44641c5e6a1a7aab269b32589effc2d91cb81a16 (diff)
vim: set a default title_dir for zk integration
Diffstat (limited to '.vim/lua')
-rw-r--r--.vim/lua/zk.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/.vim/lua/zk.lua b/.vim/lua/zk.lua
index 4cd8389..bb7fe35 100644
--- a/.vim/lua/zk.lua
+++ b/.vim/lua/zk.lua
@@ -4,6 +4,8 @@ local function zk_new(path, title_dir)
   if not (path and #path > 0) then return end
 
   title_dir = title_dir or vim.fn.input('New Zettel: ')
+  if not title_dir or (title_dir == "") then return end
+
   local o = {}
   local parts = vim.split(title_dir, '/')
   if not parts[2] then
@@ -24,7 +26,7 @@ local function zk_new(path, title_dir)
         range = {start={line=2, character=0}},
       }
       vim.cmd('startinsert')
-    end,
+    end
   )
 end