Add an orphan picker (#10)

List notes that need to be linked.
pull/11/head
Clément Joly 2 years ago committed by GitHub
parent 959d87222b
commit c1e7520eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -73,6 +73,7 @@ require("zk").new(path, args) -- path and args are optional
```vim
:Telescope zk notes
:Telescope zk orphans
:Telescope zk backlinks
:Telescope zk links
:Telescope zk related
@ -81,6 +82,7 @@ require("zk").new(path, args) -- path and args are optional
or via Lua
```lua
require('telescope').extensions.zk.notes()
require('telescope').extensions.zk.orphans()
require('telescope').extensions.zk.backlinks()
require('telescope').extensions.zk.links()
require('telescope').extensions.zk.related()
@ -138,6 +140,13 @@ vim.api.nvim_set_keymap(
{ noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"<Leader>zo",
"<cmd>lua require('telescope').extensions.zk.orphans()<CR>",
{ noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"<Leader>zb",

@ -8,6 +8,13 @@ local function show_notes(opts)
end)
end
local function show_orphans(opts)
opts = vim.tbl_extend("keep", opts or {}, { prompt_title = "Zk Orphans" })
zk.api.list(opts.path, util.wrap_note_args({ orphan = true }), function(notes)
util.show_note_picker(opts, notes)
end)
end
local function show_backlinks(opts)
opts = vim.tbl_extend("keep", opts or {}, { prompt_title = "Zk Backlinks" })
zk.api.list(opts.path, util.wrap_note_args({ linkTo = { vim.api.nvim_buf_get_name(0) } }), function(notes)
@ -44,6 +51,7 @@ end
return require("telescope").register_extension({
exports = {
notes = show_notes,
orphans = show_orphans,
backlinks = show_backlinks,
links = show_links,
related = show_related,

Loading…
Cancel
Save