Browse Source

fix: `<leader>` keybinds not working when whichkey disabled.

my-config
connorgmeean 3 years ago
parent
commit
d46c7b8ed3
  1. 290
      lua/doom/modules/core/doom/init.lua

290
lua/doom/modules/core/doom/init.lua

@ -126,193 +126,189 @@ required.binds = function ()
if is_plugin_disabled("explorer") then
table.insert(binds, { "<F3>", ":Lexplore%s<CR>", name = "Toggle explorer" })
if not is_plugin_disabled("whichkey") then
table.insert(binds, {
"<leader>",
name = "+prefix",
table.insert(binds, {
"<leader>",
name = "+prefix",
{
{
"o",
name = "+open/close",
{
"o",
name = "+open/close",
{
{ "e", ":Lexplore%s<CR>", name = "Explorer" },
},
{ "e", ":Lexplore%s<CR>", name = "Explorer" },
},
},
})
end
},
})
end
if not is_plugin_disabled("whichkey") then
local split_modes = {
vertical = "vert ",
horizontal = "",
[false] = "e",
}
local split_prefix = split_modes[doom.new_file_split]
table.insert(binds, {
"<leader>",
name = "+prefix",
local split_modes = {
vertical = "vert ",
horizontal = "",
[false] = "e",
}
local split_prefix = split_modes[doom.new_file_split]
table.insert(binds, {
"<leader>",
name = "+prefix",
{
{ "m", "<cmd>w<CR>", name = "Write" },
{
{ "m", "<cmd>w<CR>", name = "Write" },
"b",
name = "+buffer",
{
"b",
name = "+buffer",
{
{ "b", "<cmd>e #<CR>", name = "Jump to recent" },
{ "d", "<cmd>bd<CR>", name = "Delete" },
},
{ "b", "<cmd>e #<CR>", name = "Jump to recent" },
{ "d", "<cmd>bd<CR>", name = "Delete" },
},
},
{
"D",
name = "+doom",
{
"D",
name = "+doom",
{
{
"c",
("<cmd>e %s<CR>"):format(require("doom.core.config").source),
name = "Edit config",
},
{
"m",
("<cmd>e %s<CR>"):format(require("doom.core.config.modules").source),
name = "Edit modules",
},
{ "l", "<cmd>DoomConfigsReload<CR>", name = "Reload config" },
{ "r", "<cmd>DoomRollback<CR>", name = "Rollback" },
{ "R", "<cmd>DoomReport<CR>", name = "Report issue" },
{ "u", "<cmd>DoomUpdate<CR>", name = "Update" },
{ "s", "<cmd>PackerSync<CR>", name = "Sync packages" },
{ "I", "<cmd>PackerInstall<CR>", name = "Install packages" },
{ "C", "<cmd>PackerClean<CR>", name = "Clean packages" },
{ "b", "<cmd>PackerCompile<CR>", name = "Build packages" },
{ "S", "<cmd>PackerStatus<CR>", name = "Inform packages" },
{ "p", "<cmd>PackerProfile<CR>", name = "Profile" },
"c",
("<cmd>e %s<CR>"):format(require("doom.core.config").source),
name = "Edit config",
},
{
"m",
("<cmd>e %s<CR>"):format(require("doom.core.config.modules").source),
name = "Edit modules",
},
{ "l", "<cmd>DoomConfigsReload<CR>", name = "Reload config" },
{ "r", "<cmd>DoomRollback<CR>", name = "Rollback" },
{ "R", "<cmd>DoomReport<CR>", name = "Report issue" },
{ "u", "<cmd>DoomUpdate<CR>", name = "Update" },
{ "s", "<cmd>PackerSync<CR>", name = "Sync packages" },
{ "I", "<cmd>PackerInstall<CR>", name = "Install packages" },
{ "C", "<cmd>PackerClean<CR>", name = "Clean packages" },
{ "b", "<cmd>PackerCompile<CR>", name = "Build packages" },
{ "S", "<cmd>PackerStatus<CR>", name = "Inform packages" },
{ "p", "<cmd>PackerProfile<CR>", name = "Profile" },
},
},
{
"f",
name = "+file",
{
"f",
name = "+file",
{ "n", (":%snew<CR>"):format(split_prefix), name = "Create new" },
{ "w", "<cmd>w<CR>", name = "Write" },
{
{ "n", (":%snew<CR>"):format(split_prefix), name = "Create new" },
{ "w", "<cmd>w<CR>", name = "Write" },
{
"W",
function()
vim.fn.inputsave()
local new_name = vim.fn.input("New name: ")
vim.fn.inputrestore()
vim.cmd("w " .. new_name)
end,
name = "Write as",
},
{ "s", "<cmd>w<CR>", name = "Save" },
{
"S",
function()
vim.fn.inputsave()
local new_name = vim.fn.input("New name: ")
vim.fn.inputrestore()
vim.cmd("w " .. new_name)
end,
name = "Save as",
},
"W",
function()
vim.fn.inputsave()
local new_name = vim.fn.input("New name: ")
vim.fn.inputrestore()
vim.cmd("w " .. new_name)
end,
name = "Write as",
},
{ "s", "<cmd>w<CR>", name = "Save" },
{
"S",
function()
vim.fn.inputsave()
local new_name = vim.fn.input("New name: ")
vim.fn.inputrestore()
vim.cmd("w " .. new_name)
end,
name = "Save as",
},
},
},
{
"g",
name = "+git",
{
"g",
name = "+git",
{ "p", [[<cmd>TermExec cmd="git pull"<CR>]], name = "Pull" },
{ "P", [[<cmd>TermExec cmd="git push"<CR>]], name = "Push" },
{
{ "p", [[<cmd>TermExec cmd="git pull"<CR>]], name = "Pull" },
{ "P", [[<cmd>TermExec cmd="git push"<CR>]], name = "Push" },
"C",
name = "+commit",
{
"C",
name = "+commit",
{
{ "c", [[<cmd>TermExec cmd="git commit"<CR>]], name = "commit" },
{ "a", [[<cmd>TermExec cmd="git commit --ammend"<CR>]], name = "ammend" },
},
{ "c", [[<cmd>TermExec cmd="git commit"<CR>]], name = "commit" },
{ "a", [[<cmd>TermExec cmd="git commit --ammend"<CR>]], name = "ammend" },
},
},
},
},
{
"h",
name = "+help",
{
"h",
name = "+help",
{
{ "h", "<cmd>Man<CR>", name = "Manual pages", options = { silent = false } },
{ "D", "<cmd>DoomManual<CR>", name = "Open Doom" },
},
{ "h", "<cmd>Man<CR>", name = "Manual pages", options = { silent = false } },
{ "D", "<cmd>DoomManual<CR>", name = "Open Doom" },
},
},
{
"j",
name = "+jump",
{
"j",
name = "+jump",
{
{ "a", "<C-^>", name = "Alternate file" },
{ "j", "<C-o>", name = "Older file" },
{ "k", "<C-i>", name = "Newer file" },
{ "p", "<cmd>tag<CR>", name = "Push tag" },
{ "P", "<cmd>pop<CR>", name = "Pop tag" },
},
{ "a", "<C-^>", name = "Alternate file" },
{ "j", "<C-o>", name = "Older file" },
{ "k", "<C-i>", name = "Newer file" },
{ "p", "<cmd>tag<CR>", name = "Push tag" },
{ "P", "<cmd>pop<CR>", name = "Pop tag" },
},
},
{
"q",
name = "+quit",
{
"q",
name = "+quit",
{ "q", require("doom.core.functions").quit_doom, name = "Exit and save" },
{ "w", require("doom.core.functions").quit_doom, name = "Exit and save" },
{
{ "q", require("doom.core.functions").quit_doom, name = "Exit and save" },
{ "w", require("doom.core.functions").quit_doom, name = "Exit and save" },
{
"d",
function()
require("doom.core.functions").quit_doom(true, true)
end,
name = "Exit and discard",
},
"d",
function()
require("doom.core.functions").quit_doom(true, true)
end,
name = "Exit and discard",
},
},
},
{
"t",
name = "+tweak",
{
"t",
name = "+tweak",
{
{ "b", require("doom.core.functions").toggle_background, name = "Toggle background" },
{ "s", require("doom.core.functions").toggle_signcolumn, name = "Toggle sigcolumn" },
{ "i", require("doom.core.functions").set_indent, name = "Set indent" },
{ "n", require("doom.core.functions").change_number, name = "Toggle number" },
{ "S", require("doom.core.functions").toggle_spell, name = "Toggle spelling" },
{ "x", require("doom.core.functions").change_syntax, name = "Toggle syntax" },
},
{ "b", require("doom.core.functions").toggle_background, name = "Toggle background" },
{ "s", require("doom.core.functions").toggle_signcolumn, name = "Toggle sigcolumn" },
{ "i", require("doom.core.functions").set_indent, name = "Set indent" },
{ "n", require("doom.core.functions").change_number, name = "Toggle number" },
{ "S", require("doom.core.functions").toggle_spell, name = "Toggle spelling" },
{ "x", require("doom.core.functions").change_syntax, name = "Toggle syntax" },
},
},
{
"w",
name = "+window",
{
"w",
name = "+window",
{ "w", "<C-w>p", name = "Jump to recent" },
{ "d", "<C-w>c", name = "Delete window" },
{ "-", "<C-w>s", name = "Split up/down" },
{ "|", "<C-w>v", name = "Split left/right" },
{ "s", "<C-w>s", name = "Split up/down" },
{ "v", "<C-w>v", name = "Split left/right" },
{ "h", "<C-w>h", name = "Jump left" },
{ "j", "<C-w>j", name = "Jump down" },
{ "k", "<C-w>k", name = "Jump up" },
{ "l", "<C-w>l", name = "Jump right" },
{ "H", "<C-w>H", name = "Move left" },
{ "J", "<C-w>J", name = "Move down" },
{ "K", "<C-w>K", name = "Move up" },
{ "L", "<C-w>L", name = "Move right" },
{ "=", "<C-w>=", name = "Move right" },
{
{ "w", "<C-w>p", name = "Jump to recent" },
{ "d", "<C-w>c", name = "Delete window" },
{ "-", "<C-w>s", name = "Split up/down" },
{ "|", "<C-w>v", name = "Split left/right" },
{ "s", "<C-w>s", name = "Split up/down" },
{ "v", "<C-w>v", name = "Split left/right" },
{ "h", "<C-w>h", name = "Jump left" },
{ "j", "<C-w>j", name = "Jump down" },
{ "k", "<C-w>k", name = "Jump up" },
{ "l", "<C-w>l", name = "Jump right" },
{ "H", "<C-w>H", name = "Move left" },
{ "J", "<C-w>J", name = "Move down" },
{ "K", "<C-w>K", name = "Move up" },
{ "L", "<C-w>L", name = "Move right" },
{ "=", "<C-w>=", name = "Move right" },
"<C-",
{
"<C-",
{
{ "H>", "<C-w>5<", name = "Expand left" },
{ "J>", "<cmd>resize +5<CR>", name = "Expand down" },
{ "K>", "<cmd>resize -5<CR>", name = "Expand up" },
{ "L>", "<C-w>L", name = "Expand right" },
},
{ "H>", "<C-w>5<", name = "Expand left" },
{ "J>", "<cmd>resize +5<CR>", name = "Expand down" },
{ "K>", "<cmd>resize -5<CR>", name = "Expand up" },
{ "L>", "<C-w>L", name = "Expand right" },
},
},
},
},
})
end
},
})
return binds
end

Loading…
Cancel
Save