refactor: Cleaning chadrc, moved to custom & moved default_config to core

This commit is contained in:
Galen Rowell 2021-09-04 00:03:25 +10:00 committed by siduck76
parent 22f89cfeef
commit ca1ad15ad2
7 changed files with 53 additions and 241 deletions

View file

@ -1,4 +1,4 @@
local present, chadsheet = pcall(require, "cheatsheet")
local present, cheatsheet = pcall(require, "cheatsheet")
if not present then
return
@ -8,28 +8,28 @@ local mappings = require("core.utils").load_config().mappings
-- add user mappings to the cheetsheet
-- improve this function to not hardcode plugin
local function add_to_chadsheet(section, keymap, desc)
local function add_to_cheatsheet(section, keymap, desc)
if section == "plugin" then
for sec, key in pairs(mappings.plugin) do
add_to_chadsheet(sec, key, sec)
add_to_cheatsheet(sec, key, sec)
end
else
if type(keymap) == "table" then
for sec, key in pairs(keymap) do
if type(sec) == "number" then
add_to_chadsheet(section, key, desc or section)
add_to_cheatsheet(section, key, desc or section)
else
add_to_chadsheet(sec, key, desc or section)
add_to_cheatsheet(sec, key, desc or section)
end
end
else
chadsheet.add_cheat(section, keymap, desc or "Misc")
cheatsheet.add_cheat(section, keymap, desc or "Misc")
end
end
end
for section, keymap in pairs(mappings) do
add_to_chadsheet(section, keymap)
add_to_cheatsheet(section, keymap)
end
require("cheatsheet").setup {

View file

@ -280,10 +280,10 @@ return packer.startup(function()
disable = not plugin_status.cheatsheet,
after = "telescope.nvim",
config = function()
require "plugins.configs.chadsheet"
require "plugins.configs.cheatsheet"
end,
setup = function()
require("core.mappings").chadsheet()
require("core.mappings").cheatsheet()
end,
},
{