Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Neovim 0.7 #248

Merged
merged 2 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
255 changes: 41 additions & 214 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<h1 align="center">AstroVim</h1>
<div align="center" id="madewithlua">
<img src="https://astronvim.github.io/img/logo/astronvim.svg" width="110", height="100">
</div>

<h1 align="center">AstroNvim</h1>

<div align="center"><p>
<a href="https://github.com/kabinspace/AstroVim/pulse">
<img src="https://img.shields.io/github/last-commit/kabinspace/AstroVim?color=%4dc71f&label=Last%20Commit&logo=github&style=flat-square"/>
<a href="https://github.com/AstroNvim/AstroNvim/pulse">
<img src="https://img.shields.io/github/last-commit/AstroNvim/AstroNvim?color=%4dc71f&label=Last%20Commit&logo=github&style=flat-square"/>
</a>
<a href="https://github.com/kabinspace/AstroVim/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/kabinspace/AstroVim?label=License&logo=GNU&style=flat-square"/>
<a href="https://github.com/AstroNvim/AstroNvim/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/AstroNvim/AstroNvim?label=License&logo=GNU&style=flat-square"/>
</a>
<a href="https://neovim.io/">
<img src="https://img.shields.io/badge/Neovim-0.6+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/>
<img src="https://img.shields.io/badge/Neovim-0.7+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/>
</a>
<a href="https://discord.gg/UcZutyeaFW">
<img src="https://img.shields.io/badge/discord-Join-7289da?color=%235865F2%20&label=Discord&logo=discord&logoColor=%23ffffff&style=flat-square"/>
Expand All @@ -17,10 +21,14 @@
</div>

<p align="center">
AstroVim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
</p>

> **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](https://astronvim.github.io/) (_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](https://github.com/kabinspace/AstroVim/pull/248)
**REBRANDING NOTICE:** AstroVim will now be known as AstroNvim to clear up any confusion surrounding this being a Neovim configuration vs a Vim configuration. If you have used AstroNvim before the rebranding please run the following command to update your installation repo:

```sh
git -C ~/.config/nvim remote set-url origin https://github.com/AstroNvim/AstroNvim.git
```

> **Pre-v1.0 Notice:** If you were using AstroVim before the v1.0 release, please see the updated documentation because there were breaking changes.

Expand All @@ -30,10 +38,22 @@ AstroVim is an aesthetic and feature-rich neovim config that is extensible and e
![Preview2](./screenshots/preview2.png)
![Preview33](./screenshots/preview3.png)

## ✨ Features

- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp)
- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim)
- Statusline with [Lualine](https://github.com/nvim-lualine/lualine.nvim)
- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim)
- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Formatting and linting with [Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim)
- Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig)

## ⚡ Requirements

- [Nerd Fonts](https://www.nerdfonts.com/font-downloads)
- [Neovim 0.6+](https://github.com/neovim/neovim/releases/tag/v0.6.1)
- [Neovim 0.7+](https://github.com/neovim/neovim/releases/tag/v0.7.0)
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
- Optional Requirements:
- [fzf](https://github.com/junegunn/fzf) - live grep telescope search (`<leader>fw`)
Expand All @@ -45,9 +65,9 @@ AstroVim is an aesthetic and feature-rich neovim config that is extensible and e

> Note when using default theme: For MacOS, the default terminal does not have true color support. You wil need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support.

## 🛠️ Installation
> Note if you are still on Neovim v0.6: You can still install the previous version of AstroNvim that supported. After cloning the repository run `git checkout nvim-0.6` to check out this version. This will no longer be receiving updates.

### Linux
## 🛠️ Installation

#### Make a backup of your current nvim folder

Expand All @@ -58,11 +78,11 @@ mv ~/.config/nvim ~/.config/nvimbackup
#### Clone the repository

```
git clone https://github.com/kabinspace/AstroVim ~/.config/nvim
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
nvim +PackerSync
```

## 📦 Setup
## 📦 Basic Setup

#### Install LSP

Expand All @@ -79,219 +99,26 @@ Example: `:TSInstall python`
Run `:PackerClean` to remove any disabled or unused plugins<br>
Run `:PackerSync` to update and clean plugins<br>

#### Update AstroVim
#### Update AstroNvim

Run `:AstroUpdate` to get the latest updates from the repository<br>

## ✨ Features

- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp)
- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim)
- Statusline with [Lualine](https://github.com/nvim-lualine/lualine.nvim)
- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim)
- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Formatting and linting with [Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim)
- Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig)

## ⚙️ Configuration

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)

```sh
cp -r ~/.config/nvim/lua/user_example/ ~/.config/nvim/lua/user/
```

