From d474c779523c512e3bc91bc5ce7bc87cafc6372b Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 23 Sep 2023 22:05:37 +0200 Subject: Move user and auto cmds to plugins --- fnl/plugins/editor/orgmode.fnl | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'fnl/plugins/editor/orgmode.fnl') diff --git a/fnl/plugins/editor/orgmode.fnl b/fnl/plugins/editor/orgmode.fnl index bb67b88..5324b8d 100644 --- a/fnl/plugins/editor/orgmode.fnl +++ b/fnl/plugins/editor/orgmode.fnl @@ -1,5 +1,28 @@ ;; Orgmode for nvim. +(local user-cmds [[:OrgAgendaPrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :agenda.prompt))) + {:nargs 0}] + [:OrgCapturePrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :capture.prompt))) + {:nargs 0}]]) + +(local auto-cmds + [[:FileType + {:pattern :org + :callback (fn [] + (tset vim.opt_local :conceallevel 2) + (tset vim.opt_local :concealcursor :nc))}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds) + (cmds.create-auto-cmds auto-cmds))) + (local templates {:t {:description :Task :template "* TODO %?\n %u\n DEADLINE: %T\n"} :m {:description :Meeting :template "* Meeting %?"} @@ -11,14 +34,15 @@ :org_default_notes_file "~/.local/share/org/refile.org" :org_agenda_templates templates}) -(fn setup [] - (let [orgmode (require :orgmode)] +(fn config [] + (let [orgmode (require :orgmode) + cmds (require :util.cmds)] (orgmode.setup_ts_grammar) (orgmode.setup opts))) {1 :nvim-orgmode/orgmode - :config (fn [] - (setup)) + : config + : init :event :BufReadPost :keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} -- cgit v1.2.3-70-g09d2