add mapping cheatsheet (#244)

This commit is contained in:
siduck76 2021-08-16 22:18:08 +05:30
parent eaaefc236d
commit c62e94923a
4 changed files with 54 additions and 1 deletions

View File

@ -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 = "<leader>fp",
},
chadsheet = {
default_keys = "<leader>dk",
user_keys = "<leader>uk",
},
bufferline = {
new_buffer = "<S-t>",
newtab = "<C-t>b",

View File

@ -114,6 +114,18 @@ M.telescope_media = function()
map("n", m.media_files, ":Telescope media_files <CR>", opt)
end
M.chadsheet = function()
local m = user_map.chadsheet
map("n", m.default_keys, ":lua require('cheatsheet').show_cheatsheet_telescope()<CR>", opt)
map(
"n",
m.user_keys,
":lua require('cheatsheet').show_cheatsheet_telescope{bundled_cheatsheets = false, bundled_plugin_cheatsheets = false }<CR>",
opt
)
end
M.bufferline = function()
local m = user_map.bufferline

View File

@ -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"

25
lua/plugins/chadsheet.lua Normal file
View File

@ -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,
}