feat: 初始化并添加自定义插件

This commit is contained in:
OrionPax 2024-08-22 11:53:48 +08:00
parent 1860184830
commit 4dca5f301c
12 changed files with 137 additions and 6 deletions

View File

@ -892,7 +892,7 @@ require('lazy').setup({
-- --
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
}, { }, {
ui = { ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the

View File

@ -0,0 +1,2 @@
-- tab 页签
return { 'akinsho/bufferline.nvim', version = '*', dependencies = 'nvim-tree/nvim-web-devicons', opts = {} }

View File

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

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,15 @@
-- 快速跳转
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,9 @@
-- Markdown 预览
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,16 @@
-- 取代 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,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,8 @@
-- 文本替换
return {
'nvim-pack/nvim-spectre',
event = 'BufRead',
opts = {},
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,21 @@
-- 翻译
-- 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,
}