The provided example
[user_example](https://github.com/kabinspace/AstroVim/blob/main/lua/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`](https://github.com/kabinspace/AstroVim/wiki/Advanced-Configuration)

## Extending AstroVim

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.

### Add more Plugins

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](https://github.com/kabinspace/AstroVim/blob/main/lua/user_example) directory.

### Change Default Plugin Configurations

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.

### Change Default Packer 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`:

```lua
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,
},
```

### Adding sources to `nvim-cmp`

To add new completion sources to `nvim-cmp` you can add the plugin (see above) providing that source like this:

```lua
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.

### Add Custom LSP Server Settings

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`](https://github.com/kabinspace/AstroVim/tree/main/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:

```lua
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}",
},
},
},
},
},
},
```

### Compley LSP server setup

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:

```lua
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,
},
```

### Extending the LSP on_attach Function

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`:

```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,
},
```

## 🗒️ Links

[AstroVim Wiki](https://github.com/kabinspace/AstroVim/wiki)
[AstroNvim Documentation](https://astronvim.github.io/)

- [Basic Usage](https://github.com/kabinspace/AstroVim/wiki/Default-Plugins) is given for basic usage
- [Default Mappings](https://github.com/kabinspace/AstroVim/wiki/Default-Mappings) more about the default key bindings
- [Default Plugins](https://github.com/kabinspace/AstroVim/wiki/Default-Plugins) more about the default plugins
- [Advanced Configuration](https://github.com/kabinspace/AstroVim/wiki/Advanced-Configuration) more about advanced configuration
- [Basic Usage](https://astronvim.github.io/usage/walkthrough) is given for basic usage
- [Default Mappings](https://astronvim.github.io/usage/mappings) more about the default key bindings
- [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults
- [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration

[Watch](https://www.youtube.com/watch?v=JQLZ7NJRTEo&t=4s&ab_channel=JohnCodes) a review video to know about the out of the box experience

## ⭐ Credits

Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroVim possible.
Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible.

- [Plugins](https://github.com/kabinspace/AstroVim/wiki/Default-Plugins)
- [Plugins](https://astronvim.github.io/acknowledgements#plugins-used-in-astronvim)
- [NvChad](https://github.com/NvChad/NvChad)
- [LunarVim](https://github.com/LunarVim)
- [CosmicVim](https://github.com/CosmicNvim/CosmicNvim)
Expand Down
8 changes: 2 additions & 6 deletions colors/default_theme.vim → colors/default_theme.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
" Author: Kabin Karki <kabinkarki555@gmail.com>

lua << EOF
vim.g.colors_name = "default_theme"

package.loaded["default_theme"] = nil
package.loaded["default_theme.base"] = nil
package.loaded["default_theme.treesitter"] = nil
package.loaded["default_theme.lsp"] = nil
package.loaded["default_theme.others"] = nil

require("default_theme")

EOF
require "default_theme"
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vim.opt.rtp:append(vim.fn.stdpath "config" .. "/../astrovim")
vim.opt.rtp:append(vim.fn.stdpath "config" .. "/../astronvim")

local impatient_ok, impatient = pcall(require, "impatient")
if impatient_ok then
Expand Down
12 changes: 6 additions & 6 deletions lua/configs/dashboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ function M.config()
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ██ ██ ██ ███ ███",
" ██ ██ ██ ████ ████",
" ██ ██ ██ ██ ████ ██",
" ██ ██ ██ ██ ██ ██",
" ████ ██ ██ ██",
" ███  ██ ██  ██ ██ ███ ███",
" ████  ██ ██  ██ ██ ████ ████",
" ██ ██  ██ ██  ██ ██ ██ ██████",
" ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██      ██",
" ",
" ",
" ",
Expand All @@ -41,7 +41,7 @@ function M.config()

g.dashboard_custom_footer = {
" ",
" AstroVim loaded " .. plugins_count .. " plugins ",
" AstroNvim loaded " .. plugins_count .. " plugins ",
}
end

Expand Down
2 changes: 1 addition & 1 deletion lua/configs/lsp/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ M.on_attach = function(client, bufnr)
on_attach_override(client, bufnr)
end

vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
vim.api.nvim_create_user_command("Format", vim.lsp.buf.formatting, {})
lsp_highlight_document(client)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/configs/lsp/lsp-installer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lsp_installer.on_server_ready(function(server)
opts.on_attach = require("configs.lsp.handlers").on_attach
opts.capabilities = require("configs.lsp.handlers").capabilities

-- Apply AstroVim server settings (if available)
-- Apply AstroNvim server settings (if available)
local present, av_overrides = pcall(require, "configs.lsp.server-settings." .. server.name)
if present then
opts = vim.tbl_deep_extend("force", av_overrides, opts)
Expand Down
1 change: 1 addition & 0 deletions lua/configs/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function M.config()
disabled_filetypes = { "NvimTree", "neo-tree", "dashboard", "Outline" },
component_separators = "",
section_separators = "",
globalstatus = true,
},
sections = {
lualine_a = { spacer },
Expand Down