mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 21:40:37 +00:00
add mapping cheatsheet (#244)
This commit is contained in:
parent
eaaefc236d
commit
c62e94923a
4 changed files with 54 additions and 1 deletions
|
@ -51,6 +51,7 @@ local M = {
|
||||||
nvim_comment = true,
|
nvim_comment = true,
|
||||||
neoscroll_nvim = true,
|
neoscroll_nvim = true,
|
||||||
telescope_media = true,
|
telescope_media = true,
|
||||||
|
cheatsheet = false,
|
||||||
},
|
},
|
||||||
-- make sure you dont use same keys twice
|
-- make sure you dont use same keys twice
|
||||||
mappings = {
|
mappings = {
|
||||||
|
@ -88,6 +89,10 @@ local M = {
|
||||||
telescope_media = {
|
telescope_media = {
|
||||||
media_files = "<leader>fp",
|
media_files = "<leader>fp",
|
||||||
},
|
},
|
||||||
|
chadsheet = {
|
||||||
|
default_keys = "<leader>dk",
|
||||||
|
user_keys = "<leader>uk",
|
||||||
|
},
|
||||||
bufferline = {
|
bufferline = {
|
||||||
new_buffer = "<S-t>",
|
new_buffer = "<S-t>",
|
||||||
newtab = "<C-t>b",
|
newtab = "<C-t>b",
|
||||||
|
|
|
@ -114,6 +114,18 @@ M.telescope_media = function()
|
||||||
map("n", m.media_files, ":Telescope media_files <CR>", opt)
|
map("n", m.media_files, ":Telescope media_files <CR>", opt)
|
||||||
end
|
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()
|
M.bufferline = function()
|
||||||
local m = user_map.bufferline
|
local m = user_map.bufferline
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
after = "plenary.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
@ -182,6 +182,17 @@ return packer.startup(function()
|
||||||
require("mappings").telescope_media()
|
require("mappings").telescope_media()
|
||||||
end,
|
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()
|
config = function()
|
||||||
require "plugins.telescope"
|
require "plugins.telescope"
|
||||||
|
|
25
lua/plugins/chadsheet.lua
Normal file
25
lua/plugins/chadsheet.lua
Normal 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,
|
||||||
|
}
|
Loading…
Reference in a new issue