This commit is contained in:
elkowar 2021-05-08 23:54:36 +02:00
parent 399d32327d
commit a7281c3e9c
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
3 changed files with 7 additions and 12 deletions

View file

@ -4,9 +4,6 @@
nvim aniseed.nvim} nvim aniseed.nvim}
require-macros [macros]}) require-macros [macros]})
(def req
(setmetatable {} {:__index (fn [_ idx] (require idx))}))
(defn plugin-installed? [name] (defn plugin-installed? [name]
(~= nil (. packer_plugins name))) (~= nil (. packer_plugins name)))
@ -31,15 +28,13 @@
(defn keymap [modes from to ?opts] (defn keymap [modes from to ?opts]
"Set a mapping in the given modes, and some optional parameters, defaulting to {:noremap true :silent true}. "Set a mapping in the given modes, and some optional parameters, defaulting to {:noremap true :silent true}.
If :buffer is set, uses buf_set_keymap rather than set_keymap" If :buffer is set, uses buf_set_keymap rather than set_keymap"
(local full-opts (let [full-opts (->> (or ?opts {})
(->> (or ?opts {}) (a.merge {:noremap true :silent true})
(a.merge {:noremap true :silent true}) (without-keys [:buffer]))]
(without-keys [:buffer])))
(if (and ?opts (?. ?opts :buffer))
(a.println (fennel.view modes))
(each [_ mode (ipairs (single-to-list modes))] (each [_ mode (ipairs (single-to-list modes))]
(nvim.buf_set_keymap 0 mode from to full-opts) (if (-?> ?opts (. :buffer))
(nvim.set_keymap mode from to full-opts)))) (nvim.buf_set_keymap 0 mode from to full-opts)
(nvim.set_keymap mode from to full-opts)))))
(defn del-keymap [mode from ?buf-local] (defn del-keymap [mode from ?buf-local]
"Remove a keymap. Arguments: mode, mapping, bool if mapping should be buffer-local." "Remove a keymap. Arguments: mode, mapping, bool if mapping should be buffer-local."
@ -62,7 +57,7 @@
(packer.startup (packer.startup
(fn [use] (fn [use]
(each-pair [name opts pkgs] (each-pair [name opts pkgs]
(-?> (. opts :mod) (safe-require-plugin-config)) (-?> opts (. :mod) (safe-require-plugin-config))
(use (a.assoc opts 1 name))))))) (use (a.assoc opts 1 name)))))))