Initial commit
This commit is contained in:
commit
86ab71b1d6
4 changed files with 67 additions and 0 deletions
16
README.md
Normal file
16
README.md
Normal file
|
@ -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?)
|
10
autoload/zettelkasten.vim
Normal file
10
autoload/zettelkasten.vim
Normal file
|
@ -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
|
26
lua/zettelkasten/init.lua
Normal file
26
lua/zettelkasten/init.lua
Normal file
|
@ -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
|
||||
}
|
15
plugin/zettelkasten.vim
Normal file
15
plugin/zettelkasten.vim
Normal file
|
@ -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 <Plug>Zettel_Link :call zettelkasten#zettel_link()<cr>
|
||||
nnoremap <Plug>Zettel_Link :lua require 'zettelkasten'.zettel_link()<cr>
|
||||
|
||||
nmap <leader>p <Plug>Zettel_Link
|
Loading…
Reference in a new issue