优化快捷键

This commit is contained in:
LingZhaoHui 2024-06-08 13:20:09 +08:00
parent 2c922d98ea
commit 4132ab5379
Signed by: zeekling
GPG Key ID: D96E4E75267CA2CC
2 changed files with 24 additions and 18 deletions

View File

@ -1,17 +0,0 @@
vim.g.mapleader = " "
# markdown
vim.keymap.set("n", "<leader>mks", "<cmd>MarkdownPreview<cr>", { silent = true })
vim.keymap.set("n", "<leader>mkc", "<cmd>MarkdownPreviewStop<cr>", { silent = true })
# tree
vim.keymap.set("n", "<leader>ds", "<cmd>NvimTreeToggle<cr>", { silent = true })
vim.keymap.set("n", "<leader>dc", "<cmd>NvimTreeClose<cr>", { silent = true })
# buffer
vim.keymap.set("n", "<leader>bp", "<cmd>BufferLineCyclePrev<cr>", { silent = true })
vim.keymap.set("n", "<leader>bn", "<cmd>BufferLineCycleNext<cr>", { silent = true })
vim.keymap.set("n", "<leader>bd", "<cmd>bd<cr>", { silent = true })

View File

@ -7,6 +7,29 @@ return {
local wk = require("which-key") local wk = require("which-key")
-- 快捷键在这里定义 -- 快捷键在这里定义
wk.register({
["<leader>"] = {
b = {
name="Buffer",
p={"<cmd>BufferLineCyclePrev<cr>", "Go to pre buffer"},
n={"<cmd>BufferLineCycleNext<cr>", "Go to next buffer"},
d={"<cmd>bd<cr>", "delete current buffer"}
},
m = {
name="Markdown",
k={
name="Markdown",
s={"<cmd>MarkdownPreview<cr>", "MarkdownPreview"},
c={"<cmd>MarkdownPreviewStop<cr>", "MarkdownPreviewStop"}
}
},
d = {
name="dirTree",
s={"<cmd>NvimTreeToggle<cr>", "show dir tree on left"},
c={"<cmd>NvimTreeClose<cr>", "hidden dir tree on left"}
}
}
}, {silent = true, noremap = true})
wk.setup() wk.setup()
end, end,
}, },