Skip to content

Commit

Permalink
feat: builtin key mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Apr 27, 2021
1 parent e618f84 commit 0063ceb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
23 changes: 23 additions & 0 deletions lua/which-key/builtin.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local builtin = {
["<c-w>"] = {
name = "+window",
s = "Split window",
v = "Split window vertically",
w = "Switch windows",
q = "Quit a window",
T = "Break out into a new tab",
x = "Swap current with next",
["-"] = "Decrease height",
["+"] = "Increase height",
["<lt>"] = "Decrease width",
[">"] = "Increase width",
["|"] = "Max out the width",
["="] = "Equally high and wide",
h = "Go to the left window",
l = "Go to the right window",
k = "Go to the up window",
j = "Go to the down window",
},
}

return builtin
1 change: 1 addition & 0 deletions lua/which-key/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ M.namespace = vim.api.nvim_create_namespace("WhichKey")

---@class Options
local defaults = {
builtin = true, -- register a list of builtin key mappings
seperator = "->",
window = {
border = "none", -- none, single, double, shadow
Expand Down
5 changes: 4 additions & 1 deletion lua/which-key/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ require("which-key.colors").setup()

local M = {}

function M.setup(options) config.setup(options) end
function M.setup(options)
config.setup(options)
if config.options.builtin then M.register(require("which-key.builtin")) end
end

function M.show(keys, mode)
keys = keys or ""
Expand Down

0 comments on commit 0063ceb

Please sign in to comment.