AstroVim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
Rebranding Announcement: With AstroVim growing and the Neovim v0.7 release coming up we have decided to do a rebranding to AstroNvim as well as migrating the repository to a dedicated GitHub organization. GitHub will automatically forward the original repository URL to the new location so this should not cause any hiccups on the user facing side. In the mean time feel free to checkout the upcoming new AstroNvim Documentation (Note: This documentation is built for after the migration so the information on it is not entirely accurate to how the repo stands now). This update is expected to come sometime in the next couple weeks as we will wait until Neovim v0.7 stable is available across all popular package managers, this progress can be monitored in PR #248
Pre-v1.0 Notice: If you were using AstroVim before the v1.0 release, please see the updated documentation because there were breaking changes.
- Nerd Fonts
- Neovim 0.6+
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
Note when using default theme: For MacOS, the default terminal does not have true color support. You wil need to use iTerm2 or another terminal emulator that has true color support.
mv ~/.config/nvim ~/.config/nvimbackup
git clone https://github.com/kabinspace/AstroVim ~/.config/nvim
nvim +PackerSync
Enter :LspInstall
followed by the name of the server you want to install
Example: :LspInstall pyright
Enter :TSInstall
followed by the name of the language you want to install
Example: :TSInstall python
Run :PackerClean
to remove any disabled or unused plugins
Run :PackerSync
to update and clean plugins
Run :AstroUpdate
to get the latest updates from the repository
- File explorer with Neo-tree
- Autocompletion with Cmp
- Git integration with Gitsigns
- Statusline with Lualine
- Terminal with Toggleterm
- Fuzzy finding with Telescope
- Syntax highlighting with Treesitter
- Formatting and linting with Null-ls
- Language Server Protocol with Native LSP
To begin making custom user configurations you must create a user/
folder. The provided example can be created with (please note the trailing slashes after the directory names)
cp -r ~/.config/nvim/lua/user_example/ ~/.config/nvim/lua/user/
The provided example
user_example
contains an init.lua
file which can be used for all user configuration. After
running the cp
command above this file can be found in
~/.config/nvim/lua/user/init.lua
.
Advanced Configuration Options are described in the AstroVim wiki
AstroVim should allow you to extend its functionality without going outside of the user
directory!
Please get in contact when you run into some setup issue where that is not the case.
Just copy the packer
configuration without the use
and with a ,
after the last closing }
into the plugins.init
entry of your user/init.lua
file.
See the example in the user_example directory.
AstroVim allows you to easily override the setup of any pre-configured plugins.
Simply add a table to the plugins
table with a key the same name as the
plugin package and return a table with the new options or overrides that you
want. For an example see the included plugins
entry for treesitter
in the
user_example
folder which lets you extend the default treesitter
configuration.
The plugins
table extensibility includes the packer configuration for all
plugins, user plugins as well as plugins configured by AstroVim.
E.g. this code in your init.lua
plugins.init
table entry to remove
dashboard-nvim
and disable lazy loading of toggleterm
:
plugins = {
-- if the plugins init table can be a function on the default plugin table
-- instead of a table to be extended. This lets you modify the details of the default plugins
init = function(plugins)
-- add your new plugins to this table
local my_plugins = {
-- { "andweeb/presence.nvim" },
-- {
-- "ray-x/lsp_signature.nvim",
-- event = "BufRead",
-- config = function()
-- require("lsp_signature").setup()
-- end,
-- },
}
-- Remove a default plugins all-together
plugins["glepnir/dashboard-nvim"] = nil
-- Modify default plugin packer configuration
plugins["akinsho/nvim-toggleterm.lua"]["cmd"] = nil
-- add the my_plugins table to the plugin table
return vim.tbl_deep_extend("force", plugins, my_plugins)
end,
},
To add new completion sources to nvim-cmp
you can add the plugin (see above) providing that source like this:
plugins = {
init = {
{
"Saecki/crates.nvim",
after = "nvim-cmp",
config = function()
require("crates").setup()
local cmp = require "cmp"
local config = cmp.get_config()
table.insert(config.sources, { name = "crates" })
cmp.setup(config)
end,
},
},
},
Use the options provided by nvim-cmp
to change the order, etc. as you see fit.
You might want to override the default LSP settings for some servers to enable advanced features. This can be achieved with the lsp.server-settings
table inside of your user/init.lua
config and creating entries where the keys are equal to the LSP server. Examples of these table entries can be found in /lua/configs/lsp/server-settings
.
For example, if you want to add schemas to the yamlls
LSP server, you can add the following to the user/init.lua
file:
lsp = {
["server-settings"] = {
yamlls = {
settings = {
yaml = {
schemas = {
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
},
},
},
},
},
},
Some plugins need to do special magic to the LSP configuration to enable advanced features. One example for this is the rust-tools.nvim
plugin.
Those can override lsp.server_registration
.
For example the rust-tools.nvim
plugin can be set up in the user/init.lua
file as follows:
plugins = {
init = {
-- Plugin definition:
{
"simrat39/rust-tools.nvim",
requires = { "nvim-lspconfig", "nvim-lsp-installer", "nvim-dap", "Comment.nvim" },
-- Is configured via the server_registration_override installed below!
},
},
},
lsp = {
server_registration = function(server, server_opts)
-- Special code for rust.tools.nvim!
if server.name == "rust_analyzer" then
local extension_path = vim.fn.stdpath "data" .. "/dapinstall/codelldb/extension/"
local codelldb_path = extension_path .. "adapter/codelldb"
local liblldb_path = extension_path .. "lldb/lib/liblldb.so"
require("rust-tools").setup {
server = server_opts,
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
},
}
else
server:setup(server_opts)
end
end,
},
Some users may want to have more control over the on_attach
function of their LSP servers to enable or disable capabilities. This can be extended with lsp.on_attach
in the user/init.lua
file.
For example if you want to disable document formatting for intelephense
in user/init.lua
:
lsp = {
on_attach = function(client, bufnr)
if client.name == "intelephense" then
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
end
end,
},
- Basic Usage is given for basic usage
- Default Mappings more about the default key bindings
- Default Plugins more about the default plugins
- Advanced Configuration more about advanced configuration
Watch a review video to know about the out of the box experience
Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroVim possible.