2021-09-03 10:03:25 -04:00
|
|
|
local present, cheatsheet = pcall(require, "cheatsheet")
|
2021-09-24 09:01:42 -04:00
|
|
|
|
|
|
|
if not present then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local mappings = require("core.utils").load_config().mappings
|
|
|
|
|
|
|
|
-- add user mappings to the cheetsheet
|
|
|
|
-- improve this function to not hardcode plugin
|
2021-09-03 10:03:25 -04:00
|
|
|
local function add_to_cheatsheet(section, keymap, desc)
|
2021-09-24 09:01:42 -04:00
|
|
|
if section == "plugin" then
|
|
|
|
for sec, key in pairs(mappings.plugin) do
|
2021-09-03 10:03:25 -04:00
|
|
|
add_to_cheatsheet(sec, key, sec)
|
2021-09-24 09:01:42 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
if type(keymap) == "table" then
|
|
|
|
for sec, key in pairs(keymap) do
|
|
|
|
if type(sec) == "number" then
|
2021-09-03 10:03:25 -04:00
|
|
|
add_to_cheatsheet(section, key, desc or section)
|
2021-09-24 09:01:42 -04:00
|
|
|
else
|
2021-09-03 10:03:25 -04:00
|
|
|
add_to_cheatsheet(sec, key, desc or section)
|
2021-09-24 09:01:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
2021-09-03 10:03:25 -04:00
|
|
|
cheatsheet.add_cheat(section, keymap, desc or "Misc")
|
2021-09-24 09:01:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for section, keymap in pairs(mappings) do
|
2021-09-03 10:03:25 -04:00
|
|
|
add_to_cheatsheet(section, keymap)
|
2021-09-24 09:01:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
require("cheatsheet").setup {
|
|
|
|
|
|
|
|
bundled_cheatsheets = {
|
|
|
|
enabled = { "default" },
|
|
|
|
disabled = { "unicode", "nerd-fonts" },
|
|
|
|
},
|
|
|
|
|
|
|
|
bundled_plugin_cheatsheets = false,
|
|
|
|
include_only_installed_plugins = true,
|
|
|
|
}
|