Files
dotfiles/.config/nvim/fnl/map_utils.fnl

22 lines
606 B
Fennel

(local M {})
(local module_name "map_utils")
(local fn_store [])
(fn register_fn [new_fn]
(do (table.insert fn_store new_fn)
(length fn_store)))
(fn M.apply_function [id]
((. fn_store id)))
(fn M.apply_expr [id]
(vim.api.nvim_replace_termcodes ((. fn_store id)) true true true))
(fn M.lua_fn [lfn]
(string.format "<cmd>lua require('%s').apply_function(%s)<CR>" module_name (register_fn lfn)))
(fn M.lua_expr [lfn]
(string.format "v:lua.require'%s'.apply_expr(%s)" module_name (register_fn lfn)))
M