mirror of
https://github.com/NotAShelf/direnv.nvim.git
synced 2024-11-23 00:30:42 +00:00
user_cmd: use one command instead of multiple
* DirenvCheck -> Direnv reload * DirenvAllow -> Direnv allow * DirenvDeny -> Direnv deny Also renames M.check_direnv to M.reload_direnv for better naming.
This commit is contained in:
parent
9500c479f9
commit
20ecd1d869
1 changed files with 16 additions and 9 deletions
|
@ -34,15 +34,22 @@ M.setup = function(user_config)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("DirenvAllow", function()
|
vim.api.nvim_create_user_command("Direnv", function(opts)
|
||||||
M.allow_direnv()
|
local cmds = {
|
||||||
end, {})
|
["allow"] = M.allow_direnv,
|
||||||
vim.api.nvim_create_user_command("DirenvDeny", function()
|
["deny"] = M.deny_direnv,
|
||||||
M.deny_direnv()
|
["reload"] = M.check_direnv,
|
||||||
end, {})
|
}
|
||||||
vim.api.nvim_create_user_command("DirenvCheck", function()
|
local cmd = cmds[string.lower(opts.fargs[1])]
|
||||||
M.check_direnv()
|
if cmd then
|
||||||
end, {})
|
cmd()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
nargs = 1,
|
||||||
|
complete = function()
|
||||||
|
return { "allow", "deny", "reload" }
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
setup_keymaps({
|
setup_keymaps({
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue