diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-02-26 01:03:58 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-02-26 01:03:58 +0100 |
commit | 8db7db3ddbc7ee2dfc044e70d6db963239fa0a86 (patch) | |
tree | 5574a8c20383f8765fd2de162d133ae79c976972 | |
parent | cf44d8965b675e8e4f4ca139ca093e564714bf8f (diff) |
Add orgmode menu ui
-rw-r--r-- | fnl/plugins/orgmode.fnl | 17 |
1 files changed, 17 insertions, 0 deletions
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 :<c-e> :org_global_cycle :<s-e>}}}) (fn config [] |