diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..8415579 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,3 @@ +{ + "format.enable": false +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 20da920..04e39ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.1.0](https://github.com/AstroNvim/astrocore/compare/v2.0.5...v2.1.0) (2026-02-06) + + +### Features + +* add AstroUpdateCompleted event after Mason tools update ([e619a6b](https://github.com/AstroNvim/astrocore/commit/e619a6bd3ffff71d8b014cc74e4cde92b9f540c8)) + ## [2.0.5](https://github.com/AstroNvim/astrocore/compare/v2.0.4...v2.0.5) (2025-04-30) diff --git a/doc/api.md b/doc/api.md index f81f2db..e44697c 100644 --- a/doc/api.md +++ b/doc/api.md @@ -4,6 +4,15 @@ astrocore API documentation ## astrocore +AstroNvim Core Utilities + +Various utility functions to use within AstroNvim and user configurations. + +This module can be loaded with `local astro = require "astrocore"` + +copyright 2023 +license GNU General Public License v3.0 + ### cmd @@ -379,7 +388,7 @@ string ```lua -{ [string]: table } +table ``` A table to manage ToggleTerm terminals created by the user, indexed by the command run and then the instance number @@ -438,6 +447,15 @@ mode: ## astrocore.buffer +AstroNvim Buffer Utilities + +Buffer management related utility functions + +This module can be loaded with `local buffer_utils = require "astrocore.buffer"` + +copyright 2023 +license GNU General Public License v3.0 + ### close @@ -657,6 +675,15 @@ function astrocore.buffer.wipe(bufnr?: integer, force?: boolean) ## astrocore.buffer.comparator +AstroNvim Buffer Comparators + +Buffer comparator functions for sorting buffers + +This module can be loaded with `local buffer_comparators = require "astrocore.buffer.comparator"` + +copyright 2023 +license GNU General Public License v3.0 + ### bufnr @@ -740,6 +767,19 @@ function astrocore.buffer.comparator.unique_path(bufnr_a: integer, bufnr_b: inte ## astrocore.rooter +AstroNvim Rooter + +Utilities necessary for automatic root detectoin + +This module is heavily inspired by LazyVim and project.nvim +https://github.com/ahmedkhalf/project.nvim +https://github.com/LazyVim/LazyVim/blob/98db7ec0d287adcd8eaf6a93c4a392f588b5615a/lua/lazyvim/util/root.lua + +This module can be loaded with `local rooter = require "astrocore.rooter"` + +copyright 2023 +license GNU General Public License v3.0 + ### bufpath @@ -883,6 +923,15 @@ function astrocore.rooter.set_pwd(root: AstroCoreRooterRoot, config?: AstroCoreR ## astrocore.toggles +AstroNvim UI/UX Toggles + + Utility functions for easy UI toggles. + +This module can be loaded with `local ui = require("astrocore.toggles")` + +copyright 2023 +license GNU General Public License v3.0 + ### autochdir diff --git a/doc/astrocore.txt b/doc/astrocore.txt index 2a4f93e..147234d 100644 --- a/doc/astrocore.txt +++ b/doc/astrocore.txt @@ -1,4 +1,4 @@ -*astrocore.txt* For Neovim >= 0.9.0 Last change: 2025 April 30 +*astrocore.txt* For Neovim >= 0.9.0 Last change: 2026 February 06 ============================================================================== Table of Contents *astrocore-table-of-contents* @@ -251,6 +251,14 @@ astrocore API documentation ASTROCORE *astrocore-lua-api-astrocore* +AstroNvim Core Utilities + +Various utility functions to use within AstroNvim and user configurations. + +This module can be loaded with `local astro = require "astrocore"` + +copyright 2023 license GNU General Public License v3.0 + CMD ~ @@ -641,7 +649,7 @@ regex used for matching a valid URL/URI string USER_TERMINALS ~ >lua - { [string]: table } + table < A table to manage ToggleTerm terminals created by the user, indexed by the @@ -702,6 +710,15 @@ _param_ `on_error` — the callback to execute if unable to open the file ASTROCORE.BUFFER *astrocore-lua-api-astrocore.buffer* +AstroNvim Buffer Utilities + +Buffer management related utility functions + +This module can be loaded with `local buffer_utils = require +"astrocore.buffer"` + +copyright 2023 license GNU General Public License v3.0 + CLOSE ~ @@ -933,6 +950,15 @@ _param_ `force` — Whether or not to foce close the buffers or confirm changes ASTROCORE.BUFFER.COMPARATOR *astrocore-lua-api-astrocore.buffer.comparator* +AstroNvim Buffer Comparators + +Buffer comparator functions for sorting buffers + +This module can be loaded with `local buffer_comparators = require +"astrocore.buffer.comparator"` + +copyright 2023 license GNU General Public License v3.0 + BUFNR ~ @@ -1021,6 +1047,18 @@ sorted before A ASTROCORE.ROOTER *astrocore-lua-api-astrocore.rooter* +AstroNvim Rooter + +Utilities necessary for automatic root detectoin + +This module is heavily inspired by LazyVim and project.nvim +https://github.com/ahmedkhalf/project.nvim +https://github.com/LazyVim/LazyVim/blob/98db7ec0d287adcd8eaf6a93c4a392f588b5615a/lua/lazyvim/util/root.lua + +This module can be loaded with `local rooter = require "astrocore.rooter"` + +copyright 2023 license GNU General Public License v3.0 + BUFPATH ~ @@ -1165,6 +1203,14 @@ _return_ `success` — whether or not the pwd was successfully set ASTROCORE.TOGGLES *astrocore-lua-api-astrocore.toggles* +AstroNvim UI/UX Toggles + +Utility functions for easy UI toggles. + +This module can be loaded with `local ui = require("astrocore.toggles")` + +copyright 2023 license GNU General Public License v3.0 + AUTOCHDIR ~ diff --git a/lua/astrocore/init.lua b/lua/astrocore/init.lua index 1111e6e..bf1b74e 100644 --- a/lua/astrocore/init.lua +++ b/lua/astrocore/init.lua @@ -27,7 +27,16 @@ end --- Sync Lazy and then update Mason function M.update_packages() require("lazy").sync { wait = true } - if vim.fn.exists ":MasonToolsUpdate" > 0 then vim.cmd.MasonToolsUpdate() end + if vim.fn.exists ":MasonToolsUpdate" > 0 then + vim.api.nvim_create_autocmd("User", { + pattern = "MasonToolsUpdateCompleted", + once = true, + callback = function() M.event("UpdateCompleted", true) end, + }) + vim.cmd.MasonToolsUpdate() + else + M.event("UpdateCompleted", true) + end end --- Partially reload AstroNvim user settings. Includes core vim options, mappings, and highlights. This is an experimental feature and may lead to instabilities until restart. @@ -242,14 +251,9 @@ end ---@return table mappings a table with entries for each map mode function M.empty_map_table() local maps = {} - for _, mode in ipairs { "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t" } do + for _, mode in ipairs { "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t", "ia", "ca", "!a" } do maps[mode] = {} end - if vim.fn.has "nvim-0.10.0" == 1 then - for _, abbr_mode in ipairs { "ia", "ca", "!a" } do - maps[abbr_mode] = {} - end - end return maps end