微调插件配置

This commit is contained in:
caprain 2026-04-20 21:54:50 +08:00
parent d033379cb2
commit d9aa5500fd
5 changed files with 20 additions and 22 deletions

View file

@ -8,7 +8,7 @@ local P = {
-- 定义映射配置表
local mappings = {
{ ft = { "rust", "python" }, cmd = "RunCode", desc = "Save and Run Code" },
{ ft = "markdown", cmd = "PeekClose;PeekOpen", desc = "Reload Markdown Preview" },
{ ft = "markdown", cmd = "PeekToggle", desc = "Reload Markdown Preview" },
{ ft = "dart", cmd = "Telescope flutter commands", desc = "Open Flutter Commands" },
{ ft = "go", cmd = "set splitbelow;sp;term go run %", desc = "Run Go file" },
}

View file

@ -19,7 +19,7 @@ local formatters_by_ft = {
zsh = { "shfmt" },
typescript = { "deno_fmt" },
javascript = { "deno_fmt" },
markdown = { "deno_fmt_markdown" },
-- markdown = { "deno_fmt_markdown" },
}
local real_executable_map = {

View file

@ -9,21 +9,19 @@ local P = {
PackUtils.setup_listener(P.name, P.build_cmd)
-- 在插件未加载时,这些命令就存在了。一旦被调用,它们会先加载插件,再执行真正的功能。
vim.api.nvim_create_user_command("PeekOpen", function()
PackUtils.load(P, function()
require("peek").setup({
port = 9000,
-- app = { "zen", "-private-window" },
-- app = { "firefox-esr", "-private-window" },
app = { "chromium", "--app=http://localhost:9000/?theme=dark", "--incognito" },
})
end)
require("peek").open()
end, { desc = "Lazy load and open Peek" })
vim.api.nvim_create_user_command("PeekClose", function()
-- 如果插件没加载Close 命令通常不需要做任何事,或者也触发加载
if PackUtils.plugin_loaded[P.name] then
require("peek").close()
vim.api.nvim_create_user_command("PeekToggle", function()
local peek = require("peek")
if not peek.is_open() and vim.bo[vim.api.nvim_get_current_buf()].filetype == 'markdown' then
PackUtils.load(P, function()
require("peek").setup({
port = 9000,
-- app = { "zen", "-private-window" },
-- app = { "firefox-esr", "-private-window" },
app = { "chromium", "--app=http://localhost:9000/?theme=dark", "--incognito" },
})
end)
peek.open()
else
peek.close()
end
end, { desc = "Close Peek" })
end, { desc = "Lazy load and open Peek" })

View file

@ -11,8 +11,8 @@ vim.keymap.set({ "n", "x" }, "<leader>u", function()
["e"] = "move_next",
["u"] = "move_prev",
["n"] = "move2parent",
["E"] = "move_change_next",
["U"] = "move_change_prev",
-- ["E"] = "move_change_next",
-- ["U"] = "move_change_prev",
["<cr>"] = "action_enter",
["i"] = "action_enter",
["d"] = "enter_diffbuf",

View file

@ -129,7 +129,7 @@
"src": "https://github.com/folke/which-key.nvim"
},
"yazi.nvim": {
"rev": "78f7dc1ff5fef3ea60897ec356681f9aa0ed53d8",
"rev": "e7094dcfd897600e02a23e8334cdfeb9ee07dc17",
"src": "https://github.com/mikavilpas/yazi.nvim"
}
}