AstroVim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
BREAKING RELEASE NOTICE: If you were using AstroVim before the official
release, please see the updated user configuration in the lua/user_example
folder
as well as the updated configuration details below and in the user_example
README. The official release came with a lot of restructuring changes to make
things easier and more "future-proof".
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 Nvimtree
- 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,
},
More detailed explanations of the possible configuration options are described in the AstroVim wiki
Guide is given for basic usage
Learn more about the default key bindings
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.