Allow empty note titles in pickers (#25)

pull/30/head
Karim Abou Zeid 2 years ago committed by GitHub
parent 5826043421
commit 910253023e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,13 +10,14 @@ vim.cmd([[
endfunction
]])
M.note_picker_list_api_selection = { "title", "absPath" }
M.note_picker_list_api_selection = { "title", "path", "absPath" }
function M.show_note_picker(notes, options, cb)
options = options or {}
vim.fn._fzf_wrap_and_run({
source = vim.tbl_map(function(v)
return table.concat({ v.absPath, v.title }, delimiter)
local title = v.title or v.path
return table.concat({ v.absPath, title }, delimiter)
end, notes),
options = vim.list_extend({
"--delimiter=" .. delimiter,

@ -1,13 +1,13 @@
local M = {}
M.note_picker_list_api_selection = { "title", "absPath" }
M.note_picker_list_api_selection = { "title", "path", "absPath" }
function M.show_note_picker(notes, options, cb)
options = options or {}
local select_options = vim.tbl_extend("force", {
prompt = options.title,
format_item = function(item)
return item.title
return item.title or item.path
end,
}, options.select or {})
vim.ui.select(notes, select_options, function(item)

@ -10,15 +10,16 @@ local previewers = require("telescope.previewers")
local M = {}
M.note_picker_list_api_selection = { "title", "absPath", "rawContent" }
M.note_picker_list_api_selection = { "title", "absPath", "path", "rawContent" }
function M.create_note_entry_maker(_)
return function(note)
local title = note.title or note.path
return {
value = note,
path = note.absPath,
display = note.title,
ordinal = note.title,
display = title,
ordinal = title,
}
end
end

Loading…
Cancel
Save