fix(asahi): nvim, update configs for asahi machine

This commit is contained in:
vel 2022-12-16 21:52:28 -08:00
parent e5ab647d31
commit 3b843161a0
77 changed files with 1115 additions and 611 deletions

View File

@ -1,8 +1,7 @@
5288bad46858f15f2290aeb3d09c8bd8e58b7882 branch 'main' of https://github.com/AstroNvim/AstroNvim 176265812355a53559497c0f0ada7ab62a2d1ba8 branch 'main' of https://github.com/AstroNvim/AstroNvim
28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d not-for-merge branch 'dap' of https://github.com/AstroNvim/AstroNvim 2ffd706983d0171604941fa31bfd8182db6a530a not-for-merge branch 'format' of https://github.com/AstroNvim/AstroNvim
23d7faaa166f633d00a446726bab2e355143c3e2 not-for-merge branch 'devicon' of https://github.com/AstroNvim/AstroNvim 3dd00eaf98ccaae3c8b4bcf4a4e05390c0139fe6 not-for-merge branch 'gh-pages' of https://github.com/AstroNvim/AstroNvim
1e520d7e47dc588f58f59613ab17300ff8496986 not-for-merge branch 'gh-pages' of https://github.com/AstroNvim/AstroNvim 1356d5364dd54549d93127fbd1ae11bed550712d not-for-merge branch 'heirline_bufferline' of https://github.com/AstroNvim/AstroNvim
c7a79519290352fc5710b95285bb016176a8efd0 not-for-merge branch 'heirline_bufferline' of https://github.com/AstroNvim/AstroNvim ddc49bc4d074d5b9a9899b9bee33de3416f464bd not-for-merge branch 'nightly' of https://github.com/AstroNvim/AstroNvim
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba not-for-merge branch 'nightly' of https://github.com/AstroNvim/AstroNvim 8ec90cc9229a2a22cf94ae5728b5ee44f3b489af not-for-merge branch 'readme_update' of https://github.com/AstroNvim/AstroNvim
b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0 not-for-merge branch 'readme' of https://github.com/AstroNvim/AstroNvim 0c6708938039aed1da4ba8e5f1961b328803462f not-for-merge branch 'remove_mason_lazy_load' of https://github.com/AstroNvim/AstroNvim
e1a36a82a3b53ade76ea1384853d4fd387e81a8c not-for-merge branch 'shields' of https://github.com/AstroNvim/AstroNvim

View File

@ -1 +1 @@
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882

Binary file not shown.

View File

@ -1,2 +1,3 @@
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim 0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8 Riley Smith <riley@rileysmith.me> 1670548363 -0800 pull --rebase: Fast-forward

View File

@ -1,2 +1,3 @@
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim 0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8 Riley Smith <riley@rileysmith.me> 1670548363 -0800 pull --rebase: Fast-forward

View File

@ -1 +1,2 @@
0000000000000000000000000000000000000000 1e520d7e47dc588f58f59613ab17300ff8496986 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head 0000000000000000000000000000000000000000 1e520d7e47dc588f58f59613ab17300ff8496986 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
1e520d7e47dc588f58f59613ab17300ff8496986 3dd00eaf98ccaae3c8b4bcf4a4e05390c0139fe6 Riley Smith <riley@rileysmith.me> 1670548361 -0800 fetch origin: fast-forward

View File

@ -1 +1,3 @@
0000000000000000000000000000000000000000 c7a79519290352fc5710b95285bb016176a8efd0 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head 0000000000000000000000000000000000000000 c7a79519290352fc5710b95285bb016176a8efd0 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
c7a79519290352fc5710b95285bb016176a8efd0 6d7dbb93ab965aef1d48fb23859893bb66ab379f Riley Smith <riley@rileysmith.me> 1670548361 -0800 fetch origin: forced-update
6d7dbb93ab965aef1d48fb23859893bb66ab379f 1356d5364dd54549d93127fbd1ae11bed550712d Riley Smith <riley@rileysmith.me> 1671013094 -0800 fetch origin: forced-update

View File

@ -1 +1,2 @@
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: fast-forward ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: fast-forward
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8 Riley Smith <riley@rileysmith.me> 1670548361 -0800 fetch origin: fast-forward

View File

@ -1 +1,4 @@
0000000000000000000000000000000000000000 0ce1b696613bc3dba23f24508ca5a2b7133fd5ba Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head 0000000000000000000000000000000000000000 0ce1b696613bc3dba23f24508ca5a2b7133fd5ba Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba bbff11735a735bb839862eaba51c96d3a9fb5181 Riley Smith <riley@rileysmith.me> 1670548361 -0800 fetch origin: forced-update
bbff11735a735bb839862eaba51c96d3a9fb5181 f33cf19822c789b04c11a4ef795b462705aabde2 Riley Smith <riley@rileysmith.me> 1671013094 -0800 fetch origin: forced-update
f33cf19822c789b04c11a4ef795b462705aabde2 ddc49bc4d074d5b9a9899b9bee33de3416f464bd Riley Smith <riley@rileysmith.me> 1671252112 -0800 fetch origin: forced-update

View File

@ -1 +1 @@
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8

View File

@ -1 +1 @@
1e520d7e47dc588f58f59613ab17300ff8496986 3dd00eaf98ccaae3c8b4bcf4a4e05390c0139fe6

View File

@ -1 +1 @@
c7a79519290352fc5710b95285bb016176a8efd0 1356d5364dd54549d93127fbd1ae11bed550712d

View File

@ -1 +1 @@
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8

View File

@ -1 +1 @@
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba ddc49bc4d074d5b9a9899b9bee33de3416f464bd

View File

@ -1,6 +1,8 @@
blank_issues_enabled: true blank_issues_enabled: false
contact_links: contact_links:
- name: Discord community - name: r/AstroNvim (Reddit)
url: https://www.reddit.com/r/AstroNvim
about: Ask questions about AstroNvim on the official Subreddit
- name: Discord Chat
url: https://discord.gg/UcZutyeaFW url: https://discord.gg/UcZutyeaFW
about: Ask questions and discussions about AstroNvim on Discord about: Ask questions and have discussions about AstroNvim on Discord

View File

