mirror of
https://github.com/NotAShelf/direnv.nvim.git
synced 2025-11-25 15:02:55 +00:00
feat(keybinds): allow keybindings to be set to false to disable default keybindings
This commit is contained in:
parent
4dfc8758a1
commit
1995605471
1 changed files with 40 additions and 36 deletions
|
|
@ -7,11 +7,11 @@ local M = {}
|
||||||
--- @field statusline table Configuration for statusline integration
|
--- @field statusline table Configuration for statusline integration
|
||||||
--- @field statusline.enabled boolean Enable statusline integration
|
--- @field statusline.enabled boolean Enable statusline integration
|
||||||
--- @field statusline.icon string Icon to show in statusline
|
--- @field statusline.icon string Icon to show in statusline
|
||||||
--- @field keybindings table Keybindings configuration
|
--- @field keybindings table | boolean Keybindings configuration
|
||||||
--- @field keybindings.allow string Keybinding to allow direnv
|
--- @field keybindings.allow string | boolean Keybinding to allow direnv
|
||||||
--- @field keybindings.deny string Keybinding to deny direnv
|
--- @field keybindings.deny string | boolean Keybinding to deny direnv
|
||||||
--- @field keybindings.reload string Keybinding to reload direnv
|
--- @field keybindings.reload string | boolean Keybinding to reload direnv
|
||||||
--- @field keybindings.edit string Keybinding to edit .envrc
|
--- @field keybindings.edit string | boolean Keybinding to edit .envrc
|
||||||
--- @field notifications table Notification settings
|
--- @field notifications table Notification settings
|
||||||
--- @field notifications.level integer Log level for notifications
|
--- @field notifications.level integer Log level for notifications
|
||||||
--- @field notifications.silent_autoload boolean Don't show notifications during autoload and initialization
|
--- @field notifications.silent_autoload boolean Don't show notifications during autoload and initialization
|
||||||
|
|
@ -70,8 +70,10 @@ local function setup_keymaps(keymaps, mode)
|
||||||
{ noremap = true, silent = true },
|
{ noremap = true, silent = true },
|
||||||
map[3] or {}
|
map[3] or {}
|
||||||
)
|
)
|
||||||
|
if map[1] then
|
||||||
vim.keymap.set(mode, map[1], map[2], options)
|
vim.keymap.set(mode, map[1], map[2], options)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Safe notify function that works in both sync and async contexts
|
--- Safe notify function that works in both sync and async contexts
|
||||||
|
|
@ -520,6 +522,7 @@ M.setup = function(user_config)
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Setup keybindings
|
-- Setup keybindings
|
||||||
|
if M.config.keybindings then
|
||||||
setup_keymaps({
|
setup_keymaps({
|
||||||
{
|
{
|
||||||
M.config.keybindings.allow,
|
M.config.keybindings.allow,
|
||||||
|
|
@ -550,6 +553,7 @@ M.setup = function(user_config)
|
||||||
{ desc = "Edit .envrc file" },
|
{ desc = "Edit .envrc file" },
|
||||||
},
|
},
|
||||||
}, "n")
|
}, "n")
|
||||||
|
end
|
||||||
|
|
||||||
-- Check for .envrc files and set up autoload
|
-- Check for .envrc files and set up autoload
|
||||||
local group_id = vim.api.nvim_create_augroup("DirenvNvim", { clear = true })
|
local group_id = vim.api.nvim_create_augroup("DirenvNvim", { clear = true })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue