From 9cf344abe6583c655a89cc48d732ee91c3d2e4c6 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 8 Feb 2022 23:50:44 +0100 Subject: vim: install zk-nvim plugin --- .vim/lua/zk.lua | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 .vim/lua/zk.lua (limited to '.vim/lua/zk.lua') diff --git a/.vim/lua/zk.lua b/.vim/lua/zk.lua deleted file mode 100644 index 242badc..0000000 --- a/.vim/lua/zk.lua +++ /dev/null @@ -1,47 +0,0 @@ - -local function zk_new(path, title_dir) - path = path or vim.loop.cwd() - if not (path and #path > 0) then return end - - if not title_dir then - vim.ui.input('New Zettel: ', function(result) - title_dir = result - end) - end - if title_dir == "" then return end - - local o = {} - local parts = vim.split(title_dir, '/') - if not parts[2] then - o.title = vim.trim(parts[1]) - else - o.title = vim.trim(parts[2]) - o.dir = vim.trim(parts[1]) - end - - vim.lsp.buf_request(0, 'workspace/executeCommand', - { - command = 'zk.new', - arguments = { path, o }, - }, - function(_, _, result) - vim.lsp.util.jump_to_location{ - uri = vim.uri_from_fname(result.path), - range = {start={line=2, character=0}}, - } - vim.cmd('startinsert') - end - ) -end - -local function zk_index(path) - path = path or vim.loop.cwd() - vim.lsp.buf.execute_command { - command = 'zk.index', arguments = {path, nil}, - } -end - -return { - new = zk_new, - index = zk_index, -} -- cgit 1.4.1