commit 86ab71b1d6296043eba2fa7242c2cb66a0c31b9c Author: Marty Oehme Date: Mon Oct 26 15:55:40 2020 +0100 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..a9d499e --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Zettelkasten.nvim + +## TODO + +* [ ] go to zettel +* [ ] create new zettel + * create link (md / wiki) + * create anchor * +* [ ] backlinks (via rg for filename anchor?) + +* \*anchor creation + * *must* be unique + * 10 digits, usually current date+time (YYMMDDHHmm) + * but, if multiple links created within one minute (or other circumstances), this would duplicate + * thus, duplicate-check before creating a new anchor + * if duplicated, generate first *non*-duplicated link (recursive?) diff --git a/autoload/zettelkasten.vim b/autoload/zettelkasten.vim new file mode 100644 index 0000000..908c4f7 --- /dev/null +++ b/autoload/zettelkasten.vim @@ -0,0 +1,10 @@ +echom 'this is only really necessary for vimscript plugs' +echom 'we can directly lazy-source our lua files without this redirection' + +function zettelkasten#init() abort + lua require("zettelkasten").init() +endfunction + +function zettelkasten#zettel_link() abort + lua require("zettelkasten").zettel_link() +endfunction diff --git a/lua/zettelkasten/init.lua b/lua/zettelkasten/init.lua new file mode 100644 index 0000000..7991d67 --- /dev/null +++ b/lua/zettelkasten/init.lua @@ -0,0 +1,26 @@ +local ZK = {} +package.loaded['zettelkasten'] = nil + +function ZK.init() + print( + vim.fn.nvim_win_get_width(0), + vim.fn.nvim_win_get_height(0) + ) +end + +-- entrypoint for pressing the zettel key when the cursor +-- is either on an existing link (it will then +-- follow it) or over text (it will then turn it into a +-- zettel link) +function ZK.zettel_link() + ZK._test() +end + +function ZK._test() + print('follow_create_zettel') +end + +return { + init = ZK.init, + zettel_link = ZK.zettel_link +} diff --git a/plugin/zettelkasten.vim b/plugin/zettelkasten.vim new file mode 100644 index 0000000..ae53d16 --- /dev/null +++ b/plugin/zettelkasten.vim @@ -0,0 +1,15 @@ +fun! ZKReload() + " for DEBUGGING + lua for k in pairs(package.loaded) do if k:match("^zettelkasten") then package.loaded[k] = nil end end + echom 'zettelkasten reloaded' + lua require 'zettelkasten'.init() +endfun + +augroup Zettelkasten + autocmd! +augroup END + +" nnoremap Zettel_Link :call zettelkasten#zettel_link() +nnoremap Zettel_Link :lua require 'zettelkasten'.zettel_link() + +nmap p Zettel_Link