dotfiles/nvim/fnl/config/util.fnl

26 lines
572 B
Fennel

(module config.util
{autoload {nvim aniseed.nvim
a aniseed.core}})
(fn expand [path]
(nvim.fn.expand path))
(fn glob [path]
(nvim.fn.glob path true true true))
(fn exists? [path]
(= (nvim.fn.filereadable path) 1))
(fn lua-file [path]
(nvim.ex.luafile path))
(defn nnoremap [from to opts]
(let [map-opts {:noremap true}
to (.. ":" to "<cr>")]
(if (a.get opts :local?)
(nvim.buf_set_keymap 0 :n from to map-opts)
(nvim.set_keymap :n from to map-opts))))
(defn lnnoremap [from to]
(nnoremap (.. "<leader>" from) to))