diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 5ec40d8..4fea792 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -51,6 +51,7 @@ local M = { nvim_comment = true, neoscroll_nvim = true, telescope_media = true, + cheatsheet = false, }, -- make sure you dont use same keys twice mappings = { @@ -88,6 +89,10 @@ local M = { telescope_media = { media_files = "fp", }, + chadsheet = { + default_keys = "dk", + user_keys = "uk", + }, bufferline = { new_buffer = "", newtab = "b", diff --git a/lua/mappings.lua b/lua/mappings.lua index 329e5dd..7630dcd 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -114,6 +114,18 @@ M.telescope_media = function() map("n", m.media_files, ":Telescope media_files ", opt) end +M.chadsheet = function() + local m = user_map.chadsheet + + map("n", m.default_keys, ":lua require('cheatsheet').show_cheatsheet_telescope()", opt) + map( + "n", + m.user_keys, + ":lua require('cheatsheet').show_cheatsheet_telescope{bundled_cheatsheets = false, bundled_plugin_cheatsheets = false }", + opt + ) +end + M.bufferline = function() local m = user_map.bufferline diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 06acb47..7fbf998 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -169,7 +169,7 @@ return packer.startup(function() use { "nvim-telescope/telescope.nvim", - cmd = "Telescope", + after = "plenary.nvim", requires = { { "nvim-telescope/telescope-fzf-native.nvim", @@ -182,6 +182,17 @@ return packer.startup(function() require("mappings").telescope_media() end, }, + { + "sudormrfbin/cheatsheet.nvim", + disable = not plugin_status.cheatsheet, + after = "telescope.nvim", + config = function() + require "plugins.chadsheet" + end, + setup = function() + require("mappings").chadsheet() + end, + }, }, config = function() require "plugins.telescope" diff --git a/lua/plugins/chadsheet.lua b/lua/plugins/chadsheet.lua new file mode 100644 index 0000000..4ccd2b5 --- /dev/null +++ b/lua/plugins/chadsheet.lua @@ -0,0 +1,25 @@ +local present, chadsheet = pcall(require, "cheatsheet") + +if not present then + return +end + +local mappings = require("chadrc").mappings + +-- add user mappings to the cheetsheet +for section, data in pairs(mappings) do + for description, keymap in pairs(data) do + chadsheet.add_cheat(description, keymap, section) + end +end + +require("cheatsheet").setup { + + bundled_cheatsheets = { + enabled = { "default" }, + disabled = { "unicode", "nerd-fonts" }, + }, + + bundled_plugin_cheatsheets = false, + include_only_installed_plugins = true, +}