添加大纲插件

This commit is contained in:
caprain 2026-04-14 21:13:24 +08:00
parent 35ccbebb91
commit d9ba9d85fb
8 changed files with 105 additions and 43 deletions

View file

@ -41,7 +41,7 @@ local function get_ensure_installed_for_ft(ft, ft_table)
end
-- 快捷键纯懒加载:只在按下快捷键时激活
vim.keymap.set({ "n", "v" }, "<leader>f", function()
vim.keymap.set({ "n", "x" }, "<leader>f", function()
PackUtils.load(P, function()
require("conform").setup({ -- At a minimum, you will need to set up some formatters by filetype
formatters_by_ft = formatters_by_ft

View file

@ -0,0 +1,55 @@
-- === outline大纲 ===
if vim.g.vscode then return end
local P = {
name = "outline.nvim",
}
vim.keymap.set({ "n", "x" }, "<leader>v", function()
PackUtils.load(P, function()
require("outline").setup({
outline_window = {
position = "left",
width = 20,
},
keymaps = {
show_help = "?",
close = { "<Esc>", "q" },
-- Jump to symbol under cursor.
-- It can auto close the outline window when triggered, see
-- 'auto_close' option above.
goto_location = "<Cr>",
-- Jump to symbol under cursor but keep focus on outline window.
peek_location = "o",
-- Visit location in code and close outline immediately
goto_and_close = "<S-Cr>",
-- Change cursor position of outline window to match current location in code.
-- 'Opposite' of goto/peek_location.
restore_location = "<C-g>",
-- Open LSP/provider-dependent symbol hover information
hover_symbol = "<C-space>",
-- Preview location code of the symbol under cursor
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
-- These fold actions are collapsing tree nodes, not code folding
fold = "n",
unfold = "i",
fold_toggle = "<Tab>",
-- Toggle folds for all nodes.
-- If at least one node is folded, this action will fold all nodes.
-- If all nodes are folded, this action will unfold all nodes.
fold_toggle_all = "<S-Tab>",
fold_all = "N",
unfold_all = "I",
fold_reset = "R",
-- Move down/up by one line and peek_location immediately.
-- You can also use outline_window.auto_jump=true to do this for any
-- j/k/<down>/<up>.
down_and_jump = "<C-e>",
up_and_jump = "<C-u>",
},
})
end)
vim.cmd("Outline")
end, { desc = "Toggle outline" })

View file

@ -35,7 +35,7 @@ local function load_plugin()
end)
end
vim.keymap.set({ "n", "v" }, "<c-t>", function()
vim.keymap.set({ "n", "x" }, "<c-t>", function()
load_plugin()
if vim.fs.root(0, '.git') then
vim.cmd('Tv git-files')
@ -44,7 +44,7 @@ vim.keymap.set({ "n", "v" }, "<c-t>", function()
end
end, { desc = "Smart Tv: git-files or files" })
vim.keymap.set({ "n", "v" }, "<c-f>", function()
vim.keymap.set({ "n", "x" }, "<c-f>", function()
load_plugin()
vim.cmd('Tv text')
end, { desc = "模糊查找字符串" })

View file

@ -15,7 +15,7 @@ local P = {
}
-- 快捷键触发懒加载
vim.keymap.set({ "n", "v" }, "tt", function()
vim.keymap.set({ "n", "x" }, "tt", function()
-- 核心:直接调用引擎,把配置逻辑传进去
PackUtils.load(P, function()
require("yazi").setup({

View file

@ -27,6 +27,10 @@ local specs = {
"https://github.com/nvim-treesitter/nvim-treesitter-context",
-- bufferline.lua 顶部状态栏
'https://github.com/akinsho/bufferline.nvim',
-- lualine.lua 底部状态栏
"https://github.com/nvim-lualine/lualine.nvim",
-- outline.lua 大纲、函数变量结构
"https://github.com/hedyhli/outline.nvim",
-- noice.lua 取代消息、命令行和弹出菜单的 UI
"https://github.com/folke/noice.nvim",
"https://github.com/MunifTanjim/nui.nvim",
@ -44,8 +48,6 @@ local specs = {
'https://github.com/cap153/peek.nvim',
-- yazi.lua 文件管理器
'https://github.com/mikavilpas/yazi.nvim',
-- lualine.lua 底部状态栏
"https://github.com/nvim-lualine/lualine.nvim",
-- sudo权限保存文件
"https://github.com/lambdalisue/vim-suda",
-- 查看可用键位