From 8db7db3ddbc7ee2dfc044e70d6db963239fa0a86 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 26 Feb 2024 01:03:58 +0100 Subject: Add orgmode menu ui --- fnl/plugins/orgmode.fnl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'fnl/plugins/orgmode.fnl') diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl index ba562e7..288eeb0 100644 --- a/fnl/plugins/orgmode.fnl +++ b/fnl/plugins/orgmode.fnl @@ -41,6 +41,22 @@ :m {:description :Meeting :template "* Meeting %?"} :n {:description :Note :template "* NOTE %? :NOTE:\n %u\n"}}) +(lambda handler [data] + (let [options {} + options-by-label {}] + (each [_ item (ipairs data.items)] + (when (and item.key (not= (item.label:lower) :quit)) + (table.insert options item.label) + (tset options-by-label item.label item))) + (vim.ui.select options {:prompt data.prompt} + (fn [choice] + ;; FIX: this code block + (when (not choice) + (lua "return ")) + (local option (. options-by-label choice)) + (when option.action + (option.action)))))) + (local opts {:org_agenda_files ["~/.local/share/org/**/*"] :org_hide_emphasis_markers true @@ -49,6 +65,7 @@ :org_log_into_drawer :LOGBOOK :org_default_notes_file "~/.local/share/org/refile.org" :org_agenda_templates templates + :ui {:menu {: handler}} :mappings {:org {:org_cycle : :org_global_cycle :}}}) (fn config [] -- cgit v1.2.3-70-g09d2