From d2b7c2c4d4727f31bb0676ed90e7ecdc8f67ae12 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Wed, 21 Feb 2024 12:10:00 +0100 Subject: [PATCH] Fix: Allow disabling mapping for note creation in picker (#302) * Enable config for creation of new note with Ctrl-n * Add `enable_create_new` documentation --- doc/telekasten.txt | 8 ++++++++ lua/telekasten.lua | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/telekasten.txt b/doc/telekasten.txt index 175ba88..9723842 100644 --- a/doc/telekasten.txt +++ b/doc/telekasten.txt @@ -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 in enabled when + using the `find_notes` picker. + + Default: true + *telekasten.calendar_opts* ----------------------------------- Valid keys for {opts.calendar_opts} diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 30d3dd9..2ff76e2 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -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", "", picker_actions.paste_link(opts)) map("i", "", picker_actions.paste_link(opts)) map("n", "", picker_actions.paste_link(opts)) - map("i", "", picker_actions.create_new(opts)) - map("n", "", picker_actions.create_new(opts)) + if M.Cfg.enable_create_new then + map("i", "", picker_actions.create_new(opts)) + map("n", "", picker_actions.create_new(opts)) + end return true end