Fix: Allow disabling <C-n> mapping for note creation in picker (#302)

* Enable config for creation of new note with Ctrl-n

* Add `enable_create_new` documentation
This commit is contained in:
Erik Fasterius
2024-02-21 12:10:00 +01:00
committed by GitHub
parent 8c2b3889eb
commit d2b7c2c4d4
2 changed files with 14 additions and 2 deletions

View File

@@ -449,6 +449,14 @@ telekasten.setup({opts})
Default: `nil`
Example: `"call jobstart('firefox --new-window {{url}}')"`
*telekasten.settings.enable_create_new*
enable_create_new: ~
Flag that determines if creating new notes with <C-n> in enabled when
using the `find_notes` picker.
Default: true
*telekasten.calendar_opts*
-----------------------------------
Valid keys for {opts.calendar_opts}

View File

@@ -150,6 +150,8 @@ local function defaultConfig(home)
media_previewer = "telescope-media-files",
-- A customizable fallback handler for urls.
follow_url_fallback = nil,
-- Enable creation new notes with Ctrl-n when finding notes
enable_create_new = true,
}
M.Cfg = cfg
M.note_type_templates = {
@@ -1737,8 +1739,10 @@ local function FindNotes(opts)
map("n", "<c-i>", picker_actions.paste_link(opts))
map("i", "<c-cr>", picker_actions.paste_link(opts))
map("n", "<c-cr>", picker_actions.paste_link(opts))
if M.Cfg.enable_create_new then
map("i", "<c-n>", picker_actions.create_new(opts))
map("n", "<c-n>", picker_actions.create_new(opts))
end
return true
end