Compare commits
4 Commits
da8536145c
...
b98ab3c216
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b98ab3c216 | ||
|
|
4acb617457 | ||
|
|
3d87579b90 | ||
|
|
4de50097c8 |
34
lua/plugins/ale.lua
Normal file
34
lua/plugins/ale.lua
Normal file
@ -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 = {
|
||||||
|
-- 错误导航
|
||||||
|
{ "<C-k>", "<Plug>(ale_previous_wrap)", mode = "n", desc = "ALE Previous Error" },
|
||||||
|
{ "<C-j>", "<Plug>(ale_next_wrap)", mode = "n", desc = "ALE Next Error" },
|
||||||
|
-- 功能键位
|
||||||
|
{ "gh", "<Plug>(ale_hover)", mode = "n", desc = "ALE Hover" },
|
||||||
|
{ "<leader>d", "<Plug>(ale_detail)", mode = "n", desc = "ALE Detail" },
|
||||||
|
{ "<leader>x", "<Plug>(ale_fix)", mode = "n", desc = "ALE Fix" },
|
||||||
|
{ "<leader>g", "<Plug>(ale_go_to_definition_in_tab)", mode = "n", desc = "ALE Go to Definition (Tab)" },
|
||||||
|
{ "<leader>r", "<Plug>(ale_find_references)", mode = "n", desc = "ALE Find References" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
101
lua/plugins/complete-func.lua
Normal file
101
lua/plugins/complete-func.lua
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
-- complete-functions etc
|
||||||
|
-- and snippets
|
||||||
|
--
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- follow latest release.
|
||||||
|
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||||
|
-- install jsregexp (optional!).
|
||||||
|
build = "make install_jsregexp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-buffer", -- 缓冲区补全
|
||||||
|
"hrsh7th/cmp-path", -- 文件路径补全
|
||||||
|
"hrsh7th/cmp-cmdline", -- 命令行补全
|
||||||
|
"saadparwaiz1/cmp_luasnip", -- LuaSnip 集成
|
||||||
|
"L3MON4D3/LuaSnip", -- 代码片段引擎
|
||||||
|
"rafamadriz/friendly-snippets", -- 预定义片段库
|
||||||
|
"onsails/lspkind.nvim", -- 美化补全菜单图标
|
||||||
|
},
|
||||||
|
event = "InsertEnter", -- 插入模式时加载
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local lspkind = require("lspkind")
|
||||||
|
|
||||||
|
-- 加载友好代码片段库
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body) -- 启用 LuaSnip
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(), -- 触发补全
|
||||||
|
["<C-e>"] = cmp.mapping.abort(), -- 关闭补全
|
||||||
|
['<CR>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
if luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
else
|
||||||
|
cmp.confirm({
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
-- 超级Tab (片段跳转支持)
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "luasnip" }, -- LuaSnip 片段
|
||||||
|
{ name = "nvim_lsp" }, -- LSP 补全
|
||||||
|
{ name = "path" }, -- 文件路径
|
||||||
|
{ name = "buffer" }, -- 缓冲区内容
|
||||||
|
}),
|
||||||
|
-- 美化补全菜单(图标 + 类型提示)
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
mode = "symbol_text",
|
||||||
|
maxwidth = 50,
|
||||||
|
ellipsis_char = "...",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 命令行补全
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "cmdline" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
8
lua/plugins/git.lua
Normal file
8
lua/plugins/git.lua
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-- git support stuff
|
||||||
|
--
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
event = "User GitPrompt", -- 按需加载
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -1,7 +1,6 @@
|
|||||||
-- 用于搜索和快速移动
|
-- 用于搜索和快速移动
|
||||||
--
|
--
|
||||||
return {
|
return {
|
||||||
{"mileszs/ack.vim", }, -- 提供工作方式类似grep的:Ack :Ack!命令
|
|
||||||
{
|
{
|
||||||
"preservim/nerdtree",
|
"preservim/nerdtree",
|
||||||
keys = {
|
keys = {
|
||||||
@ -11,4 +10,26 @@ return {
|
|||||||
{ "<C-f>", ":NERDTreeFind<CR>", mode = "n", desc = "Nerd Tree Find" },
|
{ "<C-f>", ":NERDTreeFind<CR>", mode = "n", desc = "Nerd Tree Find" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', "nvim-tree/nvim-web-devicons", "nvim-telescope/telescope-file-browser.nvim" },
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
file_ignore_patterns = { "node_modules", ".git" },
|
||||||
|
layout_strategy = "vertical",
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
find_files = {
|
||||||
|
hidden = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>", desc = "Find Files" },
|
||||||
|
{ "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", desc = "Live Grep" },
|
||||||
|
{ "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>", desc = "Find Buffers" },
|
||||||
|
{ "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>", desc = "Help Tags" },
|
||||||
|
{ "gf", "<cmd>Telescope file_browser path=%:p:h<cr>", desc = "Open File Under Cursor" },
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
lua/plugins/statusline.lua
Normal file
11
lua/plugins/statusline.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- statusline
|
||||||
|
|
||||||
|
return {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
theme = 'auto',
|
||||||
|
icons_enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user