From 9d4c092e318af5472ad7d2f72b372aa7550dbca2 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Tue, 13 Feb 2024 11:29:05 -0500 Subject: [PATCH] refactor: simplify file structure --- init.lua | 68 ++++++++++++++++++++++++++++++++++++++++--- lua/config/lazy.lua | 47 ------------------------------ lua/config/polish.lua | 16 ---------- 3 files changed, 64 insertions(+), 67 deletions(-) delete mode 100644 lua/config/lazy.lua delete mode 100644 lua/config/polish.lua diff --git a/init.lua b/init.lua index adc5575..76e845e 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,64 @@ --- bootstrap lazy.nvim, AstroNvim, and user plugins -require "config.lazy" --- run polish file at the very end -pcall(require, "config.polish") +local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +if not (vim.env.LAZY or vim.loop.fs_stat(lazypath)) then + vim.g.astronvim_first_install = true -- lets AstroNvim know that this is an initial installation + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +local lazy_loaded, lazy = pcall(require, "lazy") -- validate that lazy is available +if not lazy_loaded then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end + +-- must configure leader key before Lazy is set up +vim.g.mapleader = " " + +-- Set to false to disable icons (if no Nerd Font is available) +vim.g.icons_enabled = true + +---@type LazyConfig +lazy.setup({ + -- TODO: change `branch="v4"` to `version="^4"` on release + { "AstroNvim/AstroNvim", branch = "v4", import = "astronvim.plugins" }, + -- AstroCommunity: import any community modules here + -- TODO: Remove branch v4 on release + -- { "AstroNvim/astrocommunity", branch = "v4" }, + -- { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins + { import = "plugins" }, +} --[[@as LazySpec]], { + install = { colorscheme = { "astrodark", "habamax" } }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) + +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This just pure lua so anything that doesn't +-- fit in the normal config locations above can go here + +-- Set up custom filetypes +-- vim.filetype.add { +-- extension = { +-- foo = "fooscript", +-- }, +-- filename = { +-- ["Foofile"] = "fooscript", +-- }, +-- pattern = { +-- ["~/%.config/foo/.*"] = "fooscript", +-- }, +-- } diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua deleted file mode 100644 index 971a26f..0000000 --- a/lua/config/lazy.lua +++ /dev/null @@ -1,47 +0,0 @@ -local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" -if not (vim.env.LAZY or vim.loop.fs_stat(lazypath)) then - vim.g.astronvim_first_install = true -- lets AstroNvim know that this is an initial installation - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) -end -vim.opt.rtp:prepend(lazypath) - -local lazy_loaded, lazy = pcall(require, "lazy") -- validate that lazy is available -if not lazy_loaded then - -- stylua: ignore - vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) - vim.fn.getchar() - vim.cmd.quit() -end - --- must configure leader key before Lazy is set up -vim.g.mapleader = " " - --- Set to false to disable icons (if no Nerd Font is available) -vim.g.icons_enabled = true - ----@type LazyConfig -lazy.setup({ - -- TODO: change `branch="v4"` to `version="^4"` on release - { "AstroNvim/AstroNvim", branch = "v4", import = "astronvim.plugins" }, - -- AstroCommunity: import any community modules here - -- TODO: Remove branch v4 on release - -- { "AstroNvim/astrocommunity", branch = "v4" }, - -- { import = "astrocommunity.pack.lua" }, - -- import/override with your plugins - { import = "plugins" }, -} --[[@as LazySpec]], { - install = { colorscheme = { "astrodark", "habamax" } }, - performance = { - rtp = { - -- disable some rtp plugins, add more to your liking - disabled_plugins = { - "gzip", - "netrwPlugin", - "tarPlugin", - "tohtml", - "zipPlugin", - }, - }, - }, -} --[[@as LazyConfig]]) diff --git a/lua/config/polish.lua b/lua/config/polish.lua deleted file mode 100644 index 123798f..0000000 --- a/lua/config/polish.lua +++ /dev/null @@ -1,16 +0,0 @@ --- This file is automatically ran last in the setup process and is a good place to configure --- augroups/autocommands and custom filetypes also this just pure lua so --- anything that doesn't fit in the normal config locations above can go here - --- Set up custom filetypes --- vim.filetype.add { --- extension = { --- foo = "fooscript", --- }, --- filename = { --- ["Foofile"] = "fooscript", --- }, --- pattern = { --- ["~/%.config/foo/.*"] = "fooscript", --- }, --- }