add user commands for calling Direnv manually

This commit is contained in:
raf 2024-07-03 18:56:56 +03:00
parent 91558d1edc
commit 8567799d76
Signed by: NotAShelf
GPG key ID: AF26552424E53993

View file

@ -14,7 +14,7 @@ local function setup_keymaps(keymaps, mode, opts)
for _, map in ipairs(keymaps) do for _, map in ipairs(keymaps) do
local options = local options =
vim.tbl_extend("force", { noremap = true, silent = true }, opts or {}) vim.tbl_extend("force", { noremap = true, silent = true }, opts or {})
vkms(mode, map[1], map[2], options) vim.api.nvim_set_keymap(mode, map[1], map[2], options)
end end
end end
@ -33,6 +33,16 @@ M.setup = function(user_config)
return return
end end
vim.api.nvim_create_user_command("DirenvAllow", function()
M.allow_direnv()
end, {})
vim.api.nvim_create_user_command("DirenvDeny", function()
M.deny_direnv()
end, {})
vim.api.nvim_create_user_command("DirenvCheck", function()
M.check_direnv()
end, {})
setup_keymaps({ setup_keymaps({
{ {
config.keybindings.allow, config.keybindings.allow,