This commit is contained in:
OrionPax 2026-02-12 01:17:23 +00:00 committed by GitHub
commit 9477aaf105
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 315 additions and 18 deletions

View File

@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.o`
@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
vim.o.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.o.relativenumber = true
vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
@ -450,6 +450,11 @@ require('lazy').setup({
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
layout_config = {
width = 0.7, -- 宽度占屏幕 80%0~1 之间的百分比,或像素值)
height = 30, -- 高度设置为 20 行
-- prompt_position = "top", -- 可选:将输入框置于顶部
},
})
end, { desc = '[/] Fuzzily search in current buffer' })
@ -614,9 +619,9 @@ require('lazy').setup({
-- You can press `g?` for help in this menu.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'lua_ls', -- Lua Language server
'lua-language-server', -- Lua Language server
'stylua', -- Used to format Lua code
-- You can add other tools here that you want Mason to install
'prettier', -- JS/TS/Markdown 等文件格式化工具
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
@ -686,6 +691,7 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
markdown = { 'prettier' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
@ -824,6 +830,7 @@ require('lazy').setup({
-- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 }
-- TODO: 和跳转插件有冲突
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
@ -881,12 +888,8 @@ require('lazy').setup({
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
-- you can continue same window with `<space>sr` which resumes last telescope search
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the

View File

@ -0,0 +1,9 @@
-- tab 页签
vim.keymap.set('n', 'gb', '<cmd>BufferLinePick<CR>', { desc = '[G]o to [B]uffer' })
return {
'akinsho/bufferline.nvim',
version = '*',
dependencies = 'nvim-tree/nvim-web-devicons',
opts = {},
}

View File

@ -0,0 +1,4 @@
-- 中文格式化,中英文之间添加空格
-- NOTE: 使用 `:PanguAll` 进行格式化
return { 'hotoo/pangu.vim', ft = { 'markdown' } }

View File

@ -0,0 +1,4 @@
return {
'sindrets/diffview.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
}

View File

@ -0,0 +1,16 @@
-- 文件树
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- 不严格要求,但推荐
'MunifTanjim/nui.nvim',
},
config = function()
require('neo-tree').setup { close_if_last_window = true }
vim.keymap.set('n', '<leader>tf', ':Neotree toggle<CR>', { desc = '[T]oggle [F]ileTree' })
end,
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,79 @@
-- Adds git related signs to the gutter, as well as utilities for managing changes
-- 在 Neovim 中显示 Git 相关的符号(比如行变动、删除、添加等),以及提供多种 Git 操作的快捷方式
-- NOTE: gitsigns is already included in init.lua but contains only the base
-- config. This will add also the recommended keymaps.
-- NOTE: gitsigns 已包含在 init.lua 中,但仅包含基础配置。这还将添加推荐的 keymaps。
return {
{
'lewis6991/gitsigns.nvim',
opts = {
on_attach = function(bufnr)
local gitsigns = require 'gitsigns'
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
-- 跳转到下个更改
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [c]hange' })
-- 跳转到上个更改
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [c]hange' })
-- Actions
-- visual mode
-- 暂存选中更改
map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [s]tage hunk' })
-- 重置选中更改
map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
-- normal mode
-- 暂存当前更改
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
-- 重置当前更改
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
-- 暂存缓存区更改
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
-- 重置缓冲区更改
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
-- 预览当前更改
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
-- 查看某一行的 Git blame 信息
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
-- 查看文件与索引的差异
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
-- 查看文件与最后提交的差异
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
-- 切换显示当前行的 blame 信息。
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
-- 切换显示已删除的行。
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
end,
},
},
}

View File

@ -0,0 +1,7 @@
-- 建立良好的指挥工作流程,戒除不良习惯。
-- 按下 `s` 然后输入需要跳转到的位置的单词
return {
'm4xshen/hardtime.nvim',
dependencies = { 'MunifTanjim/nui.nvim' },
opts = {},
}

View File

@ -1,5 +0,0 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

View File

@ -0,0 +1,17 @@
-- 快速跳转
-- 按下 `s` 然后输入需要跳转到的位置的单词
return {
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}

View File

@ -0,0 +1,6 @@
-- 使用 Shift + j/k 代替 Ctrl + d/u
vim.keymap.set('n', '<S-j>', '<C-d>')
vim.keymap.set('n', '<S-k>', '<C-u>')
return {}

View File

@ -0,0 +1,11 @@
-- Markdown 预览
-- :MarkdownPreview
return {
'iamcco/markdown-preview.nvim',
build = 'cd app && npm install',
ft = 'markdown',
config = function()
vim.g.mkdp_auto_start = 1
end,
}

View File

@ -0,0 +1,38 @@
-- Mini 全家桶
return {
'echasnovski/mini.nvim',
config = function()
-- 可视化显示缩进范围
require('mini.indentscope').setup()
-- 自动配对
require('mini.pairs').setup()
-- 启动界面
require('mini.starter').setup()
-- 小地图
local map = require 'mini.map'
map.setup {
integrations = {
map.gen_integration.builtin_search(),
map.gen_integration.gitsigns(),
map.gen_integration.diagnostic(),
},
symbols = {
encode = map.gen_encode_symbols.dot '4x2',
},
}
vim.keymap.set('n', '<Leader>tm', map.toggle, { desc = '[T]oggle [M]ap' })
vim.cmd [[autocmd User MiniStarterOpened
\ lua vim.keymap.set(
\ 'n',
\ '<CR>',
\ '<Cmd>lua MiniStarter.eval_current_item(); MiniMap.open()<CR>',
\ { buffer = true }
\ )]]
end,
}

View File

@ -0,0 +1,18 @@
-- 更好的消息提示,命令输入框
-- 取代 messages, cmdline 和 popupmenu
return {
'folke/noice.nvim',
event = 'VeryLazy',
opts = {
-- add any options here
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
'MunifTanjim/nui.nvim',
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
-- 'rcarriga/nvim-notify',
},
}

View File

@ -0,0 +1,15 @@
-- Markdown 预览
return {
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
config = function()
local rm = require 'render-markdown'
vim.keymap.set('n', '<leader>tp', rm.toggle, { noremap = true, silent = true, expr = true, desc = '[T]oggle [P]review Markdown' })
end,
}

View File

@ -0,0 +1,18 @@
-- 更好状态栏
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
options = {
theme = 'palenight',
component_separators = '',
section_separators = { left = '', right = '' },
},
sections = {
lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
lualine_z = {
{ 'location', separator = { right = '' }, left_padding = 2 },
},
},
},
}

View File

@ -0,0 +1,20 @@
local powershell_options = {
-- shell = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell',
-- shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[',
-- shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode',
-- shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode',
-- shellquote = '',
-- shellxquote = '',
shell = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell',
shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;',
shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait',
shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode',
shellquote = '',
shellxquote = '',
}
for option, value in pairs(powershell_options) do
vim.opt[option] = value
end
return {}

View File

@ -0,0 +1,9 @@
-- 文本替换
-- :Spectre
return {
'nvim-pack/nvim-spectre',
event = 'BufRead',
opts = {},
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,23 @@
-- 翻译
-- 选中内容后leader [T]ranslate
-- NOTE: 弹出窗中 `g?` 查看操作帮助
return {
'potamides/pantran.nvim',
config = function()
local pantran = require 'pantran'
pantran.setup {
default_engine = 'google',
engines = {
google = {
fallback = {
default_source = 'auto',
default_target = 'zh',
},
},
},
}
vim.keymap.set('x', '<leader>t', pantran.motion_translate, { noremap = true, silent = true, expr = true, desc = '[T]ranslate' })
end,
}

View File

@ -1,3 +1,4 @@
-- 显示缩进线
return {
{ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',

View File

@ -1,13 +1,17 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- Neo-Tree 是一个浏览文件系统的 Neovim 插件
-- https://github.com/nvim-neo-tree/neo-tree.nvim
-- leader [T]oggle [F]ileTree : 开关文件树
-- 文件树内部 `?` 查看帮助
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
'nvim-lua/plenary.nvim', -- 一个 Neovim 的 Lua 工具库NeoTree 依赖它提供一些实用函数。
'nvim-tree/nvim-web-devicons', -- 为文件和文件夹提供图标,虽然不是必需的,但推荐安装以增强界面。
'MunifTanjim/nui.nvim', -- 一个用于构建用户界面的 Lua 库NeoTree 用它来创建其界面组件。
},
lazy = false,
keys = {