summary refs log tree commit diff
path: root/.vim/lua/internal/zk.lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2026-02-10 12:32:48 +0100
committerRobert Günzler <r@gnzler.io>2026-02-10 12:41:25 +0100
commit63feeb9f369fc6176e85c1c2d8fcc863caad1946 (patch)
tree41cd5d2d1ec36e74e464caab722cc9b460153f04 /.vim/lua/internal/zk.lua
parent5bd0a4aca65ecb9818ef1285982d160b6b6ff665 (diff)
start new
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.vim/lua/internal/zk.lua')
-rw-r--r--.vim/lua/internal/zk.lua73
1 files changed, 0 insertions, 73 deletions
diff --git a/.vim/lua/internal/zk.lua b/.vim/lua/internal/zk.lua
deleted file mode 100644
index 4631e13..0000000
--- a/.vim/lua/internal/zk.lua
+++ /dev/null
@@ -1,73 +0,0 @@
-if not vim.env.ZK_NOTEBOOK_DIR then
-  vim.notify('Missing ZK_NOTEBOOK_DIR!', vim.log.levels.WARN)
-  return
-end
-
-local api = require('zk.api')
-local util = require('zk.util')
-
-local function insert_new_note()
-  -- TODO: catch error an delete note
-  api.new(nil, nil, function(err1, res1)
-    if not res1 then
-      error(err1)
-    end
-
-    -- update index to include the new note
-    api.index(nil, nil, nil)
-
-    local path = res1.path
-    local filename = vim.fs.basename(path)
-    local location = util.get_lsp_location_from_caret()
-
-    api.link(filename, location, nil, {}, function(err2, res2)
-      if not res2 then
-        error(err2)
-      end
-
-      -- open split
-      local buf = vim.api.nvim_create_buf(true, false)
-      vim.api.nvim_buf_set_name(buf, filename)
-      vim.api.nvim_buf_call(buf, function()
-        vim.cmd.edit(path)
-      end)
-      local win = vim.api.nvim_open_win(buf, false, {
-        split = 'below',
-        win = 0,
-      })
-      -- move to split
-      vim.api.nvim_set_current_win(win)
-      vim.api.nvim_win_set_cursor(win, { -1, 0 })
-    end)
-  end)
-end
-
-local function on_attach()
-  if not vim.env.ZK_NOTEBOOK_DIR then
-    vim.notify('Missing ZK_NOTEBOOK_DIR!', vim.log.levels.WARN)
-    return
-  end
-
-  -- enable virtual_text diagnostics to show link titles
-  vim.diagnostic.config({ virtual_text = true })
-
-  local opts = { remap = true, silent = false, buffer = true }
-
-  -- -- list zettelkasten
-  -- vim.keymap.set('n', '-', ':call feedkeys(";zz")<cr>', opts)
-
-  -- follow links
-  -- TODO: should this also work on outgoing links?
-  vim.keymap.set('n', '<cr>', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
-
-  -- insert ref to new note and open note in split
-  vim.keymap.set({ 'n', 'i' }, ';zi', insert_new_note, opts)
-end
-
--- setup binds to run when entering zettel buffers
-vim.api.nvim_create_autocmd({ 'BufEnter' }, {
-  pattern = vim.env.ZK_NOTEBOOK_DIR .. '/*.md',
-  callback = on_attach,
-  group = vim.api.nvim_create_augroup('zk-on-attach', { clear = true }),
-  once = true,
-})