feat!: Move to AstroNvim v4 distributed through lazy.nvim

This commit is contained in:
Micah Halter
2023-07-25 12:00:48 -04:00
parent 59b12098bd
commit 5dae91a387
18 changed files with 176 additions and 169 deletions

44
lua/config/lazy.lua Normal file
View File

@ -0,0 +1,44 @@
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- 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(vim.env.LAZY or lazypath)
-- TODO: set to true on release
local USE_STABLE = false -- use stable releases of AstroNvim
local spec = {
-- TODO: remove branch v4 on release
{ "AstroNvim/AstroNvim", branch = "v4", version = USE_STABLE and "*" or nil, import = "astronvim.plugins" },
}
if USE_STABLE then table.insert(spec, { import = "astronvim.lazy_snapshot" }) end -- pin plugins to known stable versions/commits
require("lazy").setup {
spec = vim.list_extend(spec, {
-- AstroCommunity import any community modules here
-- { "AstroNvim/astrocommunity" },
-- { import = "astrocommunity.pack.lua" },
{ import = "plugins" }, -- import/override with your plugins
}),
defaults = {
-- By default, only AstroNvim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = true,
},
install = { colorscheme = { "astrodark", "habamax" } },
checker = { enabled = false }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins, add more to your liking
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"zipPlugin",
},
},
},
}

10
lua/config/options.lua Normal file
View File

@ -0,0 +1,10 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/AstroNvim/AstroNvim/blob/main/lua/astronvim/options.lua
-- Add any additional options here
vim.opt.relativenumber = true -- sets vim.opt.relativenumber
vim.opt.number = true -- sets vim.opt.number
vim.opt.spell = false -- sets vim.opt.spell
vim.opt.signcolumn = "auto" -- sets vim.opt.signcolumn to auto
vim.opt.wrap = false -- sets vim.opt.wrap
vim.g.mapleader = " " -- sets vim.g.mapleader

16
lua/config/polish.lua Normal file
View File

@ -0,0 +1,16 @@
-- 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",
-- },
-- }

42
lua/plugins/astrocore.lua Normal file
View File

@ -0,0 +1,42 @@
return {
"AstroNvim/astrocore",
opts = {
features = {
max_file = { size = 1024 * 100, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = true, -- enable autopairs at start
cmp = true, -- enable completion at start
highlighturl = true, -- highlight URLs at start
notifications = true, -- enable notifications at start
},
-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)
mappings = {
-- first key is the mode
n = {
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(
function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
-- tables with just a `desc` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { desc = "Buffers" },
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
},
},
}

39
lua/plugins/astrolsp.lua Normal file
View File

@ -0,0 +1,39 @@
return {
"AstroNvim/astrolsp",
opts = {
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
-- customize lsp formatting options
formatting = {
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
ignore_filetypes = { -- disable format on save for specified filetypes
-- "python",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
-- "lua_ls",
},
timeout_ms = 1000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
},
-- customize language server configuration options passed to `lspconfig`
config = {
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
},
},
}

14
lua/plugins/astroui.lua Normal file
View File

@ -0,0 +1,14 @@
return {
"AstroNvim/astroui",
opts = {
colorscheme = "astrodark", -- change colorscheme
highlights = {
init = { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" },
},
duskfox = { -- a table of overrides/changes to the duskfox theme
-- Normal = { bg = "#000000" },
},
},
},
}

77
lua/plugins/core.lua Normal file
View File

@ -0,0 +1,77 @@
return {
-- customize alpha options
{
"goolord/alpha-nvim",
opts = function(_, opts)
-- customize the dashboard header
opts.section.header.val = {
" █████ ███████ ████████ ██████ ██████",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ███  ██ ██  ██ ██ ███  ███",
" ████  ██ ██  ██ ██ ████  ████",
" ██ ██  ██ ██  ██ ██ ██ ████ ██",
" ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██  ██",
}
return opts
end,
},
-- You can disable default plugins as follows:
-- { "max397574/better-escape.nvim", enabled = false },
--
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
-- {
-- "L3MON4D3/LuaSnip",
-- config = function(plugin, opts)
-- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- add more custom luasnip configuration such as filetype extend or custom snippets
-- local luasnip = require "luasnip"
-- luasnip.filetype_extend("javascript", { "javascriptreact" })
-- end,
-- },
-- {
-- "windwp/nvim-autopairs",
-- config = function(plugin, opts)
-- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- add more custom autopairs configuration such as custom rules
-- local npairs = require "nvim-autopairs"
-- local Rule = require "nvim-autopairs.rule"
-- local cond = require "nvim-autopairs.conds"
-- npairs.add_rules(
-- {
-- Rule("$", "$", { "tex", "latex" })
-- -- don't add a pair if the next character is %
-- :with_pair(cond.not_after_regex "%%")
-- -- don't add a pair if the previous character is xxx
-- :with_pair(
-- cond.not_before_regex("xxx", 3)
-- )
-- -- don't move right when repeat character
-- :with_move(cond.none())
-- -- don't delete if the next character is xx
-- :with_del(cond.not_after_regex "xx")
-- -- disable adding a newline when you press <cr>
-- :with_cr(cond.none()),
-- },
-- -- disable for .vim files, but it work for another filetypes
-- Rule("a", "a", "-vim")
-- )
-- end,
-- },
-- By adding to the which-key config and using our helper function you can add more which-key registered bindings
-- {
-- "folke/which-key.nvim",
-- config = function(plugin, opts)
-- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- Add bindings which show up as group name
-- local wk = require "which-key"
-- wk.register({
-- b = { name = "Buffer" },
-- }, { mode = "n", prefix = "<leader>" })
-- end,
-- },
}

36
lua/plugins/mason.lua Normal file
View File

@ -0,0 +1,36 @@
-- customize mason plugins
return {
-- use mason-lspconfig to configure LSP installations
{
"williamboman/mason-lspconfig.nvim",
-- overrides `require("mason-lspconfig").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "lua_ls",
})
end,
},
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
{
"jay-babu/mason-null-ls.nvim",
-- overrides `require("mason-null-ls").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "prettier",
-- "stylua",
})
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
-- overrides `require("mason-nvim-dap").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "python",
})
end,
},
}

17
lua/plugins/null-ls.lua Normal file
View File

@ -0,0 +1,17 @@
return {
"jose-elias-alvarez/null-ls.nvim",
opts = function(_, config)
-- config variable is the default configuration table for the setup function call
-- local null_ls = require "null-ls"
-- Check supported formatters and linters
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
config.sources = {
-- Set a formatter
-- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier,
}
return config -- return final config table
end,
}

View File

@ -0,0 +1,9 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "lua"
})
end,
}

12
lua/plugins/user.lua Normal file
View File

@ -0,0 +1,12 @@
return {
-- You can also add new plugins here as well:
-- Add plugins, the lazy syntax
-- "andweeb/presence.nvim",
-- {
-- "ray-x/lsp_signature.nvim",
-- event = "BufRead",
-- config = function()
-- require("lsp_signature").setup()
-- end,
-- },
}