upgrade to astronvim v5

This commit is contained in:
Andrew Lee
2025-03-27 21:43:21 -06:00
parent a9b7c5aa4d
commit 9ff02b60e7
9 changed files with 139 additions and 174 deletions

View File

@@ -9,33 +9,30 @@ return {
-- import/override with your plugins folder -- import/override with your plugins folder
{ import = "astrocommunity.colorscheme.catppuccin" }, { import = "astrocommunity.colorscheme.catppuccin" },
-- { import = "astrocommunity.editing-support.yanky-nvim" },
{ import = "astrocommunity.diagnostics.trouble-nvim" }, { import = "astrocommunity.diagnostics.trouble-nvim" },
{ import = "astrocommunity.editing-support.todo-comments-nvim" }, { import = "astrocommunity.editing-support.todo-comments-nvim" },
{ import = "astrocommunity.editing-support.multicursors-nvim" }, -- { import = "astrocommunity.editing-support.multicursors-nvim" },
{ import = "astrocommunity.editing-support.rainbow-delimiters-nvim" }, { import = "astrocommunity.editing-support.rainbow-delimiters-nvim" },
-- { import = "astrocommunity.lsp.lsp-signature-nvim" }, -- { import = "astrocommunity.lsp.inc-rename-nvim" },
{ import = "astrocommunity.lsp.inc-rename-nvim" },
{ import = "astrocommunity.markdown-and-latex.glow-nvim" }, { import = "astrocommunity.markdown-and-latex.glow-nvim" },
-- { import = "astrocommunity.motion.flash-nvim" }, { import = "astrocommunity.recipes.vscode" },
{ import = "astrocommunity.scrolling.mini-animate" }, { import = "astrocommunity.scrolling.mini-animate" },
{ import = "astrocommunity.search.grug-far-nvim" }, { import = "astrocommunity.search.grug-far-nvim" },
{ import = "astrocommunity.test.neotest" }, { import = "astrocommunity.test.neotest" },
{ import = "astrocommunity.utility.noice-nvim" }, -- { import = "astrocommunity.utility.noice-nvim" },
-- { import = "astrocommunity.workflow.hardtime-nvim" },
{ import = "astrocommunity.motion.nvim-surround" }, { import = "astrocommunity.motion.nvim-surround" },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
opts = { opts = {
keymaps = { keymaps = {
normal = "<leader>sa", normal = "<Leader>sa",
normal_cur = false, normal_cur = false,
normal_line = false, normal_line = false,
normal_cur_line = false, normal_cur_line = false,
visual = "<leader>s", visual = "<Leader>s",
visual_line = "<leader>S", visual_line = "<Leader>S",
delete = "<leader>sd", delete = "<Leader>sd",
change = "<leader>sr", change = "<Leader>sr",
}, },
aliases = { aliases = {
["i"] = "]", -- Index ["i"] = "]", -- Index
@@ -60,24 +57,24 @@ return {
}, },
}, },
}, },
{ -- {
"folke/noice.nvim", -- "folke/noice.nvim",
opts = { -- opts = {
routes = { -- routes = {
{ -- {
filter = { -- filter = {
event = "msg_show", -- event = "msg_show",
any = { -- any = {
{ find = "%d+L, %d+B" }, -- { find = "%d+L, %d+B" },
{ find = "; after #%d+" }, -- { find = "; after #%d+" },
{ find = "; before #%d+" }, -- { find = "; before #%d+" },
{ find = "%d fewer lines" }, -- { find = "%d fewer lines" },
{ find = "%d more lines" }, -- { find = "%d more lines" },
}, -- },
}, -- },
opts = { skip = true }, -- opts = { skip = true },
}, -- },
}, -- },
}, -- },
}, -- },
} }

View File

