🪴 my neovim config:)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ivy: modularize init

robin 51516fe3 453f1033

+134 -125
+28
config/lua/ivy/config/local.lua
··· 1 + do 2 + local localpackdir = vim.fn.stdpath("data") .. "/site/pack/local/start" 3 + vim.opt.rtp:append(localpackdir) 4 + 5 + local ok, loom = pcall(require, "loom") 6 + if not ok then 7 + return 8 + end 9 + ---@diagnostic disable-next-line: missing-fields 10 + loom.setup({ 11 + hlgroups = { 12 + "@loom.indent", 13 + "rainbow.1", 14 + "@loom.indent", 15 + "rainbow.2", 16 + "@loom.indent", 17 + "rainbow.3", 18 + "@loom.indent", 19 + "rainbow.4", 20 + "@loom.indent", 21 + "rainbow.5", 22 + "@loom.indent", 23 + "rainbow.6", 24 + }, 25 + }) 26 + local c = require("evergarden.colors").get() 27 + vim.api.nvim_set_hl(0, "@loom.indent", { fg = c.surface1 }) 28 + end
+94
config/lua/ivy/config/lsp.lua
··· 1 + vim.g.lsp_config = { 2 + common = {}, 3 + servers = function() 4 + return { 5 + astro = {}, 6 + bashls = {}, 7 + clangd = {}, 8 + cssls = {}, 9 + denols = {}, 10 + dockerls = {}, 11 + emmet_language_server = {}, 12 + gopls = {}, 13 + hls = {}, 14 + html = {}, 15 + jsonls = { 16 + settings = { 17 + json = { 18 + schemas = require("schemastore").json.schemas(), 19 + validate = { enable = true }, 20 + }, 21 + }, 22 + }, 23 + lua_ls = { 24 + on_init = function(client) 25 + if client.workspace_folders then 26 + local path = client.workspace_folders[1].name 27 + if 28 + path ~= vim.fn.stdpath("config") 29 + and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc")) 30 + then 31 + return 32 + end 33 + end 34 + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { 35 + workspace = { 36 + checkThirdParty = false, 37 + library = { 38 + vim.env.VIMRUNTIME, 39 + -- Depending on the usage, you might want to add additional paths here. 40 + -- "${3rd}/luv/library" 41 + }, 42 + }, 43 + }) 44 + end, 45 + settings = { 46 + Lua = { 47 + runtime = { 48 + version = "LuaJIT", 49 + path = { 50 + "lua/?.lua", 51 + "lua/?/init.lua", 52 + }, 53 + }, 54 + diagnostics = { 55 + globals = { "vim", "package", "table" }, 56 + }, 57 + hint = { 58 + enable = true, 59 + arrayIndex = "Disable", 60 + }, 61 + }, 62 + }, 63 + }, 64 + marksman = {}, 65 + nil_ls = {}, 66 + nushell = {}, 67 + taplo = {}, 68 + teal_ls = {}, 69 + tinymist = {}, 70 + ts_ls = {}, 71 + tailwindcss = {}, 72 + vue_ls = {}, 73 + yamlls = { 74 + settings = { 75 + yaml = { 76 + schemas = vim.tbl_extend("keep", { 77 + ["https://json.schemastore.org/github-action"] = ".github/action.{yaml,yml}", 78 + ["https://json.schemastore.org/github-workflow"] = ".github/workflows/*", 79 + ["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*lab-ci.{yaml,yml}", 80 + ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}", 81 + ["https://goreleaser.com/static/schema.json"] = ".goreleaser.{yml,yaml}", 82 + }, require("schemastore").yaml.schemas()), 83 + }, 84 + }, 85 + }, 86 + zk = {}, 87 + zls = {}, 88 + } 89 + end, 90 + on_attach = function(_, buf) 91 + local opts = { buffer = buf } 92 + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) 93 + end, 94 + }
+12 -125
config/lua/ivy/init.lua
··· 1 - vim.g.lsp_config = { 2 - common = {}, 3 - servers = function() 4 - return { 5 - astro = {}, 6 - bashls = {}, 7 - clangd = {}, 8 - cssls = {}, 9 - denols = {}, 10 - dockerls = {}, 11 - emmet_language_server = {}, 12 - gopls = {}, 13 - hls = {}, 14 - html = {}, 15 - jsonls = { 16 - settings = { 17 - json = { 18 - schemas = require("schemastore").json.schemas(), 19 - validate = { enable = true }, 20 - }, 21 - }, 22 - }, 23 - lua_ls = { 24 - on_init = function(client) 25 - if client.workspace_folders then 26 - local path = client.workspace_folders[1].name 27 - if 28 - path ~= vim.fn.stdpath("config") 29 - and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc")) 30 - then 31 - return 32 - end 33 - end 34 - client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { 35 - workspace = { 36 - checkThirdParty = false, 37 - library = { 38 - vim.env.VIMRUNTIME, 39 - -- Depending on the usage, you might want to add additional paths here. 40 - -- "${3rd}/luv/library" 41 - }, 42 - }, 43 - }) 44 - end, 45 - settings = { 46 - Lua = { 47 - runtime = { 48 - version = "LuaJIT", 49 - path = { 50 - "lua/?.lua", 51 - "lua/?/init.lua", 52 - }, 53 - }, 54 - diagnostics = { 55 - globals = { "vim", "package", "table" }, 56 - }, 57 - hint = { 58 - enable = true, 59 - arrayIndex = "Disable", 60 - }, 61 - }, 62 - }, 63 - }, 64 - marksman = {}, 65 - nil_ls = {}, 66 - nushell = {}, 67 - taplo = {}, 68 - teal_ls = {}, 69 - tinymist = {}, 70 - ts_ls = {}, 71 - tailwindcss = {}, 72 - vue_ls = {}, 73 - yamlls = { 74 - settings = { 75 - yaml = { 76 - schemas = vim.tbl_extend("keep", { 77 - ["https://json.schemastore.org/github-action"] = ".github/action.{yaml,yml}", 78 - ["https://json.schemastore.org/github-workflow"] = ".github/workflows/*", 79 - ["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*lab-ci.{yaml,yml}", 80 - ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}", 81 - ["https://goreleaser.com/static/schema.json"] = ".goreleaser.{yml,yaml}", 82 - }, require("schemastore").yaml.schemas()), 83 - }, 84 - }, 85 - }, 86 - zk = {}, 87 - zls = {}, 88 - } 89 - end, 90 - on_attach = function(_, buf) 91 - local opts = { buffer = buf } 92 - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) 93 - end, 94 - } 95 - 96 1 local config_base = "ivy.config" 97 2 98 3 local load_cfg = function(name) ··· 107 12 vim 108 13 .iter(ipairs({ 109 14 { "disable" }, 110 - { "autocmds" }, 15 + { "autocmds", event = "ConfigDone" }, 111 16 { "cmds", event = "VimEnter" }, 112 - { "ft" }, 17 + { "ft", event = "ConfigDone" }, 113 18 { "keybinds", event = "UIEnter" }, 114 19 { "neovide", event = "UIEnter" }, 115 20 { "options" }, 21 + { "local", event = "ConfigDone" }, 22 + { "lsp", event = "ConfigDone" }, 116 23 })) 117 24 :each(function(_, opts) 118 25 local name = opts[1] 119 26 if not name then 120 27 return 121 28 end 29 + ---@type string? 30 + local pattern 122 31 if opts.event then 32 + if opts.event == "ConfigDone" then 33 + opts.event = "User" 34 + opts.pattern = "ConfigDone" 35 + end 123 36 vim.api.nvim_create_autocmd(opts.event, { 124 37 group = vim.api.nvim_create_augroup("ivy:" .. vim.inspect(opts.event) .. "[" .. name .. "]", { clear = true }), 38 + pattern = pattern, 125 39 callback = function(_) 126 40 load_cfg(name) 127 41 end, ··· 134 48 135 49 require("lz.n").load("ivy.plugins") 136 50 137 - do 138 - local localpackdir = vim.fn.stdpath("data") .. "/site/pack/local/start" 139 - vim.opt.rtp:append(localpackdir) 140 - 141 - local ok, loom = pcall(require, "loom") 142 - if not ok then 143 - return 144 - end 145 - ---@diagnostic disable-next-line: missing-fields 146 - loom.setup({ 147 - hlgroups = { 148 - "@loom.indent", 149 - "rainbow.1", 150 - "@loom.indent", 151 - "rainbow.2", 152 - "@loom.indent", 153 - "rainbow.3", 154 - "@loom.indent", 155 - "rainbow.4", 156 - "@loom.indent", 157 - "rainbow.5", 158 - "@loom.indent", 159 - "rainbow.6", 160 - }, 161 - }) 162 - local c = require("evergarden.colors").get() 163 - vim.api.nvim_set_hl(0, "@loom.indent", { fg = c.surface1 }) 164 - end 51 + vim.api.nvim_exec_autocmds("User", { pattern = "ConfigDone" }) 165 52 166 53 require("ivy.health").loaded = true