@ -4,21 +4,32 @@
<h1 align="center">AstroNvim</h1> <h1 align="center">AstroNvim</h1>
<div align="center"><p> <h4 align="center">
<a href="https://astronvim.github.io/#%EF%B8%8F-installation">Install</a>
·
<a href="https://astronvim.github.io/#%EF%B8%8F-configuration">Configure</a>
·
<a href="https://astronvim.github.io">Docs</a>
</h4>
<p align="center">
<a href="https://github.com/AstroNvim/AstroNvim/pulse"> <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"/> <img src="https://img.shields.io/github/last-commit/AstroNvim/AstroNvim?style=for-the-badge&logo=github&color=7dc4e4&logoColor=D9E0EE&labelColor=302D41"/>
</a> </a>
<a href="https://github.com/AstroNvim/AstroNvim/blob/main/LICENSE"> <a href="https://github.com/AstroNvim/AstroNvim/releases/latest">
<img src="https://img.shields.io/github/license/AstroNvim/AstroNvim?label=License&logo=GNU&style=flat-square"/> <img src="https://img.shields.io/github/v/release/AstroNvim/AstroNvim?style=for-the-badge&logo=gitbook&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
</a> </a>
<a href="https://neovim.io/"> <a href="https://github.com/catppuccin/catppuccin/stargazers">
<img src="https://img.shields.io/badge/Neovim-0.8+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/> <img src="https://img.shields.io/github/stars/AstroNvim/AstroNvim?style=for-the-badge&logo=apachespark&color=eed49f&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<br>
<a href="https://www.reddit.com/r/AstroNvim/">
<img src="https://img.shields.io/reddit/subreddit-subscribers/AstroNvim?style=for-the-badge&logo=reddit&color=ee99a0&logoColor=D9E0EE&labelColor=302D41"/>
</a> </a>
<a href="https://discord.gg/UcZutyeaFW"> <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"/> <img src="https://img.shields.io/discord/939594913560031363?style=for-the-badge&logo=discord&color=cba6f7&logoColor=D9E0EE&labelColor=302D41"/>
</a> </a>
</p> </p>
</div>
<p align="center"> <p align="center">
AstroNvim 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
@ -28,7 +39,7 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
![Preview1](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dashboard.png) ![Preview1](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dashboard.png)
![Preview2](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/overview.png) ![Preview2](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/overview.png)
![Preview33](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/lsp_hover.png) ![Preview33](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/vertsplit.png)
## ✨ Features ## ✨ Features
@ -41,12 +52,14 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - 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) - 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) - Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig)
- Debug Adapter Protocol with [nvim-dap](https://github.com/mfussenegger/nvim-dap)
- Buffer Line with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim) - Buffer Line with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
## ⚡ Requirements ## ⚡ Requirements
- [Nerd Fonts](https://www.nerdfonts.com/font-downloads) (_Optional with manual intervention:_ See [Documentation on customizing icons](https://astronvim.github.io/Recipes/icons)) - [Nerd Fonts](https://www.nerdfonts.com/font-downloads) (_Optional with manual intervention:_ See [Documentation on customizing icons](https://astronvim.github.io/Recipes/icons))
- [Neovim 0.8 (_Not_ including nightly)](https://github.com/neovim/neovim/releases/tag/v0.8.0) - [Neovim 0.8 (_Not_ including nightly)](https://github.com/neovim/neovim/releases/tag/v0.8.0)
- [Tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/cli/README.md) (_Note:_ This is only necessary if you want to use `auto_install` feature with Treesitter)
- A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions) - A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions)
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) - Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
- Optional Requirements: - Optional Requirements:
@ -61,15 +74,16 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
## 🛠️ Installation ## 🛠️ Installation
#### Make a backup of your current nvim folder #### Make a backup of your current nvim and shared folder
``` ```shell
mv ~/.config/nvim ~/.config/nvimbackup mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
``` ```
#### Clone the repository #### Clone the repository
``` ```shell
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
nvim +PackerSync nvim +PackerSync
``` ```
@ -86,6 +100,11 @@ Example: `:LspInstall pyright`
Enter `:TSInstall` followed by the name of the language you want to install<br> Enter `:TSInstall` followed by the name of the language you want to install<br>
Example: `:TSInstall python` Example: `:TSInstall python`
#### Install Debugger
Enter `:DapInstall` followed by the name of the debugger you want to install<br>
Example: `:DapInstall python`
#### Manage plugins #### Manage plugins
Run `:PackerClean` to remove any disabled or unused plugins<br> Run `:PackerClean` to remove any disabled or unused plugins<br>
@ -105,7 +124,12 @@ Run `:AstroUpdate` to get the latest updates from the repository<br>
- [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults - [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 - [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 ### 📹 Videos
There have been some great review videos released by members of the community! Here are a few:
- [Why I'm quitting VIM by Carlos Mafla](https://www.youtube.com/watch?v=71GDopdc9rw) (Content By: [@gigo6000](https://github.com/gigo6000))
- [Astro Vim - All in one Nvim config!! by John McBride](https://www.youtube.com/watch?v=JQLZ7NJRTEo) (Content By: [@jpmcb](https://github.com/jpmcb))
## ⭐ Credits ## ⭐ Credits

View File

@ -5,4 +5,5 @@ ginit.vim
lua/packer_compiled.lua lua/packer_compiled.lua
lua/user lua/user
plugin plugin
ftplugin
spell spell

View File

@ -5,7 +5,6 @@ for _, source in ipairs {
"core.utils", "core.utils",
"core.options", "core.options",
"core.bootstrap", "core.bootstrap",
"core.plugins",
"core.diagnostics", "core.diagnostics",
"core.autocmds", "core.autocmds",
"core.mappings", "core.mappings",

View File

@ -1,7 +1,5 @@
local status_ok, Comment = pcall(require, "Comment")
if not status_ok then return end
local utils = require "Comment.utils" local utils = require "Comment.utils"
Comment.setup(astronvim.user_plugin_opts("plugins.Comment", { require("Comment").setup(astronvim.user_plugin_opts("plugins.Comment", {
pre_hook = function(ctx) pre_hook = function(ctx)
local location = nil local location = nil
if ctx.ctype == utils.ctype.blockwise then if ctx.ctype == utils.ctype.blockwise then

View File

@ -1,8 +1,6 @@
local status_ok, aerial = pcall(require, "aerial") require("aerial").setup(astronvim.user_plugin_opts("plugins.aerial", {
if not status_ok then return end
aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
attach_mode = "global", attach_mode = "global",
backends = { "lsp", "treesitter", "markdown" }, backends = { "lsp", "treesitter", "markdown", "man" },
layout = { layout = {
min_width = 28, min_width = 28,
}, },
@ -14,12 +12,14 @@ aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
nested_top = "", nested_top = "",
whitespace = " ", whitespace = " ",
}, },
on_attach = function(bufnr) keymaps = {
-- Jump forwards/backwards with '[y' and ']y' ["[y"] = "actions.prev",
vim.keymap.set("n", "[y", "<cmd>AerialPrev<cr>", { buffer = bufnr, desc = "Previous Aerial" }) ["]y"] = "actions.next",
vim.keymap.set("n", "]y", "<cmd>AerialNext<cr>", { buffer = bufnr, desc = "Next Aerial" }) ["[Y"] = "actions.prev_up",
-- Jump up the tree with '[Y' or ']Y' ["]Y"] = "actions.next_up",
vim.keymap.set("n", "[Y", "<cmd>AerialPrevUp<cr>", { buffer = bufnr, desc = "Previous and Up in Aerial" }) ["{"] = false,
vim.keymap.set("n", "]Y", "<cmd>AerialNextUp<cr>", { buffer = bufnr, desc = "Next and Up in Aerial" }) ["}"] = false,
end, ["[["] = false,
["]]"] = false,
},
})) }))

View File

@ -1,7 +1,4 @@
local status_ok, alpha = pcall(require, "alpha") require("alpha").setup(astronvim.user_plugin_opts("plugins.alpha", {
if not status_ok then return end
local alpha_button = astronvim.alpha_button
alpha.setup(astronvim.user_plugin_opts("plugins.alpha", {
layout = { layout = {
{ type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } }, { type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } },
{ {
@ -25,15 +22,15 @@ alpha.setup(astronvim.user_plugin_opts("plugins.alpha", {
{ {
type = "group", type = "group",
val = { val = {
alpha_button("LDR f f", " Find File "), astronvim.alpha_button("LDR f f", " Find File "),
alpha_button("LDR f o", " Recents "), astronvim.alpha_button("LDR f o", " Recents "),
alpha_button("LDR f w", " Find Word "), astronvim.alpha_button("LDR f w", " Find Word "),
alpha_button("LDR f n", " New File "), astronvim.alpha_button("LDR f n", " New File "),
alpha_button("LDR f m", " Bookmarks "), astronvim.alpha_button("LDR f m", " Bookmarks "),
alpha_button("LDR S l", " Last Session "), astronvim.alpha_button("LDR S l", " Last Session "),
}, },
opts = { spacing = 1 }, opts = { spacing = 1 },
}, },
}, },
opts = {}, opts = { noautocmd = true },
})) }))

View File

@ -1,13 +1,7 @@
local status_ok, npairs = pcall(require, "nvim-autopairs") local npairs = require "nvim-autopairs"
if not status_ok then return end
npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", { npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", {
check_ts = true, check_ts = true,
ts_config = { ts_config = { java = false },
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
fast_wrap = { fast_wrap = {
map = "<M-e>", map = "<M-e>",
chars = { "{", "[", "(", '"', "'" }, chars = { "{", "[", "(", '"', "'" },
@ -30,5 +24,5 @@ end
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")
if cmp_status_ok then if cmp_status_ok then
cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { map_char = { tex = "" } }) cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { tex = false })
end end

View File

@ -1,3 +1 @@
local status_ok, better_escape = pcall(require, "better_escape") require("better_escape").setup(astronvim.user_plugin_opts "plugins.better_escape")
if not status_ok then return end
better_escape.setup(astronvim.user_plugin_opts "plugins.better_escape")

View File

@ -1,6 +1,12 @@
local status_ok, bufferline = pcall(require, "bufferline") local close_func = function(bufnum)
if not status_ok then return end local bufdelete_avail, bufdelete = pcall(require, "bufdelete")
bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", { if bufdelete_avail then
bufdelete.bufdelete(bufnum, true)
else
vim.cmd.bdelete { args = { bufnum }, bang = true }
end
end
require("bufferline").setup(astronvim.user_plugin_opts("plugins.bufferline", {
options = { options = {
offsets = { offsets = {
{ filetype = "NvimTree", text = "", padding = 1 }, { filetype = "NvimTree", text = "", padding = 1 },
@ -10,9 +16,21 @@ bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", {
buffer_close_icon = astronvim.get_icon "BufferClose", buffer_close_icon = astronvim.get_icon "BufferClose",
modified_icon = astronvim.get_icon "FileModified", modified_icon = astronvim.get_icon "FileModified",
close_icon = astronvim.get_icon "NeovimClose", close_icon = astronvim.get_icon "NeovimClose",
close_command = close_func,
right_mouse_command = close_func,
max_name_length = 14, max_name_length = 14,
max_prefix_length = 13, max_prefix_length = 13,
tab_size = 20, tab_size = 20,
separator_style = "thin", separator_style = "thin",
}, },
})) }))
local highlights = require "bufferline.highlights"
vim.api.nvim_create_autocmd("User", {
pattern = "AstroColorScheme",
group = "BufferlineCmds",
desc = "Bufferline apply colors after astronvim colorscheme change",
callback = function()
highlights.reset_icon_hl_cache()
highlights.set_all(require("bufferline.config").update_highlights())
end,
})

View File

@ -1,7 +1,7 @@
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp = require "cmp"
local snip_status_ok, luasnip = pcall(require, "luasnip") local snip_status_ok, luasnip = pcall(require, "luasnip")
local lspkind_status_ok, lspkind = pcall(require, "lspkind") local lspkind_status_ok, lspkind = pcall(require, "lspkind")
if not (cmp_status_ok and snip_status_ok) then return end if not snip_status_ok then return end
local setup = cmp.setup local setup = cmp.setup
local border_opts = local border_opts =
{ border = "single", winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None" } { border = "single", winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None" }

View File

@ -1,3 +1,3 @@
local status_ok, colorizer = pcall(require, "colorizer") require("colorizer").setup(
if not status_ok then return end astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } })
colorizer.setup(astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } })) )

View File

@ -1,12 +1,10 @@
local status_ok, dressing = pcall(require, "dressing") require("dressing").setup(astronvim.user_plugin_opts("plugins.dressing", {
if not status_ok then return end
dressing.setup(astronvim.user_plugin_opts("plugins.dressing", {
input = { input = {
default_prompt = "", default_prompt = "",
winhighlight = "Normal:Normal,NormalNC:Normal", win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
}, },
select = { select = {
backend = { "telescope", "builtin" }, backend = { "telescope", "builtin" },
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" }, builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
}, },
})) }))

View File

@ -1,11 +1,10 @@
local status_ok, gitsigns = pcall(require, "gitsigns") require("gitsigns").setup(astronvim.user_plugin_opts("plugins.gitsigns", {
if not status_ok then return end
gitsigns.setup(astronvim.user_plugin_opts("plugins.gitsigns", {
signs = { signs = {
add = { text = "" }, add = { text = "" },
change = { text = "" }, change = { text = "" },
delete = { text = "" }, delete = { text = "" },
topdelete = { text = "" }, topdelete = { text = "" },
changedelete = { text = "" }, changedelete = { text = "" },
untracked = { text = "" },
}, },
})) }))

View File

@ -1,5 +1,5 @@
local status_ok, heirline = pcall(require, "heirline") local heirline = require "heirline"
if not status_ok or not astronvim.status then return end if not astronvim.status then return end
local C = require "default_theme.colors" local C = require "default_theme.colors"
local function setup_colors() local function setup_colors()
@ -9,12 +9,6 @@ local function setup_colors()
local Conditional = astronvim.get_hlgroup("Conditional", { fg = C.purple_1, bg = C.grey_4 }) local Conditional = astronvim.get_hlgroup("Conditional", { fg = C.purple_1, bg = C.grey_4 })
local String = astronvim.get_hlgroup("String", { fg = C.green, bg = C.grey_4 }) local String = astronvim.get_hlgroup("String", { fg = C.green, bg = C.grey_4 })
local TypeDef = astronvim.get_hlgroup("TypeDef", { fg = C.yellow, bg = C.grey_4 }) local TypeDef = astronvim.get_hlgroup("TypeDef", { fg = C.yellow, bg = C.grey_4 })
local HeirlineNormal = astronvim.get_hlgroup("HerlineNormal", { fg = C.blue, bg = C.grey_4 })
local HeirlineInsert = astronvim.get_hlgroup("HeirlineInsert", { fg = C.green, bg = C.grey_4 })
local HeirlineVisual = astronvim.get_hlgroup("HeirlineVisual", { fg = C.purple, bg = C.grey_4 })
local HeirlineReplace = astronvim.get_hlgroup("HeirlineReplace", { fg = C.red_1, bg = C.grey_4 })
local HeirlineCommand = astronvim.get_hlgroup("HeirlineCommand", { fg = C.yellow_1, bg = C.grey_4 })
local HeirlineInactive = astronvim.get_hlgroup("HeirlineInactive", { fg = C.grey_7, bg = C.grey_4 })
local GitSignsAdd = astronvim.get_hlgroup("GitSignsAdd", { fg = C.green, bg = C.grey_4 }) local GitSignsAdd = astronvim.get_hlgroup("GitSignsAdd", { fg = C.green, bg = C.grey_4 })
local GitSignsChange = astronvim.get_hlgroup("GitSignsChange", { fg = C.orange_1, bg = C.grey_4 }) local GitSignsChange = astronvim.get_hlgroup("GitSignsChange", { fg = C.orange_1, bg = C.grey_4 })
local GitSignsDelete = astronvim.get_hlgroup("GitSignsDelete", { fg = C.red_1, bg = C.grey_4 }) local GitSignsDelete = astronvim.get_hlgroup("GitSignsDelete", { fg = C.red_1, bg = C.grey_4 })
@ -22,6 +16,21 @@ local function setup_colors()
local DiagnosticWarn = astronvim.get_hlgroup("DiagnosticWarn", { fg = C.orange_1, bg = C.grey_4 }) local DiagnosticWarn = astronvim.get_hlgroup("DiagnosticWarn", { fg = C.orange_1, bg = C.grey_4 })
local DiagnosticInfo = astronvim.get_hlgroup("DiagnosticInfo", { fg = C.white_2, bg = C.grey_4 }) local DiagnosticInfo = astronvim.get_hlgroup("DiagnosticInfo", { fg = C.white_2, bg = C.grey_4 })
local DiagnosticHint = astronvim.get_hlgroup("DiagnosticHint", { fg = C.yellow_1, bg = C.grey_4 }) local DiagnosticHint = astronvim.get_hlgroup("DiagnosticHint", { fg = C.yellow_1, bg = C.grey_4 })
local HeirlineInactive = astronvim.get_hlgroup("HeirlineInactive", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("inactive", C.grey_7)
local HeirlineNormal = astronvim.get_hlgroup("HeirlineNormal", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("normal", C.blue)
local HeirlineInsert = astronvim.get_hlgroup("HeirlineInsert", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("insert", C.green)
local HeirlineVisual = astronvim.get_hlgroup("HeirlineVisual", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("visual", C.purple)
local HeirlineReplace = astronvim.get_hlgroup("HeirlineReplace", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("replace", C.red_1)
local HeirlineCommand = astronvim.get_hlgroup("HeirlineCommand", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("command", C.yellow_1)
local HeirlineTerminal = astronvim.get_hlgroup("HeirlineTerminal", { fg = nil }).fg
or astronvim.status.hl.lualine_mode("inactive", HeirlineInsert)
local colors = astronvim.user_plugin_opts("heirline.colors", { local colors = astronvim.user_plugin_opts("heirline.colors", {
fg = StatusLine.fg, fg = StatusLine.fg,
bg = StatusLine.bg, bg = StatusLine.bg,
@ -37,16 +46,17 @@ local function setup_colors()
diag_WARN = DiagnosticWarn.fg, diag_WARN = DiagnosticWarn.fg,
diag_INFO = DiagnosticInfo.fg, diag_INFO = DiagnosticInfo.fg,
diag_HINT = DiagnosticHint.fg, diag_HINT = DiagnosticHint.fg,
normal = astronvim.status.hl.lualine_mode("normal", HeirlineNormal.fg),
insert = astronvim.status.hl.lualine_mode("insert", HeirlineInsert.fg),
visual = astronvim.status.hl.lualine_mode("visual", HeirlineVisual.fg),
replace = astronvim.status.hl.lualine_mode("replace", HeirlineReplace.fg),
command = astronvim.status.hl.lualine_mode("command", HeirlineCommand.fg),
inactive = HeirlineInactive.fg,
winbar_fg = WinBar.fg, winbar_fg = WinBar.fg,
winbar_bg = WinBar.bg, winbar_bg = WinBar.bg,
winbarnc_fg = WinBarNC.fg, winbarnc_fg = WinBarNC.fg,
winbarnc_bg = WinBarNC.bg, winbarnc_bg = WinBarNC.bg,
inactive = HeirlineInactive,
normal = HeirlineNormal,
insert = HeirlineInsert,
visual = HeirlineVisual,
replace = HeirlineReplace,
command = HeirlineCommand,
terminal = HeirlineTerminal,
}) })
for _, section in ipairs { for _, section in ipairs {
@ -56,6 +66,7 @@ local function setup_colors()
"diagnostics", "diagnostics",
"lsp", "lsp",
"macro_recording", "macro_recording",
"cmd_info",
"treesitter", "treesitter",
"nav", "nav",
} do } do
@ -77,7 +88,7 @@ local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
astronvim.status.component.git_diff(), astronvim.status.component.git_diff(),
astronvim.status.component.diagnostics(), astronvim.status.component.diagnostics(),
astronvim.status.component.fill(), astronvim.status.component.fill(),
astronvim.status.component.macro_recording(), astronvim.status.component.cmd_info(),
astronvim.status.component.fill(), astronvim.status.component.fill(),
astronvim.status.component.lsp(), astronvim.status.component.lsp(),
astronvim.status.component.treesitter(), astronvim.status.component.treesitter(),
@ -86,34 +97,38 @@ local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
}, },
{ {
fallthrough = false, fallthrough = false,
{ astronvim.status.component.file_info {
condition = function() condition = function() return not astronvim.status.condition.is_active() end,
return astronvim.status.condition.buffer_matches { unique_path = {},
file_icon = { hl = false },
hl = { fg = "winbarnc_fg", bg = "winbarnc_bg" },
surround = false,
update = "BufEnter",
},
astronvim.status.component.breadcrumbs { hl = { fg = "winbar_fg", bg = "winbar_bg" } },
},
})
heirline.setup(heirline_opts[1], heirline_opts[2], heirline_opts[3])
local augroup = vim.api.nvim_create_augroup("Heirline", { clear = true })
vim.api.nvim_create_autocmd("User", {
pattern = "AstroColorScheme",
group = augroup,
desc = "Refresh heirline colors",
callback = function() require("heirline.utils").on_colorscheme(setup_colors()) end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "HeirlineInitWinbar",
group = augroup,
desc = "Disable winbar for some filetypes",
callback = function()
if
astronvim.status.condition.buffer_matches {
buftype = { "terminal", "prompt", "nofile", "help", "quickfix" }, buftype = { "terminal", "prompt", "nofile", "help", "quickfix" },
filetype = { "NvimTree", "neo-tree", "dashboard", "Outline", "aerial" }, filetype = { "NvimTree", "neo-tree", "dashboard", "Outline", "aerial" },
} }
end, then
init = function() vim.opt_local.winbar = nil end, vim.opt_local.winbar = nil
}, end
{
condition = astronvim.status.condition.is_active,
astronvim.status.component.breadcrumbs { hl = { fg = "winbar_fg", bg = "winbar_bg" } },
},
astronvim.status.component.file_info {
file_icon = { highlight = false },
hl = { fg = "winbarnc_fg", bg = "winbarnc_bg" },
surround = false,
},
},
})
heirline.setup(heirline_opts[1], heirline_opts[2])
vim.api.nvim_create_augroup("Heirline", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
group = "Heirline",
desc = "Refresh heirline colors",
callback = function()
heirline.reset_highlights()
heirline.load_colors(setup_colors())
end, end,
}) })

View File

@ -1,6 +1,4 @@
local status_ok, indent_blankline = pcall(require, "indent_blankline") require("indent_blankline").setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
if not status_ok then return end
indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
buftype_exclude = { buftype_exclude = {
"nofile", "nofile",
"terminal", "terminal",

View File

@ -1,3 +1,3 @@
local status_ok, indent_o_matic = pcall(require, "indent-o-matic") local indent_o_matic = require "indent-o-matic"
if not status_ok then return end
indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic") indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic")
indent_o_matic.detect()

View File

@ -1,7 +1,11 @@
local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then return end
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
-- setup language servers once AstroNvim loads local setup_servers = function()
vim.schedule(function() vim.tbl_map(astronvim.lsp.setup, astronvim.user_plugin_opts "lsp.servers") end) vim.tbl_map(astronvim.lsp.setup, astronvim.user_plugin_opts "lsp.servers")
vim.cmd "silent! do FileType"
end
if astronvim.is_available "mason-lspconfig.nvim" then
vim.api.nvim_create_autocmd("User", { pattern = "AstroLspSetup", once = true, callback = setup_servers })
else
setup_servers()
end

View File

@ -1,5 +1,3 @@
local status_ok, lspkind = pcall(require, "lspkind")
if not status_ok then return end
astronvim.lspkind = astronvim.user_plugin_opts("plugins.lspkind", { astronvim.lspkind = astronvim.user_plugin_opts("plugins.lspkind", {
mode = "symbol", mode = "symbol",
symbol_map = { symbol_map = {
@ -22,4 +20,4 @@ astronvim.lspkind = astronvim.user_plugin_opts("plugins.lspkind", {
Unit = "", Unit = "",
}, },
}) })
lspkind.init(astronvim.lspkind) require("lspkind").init(astronvim.lspkind)

View File

@ -1,9 +1,15 @@
local user_settings = astronvim.user_plugin_opts "luasnip" local user_settings = astronvim.user_plugin_opts "luasnip"
local luasnip_avail, luasnip = pcall(require, "luasnip") local luasnip = require "luasnip"
local loader_avail, loader = pcall(require, "luasnip/loaders/from_vscode") if user_settings.config then luasnip.config.setup(user_settings.config) end
if not (luasnip_avail and loader_avail) then return end for _, load_type in ipairs { "vscode", "snipmate", "lua" } do
if user_settings.vscode_snippet_paths ~= nil then loader.lazy_load { paths = user_settings.vscode_snippet_paths } end local loader = require("luasnip.loaders.from_" .. load_type)
loader.lazy_load() loader.lazy_load()
-- TODO: DEPRECATE _snippet_paths option in next major version release
local paths = user_settings[load_type .. "_snippet_paths"]
if paths then loader.lazy_load { paths = paths } end
local loader_settings = user_settings[load_type]
if loader_settings then loader.lazy_load(loader_settings) end
end
if type(user_settings.filetype_extend) == "table" then if type(user_settings.filetype_extend) == "table" then
for filetype, snippets in pairs(user_settings.filetype_extend) do for filetype, snippets in pairs(user_settings.filetype_extend) do
luasnip.filetype_extend(filetype, snippets) luasnip.filetype_extend(filetype, snippets)

View File

@ -1,6 +1,6 @@
local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig") local mason_lspconfig = require "mason-lspconfig"
if not status_ok then return end
mason_lspconfig.setup(astronvim.user_plugin_opts "plugins.mason-lspconfig") mason_lspconfig.setup(astronvim.user_plugin_opts "plugins.mason-lspconfig")
mason_lspconfig.setup_handlers( mason_lspconfig.setup_handlers(
astronvim.user_plugin_opts("mason-lspconfig.setup_handlers", { function(server) astronvim.lsp.setup(server) end }) astronvim.user_plugin_opts("mason-lspconfig.setup_handlers", { function(server) astronvim.lsp.setup(server) end })
) )
astronvim.event "LspSetup"

View File

@ -1,9 +1,3 @@
local status_ok, mason_null_ls = pcall(require, "mason-null-ls") local mason_null_ls = require "mason-null-ls"
if not status_ok then return end mason_null_ls.setup(astronvim.user_plugin_opts("plugins.mason-null-ls", { automatic_setup = true }))
mason_null_ls.setup(astronvim.user_plugin_opts "plugins.mason-null-ls") mason_null_ls.setup_handlers(astronvim.user_plugin_opts("mason-null-ls.setup_handlers", {}))
mason_null_ls.setup_handlers(
astronvim.user_plugin_opts(
"mason-null-ls.setup_handlers",
{ function(server) astronvim.null_ls_register(server) end }
)
)

View File

@ -1,6 +1,4 @@
local status_ok, mason = pcall(require, "mason") require("mason").setup(astronvim.user_plugin_opts("plugins.mason", {
if not status_ok then return end
mason.setup(astronvim.user_plugin_opts("plugins.mason", {
ui = { ui = {
icons = { icons = {
package_installed = "", package_installed = "",

View File

@ -1,6 +1,4 @@
local status_ok, neotree = pcall(require, "neo-tree") require("neo-tree").setup(astronvim.user_plugin_opts("plugins.neo-tree", {
if not status_ok then return end
neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
close_if_last_window = true, close_if_last_window = true,
enable_diagnostics = false, enable_diagnostics = false,
source_selector = { source_selector = {
@ -14,9 +12,7 @@ neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
}, },
}, },
default_component_configs = { default_component_configs = {
indent = { indent = { padding = 0 },
padding = 0,
},
icon = { icon = {
folder_closed = astronvim.get_icon "FolderClosed", folder_closed = astronvim.get_icon "FolderClosed",
folder_open = astronvim.get_icon "FolderOpen", folder_open = astronvim.get_icon "FolderOpen",
@ -40,13 +36,18 @@ neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
window = { window = {
width = 30, width = 30,
mappings = { mappings = {
["o"] = "open", ["<space>"] = false, -- disable space until we figure out which-key disabling
o = "open",
O = function(state) astronvim.system_open(state.tree:get_node():get_id()) end,
H = "prev_source",
L = "next_source",
}, },
}, },
filesystem = { filesystem = {
follow_current_file = true, follow_current_file = true,
hijack_netrw_behavior = "open_current", hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true, use_libuv_file_watcher = true,
window = { mappings = { h = "toggle_hidden" } },
}, },
event_handlers = { event_handlers = {
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end }, { event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },

View File

@ -1,4 +1,3 @@
local status_ok, notify = pcall(require, "notify") local notify = require "notify"
if not status_ok then return end
notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" })) notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" }))
vim.notify = notify vim.notify = notify

View File

@ -1,3 +1 @@
local status_ok, null_ls = pcall(require, "null-ls") require("null-ls").setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))
if not status_ok then return end
null_ls.setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))

View File

@ -1,6 +1,5 @@
local status_ok, icons = pcall(require, "nvim-web-devicons") require("nvim-web-devicons").set_default_icon(astronvim.get_icon "DefaultFile", "#6d8086", "66")
if not status_ok then return end require("nvim-web-devicons").set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", {
icons.set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", {
deb = { icon = "", name = "Deb" }, deb = { icon = "", name = "Deb" },
lock = { icon = "", name = "Lock" }, lock = { icon = "", name = "Lock" },
mp3 = { icon = "", name = "Mp3" }, mp3 = { icon = "", name = "Mp3" },

View File

@ -2,6 +2,7 @@ return {
settings = { settings = {
json = { json = {
schemas = require("schemastore").json.schemas(), schemas = require("schemastore").json.schemas(),
validate = { enable = true },
}, },
}, },
} }

View File

@ -1,14 +1,14 @@
return { return {
settings = { settings = {
Lua = { Lua = {
diagnostics = { telemetry = { enable = false },
globals = { "vim", "astronvim", "bit" }, runtime = { version = "LuaJIT" },
}, diagnostics = { globals = { "vim", "astronvim", "astronvim_installation", "packer_plugins", "bit" } },
workspace = { workspace = {
library = { library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true, vim.fn.expand "$VIMRUNTIME/lua",
[astronvim.install.home .. "/lua"] = true, astronvim.install.home .. "/lua",
[astronvim.install.config .. "/lua"] = true, astronvim.install.config .. "/lua",
}, },
}, },
}, },

View File

@ -1,3 +1 @@
local status_ok, session_manager = pcall(require, "session_manager") require("session_manager").setup(astronvim.user_plugin_opts "plugins.session_manager")
if not status_ok then return end
session_manager.setup(astronvim.user_plugin_opts "plugins.session_manager")

View File

@ -1,6 +1,4 @@
local status_ok, smart_splits = pcall(require, "smart-splits") require("smart-splits").setup(astronvim.user_plugin_opts("plugins.smart-splits", {
if not status_ok then return end
smart_splits.setup(astronvim.user_plugin_opts("plugins.smart-splits", {
ignored_filetypes = { ignored_filetypes = {
"nofile", "nofile",
"quickfix", "quickfix",

View File

@ -1,12 +1,11 @@
local status_ok, telescope = pcall(require, "telescope") local telescope = require "telescope"
if not status_ok then return end
local actions = require "telescope.actions" local actions = require "telescope.actions"
telescope.setup(astronvim.user_plugin_opts("plugins.telescope", { telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
defaults = { defaults = {
prompt_prefix = "", prompt_prefix = string.format("%s ", astronvim.get_icon "Search"),
selection_caret = " ", selection_caret = string.format("%s ", astronvim.get_icon "Selected"),
path_display = { "truncate" }, path_display = { "truncate" },
sorting_strategy = "ascending", sorting_strategy = "ascending",
layout_config = { layout_config = {

View File

@ -1,6 +1,4 @@
local status_ok, toggleterm = pcall(require, "toggleterm") require("toggleterm").setup(astronvim.user_plugin_opts("plugins.toggleterm", {
if not status_ok then return end
toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", {
size = 10, size = 10,
open_mapping = [[<F7>]], open_mapping = [[<F7>]],
shading_factor = 2, shading_factor = 2,

View File

@ -1,6 +1,4 @@
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs") require("nvim-treesitter.configs").setup(astronvim.user_plugin_opts("plugins.treesitter", {
if not status_ok then return end
treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
highlight = { highlight = {
enable = true, enable = true,
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
@ -15,7 +13,6 @@ treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
extended_mode = false, extended_mode = false,
max_file_lines = nil, max_file_lines = nil,
}, },
autopairs = { enable = true },
autotag = { enable = true }, autotag = { enable = true },
incremental_selection = { enable = true }, incremental_selection = { enable = true },
indent = { enable = false }, indent = { enable = false },

View File

@ -12,6 +12,7 @@ local mappings = {
} }
local extra_sections = { local extra_sections = {
D = "Debugger",
g = "Git", g = "Git",
s = "Search", s = "Search",
S = "Session", S = "Session",
@ -36,4 +37,15 @@ if is_available "telescope.nvim" then
init_table("n", "<leader>", "g") init_table("n", "<leader>", "g")
end end
if is_available "nvim-dap" then init_table("n", "<leader>", "D") end
if is_available "Comment.nvim" then
for _, mode in ipairs { "n", "v" } do
if not mappings[mode] then mappings[mode] = {} end
if not mappings[mode].g then mappings[mode].g = {} end
mappings[mode].g.c = "Comment toggle linewise"
mappings[mode].g.b = "Comment toggle blockwise"
end
end
astronvim.which_key_register(user_plugin_opts("which-key.register", mappings)) astronvim.which_key_register(user_plugin_opts("which-key.register", mappings))

View File

@ -1,12 +1,4 @@
local status_ok, which_key = pcall(require, "which-key") require("which-key").setup(astronvim.user_plugin_opts("plugins.which-key", {
if not status_ok then return end
local show = which_key.show
local show_override = astronvim.user_plugin_opts("which-key.show", nil, false)
which_key.show = type(show_override) == "function" and show_override(show)
or function(keys, opts)
if vim.bo.filetype ~= "TelescopePrompt" then show(keys, opts) end
end
which_key.setup(astronvim.user_plugin_opts("plugins.which-key", {
plugins = { plugins = {
spelling = { enabled = true }, spelling = { enabled = true },
presets = { operators = false }, presets = { operators = false },
@ -15,4 +7,5 @@ which_key.setup(astronvim.user_plugin_opts("plugins.which-key", {
border = "rounded", border = "rounded",
padding = { 2, 2, 2, 2 }, padding = { 2, 2, 2, 2 },
}, },
disable = { filetypes = { "TelescopePrompt" } },
})) }))

View File

@ -1,6 +1,4 @@
local status_ok, window_picker = pcall(require, "window-picker")
if not status_ok then return end
local colors = require "default_theme.colors" local colors = require "default_theme.colors"
window_picker.setup( require("window-picker").setup(
astronvim.user_plugin_opts("plugins.window-picker", { use_winbar = "smart", other_win_hl_color = colors.grey_4 }) astronvim.user_plugin_opts("plugins.window-picker", { use_winbar = "smart", other_win_hl_color = colors.grey_4 })
) )

View File

@ -1,21 +1,41 @@
local is_available = astronvim.is_available local is_available = astronvim.is_available
local user_plugin_opts = astronvim.user_plugin_opts local user_plugin_opts = astronvim.user_plugin_opts
local namespace = vim.api.nvim_create_namespace
local cmd = vim.api.nvim_create_autocmd local cmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup local augroup = vim.api.nvim_create_augroup
local create_command = vim.api.nvim_create_user_command local create_command = vim.api.nvim_create_user_command
augroup("highlighturl", { clear = true }) vim.on_key(function(char)
if vim.fn.mode() == "n" then
local new_hlsearch = vim.tbl_contains({ "<CR>", "n", "N", "*", "#", "?", "/" }, vim.fn.keytrans(char))
if vim.opt.hlsearch:get() ~= new_hlsearch then vim.opt.hlsearch = new_hlsearch end
end
end, namespace "auto_hlsearch")
cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, { cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
desc = "URL Highlighting", desc = "URL Highlighting",
group = "highlighturl", group = augroup("highlighturl", { clear = true }),
pattern = "*", pattern = "*",
callback = function() astronvim.set_url_match() end, callback = function() astronvim.set_url_match() end,
}) })
augroup("auto_quit", { clear = true }) cmd("TextYankPost", {
desc = "Highlight yanked text",
group = augroup("highlightyank", { clear = true }),
pattern = "*",
callback = function() vim.highlight.on_yank() end,
})
cmd("FileType", {
desc = "Unlist quickfist buffers",
group = augroup("unlist_quickfist", { clear = true }),
pattern = "qf",
callback = function() vim.opt_local.buflisted = false end,
})
cmd("BufEnter", { cmd("BufEnter", {
desc = "Quit AstroNvim if more than one window is open and only sidebar windows are list", desc = "Quit AstroNvim if more than one window is open and only sidebar windows are list",
group = "auto_quit", group = augroup("auto_quit", { clear = true }),
callback = function() callback = function()
local wins = vim.api.nvim_tabpage_list_wins(0) local wins = vim.api.nvim_tabpage_list_wins(0)
-- Both neo-tree and aerial will auto-quit if there is only a single window left -- Both neo-tree and aerial will auto-quit if there is only a single window left
@ -24,8 +44,15 @@ cmd("BufEnter", {
for _, winid in ipairs(wins) do for _, winid in ipairs(wins) do
if vim.api.nvim_win_is_valid(winid) then if vim.api.nvim_win_is_valid(winid) then
local bufnr = vim.api.nvim_win_get_buf(winid) local bufnr = vim.api.nvim_win_get_buf(winid)
local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
-- If any visible windows are not sidebars, early return -- If any visible windows are not sidebars, early return
if not sidebar_fts[vim.api.nvim_buf_get_option(bufnr, "filetype")] then return end if not sidebar_fts[filetype] then
return
-- If the visible window is a sidebar
else
-- only count filetypes once, so remove a found sidebar from the detection
sidebar_fts[filetype] = nil
end
end end
end end
if #vim.api.nvim_list_tabpages() > 1 then if #vim.api.nvim_list_tabpages() > 1 then
@ -37,43 +64,30 @@ cmd("BufEnter", {
}) })
if is_available "alpha-nvim" then if is_available "alpha-nvim" then
augroup("alpha_settings", { clear = true }) local group_name = augroup("alpha_settings", { clear = true })
if is_available "bufferline.nvim" then cmd("User", {
cmd("FileType", { desc = "Disable status and tablines for alpha",
desc = "Disable tabline for alpha", group = group_name,
group = "alpha_settings", pattern = "AlphaReady",
pattern = "alpha",
callback = function() callback = function()
local prev_showtabline = vim.opt.showtabline local prev_showtabline = vim.opt.showtabline
local prev_status = vim.opt.laststatus
vim.opt.laststatus = 0
vim.opt.showtabline = 0 vim.opt.showtabline = 0
vim.opt_local.winbar = nil vim.opt_local.winbar = nil
cmd("BufUnload", { cmd("BufUnload", {
pattern = "<buffer>", pattern = "<buffer>",
callback = function() vim.opt.showtabline = prev_showtabline end,
})
end,
})
end
cmd("FileType", {
desc = "Disable statusline for alpha",
group = "alpha_settings",
pattern = "alpha",
callback = function() callback = function()
local prev_status = vim.opt.laststatus vim.opt.laststatus = prev_status
vim.opt.laststatus = 0 vim.opt.showtabline = prev_showtabline
cmd("BufUnload", { end,
pattern = "<buffer>",
callback = function() vim.opt.laststatus = prev_status end,
}) })
end, end,
}) })
cmd("VimEnter", { cmd("VimEnter", {
desc = "Start Alpha when vim is opened with no arguments", desc = "Start Alpha when vim is opened with no arguments",
group = "alpha_settings", group = group_name,
callback = function() callback = function()
-- optimized start check from https://github.com/goolord/alpha-nvim
local alpha_avail, alpha = pcall(require, "alpha")
if alpha_avail then
local should_skip = false local should_skip = false
if vim.fn.argc() > 0 or vim.fn.line2byte "$" ~= -1 or not vim.o.modifiable then if vim.fn.argc() > 0 or vim.fn.line2byte "$" ~= -1 or not vim.o.modifiable then
should_skip = true should_skip = true
@ -85,17 +99,18 @@ if is_available "alpha-nvim" then
end end
end end
end end
if not should_skip then alpha.start(true) end if not should_skip then
if is_available "bufferline.nvim" then pcall(require, "bufferline") end
require("alpha").start(true)
end end
end, end,
}) })
end end
if is_available "neo-tree.nvim" then if is_available "neo-tree.nvim" then
augroup("neotree_start", { clear = true })
cmd("BufEnter", { cmd("BufEnter", {
desc = "Open Neo-Tree on startup with directory", desc = "Open Neo-Tree on startup with directory",
group = "neotree_start", group = augroup("neotree_start", { clear = true }),
callback = function() callback = function()
local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0))
if stats and stats.type == "directory" then require("neo-tree.setup.netrw").hijack() end if stats and stats.type == "directory" then require("neo-tree.setup.netrw").hijack() end
@ -103,10 +118,18 @@ if is_available "neo-tree.nvim" then
}) })
end end
augroup("astronvim_highlights", { clear = true }) if is_available "nvim-dap-ui" then
vim.api.nvim_create_autocmd("FileType", {
desc = "Make q close dap floating windows",
group = vim.api.nvim_create_augroup("dapui", { clear = true }),
pattern = "dap-float",
callback = function() vim.keymap.set("n", "q", "<cmd>close!<cr>") end,
})
end
cmd({ "VimEnter", "ColorScheme" }, { cmd({ "VimEnter", "ColorScheme" }, {
desc = "Load custom highlights from user configuration", desc = "Load custom highlights from user configuration",
group = "astronvim_highlights", group = augroup("astronvim_highlights", { clear = true }),
callback = function() callback = function()
if vim.g.colors_name then if vim.g.colors_name then
for _, module in ipairs { "init", vim.g.colors_name } do for _, module in ipairs { "init", vim.g.colors_name } do
@ -115,11 +138,49 @@ cmd({ "VimEnter", "ColorScheme" }, {
end end
end end
end end
astronvim.event "ColorScheme"
end, end,
}) })
vim.api.nvim_create_autocmd("BufRead", {
group = vim.api.nvim_create_augroup("git_plugin_lazy_load", { clear = true }),
callback = function()
vim.fn.system("git -C " .. vim.fn.expand "%:p:h" .. " rev-parse")
if vim.v.shell_error == 0 then
vim.api.nvim_del_augroup_by_name "git_plugin_lazy_load"
local packer = require "packer"
vim.tbl_map(function(plugin) packer.loader(plugin) end, astronvim.git_plugins)
end
end,
})
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("file_plugin_lazy_load", { clear = true }),
callback = function()
local title = vim.fn.expand "%"
if not (title == "" or title == "[packer]" or title:match "^neo%-tree%s+filesystem") then
vim.api.nvim_del_augroup_by_name "file_plugin_lazy_load"
local packer = require "packer"
vim.tbl_map(function(plugin) packer.loader(plugin) end, astronvim.file_plugins)
end
end,
})
create_command(
"AstroUpdatePackages",
function() astronvim.updater.update_packages() end,
{ desc = "Update Packer and Mason" }
)
create_command("AstroUpdate", function() astronvim.updater.update() end, { desc = "Update AstroNvim" }) create_command("AstroUpdate", function() astronvim.updater.update() end, { desc = "Update AstroNvim" })
create_command("AstroReload", function() astronvim.updater.reload() end, { desc = "Reload AstroNvim" }) create_command("AstroReload", function() astronvim.updater.reload() end, { desc = "Reload AstroNvim" })
create_command("AstroVersion", function() astronvim.updater.version() end, { desc = "Check AstroNvim Version" }) create_command("AstroVersion", function() astronvim.updater.version() end, { desc = "Check AstroNvim Version" })
create_command("AstroChangelog", function() astronvim.updater.changelog() end, { desc = "Check AstroNvim Changelog" }) create_command("AstroChangelog", function() astronvim.updater.changelog() end, { desc = "Check AstroNvim Changelog" })
create_command("ToggleHighlightURL", function() astronvim.ui.toggle_url_match() end, { desc = "Toggle URL Highlights" }) create_command("ToggleHighlightURL", function() astronvim.ui.toggle_url_match() end, { desc = "Toggle URL Highlights" })
if is_available "mason.nvim" then
create_command("MasonUpdateAll", function() astronvim.mason.update_all() end, { desc = "Update Mason Packages" })
create_command(
"MasonUpdate",
function(opts) astronvim.mason.update(opts.args) end,
{ nargs = 1, desc = "Update Mason Package" }
)
end

View File

@ -7,7 +7,7 @@ return {
DapBreakpointRejected = "", DapBreakpointRejected = "",
DapLogPoint = ".>", DapLogPoint = ".>",
DapStopped = "", DapStopped = "",
DefaultFile = "", DefaultFile = "",
Diagnostic = "", Diagnostic = "",
DiagnosticError = "", DiagnosticError = "",
DiagnosticHint = "", DiagnosticHint = "",
@ -37,5 +37,7 @@ return {
MacroRecording = "", MacroRecording = "",
NeovimClose = "", NeovimClose = "",
Paste = "", Paste = "",
Search = "",
Selected = "",
Spellcheck = "", Spellcheck = "",
} }

View File

@ -29,5 +29,7 @@ return {
MacroRecording = "Recording:", MacroRecording = "Recording:",
NeovimClose = "X", NeovimClose = "X",
Paste = "[PASTE]", Paste = "[PASTE]",
Search = "?",
Selected = "*",
Spellcheck = "[SPELL]", Spellcheck = "[SPELL]",
} }

View File

@ -8,9 +8,9 @@ maps[""]["<Space>"] = "<Nop>"
-- Standard Operations -- Standard Operations
maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" } maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
maps.n["<leader>q"] = { "<cmd>q<cr>", desc = "Quit" } maps.n["<leader>q"] = { "<cmd>q<cr>", desc = "Quit" }
maps.n["<leader>h"] = { "<cmd>nohlsearch<cr>", desc = "No Highlight" } maps.n["<leader>h"] = { "<cmd>nohlsearch<cr>", desc = "No Highlight" } -- TODO: REMOVE IN v3
maps.n["<leader>fn"] = { "<cmd>enew<cr>", desc = "New File" } maps.n["<leader>fn"] = { "<cmd>enew<cr>", desc = "New File" }
maps.n["gx"] = { function() astronvim.url_opener() end, desc = "Open the file under cursor with system app" } maps.n["gx"] = { function() astronvim.system_open() end, desc = "Open the file under cursor with system app" }
maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write" } maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write" }
maps.n["<C-q>"] = { "<cmd>q!<cr>", desc = "Force quit" } maps.n["<C-q>"] = { "<cmd>q!<cr>", desc = "Force quit" }
maps.n["Q"] = "<Nop>" maps.n["Q"] = "<Nop>"
@ -23,18 +23,23 @@ maps.n["<leader>pS"] = { "<cmd>PackerStatus<cr>", desc = "Packer Status" }
maps.n["<leader>pu"] = { "<cmd>PackerUpdate<cr>", desc = "Packer Update" } maps.n["<leader>pu"] = { "<cmd>PackerUpdate<cr>", desc = "Packer Update" }
-- AstroNvim -- AstroNvim
maps.n["<leader>pa"] = { "<cmd>AstroUpdatePackages<cr>", desc = "Update Packer and Mason" }
maps.n["<leader>pA"] = { "<cmd>AstroUpdate<cr>", desc = "AstroNvim Update" } maps.n["<leader>pA"] = { "<cmd>AstroUpdate<cr>", desc = "AstroNvim Update" }
maps.n["<leader>pv"] = { "<cmd>AstroVersion<cr>", desc = "AstroNvim Version" } maps.n["<leader>pv"] = { "<cmd>AstroVersion<cr>", desc = "AstroNvim Version" }
maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" } maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" }
-- Alpha -- Alpha
if is_available "alpha-nvim" then maps.n["<leader>d"] = { "<cmd>Alpha<cr>", desc = "Alpha Dashboard" } end if is_available "alpha-nvim" then
maps.n["<leader>d"] = { function() require("alpha").start() end, desc = "Alpha Dashboard" }
end
-- Bufdelete -- Bufdelete
if is_available "bufdelete.nvim" then if is_available "bufdelete.nvim" then
maps.n["<leader>c"] = { "<cmd>Bdelete<cr>", desc = "Close buffer" } maps.n["<leader>c"] = { function() require("bufdelete").bufdelete(0, false) end, desc = "Close buffer" }
maps.n["<leader>C"] = { function() require("bufdelete").bufdelete(0, true) end, desc = "Force close buffer" }
else else
maps.n["<leader>c"] = { "<cmd>bdelete<cr>", desc = "Close buffer" } maps.n["<leader>c"] = { "<cmd>bdelete<cr>", desc = "Close buffer" }
maps.n["<leader>C"] = { "<cmd>bdelete!<cr>", desc = "Force close buffer" }
end end
-- Navigate buffers -- Navigate buffers
@ -87,10 +92,9 @@ if is_available "neovim-session-manager" then
end end
-- Package Manager -- Package Manager
if is_available "mason.nvim" then maps.n["<leader>pI"] = { "<cmd>Mason<cr>", desc = "Mason Installer" } end if is_available "mason.nvim" then
maps.n["<leader>pI"] = { "<cmd>Mason<cr>", desc = "Mason Installer" }
if is_available "mason-tool-installer.nvim" then maps.n["<leader>pU"] = { "<cmd>MasonUpdateAll<cr>", desc = "Mason Update" }
maps.n["<leader>pU"] = { "<cmd>MasonToolsUpdate<cr>", desc = "Mason Update" }
end end
-- LSP Installer -- LSP Installer
@ -121,7 +125,9 @@ else
end end
-- SymbolsOutline -- SymbolsOutline
if is_available "aerial.nvim" then maps.n["<leader>lS"] = { "<cmd>AerialToggle<cr>", desc = "Symbols outline" } end if is_available "aerial.nvim" then
maps.n["<leader>lS"] = { function() require("aerial").toggle() end, desc = "Symbols outline" }
end
-- Telescope -- Telescope
if is_available "telescope.nvim" then if is_available "telescope.nvim" then
@ -151,11 +157,13 @@ if is_available "telescope.nvim" then
maps.n["<leader>sb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" } maps.n["<leader>sb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" }
maps.n["<leader>sh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" } maps.n["<leader>sh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" }
maps.n["<leader>sm"] = { function() require("telescope.builtin").man_pages() end, desc = "Search man" } maps.n["<leader>sm"] = { function() require("telescope.builtin").man_pages() end, desc = "Search man" }
maps.n["<leader>sn"] =
{ function() require("telescope").extensions.notify.notify() end, desc = "Search notifications" }
maps.n["<leader>sr"] = { function() require("telescope.builtin").registers() end, desc = "Search registers" } maps.n["<leader>sr"] = { function() require("telescope.builtin").registers() end, desc = "Search registers" }
maps.n["<leader>sk"] = { function() require("telescope.builtin").keymaps() end, desc = "Search keymaps" } maps.n["<leader>sk"] = { function() require("telescope.builtin").keymaps() end, desc = "Search keymaps" }
maps.n["<leader>sc"] = { function() require("telescope.builtin").commands() end, desc = "Search commands" } maps.n["<leader>sc"] = { function() require("telescope.builtin").commands() end, desc = "Search commands" }
if astronvim.is_available "nvim-notify" then
maps.n["<leader>sn"] =
{ function() require("telescope").extensions.notify.notify() end, desc = "Search notifications" }
end
maps.n["<leader>ls"] = { maps.n["<leader>ls"] = {
function() function()
local aerial_avail, _ = pcall(require, "aerial") local aerial_avail, _ = pcall(require, "aerial")
@ -167,21 +175,28 @@ if is_available "telescope.nvim" then
end, end,
desc = "Search symbols", desc = "Search symbols",
} }
maps.n["<leader>lG"] =
{ function() require("telescope.builtin").lsp_workspace_symbols() end, desc = "Search workspace symbols" }
maps.n["<leader>lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" }
maps.n["<leader>lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" } maps.n["<leader>lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" }
end end
-- Terminal -- Terminal
if is_available "toggleterm.nvim" then if is_available "toggleterm.nvim" then
local toggle_term_cmd = astronvim.toggle_term_cmd local toggle_term_cmd = astronvim.toggle_term_cmd
if vim.fn.executable "lazygit" == 1 then
maps.n["<leader>gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } maps.n["<leader>gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
maps.n["<leader>tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" }
maps.n["<leader>tu"] = { function() toggle_term_cmd "gdu" end, desc = "ToggleTerm gdu" }
maps.n["<leader>tt"] = { function() toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
maps.n["<leader>tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" }
maps.n["<leader>tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } maps.n["<leader>tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
end
if vim.fn.executable "node" == 1 then
maps.n["<leader>tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" }
end
if vim.fn.executable "gdu" == 1 then
maps.n["<leader>tu"] = { function() toggle_term_cmd "gdu" end, desc = "ToggleTerm gdu" }
end
if vim.fn.executable "btm" == 1 then
maps.n["<leader>tt"] = { function() toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
end
if vim.fn.executable "python" == 1 then
maps.n["<leader>tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" }
end
maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" } maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" } maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" } maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
@ -191,6 +206,34 @@ if is_available "toggleterm.nvim" then
maps.t["<C-'>"] = maps.n["<F7>"] maps.t["<C-'>"] = maps.n["<F7>"]
end end
if is_available "nvim-dap" then
-- modified function keys found with `showkey -a` in the terminal to get key code
-- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname
maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }
maps.n["<F17>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" } -- Shift+F5
maps.n["<F29>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" } -- Control+F5
maps.n["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" }
maps.n["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" }
maps.n["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" }
maps.n["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" }
maps.n["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" } -- Shift+F11
maps.n["<leader>Db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" }
maps.n["<leader>DB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" }
maps.n["<leader>Dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" }
maps.n["<leader>Di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" }
maps.n["<leader>Do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" }
maps.n["<leader>DO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" }
maps.n["<leader>Dq"] = { function() require("dap").close() end, desc = "Close Session" }
maps.n["<leader>DQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" }
maps.n["<leader>Dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" }
maps.n["<leader>Dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" }
maps.n["<leader>DR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" }
if is_available "nvim-dap-ui" then
maps.n["<leader>Du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" }
maps.n["<leader>Dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" }
end
end
-- Stay in indent mode -- Stay in indent mode
maps.v["<"] = { "<gv", desc = "unindent line" } maps.v["<"] = { "<gv", desc = "unindent line" }
maps.v[">"] = { ">gv", desc = "indent line" } maps.v[">"] = { ">gv", desc = "indent line" }
@ -199,7 +242,7 @@ maps.v[">"] = { ">gv", desc = "indent line" }
maps.t["<C-h>"] = { "<c-\\><c-n><c-w>h", desc = "Terminal left window navigation" } maps.t["<C-h>"] = { "<c-\\><c-n><c-w>h", desc = "Terminal left window navigation" }
maps.t["<C-j>"] = { "<c-\\><c-n><c-w>j", desc = "Terminal down window navigation" } maps.t["<C-j>"] = { "<c-\\><c-n><c-w>j", desc = "Terminal down window navigation" }
maps.t["<C-k>"] = { "<c-\\><c-n><c-w>k", desc = "Terminal up window navigation" } maps.t["<C-k>"] = { "<c-\\><c-n><c-w>k", desc = "Terminal up window navigation" }
maps.t["<C-l>"] = { "<c-\\><c-n><c-w>l", desc = "Terminal right window naviation" } maps.t["<C-l>"] = { "<c-\\><c-n><c-w>l", desc = "Terminal right window navigation" }
-- Custom menu for modification of the user experience -- Custom menu for modification of the user experience
if is_available "nvim-autopairs" then if is_available "nvim-autopairs" then
@ -212,6 +255,7 @@ end
if is_available "nvim-colorizer.lua" then if is_available "nvim-colorizer.lua" then
maps.n["<leader>uC"] = { "<cmd>ColorizerToggle<cr>", desc = "Toggle color highlight" } maps.n["<leader>uC"] = { "<cmd>ColorizerToggle<cr>", desc = "Toggle color highlight" }
end end
maps.n["<leader>uS"] = { function() astronvim.ui.toggle_conceal() end, desc = "Toggle conceal" }
maps.n["<leader>ud"] = { function() astronvim.ui.toggle_diagnostics() end, desc = "Toggle diagnostics" } maps.n["<leader>ud"] = { function() astronvim.ui.toggle_diagnostics() end, desc = "Toggle diagnostics" }
maps.n["<leader>ug"] = { function() astronvim.ui.toggle_signcolumn() end, desc = "Toggle signcolumn" } maps.n["<leader>ug"] = { function() astronvim.ui.toggle_signcolumn() end, desc = "Toggle signcolumn" }
maps.n["<leader>ui"] = { function() astronvim.ui.set_indent() end, desc = "Change indent setting" } maps.n["<leader>ui"] = { function() astronvim.ui.set_indent() end, desc = "Change indent setting" }
@ -223,5 +267,6 @@ maps.n["<leader>ut"] = { function() astronvim.ui.toggle_tabline() end, desc = "T
maps.n["<leader>uu"] = { function() astronvim.ui.toggle_url_match() end, desc = "Toggle URL highlight" } maps.n["<leader>uu"] = { function() astronvim.ui.toggle_url_match() end, desc = "Toggle URL highlight" }
maps.n["<leader>uw"] = { function() astronvim.ui.toggle_wrap() end, desc = "Toggle wrap" } maps.n["<leader>uw"] = { function() astronvim.ui.toggle_wrap() end, desc = "Toggle wrap" }
maps.n["<leader>uy"] = { function() astronvim.ui.toggle_syntax() end, desc = "Toggle syntax highlight" } maps.n["<leader>uy"] = { function() astronvim.ui.toggle_syntax() end, desc = "Toggle syntax highlight" }
maps.n["<leader>uN"] = { function() astronvim.ui.toggle_ui_notifications() end, desc = "Toggle UI notifications" }
astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps)) astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps))

View File

@ -1,3 +1,4 @@
vim.opt.shortmess:append { s = true, I = true } -- disable startup message
astronvim.vim_opts(astronvim.user_plugin_opts("options", { astronvim.vim_opts(astronvim.user_plugin_opts("options", {
opt = { opt = {
backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert
@ -63,5 +64,6 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
diagnostics_enabled = true, -- enable diagnostics at start diagnostics_enabled = true, -- enable diagnostics at start
status_diagnostics_enabled = true, -- enable diagnostics in statusline status_diagnostics_enabled = true, -- enable diagnostics in statusline
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available) icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
}, },
})) }))

View File

@ -1,6 +1,23 @@
local astro_plugins = { local astro_plugins = {
-- Plugin manager -- Plugin manager
["wbthomason/packer.nvim"] = {}, ["wbthomason/packer.nvim"] = {
setup = function()
astronvim.lazy_load_commands("packer.nvim", {
"PackerSnapshot",
"PackerSnapshotRollback",
"PackerSnapshotDelete",
"PackerInstall",
"PackerUpdate",
"PackerSync",
"PackerClean",
"PackerCompile",
"PackerStatus",
"PackerProfile",
"PackerLoad",
})
end,
config = function() require "core.plugins" end,
},
-- Optimiser -- Optimiser
["lewis6991/impatient.nvim"] = {}, ["lewis6991/impatient.nvim"] = {},
@ -10,19 +27,22 @@ local astro_plugins = {
-- Indent detection -- Indent detection
["Darazaki/indent-o-matic"] = { ["Darazaki/indent-o-matic"] = {
event = "BufEnter", opt = true,
setup = function() table.insert(astronvim.file_plugins, "indent-o-matic") end,
config = function() require "configs.indent-o-matic" end, config = function() require "configs.indent-o-matic" end,
}, },
-- Notification Enhancer -- Notification Enhancer
["rcarriga/nvim-notify"] = { ["rcarriga/nvim-notify"] = {
event = "UIEnter", opt = true,
setup = function() astronvim.load_plugin_with_func("nvim-notify", vim, "notify") end,
config = function() require "configs.notify" end, config = function() require "configs.notify" end,
}, },
-- Neovim UI Enhancer -- Neovim UI Enhancer
["stevearc/dressing.nvim"] = { ["stevearc/dressing.nvim"] = {
event = "UIEnter", opt = true,
setup = function() astronvim.load_plugin_with_func("dressing.nvim", vim.ui, { "input", "select" }) end,
config = function() require "configs.dressing" end, config = function() require "configs.dressing" end,
}, },
@ -33,7 +53,7 @@ local astro_plugins = {
}, },
-- Icons -- Icons
["kyazdani42/nvim-web-devicons"] = { ["nvim-tree/nvim-web-devicons"] = {
disable = not vim.g.icons_enabled, disable = not vim.g.icons_enabled,
module = "nvim-web-devicons", module = "nvim-web-devicons",
config = function() require "configs.nvim-web-devicons" end, config = function() require "configs.nvim-web-devicons" end,
@ -48,12 +68,16 @@ local astro_plugins = {
-- Bufferline -- Bufferline
["akinsho/bufferline.nvim"] = { ["akinsho/bufferline.nvim"] = {
module = "bufferline",
event = "UIEnter", event = "UIEnter",
config = function() require "configs.bufferline" end, config = function() require "configs.bufferline" end,
}, },
-- Better buffer closing -- Better buffer closing
["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } }, ["famiu/bufdelete.nvim"] = {
module = "bufdelete",
setup = function() astronvim.lazy_load_commands("bufdelete.nvim", { "Bdelete", "Bwipeout" }) end,
},
["s1n7ax/nvim-window-picker"] = { ["s1n7ax/nvim-window-picker"] = {
tag = "v1.*", tag = "v1.*",
@ -65,14 +89,41 @@ local astro_plugins = {
["nvim-neo-tree/neo-tree.nvim"] = { ["nvim-neo-tree/neo-tree.nvim"] = {
branch = "v2.x", branch = "v2.x",
module = "neo-tree", module = "neo-tree",
cmd = "Neotree",
requires = { { "MunifTanjim/nui.nvim", module = "nui" } }, requires = { { "MunifTanjim/nui.nvim", module = "nui" } },
setup = function() vim.g.neo_tree_remove_legacy_commands = true end, setup = function()
astronvim.lazy_load_commands("neo-tree.nvim", "Neotree")
vim.g.neo_tree_remove_legacy_commands = true
end,
config = function() require "configs.neo-tree" end, config = function() require "configs.neo-tree" end,
}, },
-- Statusline -- Statusline
["rebelot/heirline.nvim"] = { config = function() require "configs.heirline" end }, ["rebelot/heirline.nvim"] = { event = "VimEnter", config = function() require "configs.heirline" end },
-- Syntax highlighting
["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter",
setup = function()
table.insert(astronvim.file_plugins, "nvim-treesitter")
astronvim.lazy_load_commands("nvim-treesitter", {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
})
end,
run = function() require("nvim-treesitter.install").update { with_sync = true }() end,
config = function() require "configs.treesitter" end,
},
-- Parenthesis highlighting -- Parenthesis highlighting
["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" }, ["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" },
@ -83,23 +134,6 @@ local astro_plugins = {
-- Context based commenting -- Context based commenting
["JoosepAlviste/nvim-ts-context-commentstring"] = { after = "nvim-treesitter" }, ["JoosepAlviste/nvim-ts-context-commentstring"] = { after = "nvim-treesitter" },
-- Syntax highlighting
["nvim-treesitter/nvim-treesitter"] = {
run = ":TSUpdate",
event = "BufEnter",
cmd = {
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
"TSDisableAll",
"TSEnableAll",
},
config = function() require "configs.treesitter" end,
},
-- Snippet collection -- Snippet collection
["rafamadriz/friendly-snippets"] = { opt = true }, ["rafamadriz/friendly-snippets"] = { opt = true },
@ -111,10 +145,7 @@ local astro_plugins = {
}, },
-- Completion engine -- Completion engine
["hrsh7th/nvim-cmp"] = { ["hrsh7th/nvim-cmp"] = { event = "InsertEnter", config = function() require "configs.cmp" end },
event = "InsertEnter",
config = function() require "configs.cmp" end,
},
-- Snippet completion source -- Snippet completion source
["saadparwaiz1/cmp_luasnip"] = { ["saadparwaiz1/cmp_luasnip"] = {
@ -123,121 +154,147 @@ local astro_plugins = {
}, },
-- Buffer completion source -- Buffer completion source
["hrsh7th/cmp-buffer"] = { ["hrsh7th/cmp-buffer"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "buffer" end },
after = "nvim-cmp",
config = function() astronvim.add_user_cmp_source "buffer" end,
},
-- Path completion source -- Path completion source
["hrsh7th/cmp-path"] = { ["hrsh7th/cmp-path"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "path" end },
after = "nvim-cmp",
config = function() astronvim.add_user_cmp_source "path" end,
},
-- LSP completion source -- LSP completion source
["hrsh7th/cmp-nvim-lsp"] = { ["hrsh7th/cmp-nvim-lsp"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "nvim_lsp" end },
after = "nvim-cmp",
config = function() astronvim.add_user_cmp_source "nvim_lsp" end,
},
-- Built-in LSP -- Built-in LSP
["neovim/nvim-lspconfig"] = { config = function() require "configs.lspconfig" end }, ["neovim/nvim-lspconfig"] = {
module = "lspconfig",
setup = function() table.insert(astronvim.file_plugins, "nvim-lspconfig") end,
config = function() require "configs.lspconfig" end,
},
-- Formatting and linting -- Formatting and linting
["jose-elias-alvarez/null-ls.nvim"] = { ["jose-elias-alvarez/null-ls.nvim"] = {
event = "BufEnter", module = "null-ls",
setup = function() table.insert(astronvim.file_plugins, "null-ls.nvim") end,
config = function() require "configs.null-ls" end, config = function() require "configs.null-ls" end,
}, },
-- Debugger
["mfussenegger/nvim-dap"] = {
disable = vim.fn.has "win32" == 1,
module = "dap",
config = function() require "configs.dap" end,
},
-- Debugger UI
["rcarriga/nvim-dap-ui"] = {
disable = vim.fn.has "win32" == 1,
after = "nvim-dap",
config = function() require "configs.dapui" end,
},
-- Package Manager -- Package Manager
["williamboman/mason.nvim"] = { config = function() require "configs.mason" end }, ["williamboman/mason.nvim"] = {
module = "mason",
cmd = {
"Mason",
"MasonInstall",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
"MasonUpdate", -- astronvim command
"MasonUpdateAll", -- astronvim command
},
config = function()
require "configs.mason"
vim.tbl_map(function(plugin) pcall(require, plugin) end, { "lspconfig", "null-ls", "dap" })
end,
},
-- LSP manager -- LSP manager
["williamboman/mason-lspconfig.nvim"] = { ["williamboman/mason-lspconfig.nvim"] = {
after = { "mason.nvim", "nvim-lspconfig" }, after = "nvim-lspconfig",
config = function() require "configs.mason-lspconfig" end, config = function() require "configs.mason-lspconfig" end,
}, },
-- null-ls manager -- null-ls manager
["jayp0521/mason-null-ls.nvim"] = { ["jayp0521/mason-null-ls.nvim"] = { after = "null-ls.nvim", config = function() require "configs.mason-null-ls" end },
after = { "mason.nvim", "null-ls.nvim" },
config = function() require "configs.mason-null-ls" end, -- dap manager
["jayp0521/mason-nvim-dap.nvim"] = {
disable = vim.fn.has "win32" == 1,
after = "nvim-dap",
config = function() require "configs.mason-nvim-dap" end,
}, },
-- LSP symbols -- LSP symbols
["stevearc/aerial.nvim"] = { ["stevearc/aerial.nvim"] = {
module = "aerial", module = "aerial",
cmd = { "AerialToggle", "AerialOpen", "AerialInfo" }, after = { "nvim-treesitter", "nvim-lspconfig" },
ft = { "man", "markdown" },
config = function() require "configs.aerial" end, config = function() require "configs.aerial" end,
}, },
-- Fuzzy finder -- Fuzzy finder
["nvim-telescope/telescope.nvim"] = { ["nvim-telescope/telescope.nvim"] = {
cmd = "Telescope",
module = "telescope", module = "telescope",
setup = function() astronvim.lazy_load_commands("telescope.nvim", "Telescope") end,
config = function() require "configs.telescope" end, config = function() require "configs.telescope" end,
}, },
-- Fuzzy finder syntax support -- Fuzzy finder syntax support
["nvim-telescope/telescope-fzf-native.nvim"] = { ["nvim-telescope/telescope-fzf-native.nvim"] = {
after = "telescope.nvim", after = "telescope.nvim",
disable = vim.fn.executable "make" + vim.fn.executable "cmake" == 0, disable = vim.fn.executable "make" == 0,
run = vim.fn.executable "cmake" == 1 run = "make",
and "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build"
or "make",
config = function() require("telescope").load_extension "fzf" end, config = function() require("telescope").load_extension "fzf" end,
}, },
-- Git integration -- Git integration
["lewis6991/gitsigns.nvim"] = { ["lewis6991/gitsigns.nvim"] = {
event = "BufEnter", disable = vim.fn.executable "git" == 0,
ft = "gitcommit",
setup = function() table.insert(astronvim.git_plugins, "gitsigns.nvim") end,
config = function() require "configs.gitsigns" end, config = function() require "configs.gitsigns" end,
}, },
-- Start screen -- Start screen
["goolord/alpha-nvim"] = { ["goolord/alpha-nvim"] = {
cmd = "Alpha",
module = "alpha", module = "alpha",
setup = function() astronvim.lazy_load_commands("alpha-nvim", "Alpha") end,
config = function() require "configs.alpha" end, config = function() require "configs.alpha" end,
}, },
-- Color highlighting -- Color highlighting
["NvChad/nvim-colorizer.lua"] = { ["NvChad/nvim-colorizer.lua"] = {
event = "BufEnter", opt = true,
setup = function() table.insert(astronvim.file_plugins, "nvim-colorizer.lua") end,
config = function() require "configs.colorizer" end, config = function() require "configs.colorizer" end,
}, },
-- Autopairs -- Autopairs
["windwp/nvim-autopairs"] = { ["windwp/nvim-autopairs"] = { event = "InsertEnter", config = function() require "configs.autopairs" end },
event = "InsertEnter",
config = function() require "configs.autopairs" end,
},
-- Terminal -- Terminal
["akinsho/toggleterm.nvim"] = { ["akinsho/toggleterm.nvim"] = {
cmd = "ToggleTerm", module = "toggleterm",
module = { "toggleterm", "toggleterm.terminal" }, setup = function() astronvim.lazy_load_commands("toggleterm.nvim", "ToggleTerm") end,
config = function() require "configs.toggleterm" end, config = function() require "configs.toggleterm" end,
}, },
-- Commenting -- Commenting
["numToStr/Comment.nvim"] = { ["numToStr/Comment.nvim"] = {
module = { "Comment", "Comment.api" }, module = "Comment",
keys = { "gc", "gb", "g<", "g>" }, keys = { "gc", "gb" },
config = function() require "configs.Comment" end, config = function() require "configs.Comment" end,
}, },
-- Indentation -- Indentation
["lukas-reineke/indent-blankline.nvim"] = { ["lukas-reineke/indent-blankline.nvim"] = {
event = "BufEnter", opt = true,
setup = function() table.insert(astronvim.file_plugins, "indent-blankline.nvim") end,
config = function() require "configs.indent-line" end, config = function() require "configs.indent-line" end,
}, },
-- Keymaps popup -- Keymaps popup
["folke/which-key.nvim"] = { ["folke/which-key.nvim"] = { module = "which-key", config = function() require "configs.which-key" end },
module = "which-key",
config = function() require "configs.which-key" end,
},
-- Smooth escaping -- Smooth escaping
["max397574/better-escape.nvim"] = { ["max397574/better-escape.nvim"] = {
@ -251,8 +308,8 @@ local astro_plugins = {
-- Session manager -- Session manager
["Shatur/neovim-session-manager"] = { ["Shatur/neovim-session-manager"] = {
module = "session_manager", module = "session_manager",
cmd = "SessionManager",
event = "BufWritePost", event = "BufWritePost",
setup = function() astronvim.lazy_load_commands("neovim-session-manager", "SessionManager") end,
config = function() require "configs.session_manager" end, config = function() require "configs.session_manager" end,
}, },
} }
@ -269,8 +326,20 @@ local status_ok, packer = pcall(require, "packer")
if status_ok then if status_ok then
packer.startup { packer.startup {
function(use) function(use)
for key, plugin in pairs(user_plugin_opts("plugins.init", astro_plugins)) do local plugins = user_plugin_opts("plugins.init", astro_plugins)
for key, plugin in pairs(plugins) do
if type(key) == "string" and not plugin[1] then plugin[1] = key end if type(key) == "string" and not plugin[1] then plugin[1] = key end
if key == "williamboman/mason.nvim" and plugin.cmd then
for mason_plugin, commands in pairs { -- lazy load mason plugin commands with Mason
["jayp0521/mason-null-ls.nvim"] = { "NullLsInstall", "NullLsUninstall" },
["williamboman/mason-lspconfig.nvim"] = { "LspInstall", "LspUninstall" },
["jayp0521/mason-nvim-dap.nvim"] = { "DapInstall", "DapUninstall" },
} do
if plugins[mason_plugin] and not plugins[mason_plugin].disable then
vim.list_extend(plugin.cmd, commands)
end
end
end
use(plugin) use(plugin)
end end
end, end,

View File

@ -15,7 +15,7 @@ function git.cmd(args, ...) return astronvim.cmd("git -C " .. astronvim.install.
--- Check if the AstroNvim is able to reach the `git` command --- Check if the AstroNvim is able to reach the `git` command
-- @return the result of running `git --help` -- @return the result of running `git --help`
function git.available() return git.cmd("--help", false) end function git.available() return vim.fn.executable "git" == 1 end
--- Check if the AstroNvim home is a git repo --- Check if the AstroNvim home is a git repo
-- @return the result of the command -- @return the result of the command

View File

@ -55,6 +55,10 @@ astronvim.user_settings = load_module_file "user.init"
astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua" astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua"
--- table of user created terminals --- table of user created terminals
astronvim.user_terminals = {} astronvim.user_terminals = {}
--- table of plugins to load with git
astronvim.git_plugins = {}
--- table of plugins to load when file opened
astronvim.file_plugins = {}
--- regex used for matching a valid URL/URI string --- regex used for matching a valid URL/URI string
astronvim.url_matcher = astronvim.url_matcher =
"\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+" "\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+"
@ -104,12 +108,20 @@ end
-- @param name highlight group name -- @param name highlight group name
-- @return table of highlight group properties -- @return table of highlight group properties
function astronvim.get_hlgroup(name, fallback) function astronvim.get_hlgroup(name, fallback)
local hl = vim.fn.hlexists(name) == 1 and vim.api.nvim_get_hl_by_name(name, vim.o.termguicolors) or {} if vim.fn.hlexists(name) == 1 then
return astronvim.default_tbl( local hl = vim.api.nvim_get_hl_by_name(name, vim.o.termguicolors)
vim.o.termguicolors and { fg = hl.foreground, bg = hl.background, sp = hl.special } local old_true_val = hl[true]
or { cterfm = hl.foreground, ctermbg = hl.background }, hl[true] = nil
fallback if not vim.tbl_isempty(hl) then
) hl[true] = old_true_val
if not hl["foreground"] then hl["foreground"] = "NONE" end
if not hl["background"] then hl["background"] = "NONE" end
hl.fg, hl.bg, hl.sp = hl.foreground, hl.background, hl.special
hl.ctermfg, hl.ctermbg = hl.foreground, hl.background
return hl
end
end
return fallback
end end
--- Trim a string or return nil --- Trim a string or return nil
@ -145,7 +157,15 @@ end
-- @param msg the notification body -- @param msg the notification body
-- @param type the type of the notification (:help vim.log.levels) -- @param type the type of the notification (:help vim.log.levels)
-- @param opts table of nvim-notify options to use (:help notify-options) -- @param opts table of nvim-notify options to use (:help notify-options)
function astronvim.notify(msg, type, opts) vim.notify(msg, type, astronvim.default_tbl(opts, { title = "AstroNvim" })) end function astronvim.notify(msg, type, opts)
vim.schedule(function() vim.notify(msg, type, astronvim.default_tbl(opts, { title = "AstroNvim" })) end)
end
--- Trigger an AstroNvim user event
-- @param event the event name to be appended to Astro
function astronvim.event(event)
vim.schedule(function() vim.api.nvim_exec_autocmds("User", { pattern = "Astro" .. event }) end)
end
--- Wrapper function for neovim echo API --- Wrapper function for neovim echo API
-- @param messages an array like table where each item is an array like table of strings to echo -- @param messages an array like table where each item is an array like table of strings to echo
@ -185,11 +205,11 @@ end
--- Check if packer is installed and loadable, if not then install it and make sure it loads --- Check if packer is installed and loadable, if not then install it and make sure it loads
function astronvim.initialize_packer() function astronvim.initialize_packer()
-- try loading packer -- try loading packer
local packer_avail, _ = pcall(require, "packer") local packer_path = stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
local packer_avail = vim.fn.empty(vim.fn.glob(packer_path)) == 0
-- if packer isn't availble, reinstall it -- if packer isn't availble, reinstall it
if not packer_avail then if not packer_avail then
-- set the location to install packer -- set the location to install packer
local packer_path = stdpath "data" .. "/site/pack/packer/start/packer.nvim"
-- delete the old packer install if one exists -- delete the old packer install if one exists
vim.fn.delete(packer_path, "rf") vim.fn.delete(packer_path, "rf")
-- clone packer -- clone packer
@ -201,10 +221,10 @@ function astronvim.initialize_packer()
"https://github.com/wbthomason/packer.nvim", "https://github.com/wbthomason/packer.nvim",
packer_path, packer_path,
} }
astronvim.echo { { "Initializing Packer...\n\n" } }
-- add packer and try loading it -- add packer and try loading it
vim.cmd.packadd "packer.nvim" vim.cmd.packadd "packer.nvim"
packer_avail, _ = pcall(require, "packer") local packer_loaded, _ = pcall(require, "packer")
packer_avail = packer_loaded
-- if packer didn't load, print error -- if packer didn't load, print error
if not packer_avail then vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path) end if not packer_avail then vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path) end
end end
@ -214,12 +234,41 @@ function astronvim.initialize_packer()
local run_me, _ = loadfile( local run_me, _ = loadfile(
astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path
) )
-- if the file loads, run the compiled function
if run_me then if run_me then
-- if the file loads, run the compiled function
run_me() run_me()
-- if there is no compiled file, prompt the user to run :PackerSync
else else
astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } } -- if there is no compiled file, ask user to sync packer
require "core.plugins"
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = "PackerComplete",
callback = function()
vim.cmd.bw()
vim.tbl_map(require, { "nvim-treesitter", "mason" })
astronvim.notify "Mason is installing packages if configured, check status with :Mason"
end,
})
vim.opt.cmdheight = 1
vim.notify "Please wait while plugins are installed..."
vim.cmd.PackerSync()
end
end
end
function astronvim.lazy_load_commands(plugin, commands)
if type(commands) == "string" then commands = { commands } end
if astronvim.is_available(plugin) and not packer_plugins[plugin].loaded then
for _, command in ipairs(commands) do
pcall(
vim.cmd,
string.format(
'command -nargs=* -range -bang -complete=file %s lua require("packer.load")({"%s"}, { cmd = "%s", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)',
command,
plugin,
command
)
)
end end
end end
end end
@ -255,17 +304,19 @@ function astronvim.user_plugin_opts(module, default, extend, prefix)
return default return default
end end
--- Open a URL under the cursor with the current operating system --- Open a URL under the cursor with the current operating system (Supports Mac OS X and *nix)
function astronvim.url_opener() -- @param path the path of the file to open with the system opener
-- if mac use the open command function astronvim.system_open(path)
path = path or vim.fn.expand "<cfile>"
if vim.fn.has "mac" == 1 then if vim.fn.has "mac" == 1 then
vim.fn.jobstart({ "open", vim.fn.expand "<cfile>" }, { detach = true }) -- if mac use the open command
-- if unix then use xdg-open vim.fn.jobstart({ "open", path }, { detach = true })
elseif vim.fn.has "unix" == 1 then elseif vim.fn.has "unix" == 1 then
vim.fn.jobstart({ "xdg-open", vim.fn.expand "<cfile>" }, { detach = true }) -- if unix then use xdg-open
-- if any other operating system notify the user that there is currently no support vim.fn.jobstart({ "xdg-open", path }, { detach = true })
else else
astronvim.notify("gx is not supported on this OS!", "error") -- if any other operating system notify the user that there is currently no support
astronvim.notify("System open is not supported on this OS!", "error")
end end
end end
@ -274,22 +325,19 @@ end
--- Toggle a user terminal if it exists, if not then create a new one and save it --- Toggle a user terminal if it exists, if not then create a new one and save it
-- @param term_details a terminal command string or a table of options for Terminal:new() (Check toggleterm.nvim documentation for table format) -- @param term_details a terminal command string or a table of options for Terminal:new() (Check toggleterm.nvim documentation for table format)
function astronvim.toggle_term_cmd(term_details) function astronvim.toggle_term_cmd(opts)
local terms = astronvim.user_terminals
-- if a command string is provided, create a basic table for Terminal:new() options -- if a command string is provided, create a basic table for Terminal:new() options
if type(term_details) == "string" then term_details = { cmd = term_details, hidden = true } end if type(opts) == "string" then opts = { cmd = opts, hidden = true } end
-- use the command as the key for the table local num = vim.v.count > 0 and vim.v.count or 1
local term_key = term_details.cmd
-- set the count in the term details
if vim.v.count > 0 and term_details.count == nil then
term_details.count = vim.v.count
term_key = term_key .. vim.v.count
end
-- if terminal doesn't exist yet, create it -- if terminal doesn't exist yet, create it
if astronvim.user_terminals[term_key] == nil then if not terms[opts.cmd] then terms[opts.cmd] = {} end
astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details) if not terms[opts.cmd][num] then
if not opts.count then opts.count = vim.tbl_count(terms) * 100 + num end
terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts)
end end
-- toggle the terminal -- toggle the terminal
astronvim.user_terminals[term_key]:toggle() astronvim.user_terminals[opts.cmd][num]:toggle()
end end
--- Add a source to cmp --- Add a source to cmp
@ -374,20 +422,6 @@ function astronvim.null_ls_providers(filetype)
return registered return registered
end end
--- Register a null-ls source given a name if it has not been manually configured in the null-ls configuration
-- @param source the source name to register from all builtin types
function astronvim.null_ls_register(source)
-- try to load null-ls
local null_ls_avail, null_ls = pcall(require, "null-ls")
if null_ls_avail then
if null_ls.is_registered(source) then return end
for _, type in ipairs { "diagnostics", "formatting", "code_actions", "completion", "hover" } do
local builtin = require("null-ls.builtins._meta." .. type)
if builtin[source] then null_ls.register(null_ls.builtins[type][source]) end
end
end
end
--- Get the null-ls sources for a given null-ls method --- Get the null-ls sources for a given null-ls method
-- @param filetype the filetype to search null-ls for -- @param filetype the filetype to search null-ls for
-- @param method the null-ls method (check null-ls documentation for available methods) -- @param method the null-ls method (check null-ls documentation for available methods)
@ -432,6 +466,22 @@ end
-- @return boolean value if the plugin is available -- @return boolean value if the plugin is available
function astronvim.is_available(plugin) return packer_plugins ~= nil and packer_plugins[plugin] ~= nil end function astronvim.is_available(plugin) return packer_plugins ~= nil and packer_plugins[plugin] ~= nil end
--- A helper function to wrap a module function to require a plugin before running
-- @param plugin the plugin string to call `require("packer").laoder` with
-- @param module the system module where the functions live (e.g. `vim.ui`)
-- @param func_names a string or a list like table of strings for functions to wrap in the given moduel (e.g. `{ "ui", "select }`)
function astronvim.load_plugin_with_func(plugin, module, func_names)
if type(func_names) == "string" then func_names = { func_names } end
for _, func in ipairs(func_names) do
local old_func = module[func]
module[func] = function(...)
module[func] = old_func
require("packer").loader(plugin)
module[func](...)
end
end
end
--- Table based API for setting keybindings --- Table based API for setting keybindings
-- @param map_table A nested table where the first key is the vim mode, the second key is the key to map, and the value is the function to set the mapping to -- @param map_table A nested table where the first key is the vim mode, the second key is the key to map, and the value is the function to set the mapping to
-- @param base A base set of options to set on every keybinding -- @param base A base set of options to set on every keybinding
@ -480,12 +530,13 @@ function astronvim.cmd(cmd, show_error)
if not success and (show_error == nil and true or show_error) then if not success and (show_error == nil and true or show_error) then
vim.api.nvim_err_writeln("Error running command: " .. cmd .. "\nError message:\n" .. result) vim.api.nvim_err_writeln("Error running command: " .. cmd .. "\nError message:\n" .. result)
end end
return success and result or nil return success and result:gsub("[\27\155][][()#;?%d]*[A-PRZcf-ntqry=><~]", "") or nil
end end
require "core.utils.ui" require "core.utils.ui"
require "core.utils.status" require "core.utils.status"
require "core.utils.updater" require "core.utils.updater"
require "core.utils.mason"
require "core.utils.lsp" require "core.utils.lsp"
return astronvim return astronvim

View File

@ -14,10 +14,12 @@ local tbl_contains = vim.tbl_contains
local tbl_isempty = vim.tbl_isempty local tbl_isempty = vim.tbl_isempty
local user_plugin_opts = astronvim.user_plugin_opts local user_plugin_opts = astronvim.user_plugin_opts
local conditional_func = astronvim.conditional_func local conditional_func = astronvim.conditional_func
local is_available = astronvim.is_available
local user_registration = user_plugin_opts("lsp.server_registration", nil, false) local user_registration = user_plugin_opts("lsp.server_registration", nil, false)
local skip_setup = user_plugin_opts "lsp.skip_setup" local skip_setup = user_plugin_opts "lsp.skip_setup"
astronvim.lsp.formatting = astronvim.user_plugin_opts("lsp.formatting", { format_on_save = { enabled = true } }) astronvim.lsp.formatting =
astronvim.user_plugin_opts("lsp.formatting", { format_on_save = { enabled = true }, disabled = {} })
if type(astronvim.lsp.formatting.format_on_save) == "boolean" then if type(astronvim.lsp.formatting.format_on_save) == "boolean" then
astronvim.lsp.formatting.format_on_save = { enabled = astronvim.lsp.formatting.format_on_save } astronvim.lsp.formatting.format_on_save = { enabled = astronvim.lsp.formatting.format_on_save }
end end
@ -36,6 +38,11 @@ end
-- @param server the name of the server to be setup -- @param server the name of the server to be setup
astronvim.lsp.setup = function(server) astronvim.lsp.setup = function(server)
if not tbl_contains(skip_setup, server) then if not tbl_contains(skip_setup, server) then
-- if server doesn't exist, set it up from user server definition
if not pcall(require, "lspconfig.server_configurations." .. server) then
local server_definition = user_plugin_opts("lsp.server-settings." .. server)
if server_definition.cmd then require("lspconfig.configs")[server] = { default_config = server_definition } end
end
local opts = astronvim.lsp.server_settings(server) local opts = astronvim.lsp.server_settings(server)
if type(user_registration) == "function" then if type(user_registration) == "function" then
user_registration(server, opts) user_registration(server, opts)
@ -65,6 +72,11 @@ astronvim.lsp.on_attach = function(client, bufnr)
lsp_mappings.v["<leader>la"] = lsp_mappings.n["<leader>la"] lsp_mappings.v["<leader>la"] = lsp_mappings.n["<leader>la"]
end end
if capabilities.codeLensProvider then
lsp_mappings.n["<leader>ll"] = { function() vim.lsp.codelens.refresh() end, desc = "LSP codelens refresh" }
lsp_mappings.n["<leader>lL"] = { function() vim.lsp.codelens.run() end, desc = "LSP codelens run" }
end
if capabilities.declarationProvider then if capabilities.declarationProvider then
lsp_mappings.n["gD"] = { function() vim.lsp.buf.declaration() end, desc = "Declaration of current symbol" } lsp_mappings.n["gD"] = { function() vim.lsp.buf.declaration() end, desc = "Declaration of current symbol" }
end end
@ -73,7 +85,7 @@ astronvim.lsp.on_attach = function(client, bufnr)
lsp_mappings.n["gd"] = { function() vim.lsp.buf.definition() end, desc = "Show the definition of current symbol" } lsp_mappings.n["gd"] = { function() vim.lsp.buf.definition() end, desc = "Show the definition of current symbol" }
end end
if capabilities.documentFormattingProvider then if capabilities.documentFormattingProvider and not tbl_contains(astronvim.lsp.formatting.disabled, client.name) then
lsp_mappings.n["<leader>lf"] = { lsp_mappings.n["<leader>lf"] = {
function() vim.lsp.buf.format(astronvim.lsp.format_opts) end, function() vim.lsp.buf.format(astronvim.lsp.format_opts) end,
desc = "Format code", desc = "Format code",
@ -137,6 +149,7 @@ astronvim.lsp.on_attach = function(client, bufnr)
if capabilities.referencesProvider then if capabilities.referencesProvider then
lsp_mappings.n["gr"] = { function() vim.lsp.buf.references() end, desc = "References of current symbol" } lsp_mappings.n["gr"] = { function() vim.lsp.buf.references() end, desc = "References of current symbol" }
lsp_mappings.n["<leader>lR"] = { function() vim.lsp.buf.references() end, desc = "Search references" }
end end
if capabilities.renameProvider then if capabilities.renameProvider then
@ -151,15 +164,34 @@ astronvim.lsp.on_attach = function(client, bufnr)
lsp_mappings.n["gT"] = { function() vim.lsp.buf.type_definition() end, desc = "Definition of current type" } lsp_mappings.n["gT"] = { function() vim.lsp.buf.type_definition() end, desc = "Definition of current type" }
end end
if capabilities.workspaceSymbolProvider then
lsp_mappings.n["<leader>lG"] = { function() vim.lsp.buf.workspace_symbol() end, desc = "Search workspace symbols" }
end
if is_available "telescope.nvim" then -- setup telescope mappings if available
if lsp_mappings.n.gd then lsp_mappings.n.gd[1] = function() require("telescope.builtin").lsp_definitions() end end
if lsp_mappings.n.gI then
lsp_mappings.n.gI[1] = function() require("telescope.builtin").lsp_implementations() end
end
if lsp_mappings.n.gr then lsp_mappings.n.gr[1] = function() require("telescope.builtin").lsp_references() end end
if lsp_mappings.n["<leader>lR"] then
lsp_mappings.n["<leader>lR"][1] = function() require("telescope.builtin").lsp_references() end
end
if lsp_mappings.n.gT then
lsp_mappings.n.gT[1] = function() require("telescope.builtin").lsp_type_definitions() end
end
if lsp_mappings.n["<leader>lG"] then
lsp_mappings.n["<leader>lG"][1] = function() require("telescope.builtin").lsp_workspace_symbols() end
end
end
astronvim.set_mappings(user_plugin_opts("lsp.mappings", lsp_mappings), { buffer = bufnr }) astronvim.set_mappings(user_plugin_opts("lsp.mappings", lsp_mappings), { buffer = bufnr })
if not vim.tbl_isempty(lsp_mappings.v) then if not vim.tbl_isempty(lsp_mappings.v) then
astronvim.which_key_register({ v = { ["<leader>"] = { l = { name = "LSP" } } } }, { buffer = bufnr }) astronvim.which_key_register({ v = { ["<leader>"] = { l = { name = "LSP" } } } }, { buffer = bufnr })
end end
local on_attach_override = user_plugin_opts("lsp.on_attach", nil, false) local on_attach_override = user_plugin_opts("lsp.on_attach", nil, false)
local aerial_avail, aerial = pcall(require, "aerial")
conditional_func(on_attach_override, true, client, bufnr) conditional_func(on_attach_override, true, client, bufnr)
conditional_func(aerial.on_attach, aerial_avail, client, bufnr)
end end
--- The default AstroNvim LSP capabilities --- The default AstroNvim LSP capabilities
@ -184,7 +216,7 @@ astronvim.lsp.flags = user_plugin_opts "lsp.flags"
function astronvim.lsp.server_settings(server_name) function astronvim.lsp.server_settings(server_name)
local server = require("lspconfig")[server_name] local server = require("lspconfig")[server_name]
local opts = user_plugin_opts( -- get user server-settings local opts = user_plugin_opts( -- get user server-settings
"lsp.server-settings." .. server_name, "lsp.server-settings." .. server_name, -- TODO: RENAME lsp.server-settings to lsp.config in v3
user_plugin_opts("server-settings." .. server_name, { -- get default server-settings user_plugin_opts("server-settings." .. server_name, { -- get default server-settings
capabilities = vim.tbl_deep_extend("force", astronvim.lsp.capabilities, server.capabilities or {}), capabilities = vim.tbl_deep_extend("force", astronvim.lsp.capabilities, server.capabilities or {}),
flags = vim.tbl_deep_extend("force", astronvim.lsp.flags, server.flags or {}), flags = vim.tbl_deep_extend("force", astronvim.lsp.flags, server.flags or {}),

View File

@ -8,7 +8,6 @@
-- @copyright 2022 -- @copyright 2022
-- @license GNU General Public License v3.0 -- @license GNU General Public License v3.0
astronvim.status = { hl = {}, init = {}, provider = {}, condition = {}, component = {}, utils = {}, env = {} } astronvim.status = { hl = {}, init = {}, provider = {}, condition = {}, component = {}, utils = {}, env = {} }
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
astronvim.status.env.modes = { astronvim.status.env.modes = {
["n"] = { "NORMAL", "normal" }, ["n"] = { "NORMAL", "normal" },
@ -22,8 +21,8 @@ astronvim.status.env.modes = {
["i"] = { "INSERT", "insert" }, ["i"] = { "INSERT", "insert" },
["ic"] = { "INSERT", "insert" }, ["ic"] = { "INSERT", "insert" },
["ix"] = { "INSERT", "insert" }, ["ix"] = { "INSERT", "insert" },
["t"] = { "TERM", "insert" }, ["t"] = { "TERM", "terminal" },
["nt"] = { "TERM", "insert" }, ["nt"] = { "TERM", "terminal" },
["v"] = { "VISUAL", "visual" }, ["v"] = { "VISUAL", "visual" },
["vs"] = { "VISUAL", "visual" }, ["vs"] = { "VISUAL", "visual" },
["V"] = { "LINES", "visual" }, ["V"] = { "LINES", "visual" },
@ -86,12 +85,14 @@ function astronvim.status.hl.mode() return { bg = astronvim.status.hl.mode_bg()
--- Get the foreground color group for the current mode, good for usage with Heirline surround utility --- Get the foreground color group for the current mode, good for usage with Heirline surround utility
-- @return the highlight group for the current mode foreground -- @return the highlight group for the current mode foreground
-- @usage local heirline_component = require("heirline.utils").surround({ "|", "|" }, astronvim.status.hl.mode_bg, heirline_component), -- @usage local heirline_component = require("heirline.utils").surround({ "|", "|" }, astronvim.status.hl.mode_bg, heirline_component),
function astronvim.status.hl.mode_bg() return astronvim.status.env.modes[vim.fn.mode()][2] end function astronvim.status.hl.mode_bg() return astronvim.status.env.modes[vim.fn.mode()][2] end
--- Get the foreground color group for the current filetype --- Get the foreground color group for the current filetype
-- @return the highlight group for the current filetype foreground -- @return the highlight group for the current filetype foreground
-- @usage local heirline_component = { provider = astronvim.status.provider.fileicon(), hl = astronvim.status.hl.filetype_color }, -- @usage local heirline_component = { provider = astronvim.status.provider.fileicon(), hl = astronvim.status.hl.filetype_color },
function astronvim.status.hl.filetype_color(self) function astronvim.status.hl.filetype_color(self)
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
if not devicons_avail then return {} end if not devicons_avail then return {} end
local _, color = devicons.get_icon_color( local _, color = devicons.get_icon_color(
vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"), vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"),
@ -106,13 +107,12 @@ end
-- @return The Heirline init function -- @return The Heirline init function
-- @usage local heirline_component = { init = astronvim.status.init.breadcrumbs { padding = { left = 1 } } } -- @usage local heirline_component = { init = astronvim.status.init.breadcrumbs { padding = { left = 1 } } }
function astronvim.status.init.breadcrumbs(opts) function astronvim.status.init.breadcrumbs(opts)
local aerial_avail, aerial = pcall(require, "aerial")
opts = astronvim.default_tbl( opts = astronvim.default_tbl(
opts, opts,
{ separator = " > ", icon = { enabled = true, hl = false }, padding = { left = 0, right = 0 } } { separator = " > ", icon = { enabled = true, hl = false }, padding = { left = 0, right = 0 } }
) )
return function(self) return function(self)
local data = aerial_avail and aerial.get_location(true) or {} local data = require("aerial").get_location(true) or {}
local children = {} local children = {}
-- create a child for each level -- create a child for each level
for i, d in ipairs(data) do for i, d in ipairs(data) do
@ -189,6 +189,7 @@ end
--- A provider function for showing if paste is enabled --- A provider function for showing if paste is enabled
-- @param opts options passed to the stylize function -- @param opts options passed to the stylize function
-- @return the function for outputting if paste is enabled -- @return the function for outputting if paste is enabled
-- @usage local heirline_component = { provider = astronvim.status.provider.paste() } -- @usage local heirline_component = { provider = astronvim.status.provider.paste() }
-- @see astronvim.status.utils.stylize -- @see astronvim.status.utils.stylize
function astronvim.status.provider.paste(opts) function astronvim.status.provider.paste(opts)
@ -210,6 +211,31 @@ function astronvim.status.provider.macro_recording(opts)
end end
end end
--- A provider function for displaying the current search count
-- @param opts options for `vim.fn.searchcount` and options passed to the stylize function
-- @return a function that returns a string of the current search location
-- @usage local heirline_component = { provider = astronvim.status.provider.search_count() }
-- @see astronvim.status.utils.stylize
function astronvim.status.provider.search_count(opts)
local search_func = vim.tbl_isempty(opts or {}) and function() return vim.fn.searchcount() end
or function() return vim.fn.searchcount(opts) end
return function()
local search_ok, search = pcall(search_func)
if search_ok and type(search) == "table" and search.total then
return astronvim.status.utils.stylize(
string.format(
"%s%d/%s%d",
search.current > search.maxcount and ">" or "",
math.min(search.current, search.maxcount),
search.incomplete == 2 and ">" or "",
math.min(search.total, search.maxcount)
),
opts
)
end
end
end
--- A provider function for showing the text of the current vim mode --- A provider function for showing the text of the current vim mode
-- @param opts options for padding the text and options passed to the stylize function -- @param opts options for padding the text and options passed to the stylize function
-- @return the function for displaying the text of the current vim mode -- @return the function for displaying the text of the current vim mode
@ -235,18 +261,21 @@ function astronvim.status.provider.mode_text(opts)
end end
--- A provider function for showing the percentage of the current location in a document --- A provider function for showing the percentage of the current location in a document
-- @param opts options passed to the stylize function -- @param opts options for Top/Bot text, fixed width, and options passed to the stylize function
-- @return the statusline string for displaying the percentage of current document location -- @return the statusline string for displaying the percentage of current document location
-- @usage local heirline_component = { provider = astronvim.status.provider.percentage() } -- @usage local heirline_component = { provider = astronvim.status.provider.percentage() }
-- @see astronvim.status.utils.stylize -- @see astronvim.status.utils.stylize
function astronvim.status.provider.percentage(opts) function astronvim.status.provider.percentage(opts)
opts = astronvim.default_tbl(opts, { fixed_width = false, edge_text = true })
return function() return function()
local text = "%p%%" local text = "%" .. (opts.fixed_width and "3" or "") .. "p%%"
if opts.edge_text then
local current_line = vim.fn.line "." local current_line = vim.fn.line "."
if current_line == 1 then if current_line == 1 then
text = "Top" text = (opts.fixed_width and " " or "") .. "Top"
elseif current_line == vim.fn.line "$" then elseif current_line == vim.fn.line "$" then
text = "Bot" text = (opts.fixed_width and " " or "") .. "Bot"
end
end end
return astronvim.status.utils.stylize(text, opts) return astronvim.status.utils.stylize(text, opts)
end end
@ -305,10 +334,13 @@ end
-- @usage local heirline_component = { provider = astronvim.status.provider.filename() } -- @usage local heirline_component = { provider = astronvim.status.provider.filename() }
-- @see astronvim.status.utils.stylize -- @see astronvim.status.utils.stylize
function astronvim.status.provider.filename(opts) function astronvim.status.provider.filename(opts)
opts = astronvim.default_tbl(opts, { fname = function(nr) return vim.api.nvim_buf_get_name(nr) end, modify = ":t" }) opts = astronvim.default_tbl(
opts,
{ fallback = "[No Name]", fname = function(nr) return vim.api.nvim_buf_get_name(nr) end, modify = ":t" }
)
return function(self) return function(self)
local filename = vim.fn.fnamemodify(opts.fname(self and self.bufnr or 0), opts.modify) local filename = vim.fn.fnamemodify(opts.fname(self and self.bufnr or 0), opts.modify)
return astronvim.status.utils.stylize((filename == "" and "[No Name]" or filename), opts) return astronvim.status.utils.stylize((filename == "" and opts.fallback or filename), opts)
end end
end end
@ -401,8 +433,9 @@ end
-- @usage local heirline_component = { provider = astronvim.status.provider.file_icon() } -- @usage local heirline_component = { provider = astronvim.status.provider.file_icon() }
-- @see astronvim.status.utils.stylize -- @see astronvim.status.utils.stylize
function astronvim.status.provider.file_icon(opts) function astronvim.status.provider.file_icon(opts)
if not devicons_avail then return "" end
return function(self) return function(self)
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
if not devicons_avail then return "" end
local ft_icon, _ = devicons.get_icon( local ft_icon, _ = devicons.get_icon(
vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"), vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"),
nil, nil,
@ -515,10 +548,7 @@ end
-- @usage local heirline_component = { provider = astronvim.status.provider.treesitter_status() } -- @usage local heirline_component = { provider = astronvim.status.provider.treesitter_status() }
-- @see astronvim.status.utils.stylize -- @see astronvim.status.utils.stylize
function astronvim.status.provider.treesitter_status(opts) function astronvim.status.provider.treesitter_status(opts)
return function() return function() return astronvim.status.utils.stylize(require("nvim-treesitter.parser").has_parser() and "TS" or "", opts) end
local ts_avail, ts = pcall(require, "nvim-treesitter.parsers")
return astronvim.status.utils.stylize((ts_avail and ts.has_parser()) and "TS" or "", opts)
end
end end
--- A provider function for displaying a single string --- A provider function for displaying a single string
@ -551,6 +581,11 @@ end
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_macro_recording } -- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_macro_recording }
function astronvim.status.condition.is_macro_recording() return vim.fn.reg_recording() ~= "" end function astronvim.status.condition.is_macro_recording() return vim.fn.reg_recording() ~= "" end
--- A condition function if search is visible
-- @return boolean of wether or not searching is currently visible
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_hlsearch }
function astronvim.status.condition.is_hlsearch() return vim.v.hlsearch ~= 0 end
--- A condition function if the current file is in a git repo --- A condition function if the current file is in a git repo
-- @return boolean of wether or not the current file is in a git repo -- @return boolean of wether or not the current file is in a git repo
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_git_repo } -- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_git_repo }
@ -594,7 +629,8 @@ end
--- A condition function if Aerial is available --- A condition function if Aerial is available
-- @return boolean of wether or not aerial plugin is installed -- @return boolean of wether or not aerial plugin is installed
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.aerial_available } -- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.aerial_available }
function astronvim.status.condition.aerial_available() return astronvim.is_available "aerial.nvim" end -- function astronvim.status.condition.aerial_available() return astronvim.is_available "aerial.nvim" end
function astronvim.status.condition.aerial_available() return package.loaded["aerial"] end
--- A condition function if LSP is attached --- A condition function if LSP is attached
-- @return boolean of wether or not LSP is attached -- @return boolean of wether or not LSP is attached
@ -605,8 +641,7 @@ function astronvim.status.condition.lsp_attached() return next(vim.lsp.buf_get_c
-- @return boolean of wether or not treesitter is active -- @return boolean of wether or not treesitter is active
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.treesitter_available } -- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.treesitter_available }
function astronvim.status.condition.treesitter_available() function astronvim.status.condition.treesitter_available()
local ts_avail, ts = pcall(require, "nvim-treesitter.parsers") return package.loaded["nvim-treesitter"] and require("nvim-treesitter.parsers").has_parser()
return ts_avail and ts.has_parser()
end end
--- A utility function to stylize a string with an icon from lspkind, separators, and left/right padding --- A utility function to stylize a string with an icon from lspkind, separators, and left/right padding
@ -639,14 +674,14 @@ function astronvim.status.component.fill() return { provider = astronvim.status.
-- @usage local heirline_component = astronvim.status.component.file_info() -- @usage local heirline_component = astronvim.status.component.file_info()
function astronvim.status.component.file_info(opts) function astronvim.status.component.file_info(opts)
opts = astronvim.default_tbl(opts, { opts = astronvim.default_tbl(opts, {
file_icon = { highlight = true, padding = { left = 1, right = 1 } }, file_icon = { hl = astronvim.status.hl.filetype_color, padding = { left = 1, right = 1 } },
filename = {}, filename = {},
file_modified = { padding = { left = 1 } }, file_modified = { padding = { left = 1 } },
file_read_only = { padding = { left = 1 } }, file_read_only = { padding = { left = 1 } },
surround = { separator = "left", color = "file_info_bg", condition = astronvim.status.condition.has_filetype }, surround = { separator = "left", color = "file_info_bg", condition = astronvim.status.condition.has_filetype },
hl = { fg = "file_info_fg" }, hl = { fg = "file_info_fg" },
}) })
for i, key in ipairs { return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, {
"file_icon", "file_icon",
"unique_path", "unique_path",
"filename", "filename",
@ -654,17 +689,7 @@ function astronvim.status.component.file_info(opts)
"file_modified", "file_modified",
"file_read_only", "file_read_only",
"close_button", "close_button",
} do }))
opts[i] = opts[key]
and {
provider = key,
opts = opts[key],
hl = opts[key].highlight and astronvim.status.hl.filetype_color or opts[key].hl,
on_click = opts[key].on_click,
}
or false
end
return astronvim.status.component.builder(opts)
end end
--- A function to build a set of children components for an entire navigation section --- A function to build a set of children components for an entire navigation section
@ -680,16 +705,16 @@ function astronvim.status.component.nav(opts)
hl = { fg = "nav_fg" }, hl = { fg = "nav_fg" },
update = { "CursorMoved", "BufEnter" }, update = { "CursorMoved", "BufEnter" },
}) })
for i, key in ipairs { "ruler", "percentage", "scrollbar" } do return astronvim.status.component.builder(
opts[i] = opts[key] and { provider = key, opts = opts[key], hl = opts[key].hl } or false astronvim.status.utils.setup_providers(opts, { "ruler", "percentage", "scrollbar" })
end )
return astronvim.status.component.builder(opts)
end end
--- A function to build a set of children components for a macro recording section --- A function to build a set of children components for a macro recording section
-- @param opts options for configuring macro recording and the overall padding -- @param opts options for configuring macro recording and the overall padding
-- @return The Heirline component table -- @return The Heirline component table
-- @usage local heirline_component = astronvim.status.component.macro_recording() -- @usage local heirline_component = astronvim.status.component.macro_recording()
-- TODO: deprecate on next major version release
function astronvim.status.component.macro_recording(opts) function astronvim.status.component.macro_recording(opts)
opts = astronvim.default_tbl(opts, { opts = astronvim.default_tbl(opts, {
macro_recording = { icon = { kind = "MacroRecording", padding = { right = 1 } } }, macro_recording = { icon = { kind = "MacroRecording", padding = { right = 1 } } },
@ -701,8 +726,36 @@ function astronvim.status.component.macro_recording(opts)
hl = { fg = "macro_recording_fg", bold = true }, hl = { fg = "macro_recording_fg", bold = true },
update = { "RecordingEnter", "RecordingLeave" }, update = { "RecordingEnter", "RecordingLeave" },
}) })
opts[1] = opts.macro_recording and { provider = "macro_recording", opts = opts.macro_recording } or false return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "macro_recording" }))
return astronvim.status.component.builder(opts) end
--- A function to build a set of children components for information shown in the cmdline
-- @param opts options for configuring macro recording, search count, and the overall padding
-- @return The Heirline component table
-- @usage local heirline_component = astronvim.status.component.cmd_info()
function astronvim.status.component.cmd_info(opts)
opts = astronvim.default_tbl(opts, {
macro_recording = {
icon = { kind = "MacroRecording", padding = { right = 1 } },
condition = astronvim.status.condition.is_macro_recording,
update = { "RecordingEnter", "RecordingLeave" },
},
search_count = {
icon = { kind = "Search", padding = { right = 1 } },
padding = { left = 1 },
condition = astronvim.status.condition.is_hlsearch,
},
surround = {
separator = "center",
color = "cmd_info_bg",
condition = function() return astronvim.status.condition.is_hlsearch() or astronvim.status.condition.is_macro_recording() end,
},
condition = function() return vim.opt.cmdheight:get() == 0 end,
hl = { fg = "cmd_info_fg" },
})
return astronvim.status.component.builder(
astronvim.status.utils.setup_providers(opts, { "macro_recording", "search_count" })
)
end end
--- A function to build a set of children components for a mode section --- A function to build a set of children components for a mode section
@ -718,14 +771,10 @@ function astronvim.status.component.mode(opts)
hl = { fg = "bg" }, hl = { fg = "bg" },
update = "ModeChanged", update = "ModeChanged",
}) })
for i, key in ipairs { "mode_text", "paste", "spell" } do if not opts["mode_text"] then opts.str = { str = " " } end
if key == "mode_text" and not opts[key] then return astronvim.status.component.builder(
opts[i] = { provider = "str", opts = { str = " " } } astronvim.status.utils.setup_providers(opts, { "mode_text", "str", "paste", "spell" })
else )
opts[i] = opts[key] and { provider = key, opts = opts[key], hl = opts[key].hl } or false
end
end
return astronvim.status.component.builder(opts)
end end
--- A function to build a set of children components for an LSP breadcrumbs section --- A function to build a set of children components for an LSP breadcrumbs section
@ -761,8 +810,7 @@ function astronvim.status.component.git_branch(opts)
update = { "User", pattern = "GitSignsUpdate" }, update = { "User", pattern = "GitSignsUpdate" },
init = astronvim.status.init.update_events { "BufEnter" }, init = astronvim.status.init.update_events { "BufEnter" },
}) })
opts[1] = opts.git_branch and { provider = "git_branch", opts = opts.git_branch } or false return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "git_branch" }))
return astronvim.status.component.builder(opts)
end end
--- A function to build a set of children components for a git difference section --- A function to build a set of children components for a git difference section
@ -787,11 +835,17 @@ function astronvim.status.component.git_diff(opts)
update = { "User", pattern = "GitSignsUpdate" }, update = { "User", pattern = "GitSignsUpdate" },
init = astronvim.status.init.update_events { "BufEnter" }, init = astronvim.status.init.update_events { "BufEnter" },
}) })
for i, kind in ipairs { "added", "changed", "removed" } do return astronvim.status.component.builder(
if type(opts[kind]) == "table" then opts[kind].type = kind end astronvim.status.utils.setup_providers(opts, { "added", "changed", "removed" }, function(p_opts, provider)
opts[i] = opts[kind] and { provider = "git_diff", opts = opts[kind], hl = { fg = "git_" .. kind } } or false local out = astronvim.status.utils.build_provider(p_opts, provider)
if out then
out.provider = "git_diff"
out.opts.type = provider
out.hl = { fg = "git_" .. provider }
end end
return astronvim.status.component.builder(opts) return out
end)
)
end end
--- A function to build a set of children components for a diagnostics section --- A function to build a set of children components for a diagnostics section
@ -816,11 +870,17 @@ function astronvim.status.component.diagnostics(opts)
}, },
update = { "DiagnosticChanged", "BufEnter" }, update = { "DiagnosticChanged", "BufEnter" },
}) })
for i, kind in ipairs { "ERROR", "WARN", "INFO", "HINT" } do return astronvim.status.component.builder(
if type(opts[kind]) == "table" then opts[kind].severity = kind end astronvim.status.utils.setup_providers(opts, { "ERROR", "WARN", "INFO", "HINT" }, function(p_opts, provider)
opts[i] = opts[kind] and { provider = "diagnostics", opts = opts[kind], hl = { fg = "diag_" .. kind } } or false local out = astronvim.status.utils.build_provider(p_opts, provider)
if out then
out.provider = "diagnostics"
out.opts.severity = provider
out.hl = { fg = "diag_" .. provider }
end end
return astronvim.status.component.builder(opts) return out
end)
)
end end
--- A function to build a set of children components for a Treesitter section --- A function to build a set of children components for a Treesitter section
@ -839,8 +899,7 @@ function astronvim.status.component.treesitter(opts)
update = { "OptionSet", pattern = "syntax" }, update = { "OptionSet", pattern = "syntax" },
init = astronvim.status.init.update_events { "BufEnter" }, init = astronvim.status.init.update_events { "BufEnter" },
}) })
opts[1] = opts.str and { provider = "str", opts = opts.str } or false return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "str" }))
return astronvim.status.component.builder(opts)
end end
--- A function to build a set of children components for an LSP section --- A function to build a set of children components for an LSP section
@ -849,32 +908,40 @@ end
-- @usage local heirline_component = astronvim.status.component.lsp() -- @usage local heirline_component = astronvim.status.component.lsp()
function astronvim.status.component.lsp(opts) function astronvim.status.component.lsp(opts)
opts = astronvim.default_tbl(opts, { opts = astronvim.default_tbl(opts, {
lsp_progress = { str = "", padding = { right = 1 } }, lsp_progress = {
lsp_client_names = { str = "LSP", icon = { kind = "ActiveLSP", padding = { right = 2 } } }, str = "",
padding = { right = 1 },
update = { "User", pattern = { "LspProgressUpdate", "LspRequest" } },
},
lsp_client_names = {
str = "LSP",
update = { "LspAttach", "LspDetach", "BufEnter" },
icon = { kind = "ActiveLSP", padding = { right = 2 } },
},
hl = { fg = "lsp_fg" }, hl = { fg = "lsp_fg" },
surround = { separator = "right", color = "lsp_bg", condition = astronvim.status.condition.lsp_attached }, surround = { separator = "right", color = "lsp_bg", condition = astronvim.status.condition.lsp_attached },
on_click = { on_click = {
name = "heirline_lsp", name = "heirline_lsp",
callback = function() callback = function()
vim.defer_fn(function() vim.cmd "LspInfo" end, 100) vim.defer_fn(function() vim.cmd.LspInfo() end, 100)
end, end,
}, },
}) })
opts[1] = {} return astronvim.status.component.builder(
for i, provider in ipairs { "lsp_progress", "lsp_client_names" } do astronvim.status.utils.setup_providers(
if type(opts[provider]) == "table" then opts,
local new_provider = opts[provider].str { "lsp_progress", "lsp_client_names" },
and astronvim.status.utils.make_flexible( function(p_opts, provider, i)
i, return p_opts
{ provider = astronvim.status.provider[provider](opts[provider]) }, and {
{ provider = astronvim.status.provider.str(opts[provider]) } flexible = i,
astronvim.status.utils.build_provider(p_opts, astronvim.status.provider[provider](p_opts)),
astronvim.status.utils.build_provider(p_opts, astronvim.status.provider.str(p_opts)),
}
or false
end
)
) )
or { provider = provider, opts = opts[provider] }
if provider == "lsp_client_names" then new_provider.update = { "LspAttach", "LspDetach", "BufEnter" } end
table.insert(opts[1], new_provider)
end
end
return astronvim.status.component.builder(opts)
end end
--- A general function to build a section of astronvim status providers with highlights, conditions, and section surrounding --- A general function to build a section of astronvim status providers with highlights, conditions, and section surrounding
@ -911,6 +978,36 @@ function astronvim.status.component.builder(opts)
or children or children
end end
--- Convert a component parameter table to a table that can be used with the component builder
-- @param opts a table of provider options
-- @param provider a provider in `astronvim.status.providers`
-- @return the provider table that can be used in `astronvim.status.component.builder`
function astronvim.status.utils.build_provider(opts, provider, _)
return opts
and {
provider = provider,
opts = opts,
condition = opts.condition,
on_click = opts.on_click,
update = opts.update,
hl = opts.hl,
}
or false
end
--- Convert key/value table of options to an array of providers for the component builder
-- @param opts the table of options for the components
-- @param providers an ordered list like array of providers that are configured in the options table
-- @param setup a function that takes provider options table, provider name, provider index and returns the setup provider table, optional, default is `astronvim.status.utils.build_provider`
-- @return the fully setup options table with the appropriately ordered providers
function astronvim.status.utils.setup_providers(opts, providers, setup)
setup = setup or astronvim.status.utils.build_provider
for i, provider in ipairs(providers) do
opts[i] = setup(opts[provider], provider, i)
end
return opts
end
--- A utility function to get the width of the bar --- A utility function to get the width of the bar
-- @param is_winbar boolean true if you want the width of the winbar, false if you want the statusline width -- @param is_winbar boolean true if you want the width of the winbar, false if you want the statusline width
-- @return the width of the specified bar -- @return the width of the specified bar
@ -918,29 +1015,6 @@ function astronvim.status.utils.width(is_winbar)
return vim.o.laststatus == 3 and not is_winbar and vim.o.columns or vim.api.nvim_win_get_width(0) return vim.o.laststatus == 3 and not is_winbar and vim.o.columns or vim.api.nvim_win_get_width(0)
end end
local function insert(destination, ...)
local new = astronvim.default_tbl({}, destination)
for _, child in ipairs { ... } do
table.insert(new, astronvim.default_tbl({}, child))
end
return new
end
--- Create a flexible statusline component
-- @param priority the priority of the element
-- @return the flexible component that switches between components to fit the width
function astronvim.status.utils.make_flexible(priority, ...)
local new = insert({}, ...)
new.static = { _priority = priority }
new.init = function(self)
if not vim.tbl_contains(self._flexible_components, self) then table.insert(self._flexible_components, self) end
self:set_win_attr("_win_child_index", nil, 1)
self.pick_child = { self:get_win_attr "_win_child_index" }
end
new.restrict = { _win_child_index = true }
return new
end
--- Surround component with separator and color adjustment --- Surround component with separator and color adjustment
-- @param separator the separator index to use in `astronvim.status.env.separators` -- @param separator the separator index to use in `astronvim.status.env.separators`
-- @param color the color to use as the separator foreground/component background -- @param color the color to use as the separator foreground/component background

View File

@ -11,7 +11,17 @@
astronvim.ui = {} astronvim.ui = {}
local bool2str = function(bool) return bool and "on" or "off" end local function bool2str(bool) return bool and "on" or "off" end
local function ui_notify(str)
if vim.g.ui_notifications_enabled then astronvim.notify(str) end
end
--- Toggle notifications for UI toggles
function astronvim.ui.toggle_ui_notifications()
vim.g.ui_notifications_enabled = not vim.g.ui_notifications_enabled
ui_notify(string.format("ui notifications %s", bool2str(vim.g.ui_notifications_enabled)))
end
--- Toggle autopairs --- Toggle autopairs
function astronvim.ui.toggle_autopairs() function astronvim.ui.toggle_autopairs()
@ -23,9 +33,9 @@ function astronvim.ui.toggle_autopairs()
autopairs.disable() autopairs.disable()
end end
vim.g.autopairs_enabled = autopairs.state.disabled vim.g.autopairs_enabled = autopairs.state.disabled
astronvim.notify(string.format("autopairs %s", bool2str(not autopairs.state.disabled))) ui_notify(string.format("autopairs %s", bool2str(not autopairs.state.disabled)))
else else
astronvim.notify "autopairs not available" ui_notify "autopairs not available"
end end
end end
@ -46,32 +56,38 @@ function astronvim.ui.toggle_diagnostics()
end end
vim.diagnostic.config(astronvim.lsp.diagnostics[bool2str(vim.g.diagnostics_enabled)]) vim.diagnostic.config(astronvim.lsp.diagnostics[bool2str(vim.g.diagnostics_enabled)])
astronvim.notify(string.format("diagnostics %s", status)) ui_notify(string.format("diagnostics %s", status))
end end
--- Toggle background="dark"|"light" --- Toggle background="dark"|"light"
function astronvim.ui.toggle_background() function astronvim.ui.toggle_background()
vim.go.background = vim.go.background == "light" and "dark" or "light" vim.go.background = vim.go.background == "light" and "dark" or "light"
astronvim.notify(string.format("background=%s", vim.go.background)) ui_notify(string.format("background=%s", vim.go.background))
end end
--- Toggle cmp entrirely --- Toggle cmp entrirely
function astronvim.ui.toggle_cmp() function astronvim.ui.toggle_cmp()
vim.g.cmp_enabled = not vim.g.cmp_enabled vim.g.cmp_enabled = not vim.g.cmp_enabled
local ok, _ = pcall(require, "cmp") local ok, _ = pcall(require, "cmp")
astronvim.notify(ok and string.format("completion %s", bool2str(vim.g.cmp_enabled)) or "completion not available") ui_notify(ok and string.format("completion %s", bool2str(vim.g.cmp_enabled)) or "completion not available")
end end
--- Toggle auto format --- Toggle auto format
function astronvim.ui.toggle_autoformat() function astronvim.ui.toggle_autoformat()
vim.g.autoformat_enabled = not vim.g.autoformat_enabled vim.g.autoformat_enabled = not vim.g.autoformat_enabled
astronvim.notify(string.format("Autoformatting %s", bool2str(vim.g.autoformat_enabled))) ui_notify(string.format("Autoformatting %s", bool2str(vim.g.autoformat_enabled)))
end end
--- Toggle showtabline=2|0 --- Toggle showtabline=2|0
function astronvim.ui.toggle_tabline() function astronvim.ui.toggle_tabline()
vim.opt.showtabline = vim.opt.showtabline:get() == 0 and 2 or 0 vim.opt.showtabline = vim.opt.showtabline:get() == 0 and 2 or 0
astronvim.notify(string.format("tabline %s", bool2str(vim.opt.showtabline:get() == 2))) ui_notify(string.format("tabline %s", bool2str(vim.opt.showtabline:get() == 2)))
end
--- Toggle conceal=2|0
function astronvim.ui.toggle_conceal()
vim.opt.conceallevel = vim.opt.conceallevel:get() == 0 and 2 or 0
ui_notify(string.format("conceal %s", bool2str(vim.opt.conceallevel:get() == 2)))
end end
--- Toggle laststatus=3|2|0 --- Toggle laststatus=3|2|0
@ -88,7 +104,7 @@ function astronvim.ui.toggle_statusline()
vim.opt.laststatus = 0 vim.opt.laststatus = 0
status = "off" status = "off"
end end
astronvim.notify(string.format("statusline %s", status)) ui_notify(string.format("statusline %s", status))
end end
--- Toggle signcolumn="auto"|"no" --- Toggle signcolumn="auto"|"no"
@ -100,7 +116,7 @@ function astronvim.ui.toggle_signcolumn()
else else
vim.wo.signcolumn = "no" vim.wo.signcolumn = "no"
end end
astronvim.notify(string.format("signcolumn=%s", vim.wo.signcolumn)) ui_notify(string.format("signcolumn=%s", vim.wo.signcolumn))
end end
--- Set the indent and tab related numbers --- Set the indent and tab related numbers
@ -112,7 +128,7 @@ function astronvim.ui.set_indent()
vim.bo.tabstop = indent -- local to buffer vim.bo.tabstop = indent -- local to buffer
vim.bo.softtabstop = indent -- local to buffer vim.bo.softtabstop = indent -- local to buffer
vim.bo.shiftwidth = indent -- local to buffer vim.bo.shiftwidth = indent -- local to buffer
astronvim.notify(string.format("indent=%d %s", indent, vim.bo.expandtab and "expandtab" or "noexpandtab")) ui_notify(string.format("indent=%d %s", indent, vim.bo.expandtab and "expandtab" or "noexpandtab"))
end end
--- Change the number display modes --- Change the number display modes
@ -128,27 +144,25 @@ function astronvim.ui.change_number()
else -- not number and relativenumber else -- not number and relativenumber
vim.wo.relativenumber = false vim.wo.relativenumber = false
end end
astronvim.notify( ui_notify(string.format("number %s, relativenumber %s", bool2str(vim.wo.number), bool2str(vim.wo.relativenumber)))
string.format("number %s, relativenumber %s", bool2str(vim.wo.number), bool2str(vim.wo.relativenumber))
)
end end
--- Toggle spell --- Toggle spell
function astronvim.ui.toggle_spell() function astronvim.ui.toggle_spell()
vim.wo.spell = not vim.wo.spell -- local to window vim.wo.spell = not vim.wo.spell -- local to window
astronvim.notify(string.format("spell %s", bool2str(vim.wo.spell))) ui_notify(string.format("spell %s", bool2str(vim.wo.spell)))
end end
--- Toggle paste --- Toggle paste
function astronvim.ui.toggle_paste() function astronvim.ui.toggle_paste()
vim.opt.paste = not vim.opt.paste:get() -- local to window vim.opt.paste = not vim.opt.paste:get() -- local to window
astronvim.notify(string.format("paste %s", bool2str(vim.opt.paste:get()))) ui_notify(string.format("paste %s", bool2str(vim.opt.paste:get())))
end end
--- Toggle wrap --- Toggle wrap
function astronvim.ui.toggle_wrap() function astronvim.ui.toggle_wrap()
vim.wo.wrap = not vim.wo.wrap -- local to window vim.wo.wrap = not vim.wo.wrap -- local to window
astronvim.notify(string.format("wrap %s", bool2str(vim.wo.wrap))) ui_notify(string.format("wrap %s", bool2str(vim.wo.wrap)))
end end
--- Toggle syntax highlighting and treesitter --- Toggle syntax highlighting and treesitter
@ -161,7 +175,7 @@ function astronvim.ui.toggle_syntax()
if ts_avail and parsers.has_parser() then vim.cmd.TSBufEnable "highlight" end if ts_avail and parsers.has_parser() then vim.cmd.TSBufEnable "highlight" end
vim.cmd.syntax "on" -- set vim.g.syntax_on = true vim.cmd.syntax "on" -- set vim.g.syntax_on = true
end end
astronvim.notify(string.format("syntax %s", bool2str(vim.g.syntax_on))) ui_notify(string.format("syntax %s", bool2str(vim.g.syntax_on)))
end end
--- Toggle URL/URI syntax highlighting rules --- Toggle URL/URI syntax highlighting rules

View File

@ -76,22 +76,45 @@ local cancelled_message = { { "Update cancelled", "WarningMsg" } }
-- @param quiet boolean to quietly execute or send a notification -- @param quiet boolean to quietly execute or send a notification
function astronvim.updater.reload(quiet) function astronvim.updater.reload(quiet)
-- stop LSP if it is running -- stop LSP if it is running
if vim.fn.exists ":LspStop" ~= 0 then vim.cmd "LspStop" end if vim.fn.exists ":LspStop" ~= 0 then vim.cmd.LspStop() end
local reload_module = require("plenary.reload").reload_module local reload_module = require("plenary.reload").reload_module
-- unload AstroNvim configuration files -- unload AstroNvim configuration files
reload_module("user", false) reload_module "user"
reload_module("configs", false) reload_module "configs"
reload_module("default_theme", false) reload_module "default_theme"
reload_module("core", false) reload_module "core"
-- manual unload some plugins that need it if they exist -- manual unload some plugins that need it if they exist
reload_module("cmp", false) reload_module "cmp"
reload_module("which-key", false) reload_module "which-key"
-- source the AstroNvim configuration -- source the AstroNvim configuration
local reloaded, _ = pcall(dofile, vim.fn.expand "$MYVIMRC") local reloaded, _ = pcall(dofile, vim.fn.expand "$MYVIMRC")
-- if successful reload and not quiet, display a notification -- if successful reload and not quiet, display a notification
if reloaded and not quiet then astronvim.notify "Reloaded AstroNvim" end if reloaded and not quiet then astronvim.notify "Reloaded AstroNvim" end
end end
--- Sync Packer and then update Mason
function astronvim.updater.update_packages()
vim.api.nvim_create_autocmd("User", {
once = true,
desc = "Update Mason with Packer",
group = vim.api.nvim_create_augroup("astro_sync", { clear = true }),
pattern = "PackerComplete",
callback = function()
if astronvim.is_available "mason.nvim" then
vim.api.nvim_create_autocmd("User", {
pattern = "AstroMasonUpdateComplete",
once = true,
callback = function() astronvim.event "UpdatePackagesComplete" end,
})
astronvim.mason.update_all()
else
astronvim.event "UpdatePackagesComplete"
end
end,
})
vim.cmd.PackerSync()
end
--- AstroNvim's updater function --- AstroNvim's updater function
function astronvim.updater.update() function astronvim.updater.update()
-- if the git command is not available, then throw an error -- if the git command is not available, then throw an error
@ -255,23 +278,19 @@ function astronvim.updater.update()
-- if the user wants to reload and sync packer -- if the user wants to reload and sync packer
if options.auto_reload then if options.auto_reload then
-- perform a reload -- perform a reload
vim.opt.modifiable = true
astronvim.updater.reload(true) -- run quiet to not show notification on reload astronvim.updater.reload(true) -- run quiet to not show notification on reload
-- sync packer if it is available vim.api.nvim_create_autocmd("User", {
local packer_avail, packer = pcall(require, "packer") once = true,
if packer_avail then pattern = "AstroUpdatePackagesComplete",
-- on a successful packer sync send user event callback = function() astronvim.event "UpdateComplete" end,
vim.api.nvim_create_autocmd( })
"User", require "core.plugins"
{ pattern = "PackerComplete", command = "doautocmd User AstroUpdateComplete" } astronvim.updater.update_packages()
)
packer.sync()
-- if packer isn't available send successful update event -- if packer isn't available send successful update event
else
vim.cmd [[doautocmd User AstroUpdateComplete]]
end
else else
-- send user event of successful update -- send user event of successful update
vim.cmd [[doautocmd User AstroUpdateComplete]] astronvim.event "UpdateComplete"
end end
end end
end end

View File

@ -76,6 +76,7 @@ local colors = {
woff2 = "#abb2bf", woff2 = "#abb2bf",
zip = "#f9d71c", zip = "#f9d71c",
md = "#519aba", md = "#519aba",
pkg = "#d39ede",
} }
return astronvim.user_plugin_opts("default_theme.colors", colors) return astronvim.user_plugin_opts("default_theme.colors", colors)

View File

@ -20,6 +20,7 @@ for plugin, enabled in
beacon = false, beacon = false,
bufferline = true, bufferline = true,
cmp = true, cmp = true,
dapui = true,
dashboard = true, dashboard = true,
gitsigns = true, gitsigns = true,
highlighturl = true, highlighturl = true,

View File

@ -9,6 +9,8 @@ local lsp = {
DiagnosticUnderlineHint = { sp = C.red_2, undercurl = true }, DiagnosticUnderlineHint = { sp = C.red_2, undercurl = true },
DiagnosticUnderlineInfo = { sp = C.red_2, undercurl = true }, DiagnosticUnderlineInfo = { sp = C.red_2, undercurl = true },
DiagnosticUnderlineWarn = { sp = C.red_2, undercurl = true }, DiagnosticUnderlineWarn = { sp = C.red_2, undercurl = true },
LspCodeLens = { fg = C.grey_2 },
LspCodeLensSeparator = { fg = C.grey },
LspDiagnosticsFloatingError = { fg = C.red_1 }, LspDiagnosticsFloatingError = { fg = C.red_1 },
LspDiagnosticsFloatingHint = { fg = C.yellow_1 }, LspDiagnosticsFloatingHint = { fg = C.yellow_1 },
LspDiagnosticsFloatingInfor = { fg = C.white_2 }, LspDiagnosticsFloatingInfor = { fg = C.white_2 },

View File

@ -25,6 +25,7 @@ return {
AerialPropertyIcon = { link = "@property" }, AerialPropertyIcon = { link = "@property" },
AerialStringIcon = { link = "@string" }, AerialStringIcon = { link = "@string" },
AerialStructIcon = { link = "@type" }, AerialStructIcon = { link = "@type" },
AerialTypeIcon = { link = "@type" },
AerialTypeParameterIcon = { link = "@parameter" }, AerialTypeParameterIcon = { link = "@parameter" },
AerialVariableIcon = { link = "@variable" }, AerialVariableIcon = { link = "@variable" },
} }

View File

@ -1,4 +1,5 @@
return { return {
NotifyBackground = { bg = C.bg },
NotifyERRORBorder = { fg = C.red }, NotifyERRORBorder = { fg = C.red },
NotifyWARNBorder = { fg = C.orange_1 }, NotifyWARNBorder = { fg = C.orange_1 },
NotifyINFOBorder = { fg = C.green }, NotifyINFOBorder = { fg = C.green },

View File

@ -29,4 +29,6 @@ return {
DevIconXz = { fg = C.zip }, DevIconXz = { fg = C.zip },
DevIconZip = { fg = C.zip }, DevIconZip = { fg = C.zip },
DevIconMd = { fg = C.md }, DevIconMd = { fg = C.md },
DevIconPackageJson = { fg = C.pkg },
DevIconPackageLockJson = { fg = C.pkg },
} }

View File

@ -12,7 +12,7 @@ local treesitter = {
["@error"] = { fg = C.red }, ["@error"] = { fg = C.red },
["@exception"] = { fg = C.purple }, ["@exception"] = { fg = C.purple },
["@field"] = { fg = C.red }, ["@field"] = { fg = C.red },
["@float"] = { fg = C.green }, ["@float"] = { fg = C.orange },
["@function"] = { fg = C.blue }, ["@function"] = { fg = C.blue },
["@function.builtin"] = { fg = C.blue }, ["@function.builtin"] = { fg = C.blue },
["@function.macro"] = { fg = C.yellow }, ["@function.macro"] = { fg = C.yellow },

View File

@ -2,8 +2,8 @@ return {
VimwikiLink = { fg = C.cyan, bg = C.none }, VimwikiLink = { fg = C.cyan, bg = C.none },
VimwikiHeaderChar = { fg = C.grey, bg = C.none }, VimwikiHeaderChar = { fg = C.grey, bg = C.none },
VimwikiHR = { fg = C.yellow, bg = C.none }, VimwikiHR = { fg = C.yellow, bg = C.none },
VimwikiList = { fg = C.orange, bg = C.orange }, VimwikiList = { fg = C.orange, bg = C.none },
VimwikiTag = { fg = C.orange, bg = C.orange }, VimwikiTag = { fg = C.orange, bg = C.none },
VimwikiMarkers = { fg = C.grey, bg = C.none }, VimwikiMarkers = { fg = C.grey, bg = C.none },
VimwikiHeader1 = { fg = C.orange, bg = C.none, bold = true }, VimwikiHeader1 = { fg = C.orange, bg = C.none, bold = true },
VimwikiHeader2 = { fg = C.green, bg = C.none, bold = true }, VimwikiHeader2 = { fg = C.green, bg = C.none, bold = true },

View File

@ -56,6 +56,7 @@ local config = {
diagnostics_enabled = true, -- enable diagnostics at start diagnostics_enabled = true, -- enable diagnostics at start
status_diagnostics_enabled = true, -- enable diagnostics in statusline status_diagnostics_enabled = true, -- enable diagnostics in statusline
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
}, },
}, },
-- If you need more control, you can use the function()...end notation -- If you need more control, you can use the function()...end notation
@ -264,16 +265,22 @@ local config = {
["mason-null-ls"] = { -- overrides `require("mason-null-ls").setup(...)` ["mason-null-ls"] = { -- overrides `require("mason-null-ls").setup(...)`
-- ensure_installed = { "prettier", "stylua" }, -- ensure_installed = { "prettier", "stylua" },
}, },
["mason-nvim-dap"] = { -- overrides `require("mason-nvim-dap").setup(...)`
-- ensure_installed = { "python" },
},
}, },
-- LuaSnip Options -- LuaSnip Options
luasnip = { luasnip = {
-- Add paths for including more VS Code style snippets in luasnip
vscode_snippet_paths = {},
-- Extend filetypes -- Extend filetypes
filetype_extend = { filetype_extend = {
-- javascript = { "javascriptreact" }, -- javascript = { "javascriptreact" },
}, },
-- Configure luasnip loaders (vscode, lua, and/or snipmate)
vscode = {
-- Add paths for including more VS Code style snippets in luasnip
paths = {},
},
}, },
-- CMP Source Priorities -- CMP Source Priorities

View File

@ -1 +1 @@
{"better-escape.nvim": {"commit": "d5ee0ce"}, "telescope-fzf-native.nvim": {"commit": "65c0ee3"}, "packer.nvim": {"commit": "6afb674"}, "nvim-notify": {"commit": "5e8d494"}, "mason-null-ls.nvim": {"commit": "40d23dd"}, "nvim-lspconfig": {"commit": "3592f76"}, "smart-splits.nvim": {"commit": "981f966"}, "nvim-window-picker": {"commit": "a53a3b7"}, "null-ls.nvim": {"commit": "2446375"}, "mason-lspconfig.nvim": {"commit": "90fcb1f"}, "which-key.nvim": {"commit": "6885b66"}, "bufferline.nvim": {"commit": "e70be62"}, "nvim-autopairs": {"commit": "4fc96c8"}, "cmp_luasnip": {"commit": "a9de941"}, "friendly-snippets": {"commit": "fd16b4d"}, "nvim-colorizer.lua": {"commit": "9dd7ecd"}, "lspkind.nvim": {"commit": "c68b3a0"}, "gitsigns.nvim": {"commit": "56e01cb"}, "SchemaStore.nvim": {"commit": "fe35502"}, "indent-blankline.nvim": {"commit": "db7cbcb"}, "dressing.nvim": {"commit": "12b808a"}, "nvim-ts-autotag": {"commit": "fdefe46"}, "neo-tree.nvim": {"commit": "e968cda"}, "telescope.nvim": {"commit": "f174a03"}, "nvim-ts-context-commentstring": {"commit": "2941f00"}, "Comment.nvim": {"commit": "ad7ffa8"}, "mason.nvim": {"commit": "5278438"}, "aerial.nvim": {"commit": "d35799b"}, "alpha-nvim": {"commit": "0bb6fc0"}, "cmp-nvim-lsp": {"commit": "3cf38d9"}, "LuaSnip": {"commit": "663d544"}, "heirline.nvim": {"commit": "9d0add9"}, "nvim-web-devicons": {"commit": "9061e2d"}, "neovim-session-manager": {"commit": "4005dac"}, "nvim-treesitter": {"commit": "d49495f"}, "nui.nvim": {"commit": "35758e9"}, "impatient.nvim": {"commit": "b842e16"}, "indent-o-matic": {"commit": "68f19ea"}, "toggleterm.nvim": {"commit": "2a787c4"}, "plenary.nvim": {"commit": "4b7e520"}, "bufdelete.nvim": {"commit": "e88dbe0"}, "nvim-cmp": {"commit": "e94d348"}, "nvim-ts-rainbow": {"commit": "1ec3f88"}, "cmp-path": {"commit": "91ff86c"}, "cmp-buffer": {"commit": "3022dbc"}} {"better-escape.nvim": {"commit": "d5ee0ce"}, "nvim-dap": {"commit": "8f396b7"}, "telescope-fzf-native.nvim": {"commit": "ae9d95d"}, "packer.nvim": {"commit": "64ae65f"}, "nvim-notify": {"commit": "b005821"}, "mason-null-ls.nvim": {"commit": "3058cab"}, "nvim-lspconfig": {"commit": "c720632"}, "smart-splits.nvim": {"commit": "dd244e8"}, "nvim-window-picker": {"commit": "a53a3b7"}, "null-ls.nvim": {"commit": "b3d2ebd"}, "mason-lspconfig.nvim": {"commit": "4674ed1"}, "which-key.nvim": {"commit": "61553ae"}, "bufferline.nvim": {"commit": "4ecfa81"}, "nvim-autopairs": {"commit": "9fa9961"}, "cmp_luasnip": {"commit": "1809552"}, "friendly-snippets": {"commit": "9b3e497"}, "nvim-colorizer.lua": {"commit": "760e27d"}, "lspkind.nvim": {"commit": "c68b3a0"}, "gitsigns.nvim": {"commit": "d076301"}, "SchemaStore.nvim": {"commit": "cb67722"}, "dressing.nvim": {"commit": "ed44aa7"}, "indent-blankline.nvim": {"commit": "db7cbcb"}, "nvim-ts-autotag": {"commit": "fdefe46"}, "neo-tree.nvim": {"commit": "7c6903b"}, "telescope.nvim": {"commit": "cabf991"}, "nvim-ts-context-commentstring": {"commit": "32d9627"}, "Comment.nvim": {"commit": "5f01c1a"}, "mason.nvim": {"commit": "66f02fd"}, "aerial.nvim": {"commit": "50d28ad"}, "alpha-nvim": {"commit": "21a0f25"}, "cmp-nvim-lsp": {"commit": "5922477"}, "LuaSnip": {"commit": "5ce70a0"}, "nvim-dap-ui": {"commit": "54365d2"}, "heirline.nvim": {"commit": "f684e4c"}, "nvim-web-devicons": {"commit": "189ad37"}, "neovim-session-manager": {"commit": "24ceb4b"}, "nvim-treesitter": {"commit": "440401c"}, "nui.nvim": {"commit": "d12a697"}, "impatient.nvim": {"commit": "d3dd30f"}, "indent-o-matic": {"commit": "749b7cb"}, "mason-nvim-dap.nvim": {"commit": "88257d5"}, "toggleterm.nvim": {"commit": "3ba6838"}, "plenary.nvim": {"commit": "4b7e520"}, "bufdelete.nvim": {"commit": "f79e9d1"}, "nvim-cmp": {"commit": "93f385c"}, "nvim-ts-rainbow": {"commit": "064fd6c"}, "cmp-path": {"commit": "91ff86c"}, "cmp-buffer": {"commit": "3022dbc"}}

View File

@ -12,19 +12,27 @@ set $right l
### Output configuration ### Output configuration
output * bg /home/pixel/Downloads/wallhaven-q22r57.png fill output * bg /home/pixel/Downloads/wallhaven-q22r57.png fill
output * scale 1.8
# set monitor config # set monitor config
output DP-1 resolution 1920x1080@74.924Hz position 1920,650 #output DP-1 resolution 1920x1080@74.924Hz position 1920,650
output HDMI-A-1 resolution 1920x1080@60Hz position 840,160 transform 90 #output HDMI-A-1 resolution 1920x1080@60Hz position 840,160 transform 90
output DVI-D-1 resolution 1440x900@59.887Hz position 3840,910 #output DVI-D-1 resolution 1440x900@59.887Hz position 3840,910
# input stuff
input "1452:834:Apple_Internal_Keyboard_/_Trackpad" {
natural_scroll enabled
}
seat seat0 xcursor_theme Adwaita 24
### Key bindings: ### Key bindings:
# Start a terminal # Start a terminal
bindsym $mod+Return exec kitty bindsym $mod+Return exec LIBGL_ALWAYS_SOFTWARE=1 kitty
# Kill focused window # Kill focused window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# Start your launcher # Start your launcher
bindsym $mod+Shift+d exec networkmanager_dmenu
bindsym $mod+d exec "rofi -modi drun,run -show drun" bindsym $mod+d exec "rofi -modi drun,run -show drun"
# screenshots
bindsym $mod2+Shift+t exec 'grim -g "$(slurp)" - | swappy -f -' bindsym $mod2+Shift+t exec 'grim -g "$(slurp)" - | swappy -f -'
# Drag floating windows by holding down $mod and left mouse button. # Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod. # Resize them with right mouse button + $mod.
@ -38,6 +46,26 @@ output DVI-D-1 resolution 1440x900@59.887Hz position 3840,910
# Exit sway (logs you out of your Wayland session) # Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
# BRIGHTNESS AND AUDIO
#define XKB_KEY_XF86MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */
#define XKB_KEY_XF86MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */
bindsym XF86MonBrightnessUp exec sudo light -s sysfs/backlight/apple-panel-bl -A 10
bindsym XF86MonBrightnessDown exec sudo light -s sysfs/backlight/apple-panel-bl -U 10
bindsym XF86MonBrightnessUp+Shift exec sudo light -s sysfs/leds/kbd_backlight -A 10
bindsym XF86MonBrightnessDown+Shift exec sudo light -s sysfs/leds/kbd_backlight -U 10
#define XKB_KEY_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */
#define XKB_KEY_XF86AudioRaiseVolume 0x1008FF13 /* Volume control up */
bindsym XF86AudioRaiseVolume exec pamixer -i 8
bindsym XF86AudioLowerVolume exec pamixer -d 8
#define XKB_KEY_XF86AudioMute 0x1008FF12 /* Mute sound from the system
bindsym XF86AudioMute exec pamixer -t
#define XKB_KEY_XF86AudioPlay 0x1008FF14 /* Start playing of audio >
#define XKB_KEY_XF86AudioStop 0x1008FF15 /* Stop playing audio
#define XKB_KEY_XF86AudioPrev 0x1008FF16 /* Previous track
#define XKB_KEY_XF86AudioNext 0x1008FF17 /* Next track
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86AudioPlay exec playerctl play-pause
# #
# Moving around: # Moving around:
# #
@ -175,9 +203,11 @@ bar {
# dbus stuff # dbus stuff
exec hash dbus-update-activation-environment 2>/dev/null && \ exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK dbus-update-activation-environment --systemd --all
#systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# setup pipewire # setup pipewire
exec $HOME/pipewire.sh #exec $HOME/pipewire.sh
#border #border
default_border pixel 1 default_border pixel 1
@ -188,8 +218,9 @@ titlebar_border_thickness 0
titlebar_padding 0 titlebar_padding 0
#gaps #gaps
gaps inner 4 gaps inner 2
gaps top 4
# transparency # transparency
#set $opacity 0.9 #set $opacity 0.9

View File

@ -1,40 +1,33 @@
{ {
// "layer": "top", // Waybar at top layer // "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right) // "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 20, // Waybar height (to be removed for auto height) "height": 35, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width // "width": 1280, // Waybar width
"spacing": 8, // Gaps between modules (4px) "spacing": 8, // Gaps between modules (4px)
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"], "modules-left": [
"modules-right": ["pulseaudio", "cpu", "memory", "clock", "tray"], "custom/icon",
"sway/workspaces",
"sway/mode",
"sway/window"
],
"modules-right": [
"custom/spotify",
"pulseaudio",
"cpu",
"memory",
"battery",
"network",
"clock",
"tray"
],
// Modules configuration // Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"sway/mode": { "sway/mode": {
"format": "<span style=\"italic\">{}</span>" "format": "<span style=\"italic\">{}</span>"
}, },
"custom/icon": {
"format": ""
},
"idle_inhibitor": { "idle_inhibitor": {
"format": "{icon}", "format": "{icon}",
"format-icons": { "format-icons": {
@ -47,7 +40,7 @@
"spacing": 10 "spacing": 10
}, },
"clock": { "clock": {
// "timezone": "America/New_York", "timezone": "America/Los_Angeles",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}" "format-alt": "{:%Y-%m-%d}"
}, },
@ -59,7 +52,6 @@
"format": "{}% " "format": "{}% "
}, },
"network": { "network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ", "format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ipaddr}/{cidr} ", "format-ethernet": "{ipaddr}/{cidr} ",
"tooltip-format": "{ifname} via {gwaddr} ", "tooltip-format": "{ifname} via {gwaddr} ",
@ -68,7 +60,6 @@
"format-alt": "{ifname}: {ipaddr}/{cidr}" "format-alt": "{ifname}: {ipaddr}/{cidr}"
}, },
"pulseaudio": { "pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}", "format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}", "format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}", "format-bluetooth-muted": " {icon} {format_source}",
@ -77,28 +68,47 @@
"format-source-muted": "", "format-source-muted": "",
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
"hands-free": "", "default": [
"headset": "", "",
"phone": "", "",
"portable": "", ""
"car": "", ]
"default": ["", "", ""]
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },
"sway/workspaces": { "sway/workspaces": {
"all-outputs": true "all-outputs": true
},
"battery": {
"interval": 30,
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-icons": [
"",
"",
"",
"",
""
],
"max-length": 25
},
"custom/spotify": {
"format": " {icon}{}",
"escape": true,
"return-type": "json",
"format-icons": {
"Playing": " ",
"Paused": " "
},
"max-length": 40,
// "interval": 30,
"on-click": "spt playback --toggle",
"on-click-right": "kitty spt",
//"exec": "zscroll --delay 0.2 --match-command \"spt playback\" --update-check true \"spt playback\" &",
"exec": "playerctl -a metadata --format '{\"text\": \"{{markup_escape(title)}} - {{artist}}\", \"tooltip\": \"{{markup_escape(title)}} - {{artist}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F",
"exec-if": "pgrep spotify"
} }
// "custom/media": {
// "format": "{icon} {}",
// "return-type": "json",
// "max-length": 40,
// "format-icons": {
// "spotify": "",
// "default": "🎜"
// },
// "escape": true,
// "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
// }
} }

View File

@ -1,13 +1,41 @@
* { * {
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: Roboto, Helvetica, Arial, sans-serif; font-family: NotoSans, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px; font-size: 13px;
min-height: 0; min-height: 0;
/*padding-right: 2px;*/
} }
window#waybar { window#waybar {
background: #11151a; background: rgba(17, 21, 26, 0.4);
color: white; color: white;
border-bottom: 3px solid rgba(100, 114, 125, 0.5); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.50), 0 1px 2px rgba(0, 0, 0, 0.50);
/*border-bottom: 2px solid rgba(100, 114, 125, 0.5);*/
} }
tooltip {
border-radius: 8px;
}
#workspaces button {
min-width: 1px;
}
#workspaces button.focused {
font-weight: bold;
}
#tray {
margin-right: 10px;
}
#custom-icon {
color: white;
font-size: 20px;
padding-left: 10px;
padding-right: 8px;
border-radius: 0 10px 10px 0;
background: #1e2733;
/* border-bottom: 2px solid rgba(100, 114, 125, 0.5); */
}

View File

@ -1,5 +1,5 @@
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH="$HOME/repos/ohmyzsh" #export ZSH="$HOME/repos/ohmyzsh"
# znap # znap
[[ -f ~/repos/zsh-snap/znap.zsh ]] || [[ -f ~/repos/zsh-snap/znap.zsh ]] ||
@ -8,7 +8,7 @@ export ZSH="$HOME/repos/ohmyzsh"
source ~/repos/zsh-snap/znap.zsh source ~/repos/zsh-snap/znap.zsh
# OMZ # OMZ
znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance} #znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}
# Plugins # Plugins
znap source marlonrichert/zsh-autocomplete znap source marlonrichert/zsh-autocomplete
@ -29,5 +29,14 @@ alias cat="bat"
alias vim="nvim" alias vim="nvim"
alias vi="nvim" alias vi="nvim"
#if [ -z "$SSH_AUTH_SOCK" ] ; then
# eval `ssh-agent -s`
# ssh-add
#fi
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh
# zoxide
eval "$(zoxide init zsh --cmd cd)"
# remember to install starship # remember to install starship
eval "$(starship init zsh)" eval "$(starship init zsh)"