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
No known key found for this signature in database
GPG Key ID: 4224A6EA9A8CAAA8
18 changed files with 176 additions and 169 deletions

10
.github/README.md vendored
View File

@ -9,12 +9,8 @@ A user configuration template for [AstroNvim](https://github.com/AstroNvim/Astro
```shell
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
```
#### Clone AstroNvim
```shell
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
mv ~/.local/state/nvim ~/.local/state/nvim.bak
mv ~/.cache/nvim ~/.cache/nvim.bak
```
#### Create a new user repository from this template
@ -26,7 +22,7 @@ You can also just clone this repository directly if you do not want to track you
#### Clone the repository
```shell
git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim/lua/user
git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim
```
#### Start Neovim

View File

@ -1,3 +0,0 @@
return { -- a table of overrides/changes to the duskfox theme
Normal = { bg = "#000000" },
}

View File

@ -1,3 +0,0 @@
return { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" },
}

View File

@ -1,85 +1,4 @@
return {
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Set colorscheme to use
colorscheme = "astrodark",
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- 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"
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
},
},
},
-- This function is run last and is a good place to configuring
-- 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
polish = function()
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
end,
}
-- bootstrap lazy.nvim, AstroNvim, and user plugins
require "config.lazy"
-- run polish file at the very end
pcall(require, "config.polish")

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" },
},
},
},
}

View File

@ -6,7 +6,7 @@ return {
-- 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("astronvim.utils").list_insert_unique(opts.ensure_installed, {
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "lua_ls",
})
end,
@ -17,7 +17,7 @@ return {
-- 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("astronvim.utils").list_insert_unique(opts.ensure_installed, {
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "prettier",
-- "stylua",
})
@ -28,7 +28,7 @@ return {
-- 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("astronvim.utils").list_insert_unique(opts.ensure_installed, {
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "python",
})
end,

View File

@ -2,7 +2,7 @@ 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("astronvim.utils").list_insert_unique(opts.ensure_installed, {
opts.ensure_installed = require("astrocore.utils").list_insert_unique(opts.ensure_installed, {
-- "lua"
})
end,

View File

@ -1,28 +0,0 @@
-- 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.)
return {
-- 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 the `name` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { name = "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,
},
}

View File

@ -1,30 +0,0 @@
-- set vim options here (vim.<first_key>.<second_key> = value)
return {
opt = {
-- set to true or false etc.
relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
},
g = {
mapleader = " ", -- sets vim.g.mapleader
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
resession_enabled = false, -- enable experimental resession.nvim session management (will be default in AstroNvim v4)
},
}
-- If you need more control, you can use the function()...end notation
-- return function(local_vim)
-- local_vim.opt.relativenumber = true
-- local_vim.g.mapleader = " "
-- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list
-- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list
--
-- return local_vim
-- end

View File

@ -1,9 +0,0 @@
return {
-- Add the community repository of plugin specifications
"AstroNvim/astrocommunity",
-- example of imporing a plugin, comment out to use it or add your own
-- available plugins can be found at https://github.com/AstroNvim/astrocommunity
-- { import = "astrocommunity.colorscheme.catppuccin" },
-- { import = "astrocommunity.completion.copilot-lua-cmp" },
}