Skip to content

Commit

Permalink
build: selene + stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 12, 2021
1 parent 69fcfff commit 5c5b5f5
Show file tree
Hide file tree
Showing 19 changed files with 349 additions and 155 deletions.
8 changes: 6 additions & 2 deletions lua/which-key/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ local links = {
Value = "Comment",
}

if vim.fn.hlexists("WhichKeySeperator") then links["Separator"] = "WhichKeySeperator" end
if vim.fn.hlexists("WhichKeySeperator") then
links["Separator"] = "WhichKeySeperator"
end

function M.setup()
for k, v in pairs(links) do vim.api.nvim_command("hi def link WhichKey" .. k .. " " .. v) end
for k, v in pairs(links) do
vim.api.nvim_command("hi def link WhichKey" .. k .. " " .. v)
end
end

return M
4 changes: 3 additions & 1 deletion lua/which-key/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ local defaults = {
M.options = {}

---@return Options
function M.setup(options) M.options = vim.tbl_deep_extend("force", {}, defaults, options or {}) end
function M.setup(options)
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
end

M.setup()

Expand Down
15 changes: 9 additions & 6 deletions lua/which-key/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ local Util = require("which-key.util")
---@class WhichKey
local M = {}

function M.setup(options) require("which-key.config").setup(options) end
function M.setup(options)
require("which-key.config").setup(options)
end

function M.execute(id)
local func = Keys.functions[id]
Expand All @@ -13,7 +15,9 @@ end

function M.show(keys, opts)
opts = opts or {}
if type(opts) == "string" then opts = { mode = opts } end
if type(opts) == "string" then
opts = { mode = opts }
end

keys = keys or ""

Expand All @@ -33,13 +37,12 @@ end

function M.show_command(keys, mode)
keys = keys or ""
keys = (keys == "\"\"" or keys == "''") and "" or keys
mode = (mode == "\"\"" or mode == "''") and "" or mode
keys = (keys == '""' or keys == "''") and "" or keys
mode = (mode == '""' or mode == "''") and "" or mode
mode = mode or "n"
keys = Util.t(keys)
if not Util.check_mode(mode) then
Util.error(
"Invalid mode passed to :WhichKey (Dont create any keymappings to trigger WhichKey. WhichKey does this automaytically)")
Util.error("Invalid mode passed to :WhichKey (Dont create any keymappings to trigger WhichKey. WhichKey does this automaytically)")
else
M.show(keys, { mode = mode })
end
Expand Down
Loading

0 comments on commit 5c5b5f5

Please sign in to comment.