diff --git a/init.lua b/init.lua index 4eae8e7d..dff68443 100644 --- a/init.lua +++ b/init.lua @@ -942,12 +942,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 `sh` then write `lazy.nvim-plugin` - -- you can continue same window with `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 diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000..d45da895 --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,2 @@ +-- tab 页签 +return { 'akinsho/bufferline.nvim', version = '*', dependencies = 'nvim-tree/nvim-web-devicons', opts = {} } \ No newline at end of file diff --git a/lua/custom/plugins/chinese-prettier.lua b/lua/custom/plugins/chinese-prettier.lua new file mode 100644 index 00000000..7cbf7721 --- /dev/null +++ b/lua/custom/plugins/chinese-prettier.lua @@ -0,0 +1,3 @@ +-- 中文格式化,中英文之间添加空格 +-- NOTE: 使用 `:Pangu` 进行格式化 +return { 'hotoo/pangu.vim', ft = { 'markdown' } } \ No newline at end of file diff --git a/lua/custom/plugins/file-tree.lua b/lua/custom/plugins/file-tree.lua new file mode 100644 index 00000000..f37f93e4 --- /dev/null +++ b/lua/custom/plugins/file-tree.lua @@ -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', 'tf', ':Neotree toggle', { desc = '[T]oggle [F]ileTree' }) + end, +} + +-- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8..00000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -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 {} diff --git a/lua/custom/plugins/jump.lua b/lua/custom/plugins/jump.lua new file mode 100644 index 00000000..3b7199fd --- /dev/null +++ b/lua/custom/plugins/jump.lua @@ -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" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} \ No newline at end of file diff --git a/lua/custom/plugins/keymaps.lua b/lua/custom/plugins/keymaps.lua new file mode 100644 index 00000000..892df950 --- /dev/null +++ b/lua/custom/plugins/keymaps.lua @@ -0,0 +1,6 @@ +-- 使用 Shift + j/k 代替 Ctrl + d/u + +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') + +return {} diff --git a/lua/custom/plugins/markdown-preview.lua b/lua/custom/plugins/markdown-preview.lua new file mode 100644 index 00000000..9056b572 --- /dev/null +++ b/lua/custom/plugins/markdown-preview.lua @@ -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, +} \ No newline at end of file diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua new file mode 100644 index 00000000..7ff88f51 --- /dev/null +++ b/lua/custom/plugins/mini.lua @@ -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', 'tm', map.toggle, { desc = '[T]oggle [M]ap' }) + + vim.cmd [[autocmd User MiniStarterOpened + \ lua vim.keymap.set( + \ 'n', + \ '', + \ 'lua MiniStarter.eval_current_item(); MiniMap.open()', + \ { buffer = true } + \ )]] + end, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000..e677b8d7 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -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', + }, +} \ No newline at end of file diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua new file mode 100644 index 00000000..770554a5 --- /dev/null +++ b/lua/custom/plugins/statusline.lua @@ -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 }, + }, + }, + }, +} diff --git a/lua/custom/plugins/text-replace.lua b/lua/custom/plugins/text-replace.lua new file mode 100644 index 00000000..e872cf48 --- /dev/null +++ b/lua/custom/plugins/text-replace.lua @@ -0,0 +1,8 @@ +-- 文本替换 +return { + 'nvim-pack/nvim-spectre', + event = 'BufRead', + opts = {}, +} + +-- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/translation.lua b/lua/custom/plugins/translation.lua new file mode 100644 index 00000000..6879a694 --- /dev/null +++ b/lua/custom/plugins/translation.lua @@ -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', 't', pantran.motion_translate, { noremap = true, silent = true, expr = true, desc = '[T]ranslate' }) + end, +} \ No newline at end of file