@@ -1,13 +1,14 @@
require("lazy").setup({ require("lazy").setup({
{ {
"AstroNvim/AstroNvim", "AstroNvim/AstroNvim",
version = "^4", -- Remove version tracking to elect for nighly AstroNvim version = "^5", -- Remove version tracking to elect for nighly AstroNvim
import = "astronvim.plugins", import = "astronvim.plugins",
opts = { -- AstroNvim options must be set here with the `import` key opts = { -- AstroNvim options must be set here with the `import` key
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins
}, },
}, },
{ import = "community" }, { import = "community" },

View File

@@ -1,3 +1,5 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! -- AstroCore provides a central place to modify mappings, vim options, autocommands, and more!
-- Configuration documentation can be found with `:h astrocore` -- Configuration documentation can be found with `:h astrocore`
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) -- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
@@ -10,12 +12,12 @@ return {
opts = { opts = {
-- Configure core features of AstroNvim -- Configure core features of AstroNvim
features = { features = {
large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = true, -- enable autopairs at start autopairs = true, -- enable autopairs at start
cmp = true, -- enable completion at start cmp = true, -- enable completion at start
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on) diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup
highlighturl = true, -- highlight URLs at start highlighturl = true, -- highlight URLs at start
notifications = true, -- enable notifications at start notifications = true, -- enable notifications at start
}, },
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = { diagnostics = {
@@ -24,14 +26,14 @@ return {
}, },
-- vim options can be configured here -- vim options can be configured here
options = { options = {
opt = { -- vim.opt.<key> opt = { -- vim.opt.<key>
relativenumber = true, -- sets vim.opt.relativenumber relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto signcolumn = "yes", -- sets vim.opt.signcolumn to yes
wrap = false, -- sets vim.opt.wrap wrap = false, -- sets vim.opt.wrap
}, },
g = { -- vim.g.<key> g = { -- vim.g.<key>
-- configure global vim variables (vim.g) -- configure global vim variables (vim.g)
-- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup`
-- This can be found in the `lua/lazy_setup.lua` file -- This can be found in the `lua/lazy_setup.lua` file
@@ -44,45 +46,26 @@ return {
n = { n = {
-- second key is the lefthand side of the map -- second key is the lefthand side of the map
-- navigate buffer tabs with `H` and `L` -- navigate buffer tabs
-- L = { ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
-- function() require("astrocore.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, ["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
-- desc = "Next buffer",
-- },
-- H = {
-- function() require("astrocore.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
-- desc = "Previous buffer",
-- },
["<C-j>"] = { "<C-d>", desc = "Scroll half down" },
["<C-k>"] = { "<C-u>", desc = "Scroll half up" },
["<leader>sw"] = { "<leader>saiw", desc = "Surround word", remap = true },
["<Leader>sW"] = { "<leader>saiW", desc = "Surround Word", remap = true },
["<Esc>"] = {
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Dismiss notifications",
},
-- mappings seen under group name "Buffer" -- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" }, ["<Leader>bd"] = {
["<Leader>bD"] = {
function() function()
require("astroui.status.heirline").buffer_picker( require("astroui.status.heirline").buffer_picker(
function(bufnr) require("astrocore.buffer").close(bufnr) end function(bufnr) require("astrocore.buffer").close(bufnr) end
) )
end, end,
desc = "Pick to close", desc = "Close buffer from tabline",
}, },
-- tables with just a `desc` key will be registered with which-key if it's installed -- tables with just a `desc` key will be registered with which-key if it's installed
-- this is useful for naming menus -- this is useful for naming menus
["<Leader>b"] = { desc = "Buffers" }, -- ["<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 -- setting a mapping to false will disable it
-- ["<esc>"] = false, -- ["<C-S>"] = false,
}, },
}, },
}, },

View File

@@ -1,3 +1,5 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine -- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine
-- Configuration documentation can be found with `:h astrolsp` -- Configuration documentation can be found with `:h astrolsp`
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) -- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
@@ -10,16 +12,15 @@ return {
opts = { opts = {
-- Configuration table of features provided by AstroLSP -- Configuration table of features provided by AstroLSP
features = { features = {
autoformat = true, -- enable or disable auto formatting on start codelens = true, -- enable/disable codelens refresh on start
codelens = true, -- enable/disable codelens refresh on start inlay_hints = false, -- enable/disable inlay hints on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting semantic_tokens = true, -- enable/disable semantic token highlighting
}, },
-- customize lsp formatting options -- customize lsp formatting options
formatting = { formatting = {
-- control auto formatting on save -- control auto formatting on save
format_on_save = { format_on_save = {
enabled = true, -- enable or disable format on save globally enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only allow_filetypes = { -- enable format on save for specified filetypes only
-- "go", -- "go",
}, },
@@ -39,23 +40,11 @@ return {
-- enable servers that you already have installed without mason -- enable servers that you already have installed without mason
servers = { servers = {
-- "pyright" -- "pyright"
"zls",
}, },
-- customize language server configuration options passed to `lspconfig` -- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields ---@diagnostic disable: missing-fields
config = { config = {
-- clangd = { capabilities = { offsetEncoding = "utf-8" } }, -- clangd = { capabilities = { offsetEncoding = "utf-8" } },
zls = {
cmd = { "zls" },
filetypes = { "zig" },
},
clangd = {
cmd = {
"clangd",
"--offset-encoding=utf-16",
},
filetypes = { "c", "cpp", "objc", "objcpp" },
},
}, },
-- customize how language servers are attached -- customize how language servers are attached
handlers = { handlers = {
@@ -69,43 +58,41 @@ return {
-- Configure buffer local auto commands to add when attaching a language server -- Configure buffer local auto commands to add when attaching a language server
autocmds = { autocmds = {
-- first key is the `augroup` to add the auto commands to (:h augroup) -- first key is the `augroup` to add the auto commands to (:h augroup)
lsp_document_highlight = { lsp_codelens_refresh = {
-- Optional condition to create/delete auto command group -- Optional condition to create/delete auto command group
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
-- condition will be resolved for each client on each execution and if it ever fails for all clients, -- condition will be resolved for each client on each execution and if it ever fails for all clients,
-- the auto commands will be deleted for that buffer -- the auto commands will be deleted for that buffer
cond = "textDocument/documentHighlight", cond = "textDocument/codeLens",
-- cond = function(client, bufnr) return client.name == "lua_ls" end, -- cond = function(client, bufnr) return client.name == "lua_ls" end,
-- list of auto commands to set -- list of auto commands to set
{ {
-- events to trigger -- events to trigger
event = { "CursorHold", "CursorHoldI" }, event = { "InsertLeave", "BufEnter" },
-- the rest of the autocmd options (:h nvim_create_autocmd) -- the rest of the autocmd options (:h nvim_create_autocmd)
desc = "Document Highlighting", desc = "Refresh codelens (buffer)",
callback = function() vim.lsp.buf.document_highlight() end, callback = function(args)
}, if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end
{ end,
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function() vim.lsp.buf.clear_references() end,
}, },
}, },
}, },
-- mappings to be set up on attaching of a language server -- mappings to be set up on attaching of a language server
mappings = { mappings = {
n = { n = {
gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" },
-- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean
-- gD = { gD = {
-- function() vim.lsp.buf.declaration() end, function() vim.lsp.buf.declaration() end,
-- desc = "Declaration of current symbol", desc = "Declaration of current symbol",
-- cond = "textDocument/declaration", cond = "textDocument/declaration",
-- }, },
-- ["<Leader>uY"] = { ["<Leader>uY"] = {
-- function() require("astrolsp.toggles").buffer_semantic_tokens() end, function() require("astrolsp.toggles").buffer_semantic_tokens() end,
-- desc = "Toggle LSP semantic highlight (buffer)", desc = "Toggle LSP semantic highlight (buffer)",
-- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end, cond = function(client)
-- }, return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil
end,
},
}, },
}, },
-- A custom `on_attach` function to be run after the default `on_attach` function -- A custom `on_attach` function to be run after the default `on_attach` function

View File

@@ -1,3 +1,5 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- AstroUI provides the basis for configuring the AstroNvim User Interface -- AstroUI provides the basis for configuring the AstroNvim User Interface
-- Configuration documentation can be found with `:h astroui` -- Configuration documentation can be found with `:h astroui`
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) -- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
@@ -15,7 +17,7 @@ return {
init = { -- this table overrides highlights in all themes init = { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" }, -- Normal = { bg = "#000000" },
}, },
astrotheme = { -- a table of overrides/changes when applying the astrotheme theme astrodark = { -- a table of overrides/changes when applying the astrotheme theme
-- Normal = { bg = "#000000" }, -- Normal = { bg = "#000000" },
}, },
}, },

View File

@@ -1,41 +1,28 @@
-- Customize Mason plugins if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize Mason
---@type LazySpec ---@type LazySpec
return { return {
-- use mason-lspconfig to configure LSP installations -- use mason-tool-installer for automatically installing Mason packages
{ {
"williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
-- overrides `require("mason-lspconfig").setup(...)` -- overrides `require("mason-tool-installer").setup(...)`
opts = function(_, opts) opts = {
-- add more things to the ensure_installed table protecting against community packs modifying it -- Make sure to use the names found in `:Mason`
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { ensure_installed = {
"lua_ls", -- install language servers
-- add more arguments for adding more language servers "lua-language-server",
})
end, -- install formatters
},
-- 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").list_insert_unique(opts.ensure_installed, {
"prettier",
"stylua", "stylua",
-- add more arguments for adding more null-ls sources
}) -- install debuggers
end, "debugpy",
},
{ -- install any other package
"jay-babu/mason-nvim-dap.nvim", "tree-sitter-cli",
-- 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").list_insert_unique(opts.ensure_installed, {
"python",
-- add more arguments for adding more debuggers
})
end,
}, },
} }

View File

@@ -1,20 +1,24 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize None-ls sources -- Customize None-ls sources
---@type LazySpec ---@type LazySpec
return { return {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
opts = function(_, config) opts = function(_, opts)
-- config variable is the default configuration table for the setup function call -- opts variable is the default configuration table for the setup function call
-- local null_ls = require "null-ls" -- local null_ls = require "null-ls"
-- Check supported formatters and linters -- Check supported formatters and linters
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
config.sources = {
-- Only insert new sources, do not replace the existing ones
-- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function)
opts.sources = require("astrocore").list_insert_unique(opts.sources, {
-- Set a formatter -- Set a formatter
-- null_ls.builtins.formatting.stylua, -- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier, -- null_ls.builtins.formatting.prettier,
} })
return config -- return final config table
end, end,
} }

View File

@@ -1,14 +1,15 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize Treesitter -- Customize Treesitter
---@type LazySpec ---@type LazySpec
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
opts = function(_, opts) opts = {
-- add more things to the ensure_installed table protecting against community packs modifying it ensure_installed = {
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"lua", "lua",
"vim", "vim",
-- add more arguments for adding more treesitter parsers -- add more arguments for adding more treesitter parsers
}) },
end, },
} }

View File

@@ -1,6 +1,7 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- You can also add or configure plugins by creating files in this `plugins/` folder -- You can also add or configure plugins by creating files in this `plugins/` folder
-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE
-- Here are some examples: -- Here are some examples:
---@type LazySpec ---@type LazySpec
@@ -17,26 +18,28 @@ return {
-- == Examples of Overriding Plugins == -- == Examples of Overriding Plugins ==
-- customize alpha options -- customize dashboard options
{ {
"goolord/alpha-nvim", "folke/snacks.nvim",
opts = function(_, opts) opts = {
-- customize the dashboard header dashboard = {
opts.section.header.val = { preset = {
" █████ ███████ ████████ ██████ ██████", header = table.concat({
"██ ██ ██ ██ ██ ██ ██ ██", " █████ ███████ ████████ ██████ ██████ ",
"███████ ███████ ██ ██████ ██ ██", "██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██", "███████ ███████ ██ ██████ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████", "██ ██ ██ ██ ██ ██ ██ ██",
" ", "██ ██ ███████ ██ ██ ██ ██████ ",
" ███  ██ ██  ██ ██ ███  ███", "",
"███  ██ ██  ██ ██ ███ ███", "███  ██ ██  ██ ██ ███  ███",
" ████  ██ ██  ██ ██ ██ ████ ██", "████  ██ ██  ██ ██ ████  ████",
" ██ ██ ██ ██  ██  ██ ████ ██", "██ ██  ██ ██  ██ ██ ██ ████ ██",
" ██   ████   ████   ██ ██  ██", "██  ████  ██ ██  ██ ██  ██  ██",
} "██   ████   ████   ██ ██  ██",
return opts }, "\n"),
end, },
},
},
}, },
-- You can disable default plugins as follows: -- You can disable default plugins as follows: