From a732c5a1f42165df19299d26e737c39d9101ccb5 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 1 Dec 2023 12:15:42 +0100 Subject: Load oil on key --- fnl/plugins/editor/oil.fnl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'fnl/plugins') diff --git a/fnl/plugins/editor/oil.fnl b/fnl/plugins/editor/oil.fnl index e326663..44ad7a4 100644 --- a/fnl/plugins/editor/oil.fnl +++ b/fnl/plugins/editor/oil.fnl @@ -1,5 +1,11 @@ ;; File explorer that lets you edit your filesystem. +(local user-cmds [[:Oil + (lambda [] + (let [oil (require :oil)] + (oil.open))) + {:nargs 0}]]) + (local keymaps {:g? :actions.show_help : :actions.select : :actions.select_vsplit @@ -17,11 +23,14 @@ :g. :actions.toggle_hidden "g\\\\" :actions.toggle_trash}) +(local keys [{1 "-" 2 :Oil :desc "Open parent directory"}]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + (fn config [] (let [oil (require :oil)] - (oil.setup {: keymaps}) - (vim.keymap.set :n "-" (fn [] - (oil.open)) - {:desc "Open parent directory"}))) + (oil.setup {: keymaps}))) -{1 :stevearc/oil.nvim : config :event :VeryLazy} +{1 :stevearc/oil.nvim : init : config : keys} -- cgit v1.2.3-70-g09d2