{"id":28376664,"url":"https://github.com/astronvim/astrocore","last_synced_at":"2025-06-26T14:31:33.113Z","repository":{"id":182607165,"uuid":"668765487","full_name":"AstroNvim/astrocore","owner":"AstroNvim","description":"Core AstroNvim configuration engine","archived":false,"fork":false,"pushed_at":"2025-06-06T15:44:48.000Z","size":398,"stargazers_count":45,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T23:16:07.529Z","etag":null,"topics":["astronvim","astrovim","lua","neovim","neovim-lua","neovim-lua-plugin","neovim-plugin"],"latest_commit_sha":null,"homepage":"https://AstroNvim.com","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AstroNvim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-20T14:40:40.000Z","updated_at":"2025-06-06T12:17:05.000Z","dependencies_parsed_at":"2023-10-02T22:59:46.837Z","dependency_job_id":"bd81c96b-ea85-417c-aac6-8157c9f295fb","html_url":"https://github.com/AstroNvim/astrocore","commit_stats":null,"previous_names":["astronvim/astrocore"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/AstroNvim/astrocore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroNvim%2Fastrocore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroNvim%2Fastrocore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroNvim%2Fastrocore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroNvim%2Fastrocore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstroNvim","download_url":"https://codeload.github.com/AstroNvim/astrocore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroNvim%2Fastrocore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262084730,"owners_count":23256292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astronvim","astrovim","lua","neovim","neovim-lua","neovim-lua-plugin","neovim-plugin"],"created_at":"2025-05-30T00:07:30.657Z","updated_at":"2025-06-26T14:31:33.090Z","avatar_url":"https://github.com/AstroNvim.png","language":"Lua","readme":"# 🧰 AstroCore\n\nAstroCore provides the core Lua API that powers [AstroNvim](https://github.com/AstroNvim/AstroNvim). It provides an interface for configuration auto commands, user commands, on_key functions, key mappings, and more as well as a Lua API of common utility functions.\n\n## ✨ Features\n\n- Unified interface for configuring auto commands, user commands, key maps, on key functions\n- Easy toggles of UI/UX elements and features\n- Universal interface for setting up git worktrees\n- Tab local buffer management for a clean `tabline`\n- Project root detection with automatic `cd` features\n- Session management with [resession.nvim][resession]\n\n## ⚡️ Requirements\n\n- Neovim \u003e= 0.10\n- [lazy.nvim](https://github.com/folke/lazy.nvim)\n- [resession.nvim][resession] (_optional_)\n\n## 📦 Installation\n\nInstall the plugin with the lazy plugin manager:\n\n```lua\nreturn {\n  \"AstroNvim/astrocore\",\n  lazy = false, -- disable lazy loading\n  priority = 10000, -- load AstroCore first\n  opts = {\n    -- set configuration options  as described below\n  },\n}\n```\n\n\u003e 💡 If you want to enable session management with [resession.nvim][resession], enable it in the setup:\n\n```lua\nrequire(\"resession\").setup {\n  extensions = {\n    astrocore = {},\n  },\n}\n```\n\n## ⚙️ Configuration\n\n**AstroCore** comes with no defaults, but can be configured fully through the `opts` table in lazy. Here are descriptions of the options and some example usages:\n\n```lua\n---@type AstroCoreConfig\nlocal opts = {\n  -- easily configure auto commands\n  autocmds = {\n    -- first key is the `augroup` (:h augroup)\n    highlighturl = {\n      -- list of auto commands to set\n      {\n        -- events to trigger\n        event = { \"VimEnter\", \"FileType\", \"BufEnter\", \"WinEnter\" },\n        -- the rest of the autocmd options (:h nvim_create_autocmd)\n        desc = \"URL Highlighting\",\n        callback = function() require(\"astrocore\").set_url_match() end,\n      },\n    },\n  },\n  -- easily configure user commands\n  commands = {\n    -- key is the command name\n    AstroReload = {\n      -- first element with no key is the command (string or function)\n      function() require(\"astrocore\").reload() end,\n      -- the rest are options for creating user commands (:h nvim_create_user_command)\n      desc = \"Reload AstroNvim (Experimental)\",\n    },\n  },\n  -- Configure diagnostics options (`:h vim.diagnostic.config()`)\n  diagnostics = {\n    update_in_insert = false,\n  },\n  -- passed to `vim.filetype.add`\n  filetypes = {\n    -- see `:h vim.filetype.add` for usage\n    extension = {\n      foo = \"fooscript\",\n    },\n    filename = {\n      [\".foorc\"] = \"fooscript\",\n    },\n    pattern = {\n      [\".*/etc/foo/.*\"] = \"fooscript\",\n    },\n  },\n  -- Configuration of vim mappings to create\n  mappings = {\n    -- map mode (:h map-modes)\n    n = {\n      -- use vimscript strings for mappings\n      [\"\u003cC-s\u003e\"] = { \":w!\u003ccr\u003e\", desc = \"Save File\" },\n      -- navigate buffer tabs with `H` and `L`\n      L = {\n        function() require(\"astrocore.buffer\").nav(vim.v.count1) end,\n        desc = \"Next buffer\",\n      },\n      H = {\n        function() require(\"astrocore.buffer\").nav(-vim.v.count1) end,\n        desc = \"Previous buffer\",\n      },\n      -- tables with just a `desc` key will be registered with which-key if it's installed\n      -- this is useful for naming menus\n      [\"\u003cleader\u003eb\"] = { desc = \"Buffers\" },\n    },\n  },\n  -- easily configure functions on key press\n  on_keys = {\n    -- first key is the namespace\n    auto_hlsearch = {\n      -- list of functions to execute on key press (:h vim.on_key)\n      function(char) -- example automatically disables `hlsearch` when not actively searching\n        if vim.fn.mode() == \"n\" then\n          local new_hlsearch = vim.tbl_contains({ \"\u003cCR\u003e\", \"n\", \"N\", \"*\", \"#\", \"?\", \"/\" }, vim.fn.keytrans(char))\n          if vim.opt.hlsearch:get() ~= new_hlsearch then vim.opt.hlsearch = new_hlsearch end\n        end\n      end,\n    },\n  },\n  -- easily configure vim options\n  options = {\n    -- first key is the type of option `vim.\u003cfirst_key\u003e`\n    opt = {\n      relativenumber = true, -- sets `vim.opt.relativenumber`\n      signcolumn = \"auto\", -- sets `vim.opt.relativenumber`\n    },\n    g = {\n      -- set global `vim.g` settings here\n    },\n  },\n  -- configure AstroNvim features\n  features = {\n    autopairs = true, -- enable or disable autopairs on start\n    cmp = true, -- enable or disable cmp on start\n    diagnostics = { virtual_text = true, virtual_lines = false }, -- enable or disable diagnostics features on start\n    highlighturl = true, -- enable or disable highlighting of urls on start\n    -- table for defining the size of the max file for all features, above these limits we disable features like treesitter.\n    large_buf = {\n      -- whether to enable large file detection for a buffer (must return false to disable)\n      -- first parameter is the buffer number, the second is the large buffer configuration table\n      -- return values:\n      --   - `true` or `nil` to continue and respects all changes made to the large buffer configuration table\n      --   - `false` to disable large file detection for the buffer\n      --   - a new table of large buffer options to use instead of the defaults\n      enabled = function(bufnr, config) end,\n      notify = true, -- whether or not to display a notification when a large file is detected\n      size = 1024 * 100, -- max file size (or false to disable check)\n      lines = 10000, -- max number of lines (or false to disable check)\n      line_length = 1000, -- average line length (or false to disable check)\n    },\n    notifications = true, -- enable or disable notifications on start\n  },\n  -- Enable git integration for detached worktrees\n  git_worktrees = {\n    { toplevel = vim.env.HOME, gitdir = vim.env.HOME .. \"/.dotfiles\" },\n  },\n  -- Configure project root detection, check status with `:AstroRootInfo`\n  rooter = {\n    -- list of detectors in order of prevalence, elements can be:\n    --   \"lsp\" : lsp detection\n    --   string[] : a list of directory patterns to look for\n    --   fun(bufnr: integer): string|string[] : a function that takes a buffer number and outputs detected roots\n    detector = {\n      \"lsp\", -- highest priority is getting workspace from running language servers\n      { \".git\", \"_darcs\", \".hg\", \".bzr\", \".svn\" }, -- next check for a version controlled parent directory\n      { \"lua\", \"MakeFile\", \"package.json\" }, -- lastly check for known project root files\n    },\n    -- ignore things from root detection\n    ignore = {\n      servers = {}, -- list of language server names to ignore (Ex. { \"efm\" })\n      dirs = {}, -- list of directory patterns (Ex. { \"~/.cargo/*\" })\n    },\n    -- automatically update working directory (update manually with `:AstroRoot`)\n    autochdir = false,\n    -- scope of working directory to change (\"global\"|\"tab\"|\"win\")\n    scope = \"global\",\n    -- show notification on every working directory change\n    notify = false,\n  },\n  -- Configuration table of session options for AstroNvim's session management powered by Resession\n  sessions = {\n    -- Configure auto saving\n    autosave = {\n      last = true, -- auto save last session\n      cwd = true, -- auto save session for each working directory\n    },\n    -- Patterns to ignore when saving sessions\n    ignore = {\n      dirs = {}, -- working directories to ignore sessions in\n      filetypes = { \"gitcommit\", \"gitrebase\" }, -- filetypes to ignore sessions\n      buftypes = {}, -- buffer types to ignore sessions\n    },\n  },\n}\n```\n\n## 📦 API\n\n**AstroCore** provides a Lua API with utility functions. This can be viewed with `:h astrocore` or in the repository at [doc/api.md](doc/api.md)\n\n[resession]: https://github.com/stevearc/resession.nvim/\n\n## 🚀 Contributing\n\nIf you plan to contribute, please check the [contribution guidelines](https://github.com/AstroNvim/.github/blob/main/CONTRIBUTING.md) first.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastronvim%2Fastrocore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastronvim%2Fastrocore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastronvim%2Fastrocore/lists"}