neovim-config/lua/plugins/configs/chadsheet.lua

45 lines
1.1 KiB
Lua
Raw Normal View History

Restructure config | Move some to a packer plugin | Lot of cleanup * move teleacope files, updater and related utils to https://github.com/NvChad/core * restructure config file and directory structure * expose mappings for better escape * allow multiple mappings for some * improve merge table function for the same * move autocommands to a seperate file * rearrange everything alphabetically where sanely possible * rearrange packer plugin list on the basis of trigerred state config structure now . ├── init.lua ├── LICENSE ├── lua │ ├── chadrc.lua │ ├── colors │ │ ├── highlights.lua │ │ ├── init.lua │ │ └── themes │ │ ├── chadracula.lua │ │ ├── everforest.lua │ │ ├── gruvchad.lua │ │ ├── javacafe.lua │ │ ├── mountain.lua │ │ ├── norchad.lua │ │ ├── one-light.lua │ │ ├── onedark.lua │ │ ├── tokyonight.lua │ │ └── tomorrow-night.lua │ ├── core │ │ ├── autocmds.lua │ │ ├── init.lua │ │ ├── mappings.lua │ │ ├── options.lua │ │ └── utils.lua │ ├── default_config.lua │ └── plugins │ ├── configs │ │ ├── autopairs.lua │ │ ├── autosave.lua │ │ ├── bufferline.lua │ │ ├── chadsheet.lua │ │ ├── compe.lua │ │ ├── dashboard.lua │ │ ├── gitsigns.lua │ │ ├── icons.lua │ │ ├── lspconfig.lua │ │ ├── luasnip.lua │ │ ├── nvimtree.lua │ │ ├── others.lua │ │ ├── statusline.lua │ │ ├── telescope.lua │ │ ├── treesitter.lua │ │ └── zenmode.lua │ ├── init.lua │ └── packerInit.lua └── README.md
2021-08-22 07:49:15 +00:00
local present, chadsheet = pcall(require, "cheatsheet")
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
local function add_to_chadsheet(section, keymap, desc)
if section == "plugin" then
for sec, key in pairs(mappings.plugin) do
add_to_chadsheet(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)
else
add_to_chadsheet(sec, key, desc or section)
end
end
else
chadsheet.add_cheat(section, keymap, desc or "Misc")
end
end
end
for section, keymap in pairs(mappings) do
add_to_chadsheet(section, keymap)
end
require("cheatsheet").setup {
bundled_cheatsheets = {
enabled = { "default" },
disabled = { "unicode", "nerd-fonts" },
},
bundled_plugin_cheatsheets = false,
include_only_installed_plugins = true,
}