Revert "remove cheatsheet.nvim for now"
This reverts commit f3fe3d46c8
.
This commit is contained in:
parent
f3fe3d46c8
commit
22f89cfeef
@ -77,6 +77,7 @@ M.plugin_status = {
|
|||||||
autosave = false, -- to autosave files
|
autosave = false, -- to autosave files
|
||||||
blankline = true, -- beautified blank lines
|
blankline = true, -- beautified blank lines
|
||||||
bufferline = true, -- buffer shown as tabs
|
bufferline = true, -- buffer shown as tabs
|
||||||
|
cheatsheet = true, -- fuzzy search your commands/keymappings
|
||||||
colorizer = true,
|
colorizer = true,
|
||||||
comment = true, -- universal commentor
|
comment = true, -- universal commentor
|
||||||
dashboard = false, -- a nice looking dashboard
|
dashboard = false, -- a nice looking dashboard
|
||||||
@ -147,6 +148,10 @@ M.mappings.plugin = {
|
|||||||
moveUp = "<C-k>",
|
moveUp = "<C-k>",
|
||||||
moveDown = "<C-j>",
|
moveDown = "<C-j>",
|
||||||
},
|
},
|
||||||
|
chadsheet = {
|
||||||
|
default_keys = "<leader>dk",
|
||||||
|
user_keys = "<leader>uk",
|
||||||
|
},
|
||||||
comment = {
|
comment = {
|
||||||
toggle = "<leader>/", -- trigger comment on a single/selected lines/number prefix
|
toggle = "<leader>/", -- trigger comment on a single/selected lines/number prefix
|
||||||
},
|
},
|
||||||
|
@ -131,6 +131,17 @@ M.bufferline = function()
|
|||||||
map("n", m.moveDown, "<C-w>j")
|
map("n", m.moveDown, "<C-w>j")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.chadsheet = function()
|
||||||
|
local m = plugin_maps.chadsheet
|
||||||
|
|
||||||
|
map("n", m.default_keys, ":lua require('cheatsheet').show_cheatsheet_telescope() <CR>")
|
||||||
|
map(
|
||||||
|
"n",
|
||||||
|
m.user_keys,
|
||||||
|
":lua require('cheatsheet').show_cheatsheet_telescope{bundled_cheatsheets = false, bundled_plugin_cheatsheets = false } <CR>"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
M.comment = function()
|
M.comment = function()
|
||||||
local m = plugin_maps.comment.toggle
|
local m = plugin_maps.comment.toggle
|
||||||
map("n", m, ":CommentToggle <CR>")
|
map("n", m, ":CommentToggle <CR>")
|
||||||
|
@ -82,6 +82,7 @@ M.plugin_status = {
|
|||||||
autosave = false, -- to autosave files
|
autosave = false, -- to autosave files
|
||||||
blankline = true, -- beautified blank lines
|
blankline = true, -- beautified blank lines
|
||||||
bufferline = true, -- buffer shown as tabs
|
bufferline = true, -- buffer shown as tabs
|
||||||
|
cheatsheet = true, -- fuzzy search your commands/keymappings
|
||||||
colorizer = true,
|
colorizer = true,
|
||||||
comment = true, -- universal commentor
|
comment = true, -- universal commentor
|
||||||
dashboard = false, -- a nice looking dashboard
|
dashboard = false, -- a nice looking dashboard
|
||||||
@ -147,6 +148,10 @@ M.mappings.plugin = {
|
|||||||
next_buffer = "<TAB>", -- next buffer
|
next_buffer = "<TAB>", -- next buffer
|
||||||
prev_buffer = "<S-Tab>", -- previous buffer
|
prev_buffer = "<S-Tab>", -- previous buffer
|
||||||
},
|
},
|
||||||
|
chadsheet = {
|
||||||
|
default_keys = "<leader>dk",
|
||||||
|
user_keys = "<leader>uk",
|
||||||
|
},
|
||||||
comment = {
|
comment = {
|
||||||
toggle = "<leader>/", -- trigger comment on a single/selected lines/number prefix
|
toggle = "<leader>/", -- trigger comment on a single/selected lines/number prefix
|
||||||
},
|
},
|
||||||
|
44
lua/plugins/configs/chadsheet.lua
Normal file
44
lua/plugins/configs/chadsheet.lua
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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,
|
||||||
|
}
|
@ -272,7 +272,20 @@ return packer.startup(function()
|
|||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
|
-- because cheatsheet is not activated by a teleacope command
|
||||||
|
module = "cheatsheet",
|
||||||
requires = {
|
requires = {
|
||||||
|
{
|
||||||
|
"sudormrfbin/cheatsheet.nvim",
|
||||||
|
disable = not plugin_status.cheatsheet,
|
||||||
|
after = "telescope.nvim",
|
||||||
|
config = function()
|
||||||
|
require "plugins.configs.chadsheet"
|
||||||
|
end,
|
||||||
|
setup = function()
|
||||||
|
require("core.mappings").chadsheet()
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
run = "make",
|
run = "make",
|
||||||
|
Loading…
Reference in New Issue
Block a user