diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-09-23 22:05:37 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-09-23 22:05:37 +0200 |
commit | d474c779523c512e3bc91bc5ce7bc87cafc6372b (patch) | |
tree | 3c50cc5bf8fb55167150c76171f54590babf7118 /fnl/plugins/editor/orgmode.fnl | |
parent | 6dcd88cde5825573a3732e8b18f7d663ca47495b (diff) |
Move user and auto cmds to plugins
Diffstat (limited to 'fnl/plugins/editor/orgmode.fnl')
-rw-r--r-- | fnl/plugins/editor/orgmode.fnl | 32 |
1 files changed, 28 insertions, 4 deletions
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 :<cmd>OrgAgendaPrompt<cr> :desc "Open agenda prompt"} {1 :gc 2 :<cmd>OrgCapturePrompt<cr> :desc "Open capture prompt"} |