From b98ab3c21675f04b614b509e53d78f1a2fd21c5c Mon Sep 17 00:00:00 2001 From: niuzhaolong Date: Wed, 21 May 2025 00:47:18 +0800 Subject: [PATCH] add ale and git support, please remember to review these plugins --- lua/plugins/ale.lua | 34 ++++++++++++++++++++++++++++++++++ lua/plugins/git.lua | 8 ++++++++ 2 files changed, 42 insertions(+) create mode 100644 lua/plugins/ale.lua create mode 100644 lua/plugins/git.lua diff --git a/lua/plugins/ale.lua b/lua/plugins/ale.lua new file mode 100644 index 0000000..0c4b551 --- /dev/null +++ b/lua/plugins/ale.lua @@ -0,0 +1,34 @@ +return { + { + "dense-analysis/ale", + event = { "BufReadPost", "BufNewFile" }, -- 延迟加载 + init = function() + -- 禁用 ALE 补全(不再需要) + vim.g.ale_completion_enabled = 0 + + -- 全局 Fixers + vim.g.ale_fixers = { + ['*'] = { 'remove_trailing_lines', 'trim_whitespace' }, + } + + -- 保存时自动修复 + vim.g.ale_fix_on_save = 1 + + -- 浮动窗口样式(Neovim 专属) + vim.g.ale_floating_preview = 1 + vim.g.ale_floating_window_border = { '│', '─', '╭', '╮', '╯', '╰', '│', '─' } + vim.g.ale_hover_to_floating_preview = 1 + end, + keys = { + -- 错误导航 + { "", "(ale_previous_wrap)", mode = "n", desc = "ALE Previous Error" }, + { "", "(ale_next_wrap)", mode = "n", desc = "ALE Next Error" }, + -- 功能键位 + { "gh", "(ale_hover)", mode = "n", desc = "ALE Hover" }, + { "d", "(ale_detail)", mode = "n", desc = "ALE Detail" }, + { "x", "(ale_fix)", mode = "n", desc = "ALE Fix" }, + { "g", "(ale_go_to_definition_in_tab)", mode = "n", desc = "ALE Go to Definition (Tab)" }, + { "r", "(ale_find_references)", mode = "n", desc = "ALE Find References" }, + }, + } +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..fae9c20 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,8 @@ +-- git support stuff +-- +return { + { + "tpope/vim-fugitive", + event = "User GitPrompt", -- 按需加载 + }, +}