irongit

refactor(nvim): move large plugins into their own files

huncholanehuncholaneauthored
parent d52302ecommit 8339d04459f489627a6c598a969e623116f5afe1Browse files

9 files changed, +142 -113

+1-0nvim/after/ftplugin/http.lua
@@ -0,0 +1 @@
1+vim.keymap.set("n", "<leader>r", "<cmd>Rest run<cr>", { buffer = true, desc = "Rest Run" })
+1-0nvim/lazy-lock.json
@@ -10,6 +10,7 @@
1010 "none-ls.nvim": { "branch": "main", "commit": "6617d47fbf275d197e3335022a3d33ff310a4b93" },
1111 "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
1212 "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
13+ "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
1314 "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
1415 "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
1516 "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
+17-113nvim/lua/plugins.lua
@@ -1,112 +1,9 @@
11 require("lazy-bootstrap")
2-require("lazy").setup({
3- {
4- "nvimtools/none-ls.nvim",
5- dependencies = {
6- { "nvimtools/none-ls-extras.nvim" },
7- },
8- -- dependencies = {
9- -- { dir = "~/code/contributions/none-ls-extras.nvim" },
10- -- },
11- config = function()
12- local null_ls = require("null-ls")
132
14- null_ls.setup({
15- sources = {
16- require("null-ls.builtins.diagnostics.dotenv_linter").with({
17- filetypes = { "env" },
18- }),
19- require("null-ls.builtins.formatting.prettier").with({
20- filetypes = { "sh", "env" },
21- }),
22- require("none-ls.formatting.mbake"),
23- require("null-ls.builtins.diagnostics.checkmake"),
24- require("null-ls.builtins.formatting.isort"),
25- require("none-ls.formatting.taplo"),
26- require("null-ls.builtins.diagnostics.hadolint")
27- },
28- })
29- end,
30- },
31- {
32- "mikavilpas/yazi.nvim",
33- version = "*", -- use the latest stable version
34- event = "VeryLazy",
35- dependencies = {
36- { "nvim-lua/plenary.nvim", lazy = true },
37- },
38- keys = {
39- -- ๐Ÿ‘‡ in this section, choose your own keymappings!
40- {
41- "<leader>-",
42- mode = { "n", "v" },
43- "<cmd>Yazi<cr>",
44- desc = "Open yazi at the current file",
45- },
46- {
47- -- Open in the current working directory
48- "<leader>e",
49- "<cmd>Yazi cwd<cr>",
50- desc = "Open the file manager in nvim's working directory",
51- },
52- {
53- "<c-up>",
54- "<cmd>Yazi toggle<cr>",
55- desc = "Resume the last yazi session",
56- },
57- },
58- ---@type YaziConfig | {}
59- opts = {
60- -- if you want to open yazi instead of netrw, see below for more info
61- open_for_directories = false,
62- keymaps = {
63- show_help = "<f1>",
64- },
65- },
66- -- ๐Ÿ‘‡ if you use `open_for_directories=true`, this is recommended
67- init = function()
68- -- mark netrw as loaded so it's not loaded at all.
69- --
70- -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802
71- vim.g.loaded_netrwPlugin = 1
72- end,
73- },
74- {
75- "rest-nvim/rest.nvim",
76- dependencies = {
77- "nvim-treesitter/nvim-treesitter",
78- opts = function(_, opts)
79- opts.ensure_installed = opts.ensure_installed or {}
80- table.insert(opts.ensure_installed, "http")
81- end,
82- },
83- { "j-hui/fidget.nvim" }
84- },
3+-- These plugins don't need individual files
4+local plugins = {
855 { "nvim-telescope/telescope.nvim" },
866 { "folke/tokyonight.nvim" },
87- {
88- "folke/which-key.nvim",
89- config = function()
90- require("which-key").add({
91- { "<leader>w", proxy = "<c-w>", group = "windows" },
92- })
93- end,
94- },
95- {
96- "nvim-treesitter/nvim-treesitter",
97- branch = 'master',
98- lazy = false,
99- build = ":TSUpdate",
100- config = function()
101- require("nvim-treesitter.configs").setup({
102- ensure_installed = { "c", "lua", "vim", "vimdoc", "json", "python", "rust", "typescript", "markdown", "bash" },
103- sync_install = false,
104- auto_install = true,
105- ignore_install = {},
106- modules = {}
107- })
108- end
109- },
1107 {
1118 "mason-org/mason.nvim",
1129 opts = {}
@@ -118,11 +15,18 @@ require("lazy").setup({
11815 opts = {},
11916 },
12017 { "windwp/nvim-autopairs", opts = {} },
121- {
122- "saghen/blink.cmp",
123- dependencies = { "rafamadriz/friendly-snippets" },
124- build = "cargo build --release",
125- opts = { cmdline = { enabled = false } },
126- },
127- { "nvim-mini/mini.ai", opts = {} },
128-})
18+ { "nvim-mini/mini.ai", opts = {} },
19+}
20+
21+-- Load plugins from lua/plugins
22+for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath("config") .. "/lua/plugins")) do
23+ if file:sub(-4) == ".lua" then
24+ local mod_str = 'plugins.'..file:sub(1, -5)
25+ local ok, mod = pcall(require, mod_str)
26+ if ok then
27+ table.insert(plugins, mod)
28+ end
29+ end
30+end
31+
32+require("lazy").setup(plugins)
+7-0nvim/lua/plugins/blink.lua
@@ -0,0 +1,7 @@
1+---@type LazySpec
2+return {
3+ "saghen/blink.cmp",
4+ dependencies = { "rafamadriz/friendly-snippets" },
5+ build = "cargo build --release",
6+ opts = { cmdline = { enabled = false } },
7+}
+29-0nvim/lua/plugins/none-ls.lua
@@ -0,0 +1,29 @@
1+---@type LazySpec
2+return {
3+ "nvimtools/none-ls.nvim",
4+ dependencies = {
5+ { "nvimtools/none-ls-extras.nvim" },
6+ },
7+ -- dependencies = {
8+ -- { dir = "~/code/contributions/none-ls-extras.nvim" },
9+ -- },
10+ config = function()
11+ local null_ls = require("null-ls")
12+
13+ null_ls.setup({
14+ sources = {
15+ require("null-ls.builtins.diagnostics.dotenv_linter").with({
16+ filetypes = { "env" },
17+ }),
18+ require("null-ls.builtins.formatting.prettier").with({
19+ filetypes = { "sh", "env" },
20+ }),
21+ require("none-ls.formatting.mbake"),
22+ require("null-ls.builtins.diagnostics.checkmake"),
23+ require("null-ls.builtins.formatting.isort"),
24+ require("none-ls.formatting.taplo"),
25+ require("null-ls.builtins.diagnostics.hadolint")
26+ },
27+ })
28+ end,
29+}
+18-0nvim/lua/plugins/nvim-rest.lua
@@ -0,0 +1,18 @@
1+---@type LazySpec
2+return {
3+ "rest-nvim/rest.nvim",
4+ dependencies = {
5+ { "j-hui/fidget.nvim" },
6+ { "nvim-neotest/nvim-nio" },
7+ {
8+ "nvim-treesitter/nvim-treesitter",
9+ opts = function(_, opts)
10+ opts.ensure_installed = opts.ensure_installed or {}
11+ table.insert(opts.ensure_installed, "http")
12+ end,
13+ }
14+ },
15+ ft = { "http" },
16+ keys = {
17+ }
18+}
+16-0nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,16 @@
1+---@type LazySpec
2+return {
3+ "nvim-treesitter/nvim-treesitter",
4+ branch = 'master',
5+ lazy = false,
6+ build = ":TSUpdate",
7+ config = function()
8+ require("nvim-treesitter.configs").setup({
9+ ensure_installed = { "c", "lua", "vim", "vimdoc", "json", "python", "rust", "typescript", "markdown", "bash" },
10+ sync_install = false,
11+ auto_install = true,
12+ ignore_install = {},
13+ modules = {}
14+ })
15+ end
16+}
+9-0nvim/lua/plugins/which-key.lua
@@ -0,0 +1,9 @@
1+---@type LazySpec
2+return {
3+ "folke/which-key.nvim",
4+ config = function()
5+ require("which-key").add({
6+ { "<leader>w", proxy = "<c-w>", group = "windows" },
7+ })
8+ end,
9+}
+44-0nvim/lua/plugins/yazi.lua
@@ -0,0 +1,44 @@
1+---@type LazySpec
2+return {
3+ "mikavilpas/yazi.nvim",
4+ version = "*", -- use the latest stable version
5+ event = "VeryLazy",
6+ dependencies = {
7+ { "nvim-lua/plenary.nvim", lazy = true },
8+ },
9+ keys = {
10+ -- ๐Ÿ‘‡ in this section, choose your own keymappings!
11+ {
12+ "<leader>-",
13+ mode = { "n", "v" },
14+ "<cmd>Yazi<cr>",
15+ desc = "Open yazi at the current file",
16+ },
17+ {
18+ -- Open in the current working directory
19+ "<leader>e",
20+ "<cmd>Yazi cwd<cr>",
21+ desc = "Open the file manager in nvim's working directory",
22+ },
23+ {
24+ "<c-up>",
25+ "<cmd>Yazi toggle<cr>",
26+ desc = "Resume the last yazi session",
27+ },
28+ },
29+ ---@type YaziConfig | {}
30+ opts = {
31+ -- if you want to open yazi instead of netrw, see below for more info
32+ open_for_directories = false,
33+ keymaps = {
34+ show_help = "<f1>",
35+ },
36+ },
37+ -- ๐Ÿ‘‡ if you use `open_for_directories=true`, this is recommended
38+ init = function()
39+ -- mark netrw as loaded so it's not loaded at all.
40+ --
41+ -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802
42+ vim.g.loaded_netrwPlugin = 1
43+ end,
44+}