mirror of https://github.com/qpixel/dotfiles.git
fix(asahi): nvim, update configs for asahi machine
This commit is contained in:
parent
e5ab647d31
commit
3b843161a0
|
|
@ -1,8 +1,7 @@
|
|||
5288bad46858f15f2290aeb3d09c8bd8e58b7882 branch 'main' of https://github.com/AstroNvim/AstroNvim
|
||||
28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d not-for-merge branch 'dap' of https://github.com/AstroNvim/AstroNvim
|
||||
23d7faaa166f633d00a446726bab2e355143c3e2 not-for-merge branch 'devicon' of https://github.com/AstroNvim/AstroNvim
|
||||
1e520d7e47dc588f58f59613ab17300ff8496986 not-for-merge branch 'gh-pages' of https://github.com/AstroNvim/AstroNvim
|
||||
c7a79519290352fc5710b95285bb016176a8efd0 not-for-merge branch 'heirline_bufferline' of https://github.com/AstroNvim/AstroNvim
|
||||
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba not-for-merge branch 'nightly' of https://github.com/AstroNvim/AstroNvim
|
||||
b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0 not-for-merge branch 'readme' of https://github.com/AstroNvim/AstroNvim
|
||||
e1a36a82a3b53ade76ea1384853d4fd387e81a8c not-for-merge branch 'shields' of https://github.com/AstroNvim/AstroNvim
|
||||
176265812355a53559497c0f0ada7ab62a2d1ba8 branch 'main' of https://github.com/AstroNvim/AstroNvim
|
||||
2ffd706983d0171604941fa31bfd8182db6a530a not-for-merge branch 'format' of https://github.com/AstroNvim/AstroNvim
|
||||
3dd00eaf98ccaae3c8b4bcf4a4e05390c0139fe6 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
|
||||
ddc49bc4d074d5b9a9899b9bee33de3416f464bd not-for-merge branch 'nightly' of https://github.com/AstroNvim/AstroNvim
|
||||
8ec90cc9229a2a22cf94ae5728b5ee44f3b489af not-for-merge branch 'readme_update' of https://github.com/AstroNvim/AstroNvim
|
||||
0c6708938039aed1da4ba8e5f1961b328803462f not-for-merge branch 'remove_mason_lazy_load' of https://github.com/AstroNvim/AstroNvim
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
ba775276324b75e4f703cd63fea3cfe7726514de
|
||||
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,2 +1,3 @@
|
|||
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
|
||||
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8 Riley Smith <riley@rileysmith.me> 1670548363 -0800 pull --rebase: Fast-forward
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
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
|
||||
5288bad46858f15f2290aeb3d09c8bd8e58b7882 176265812355a53559497c0f0ada7ab62a2d1ba8 Riley Smith <riley@rileysmith.me> 1670548363 -0800 pull --rebase: Fast-forward
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||
176265812355a53559497c0f0ada7ab62a2d1ba8
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1e520d7e47dc588f58f59613ab17300ff8496986
|
||||
3dd00eaf98ccaae3c8b4bcf4a4e05390c0139fe6
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
c7a79519290352fc5710b95285bb016176a8efd0
|
||||
1356d5364dd54549d93127fbd1ae11bed550712d
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||
176265812355a53559497c0f0ada7ab62a2d1ba8
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba
|
||||
ddc49bc4d074d5b9a9899b9bee33de3416f464bd
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
blank_issues_enabled: true
|
||||
|
||||
blank_issues_enabled: false
|
||||
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
|
||||
about: Ask questions and discussions about AstroNvim on Discord
|
||||
about: Ask questions and have discussions about AstroNvim on Discord
|
||||
|
|
|
|||
|
|
@ -4,21 +4,32 @@
|
|||
|
||||
<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">
|
||||
<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 href="https://github.com/AstroNvim/AstroNvim/blob/main/LICENSE">
|
||||
<img src="https://img.shields.io/github/license/AstroNvim/AstroNvim?label=License&logo=GNU&style=flat-square"/>
|
||||
<a href="https://github.com/AstroNvim/AstroNvim/releases/latest">
|
||||
<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 href="https://neovim.io/">
|
||||
<img src="https://img.shields.io/badge/Neovim-0.8+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/>
|
||||
<a href="https://github.com/catppuccin/catppuccin/stargazers">
|
||||
<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 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>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<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
|
||||
|
|
@ -28,7 +39,7 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
|
|||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## ✨ 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)
|
||||
- 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)
|
||||
- Debug Adapter Protocol with [nvim-dap](https://github.com/mfussenegger/nvim-dap)
|
||||
- Buffer Line with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
|
||||
|
||||
## ⚡ Requirements
|
||||
|
||||
- [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)
|
||||
- [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)
|
||||
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
|
||||
- Optional Requirements:
|
||||
|
|
@ -61,15 +74,16 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
|
|||
|
||||
## 🛠️ Installation
|
||||
|
||||
#### Make a backup of your current nvim folder
|
||||
#### Make a backup of your current nvim and shared folder
|
||||
|
||||
```
|
||||
mv ~/.config/nvim ~/.config/nvimbackup
|
||||
```shell
|
||||
mv ~/.config/nvim ~/.config/nvim.bak
|
||||
mv ~/.local/share/nvim ~/.local/share/nvim.bak
|
||||
```
|
||||
|
||||
#### Clone the repository
|
||||
|
||||
```
|
||||
```shell
|
||||
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
|
||||
nvim +PackerSync
|
||||
```
|
||||
|
|
@ -86,6 +100,11 @@ Example: `:LspInstall pyright`
|
|||
Enter `:TSInstall` followed by the name of the language you want to install<br>
|
||||
Example: `:TSInstall python`
|
||||
|
||||
#### Install Debugger
|
||||
|
||||
Enter `:DapInstall` followed by the name of the debugger you want to install<br>
|
||||
Example: `:DapInstall python`
|
||||
|
||||
#### Manage plugins
|
||||
|
||||
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
|
||||
- [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
|
||||
|
||||
|
|
|
|||
|
|
@ -5,4 +5,5 @@ ginit.vim
|
|||
lua/packer_compiled.lua
|
||||
lua/user
|
||||
plugin
|
||||
ftplugin
|
||||
spell
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ for _, source in ipairs {
|
|||
"core.utils",
|
||||
"core.options",
|
||||
"core.bootstrap",
|
||||
"core.plugins",
|
||||
"core.diagnostics",
|
||||
"core.autocmds",
|
||||
"core.mappings",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
local status_ok, Comment = pcall(require, "Comment")
|
||||
if not status_ok then return end
|
||||
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)
|
||||
local location = nil
|
||||
if ctx.ctype == utils.ctype.blockwise then
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
local status_ok, aerial = pcall(require, "aerial")
|
||||
if not status_ok then return end
|
||||
aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
|
||||
require("aerial").setup(astronvim.user_plugin_opts("plugins.aerial", {
|
||||
attach_mode = "global",
|
||||
backends = { "lsp", "treesitter", "markdown" },
|
||||
backends = { "lsp", "treesitter", "markdown", "man" },
|
||||
layout = {
|
||||
min_width = 28,
|
||||
},
|
||||
|
|
@ -14,12 +12,14 @@ aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
|
|||
nested_top = "│ ",
|
||||
whitespace = " ",
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
-- Jump forwards/backwards with '[y' and ']y'
|
||||
vim.keymap.set("n", "[y", "<cmd>AerialPrev<cr>", { buffer = bufnr, desc = "Previous Aerial" })
|
||||
vim.keymap.set("n", "]y", "<cmd>AerialNext<cr>", { buffer = bufnr, desc = "Next Aerial" })
|
||||
-- Jump up the tree with '[Y' or ']Y'
|
||||
vim.keymap.set("n", "[Y", "<cmd>AerialPrevUp<cr>", { buffer = bufnr, desc = "Previous and Up in Aerial" })
|
||||
vim.keymap.set("n", "]Y", "<cmd>AerialNextUp<cr>", { buffer = bufnr, desc = "Next and Up in Aerial" })
|
||||
end,
|
||||
keymaps = {
|
||||
["[y"] = "actions.prev",
|
||||
["]y"] = "actions.next",
|
||||
["[Y"] = "actions.prev_up",
|
||||
["]Y"] = "actions.next_up",
|
||||
["{"] = false,
|
||||
["}"] = false,
|
||||
["[["] = false,
|
||||
["]]"] = false,
|
||||
},
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then return end
|
||||
local alpha_button = astronvim.alpha_button
|
||||
alpha.setup(astronvim.user_plugin_opts("plugins.alpha", {
|
||||
require("alpha").setup(astronvim.user_plugin_opts("plugins.alpha", {
|
||||
layout = {
|
||||
{ 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",
|
||||
val = {
|
||||
alpha_button("LDR f f", " Find File "),
|
||||
alpha_button("LDR f o", " Recents "),
|
||||
alpha_button("LDR f w", " Find Word "),
|
||||
alpha_button("LDR f n", " New File "),
|
||||
alpha_button("LDR f m", " Bookmarks "),
|
||||
alpha_button("LDR S l", " Last Session "),
|
||||
astronvim.alpha_button("LDR f f", " Find File "),
|
||||
astronvim.alpha_button("LDR f o", " Recents "),
|
||||
astronvim.alpha_button("LDR f w", " Find Word "),
|
||||
astronvim.alpha_button("LDR f n", " New File "),
|
||||
astronvim.alpha_button("LDR f m", " Bookmarks "),
|
||||
astronvim.alpha_button("LDR S l", " Last Session "),
|
||||
},
|
||||
opts = { spacing = 1 },
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
opts = { noautocmd = true },
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then return end
|
||||
local npairs = require "nvim-autopairs"
|
||||
npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
disable_filetype = { "TelescopePrompt", "spectre_panel" },
|
||||
ts_config = { java = false },
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
|
|
@ -30,5 +24,5 @@ end
|
|||
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
local status_ok, better_escape = pcall(require, "better_escape")
|
||||
if not status_ok then return end
|
||||
better_escape.setup(astronvim.user_plugin_opts "plugins.better_escape")
|
||||
require("better_escape").setup(astronvim.user_plugin_opts "plugins.better_escape")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then return end
|
||||
bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", {
|
||||
local close_func = function(bufnum)
|
||||
local bufdelete_avail, bufdelete = pcall(require, "bufdelete")
|
||||
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 = {
|
||||
offsets = {
|
||||
{ filetype = "NvimTree", text = "", padding = 1 },
|
||||
|
|
@ -10,9 +16,21 @@ bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", {
|
|||
buffer_close_icon = astronvim.get_icon "BufferClose",
|
||||
modified_icon = astronvim.get_icon "FileModified",
|
||||
close_icon = astronvim.get_icon "NeovimClose",
|
||||
close_command = close_func,
|
||||
right_mouse_command = close_func,
|
||||
max_name_length = 14,
|
||||
max_prefix_length = 13,
|
||||
tab_size = 20,
|
||||
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,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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 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 border_opts =
|
||||
{ border = "single", winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None" }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
local status_ok, colorizer = pcall(require, "colorizer")
|
||||
if not status_ok then return end
|
||||
colorizer.setup(astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } }))
|
||||
require("colorizer").setup(
|
||||
astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } })
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
local status_ok, dressing = pcall(require, "dressing")
|
||||
if not status_ok then return end
|
||||
dressing.setup(astronvim.user_plugin_opts("plugins.dressing", {
|
||||
require("dressing").setup(astronvim.user_plugin_opts("plugins.dressing", {
|
||||
input = {
|
||||
default_prompt = "➤ ",
|
||||
winhighlight = "Normal:Normal,NormalNC:Normal",
|
||||
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope", "builtin" },
|
||||
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
|
||||
},
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not status_ok then return end
|
||||
gitsigns.setup(astronvim.user_plugin_opts("plugins.gitsigns", {
|
||||
require("gitsigns").setup(astronvim.user_plugin_opts("plugins.gitsigns", {
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "▎" },
|
||||
topdelete = { text = "契" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local status_ok, heirline = pcall(require, "heirline")
|
||||
if not status_ok or not astronvim.status then return end
|
||||
local heirline = require "heirline"
|
||||
if not astronvim.status then return end
|
||||
local C = require "default_theme.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 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 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 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 })
|
||||
|
|
@ -22,6 +16,21 @@ local function setup_colors()
|
|||
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 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", {
|
||||
fg = StatusLine.fg,
|
||||
bg = StatusLine.bg,
|
||||
|
|
@ -37,16 +46,17 @@ local function setup_colors()
|
|||
diag_WARN = DiagnosticWarn.fg,
|
||||
diag_INFO = DiagnosticInfo.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_bg = WinBar.bg,
|
||||
winbarnc_fg = WinBarNC.fg,
|
||||
winbarnc_bg = WinBarNC.bg,
|
||||
inactive = HeirlineInactive,
|
||||
normal = HeirlineNormal,
|
||||
insert = HeirlineInsert,
|
||||
visual = HeirlineVisual,
|
||||
replace = HeirlineReplace,
|
||||
command = HeirlineCommand,
|
||||
terminal = HeirlineTerminal,
|
||||
})
|
||||
|
||||
for _, section in ipairs {
|
||||
|
|
@ -56,6 +66,7 @@ local function setup_colors()
|
|||
"diagnostics",
|
||||
"lsp",
|
||||
"macro_recording",
|
||||
"cmd_info",
|
||||
"treesitter",
|
||||
"nav",
|
||||
} do
|
||||
|
|
@ -77,7 +88,7 @@ local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
|
|||
astronvim.status.component.git_diff(),
|
||||
astronvim.status.component.diagnostics(),
|
||||
astronvim.status.component.fill(),
|
||||
astronvim.status.component.macro_recording(),
|
||||
astronvim.status.component.cmd_info(),
|
||||
astronvim.status.component.fill(),
|
||||
astronvim.status.component.lsp(),
|
||||
astronvim.status.component.treesitter(),
|
||||
|
|
@ -86,34 +97,38 @@ local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
|
|||
},
|
||||
{
|
||||
fallthrough = false,
|
||||
{
|
||||
condition = function()
|
||||
return astronvim.status.condition.buffer_matches {
|
||||
astronvim.status.component.file_info {
|
||||
condition = function() return not astronvim.status.condition.is_active() end,
|
||||
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" },
|
||||
filetype = { "NvimTree", "neo-tree", "dashboard", "Outline", "aerial" },
|
||||
}
|
||||
end,
|
||||
init = function() 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())
|
||||
then
|
||||
vim.opt_local.winbar = nil
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then return end
|
||||
indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
|
||||
require("indent_blankline").setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
|
||||
buftype_exclude = {
|
||||
"nofile",
|
||||
"terminal",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
local status_ok, indent_o_matic = pcall(require, "indent-o-matic")
|
||||
if not status_ok then return end
|
||||
local indent_o_matic = require "indent-o-matic"
|
||||
indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic")
|
||||
indent_o_matic.detect()
|
||||
|
|
|
|||
|
|
@ -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/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
|
||||
-- setup language servers once AstroNvim loads
|
||||
vim.schedule(function() vim.tbl_map(astronvim.lsp.setup, astronvim.user_plugin_opts "lsp.servers") end)
|
||||
local setup_servers = function()
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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", {
|
||||
mode = "symbol",
|
||||
symbol_map = {
|
||||
|
|
@ -22,4 +20,4 @@ astronvim.lspkind = astronvim.user_plugin_opts("plugins.lspkind", {
|
|||
Unit = "",
|
||||
},
|
||||
})
|
||||
lspkind.init(astronvim.lspkind)
|
||||
require("lspkind").init(astronvim.lspkind)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
local user_settings = astronvim.user_plugin_opts "luasnip"
|
||||
local luasnip_avail, luasnip = pcall(require, "luasnip")
|
||||
local loader_avail, loader = pcall(require, "luasnip/loaders/from_vscode")
|
||||
if not (luasnip_avail and loader_avail) then return end
|
||||
if user_settings.vscode_snippet_paths ~= nil then loader.lazy_load { paths = user_settings.vscode_snippet_paths } end
|
||||
loader.lazy_load()
|
||||
local luasnip = require "luasnip"
|
||||
if user_settings.config then luasnip.config.setup(user_settings.config) end
|
||||
for _, load_type in ipairs { "vscode", "snipmate", "lua" } do
|
||||
local loader = require("luasnip.loaders.from_" .. load_type)
|
||||
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
|
||||
for filetype, snippets in pairs(user_settings.filetype_extend) do
|
||||
luasnip.filetype_extend(filetype, snippets)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not status_ok then return end
|
||||
local mason_lspconfig = require "mason-lspconfig"
|
||||
mason_lspconfig.setup(astronvim.user_plugin_opts "plugins.mason-lspconfig")
|
||||
mason_lspconfig.setup_handlers(
|
||||
astronvim.user_plugin_opts("mason-lspconfig.setup_handlers", { function(server) astronvim.lsp.setup(server) end })
|
||||
)
|
||||
astronvim.event "LspSetup"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
local status_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not status_ok then return end
|
||||
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",
|
||||
{ function(server) astronvim.null_ls_register(server) end }
|
||||
)
|
||||
)
|
||||
local mason_null_ls = require "mason-null-ls"
|
||||
mason_null_ls.setup(astronvim.user_plugin_opts("plugins.mason-null-ls", { automatic_setup = true }))
|
||||
mason_null_ls.setup_handlers(astronvim.user_plugin_opts("mason-null-ls.setup_handlers", {}))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, mason = pcall(require, "mason")
|
||||
if not status_ok then return end
|
||||
mason.setup(astronvim.user_plugin_opts("plugins.mason", {
|
||||
require("mason").setup(astronvim.user_plugin_opts("plugins.mason", {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, neotree = pcall(require, "neo-tree")
|
||||
if not status_ok then return end
|
||||
neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
||||
require("neo-tree").setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
||||
close_if_last_window = true,
|
||||
enable_diagnostics = false,
|
||||
source_selector = {
|
||||
|
|
@ -14,9 +12,7 @@ neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
|||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
padding = 0,
|
||||
},
|
||||
indent = { padding = 0 },
|
||||
icon = {
|
||||
folder_closed = astronvim.get_icon "FolderClosed",
|
||||
folder_open = astronvim.get_icon "FolderOpen",
|
||||
|
|
@ -40,13 +36,18 @@ neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
|||
window = {
|
||||
width = 30,
|
||||
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 = {
|
||||
follow_current_file = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
use_libuv_file_watcher = true,
|
||||
window = { mappings = { h = "toggle_hidden" } },
|
||||
},
|
||||
event_handlers = {
|
||||
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
local status_ok, notify = pcall(require, "notify")
|
||||
if not status_ok then return end
|
||||
local notify = require "notify"
|
||||
notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" }))
|
||||
vim.notify = notify
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
local status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not status_ok then return end
|
||||
null_ls.setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))
|
||||
require("null-ls").setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
local status_ok, icons = pcall(require, "nvim-web-devicons")
|
||||
if not status_ok then return end
|
||||
icons.set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", {
|
||||
require("nvim-web-devicons").set_default_icon(astronvim.get_icon "DefaultFile", "#6d8086", "66")
|
||||
require("nvim-web-devicons").set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", {
|
||||
deb = { icon = "", name = "Deb" },
|
||||
lock = { icon = "", name = "Lock" },
|
||||
mp3 = { icon = "", name = "Mp3" },
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ return {
|
|||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim", "astronvim", "bit" },
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
runtime = { version = "LuaJIT" },
|
||||
diagnostics = { globals = { "vim", "astronvim", "astronvim_installation", "packer_plugins", "bit" } },
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
[astronvim.install.home .. "/lua"] = true,
|
||||
[astronvim.install.config .. "/lua"] = true,
|
||||
vim.fn.expand "$VIMRUNTIME/lua",
|
||||
astronvim.install.home .. "/lua",
|
||||
astronvim.install.config .. "/lua",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
local status_ok, session_manager = pcall(require, "session_manager")
|
||||
if not status_ok then return end
|
||||
session_manager.setup(astronvim.user_plugin_opts "plugins.session_manager")
|
||||
require("session_manager").setup(astronvim.user_plugin_opts "plugins.session_manager")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, smart_splits = pcall(require, "smart-splits")
|
||||
if not status_ok then return end
|
||||
smart_splits.setup(astronvim.user_plugin_opts("plugins.smart-splits", {
|
||||
require("smart-splits").setup(astronvim.user_plugin_opts("plugins.smart-splits", {
|
||||
ignored_filetypes = {
|
||||
"nofile",
|
||||
"quickfix",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then return end
|
||||
local telescope = require "telescope"
|
||||
local actions = require "telescope.actions"
|
||||
|
||||
telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
|
||||
defaults = {
|
||||
|
||||
prompt_prefix = " ",
|
||||
selection_caret = "❯ ",
|
||||
prompt_prefix = string.format("%s ", astronvim.get_icon "Search"),
|
||||
selection_caret = string.format("%s ", astronvim.get_icon "Selected"),
|
||||
path_display = { "truncate" },
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, toggleterm = pcall(require, "toggleterm")
|
||||
if not status_ok then return end
|
||||
toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", {
|
||||
require("toggleterm").setup(astronvim.user_plugin_opts("plugins.toggleterm", {
|
||||
size = 10,
|
||||
open_mapping = [[<F7>]],
|
||||
shading_factor = 2,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then return end
|
||||
treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
|
||||
require("nvim-treesitter.configs").setup(astronvim.user_plugin_opts("plugins.treesitter", {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
|
|
@ -15,7 +13,6 @@ treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
|
|||
extended_mode = false,
|
||||
max_file_lines = nil,
|
||||
},
|
||||
autopairs = { enable = true },
|
||||
autotag = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
indent = { enable = false },
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ local mappings = {
|
|||
}
|
||||
|
||||
local extra_sections = {
|
||||
D = "Debugger",
|
||||
g = "Git",
|
||||
s = "Search",
|
||||
S = "Session",
|
||||
|
|
@ -36,4 +37,15 @@ if is_available "telescope.nvim" then
|
|||
init_table("n", "<leader>", "g")
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -1,12 +1,4 @@
|
|||
local status_ok, which_key = pcall(require, "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", {
|
||||
require("which-key").setup(astronvim.user_plugin_opts("plugins.which-key", {
|
||||
plugins = {
|
||||
spelling = { enabled = true },
|
||||
presets = { operators = false },
|
||||
|
|
@ -15,4 +7,5 @@ which_key.setup(astronvim.user_plugin_opts("plugins.which-key", {
|
|||
border = "rounded",
|
||||
padding = { 2, 2, 2, 2 },
|
||||
},
|
||||
disable = { filetypes = { "TelescopePrompt" } },
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
window_picker.setup(
|
||||
require("window-picker").setup(
|
||||
astronvim.user_plugin_opts("plugins.window-picker", { use_winbar = "smart", other_win_hl_color = colors.grey_4 })
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,21 +1,41 @@
|
|||
local is_available = astronvim.is_available
|
||||
local user_plugin_opts = astronvim.user_plugin_opts
|
||||
local namespace = vim.api.nvim_create_namespace
|
||||
local cmd = vim.api.nvim_create_autocmd
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
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" }, {
|
||||
desc = "URL Highlighting",
|
||||
group = "highlighturl",
|
||||
group = augroup("highlighturl", { clear = true }),
|
||||
pattern = "*",
|
||||
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", {
|
||||
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()
|
||||
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
|
||||
|
|
@ -24,8 +44,15 @@ cmd("BufEnter", {
|
|||
for _, winid in ipairs(wins) do
|
||||
if vim.api.nvim_win_is_valid(winid) then
|
||||
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 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
|
||||
if #vim.api.nvim_list_tabpages() > 1 then
|
||||
|
|
@ -37,43 +64,30 @@ cmd("BufEnter", {
|
|||
})
|
||||
|
||||
if is_available "alpha-nvim" then
|
||||
augroup("alpha_settings", { clear = true })
|
||||
if is_available "bufferline.nvim" then
|
||||
cmd("FileType", {
|
||||
desc = "Disable tabline for alpha",
|
||||
group = "alpha_settings",
|
||||
pattern = "alpha",
|
||||
local group_name = augroup("alpha_settings", { clear = true })
|
||||
cmd("User", {
|
||||
desc = "Disable status and tablines for alpha",
|
||||
group = group_name,
|
||||
pattern = "AlphaReady",
|
||||
callback = function()
|
||||
local prev_showtabline = vim.opt.showtabline
|
||||
local prev_status = vim.opt.laststatus
|
||||
vim.opt.laststatus = 0
|
||||
vim.opt.showtabline = 0
|
||||
vim.opt_local.winbar = nil
|
||||
cmd("BufUnload", {
|
||||
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()
|
||||
local prev_status = vim.opt.laststatus
|
||||
vim.opt.laststatus = 0
|
||||
cmd("BufUnload", {
|
||||
pattern = "<buffer>",
|
||||
callback = function() vim.opt.laststatus = prev_status end,
|
||||
vim.opt.laststatus = prev_status
|
||||
vim.opt.showtabline = prev_showtabline
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
cmd("VimEnter", {
|
||||
desc = "Start Alpha when vim is opened with no arguments",
|
||||
group = "alpha_settings",
|
||||
group = group_name,
|
||||
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
|
||||
if vim.fn.argc() > 0 or vim.fn.line2byte "$" ~= -1 or not vim.o.modifiable then
|
||||
should_skip = true
|
||||
|
|
@ -85,17 +99,18 @@ if is_available "alpha-nvim" then
|
|||
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
|
||||
|
||||
if is_available "neo-tree.nvim" then
|
||||
augroup("neotree_start", { clear = true })
|
||||
cmd("BufEnter", {
|
||||
desc = "Open Neo-Tree on startup with directory",
|
||||
group = "neotree_start",
|
||||
group = augroup("neotree_start", { clear = true }),
|
||||
callback = function()
|
||||
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
|
||||
|
|
@ -103,10 +118,18 @@ if is_available "neo-tree.nvim" then
|
|||
})
|
||||
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" }, {
|
||||
desc = "Load custom highlights from user configuration",
|
||||
group = "astronvim_highlights",
|
||||
group = augroup("astronvim_highlights", { clear = true }),
|
||||
callback = function()
|
||||
if vim.g.colors_name then
|
||||
for _, module in ipairs { "init", vim.g.colors_name } do
|
||||
|
|
@ -115,11 +138,49 @@ cmd({ "VimEnter", "ColorScheme" }, {
|
|||
end
|
||||
end
|
||||
end
|
||||
astronvim.event "ColorScheme"
|
||||
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("AstroReload", function() astronvim.updater.reload() end, { desc = "Reload AstroNvim" })
|
||||
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("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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ return {
|
|||
DapBreakpointRejected = "",
|
||||
DapLogPoint = ".>",
|
||||
DapStopped = "",
|
||||
DefaultFile = "",
|
||||
DefaultFile = "",
|
||||
Diagnostic = "裂",
|
||||
DiagnosticError = "",
|
||||
DiagnosticHint = "",
|
||||
|
|
@ -37,5 +37,7 @@ return {
|
|||
MacroRecording = "",
|
||||
NeovimClose = "",
|
||||
Paste = "",
|
||||
Search = "",
|
||||
Selected = "❯",
|
||||
Spellcheck = "暈",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,7 @@ return {
|
|||
MacroRecording = "Recording:",
|
||||
NeovimClose = "X",
|
||||
Paste = "[PASTE]",
|
||||
Search = "?",
|
||||
Selected = "*",
|
||||
Spellcheck = "[SPELL]",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ maps[""]["<Space>"] = "<Nop>"
|
|||
-- Standard Operations
|
||||
maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
|
||||
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["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-q>"] = { "<cmd>q!<cr>", desc = "Force quit" }
|
||||
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" }
|
||||
|
||||
-- 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>pv"] = { "<cmd>AstroVersion<cr>", desc = "AstroNvim Version" }
|
||||
maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" }
|
||||
|
||||
-- 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
|
||||
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
|
||||
maps.n["<leader>c"] = { "<cmd>bdelete<cr>", desc = "Close buffer" }
|
||||
maps.n["<leader>C"] = { "<cmd>bdelete!<cr>", desc = "Force close buffer" }
|
||||
end
|
||||
|
||||
-- Navigate buffers
|
||||
|
|
@ -87,10 +92,9 @@ if is_available "neovim-session-manager" then
|
|||
end
|
||||
|
||||
-- Package Manager
|
||||
if is_available "mason.nvim" then maps.n["<leader>pI"] = { "<cmd>Mason<cr>", desc = "Mason Installer" } end
|
||||
|
||||
if is_available "mason-tool-installer.nvim" then
|
||||
maps.n["<leader>pU"] = { "<cmd>MasonToolsUpdate<cr>", desc = "Mason Update" }
|
||||
if is_available "mason.nvim" then
|
||||
maps.n["<leader>pI"] = { "<cmd>Mason<cr>", desc = "Mason Installer" }
|
||||
maps.n["<leader>pU"] = { "<cmd>MasonUpdateAll<cr>", desc = "Mason Update" }
|
||||
end
|
||||
|
||||
-- LSP Installer
|
||||
|
|
@ -121,7 +125,9 @@ else
|
|||
end
|
||||
|
||||
-- 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
|
||||
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>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>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>sk"] = { function() require("telescope.builtin").keymaps() end, desc = "Search keymaps" }
|
||||
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"] = {
|
||||
function()
|
||||
local aerial_avail, _ = pcall(require, "aerial")
|
||||
|
|
@ -167,21 +175,28 @@ if is_available "telescope.nvim" then
|
|||
end,
|
||||
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" }
|
||||
end
|
||||
|
||||
-- Terminal
|
||||
if is_available "toggleterm.nvim" then
|
||||
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>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" }
|
||||
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>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" }
|
||||
|
|
@ -191,6 +206,34 @@ if is_available "toggleterm.nvim" then
|
|||
maps.t["<C-'>"] = maps.n["<F7>"]
|
||||
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
|
||||
maps.v["<"] = { "<gv", desc = "unindent 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-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-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
|
||||
if is_available "nvim-autopairs" then
|
||||
|
|
@ -212,6 +255,7 @@ end
|
|||
if is_available "nvim-colorizer.lua" then
|
||||
maps.n["<leader>uC"] = { "<cmd>ColorizerToggle<cr>", desc = "Toggle color highlight" }
|
||||
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>ug"] = { function() astronvim.ui.toggle_signcolumn() end, desc = "Toggle signcolumn" }
|
||||
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>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>uN"] = { function() astronvim.ui.toggle_ui_notifications() end, desc = "Toggle UI notifications" }
|
||||
|
||||
astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
vim.opt.shortmess:append { s = true, I = true } -- disable startup message
|
||||
astronvim.vim_opts(astronvim.user_plugin_opts("options", {
|
||||
opt = {
|
||||
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
|
||||
status_diagnostics_enabled = true, -- enable diagnostics in statusline
|
||||
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
|
||||
},
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,23 @@
|
|||
local astro_plugins = {
|
||||
-- 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
|
||||
["lewis6991/impatient.nvim"] = {},
|
||||
|
|
@ -10,19 +27,22 @@ local astro_plugins = {
|
|||
|
||||
-- Indent detection
|
||||
["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,
|
||||
},
|
||||
|
||||
-- Notification Enhancer
|
||||
["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,
|
||||
},
|
||||
|
||||
-- Neovim UI Enhancer
|
||||
["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,
|
||||
},
|
||||
|
||||
|
|
@ -33,7 +53,7 @@ local astro_plugins = {
|
|||
},
|
||||
|
||||
-- Icons
|
||||
["kyazdani42/nvim-web-devicons"] = {
|
||||
["nvim-tree/nvim-web-devicons"] = {
|
||||
disable = not vim.g.icons_enabled,
|
||||
module = "nvim-web-devicons",
|
||||
config = function() require "configs.nvim-web-devicons" end,
|
||||
|
|
@ -48,12 +68,16 @@ local astro_plugins = {
|
|||
|
||||
-- Bufferline
|
||||
["akinsho/bufferline.nvim"] = {
|
||||
module = "bufferline",
|
||||
event = "UIEnter",
|
||||
config = function() require "configs.bufferline" end,
|
||||
},
|
||||
|
||||
-- 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"] = {
|
||||
tag = "v1.*",
|
||||
|
|
@ -65,14 +89,41 @@ local astro_plugins = {
|
|||
["nvim-neo-tree/neo-tree.nvim"] = {
|
||||
branch = "v2.x",
|
||||
module = "neo-tree",
|
||||
cmd = "Neotree",
|
||||
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,
|
||||
},
|
||||
|
||||
-- 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
|
||||
["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" },
|
||||
|
|
@ -83,23 +134,6 @@ local astro_plugins = {
|
|||
-- Context based commenting
|
||||
["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
|
||||
["rafamadriz/friendly-snippets"] = { opt = true },
|
||||
|
||||
|
|
@ -111,10 +145,7 @@ local astro_plugins = {
|
|||
},
|
||||
|
||||
-- Completion engine
|
||||
["hrsh7th/nvim-cmp"] = {
|
||||
event = "InsertEnter",
|
||||
config = function() require "configs.cmp" end,
|
||||
},
|
||||
["hrsh7th/nvim-cmp"] = { event = "InsertEnter", config = function() require "configs.cmp" end },
|
||||
|
||||
-- Snippet completion source
|
||||
["saadparwaiz1/cmp_luasnip"] = {
|
||||
|
|
@ -123,121 +154,147 @@ local astro_plugins = {
|
|||
},
|
||||
|
||||
-- Buffer completion source
|
||||
["hrsh7th/cmp-buffer"] = {
|
||||
after = "nvim-cmp",
|
||||
config = function() astronvim.add_user_cmp_source "buffer" end,
|
||||
},
|
||||
["hrsh7th/cmp-buffer"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "buffer" end },
|
||||
|
||||
-- Path completion source
|
||||
["hrsh7th/cmp-path"] = {
|
||||
after = "nvim-cmp",
|
||||
config = function() astronvim.add_user_cmp_source "path" end,
|
||||
},
|
||||
["hrsh7th/cmp-path"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "path" end },
|
||||
|
||||
-- LSP completion source
|
||||
["hrsh7th/cmp-nvim-lsp"] = {
|
||||
after = "nvim-cmp",
|
||||
config = function() astronvim.add_user_cmp_source "nvim_lsp" end,
|
||||
},
|
||||
["hrsh7th/cmp-nvim-lsp"] = { after = "nvim-cmp", config = function() astronvim.add_user_cmp_source "nvim_lsp" end },
|
||||
|
||||
-- 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
|
||||
["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,
|
||||
},
|
||||
|
||||
-- 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
|
||||
["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
|
||||
["williamboman/mason-lspconfig.nvim"] = {
|
||||
after = { "mason.nvim", "nvim-lspconfig" },
|
||||
after = "nvim-lspconfig",
|
||||
config = function() require "configs.mason-lspconfig" end,
|
||||
},
|
||||
|
||||
-- null-ls manager
|
||||
["jayp0521/mason-null-ls.nvim"] = {
|
||||
after = { "mason.nvim", "null-ls.nvim" },
|
||||
config = function() require "configs.mason-null-ls" end,
|
||||
["jayp0521/mason-null-ls.nvim"] = { after = "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
|
||||
["stevearc/aerial.nvim"] = {
|
||||
module = "aerial",
|
||||
cmd = { "AerialToggle", "AerialOpen", "AerialInfo" },
|
||||
after = { "nvim-treesitter", "nvim-lspconfig" },
|
||||
ft = { "man", "markdown" },
|
||||
config = function() require "configs.aerial" end,
|
||||
},
|
||||
|
||||
-- Fuzzy finder
|
||||
["nvim-telescope/telescope.nvim"] = {
|
||||
cmd = "Telescope",
|
||||
module = "telescope",
|
||||
setup = function() astronvim.lazy_load_commands("telescope.nvim", "Telescope") end,
|
||||
config = function() require "configs.telescope" end,
|
||||
},
|
||||
|
||||
-- Fuzzy finder syntax support
|
||||
["nvim-telescope/telescope-fzf-native.nvim"] = {
|
||||
after = "telescope.nvim",
|
||||
disable = vim.fn.executable "make" + vim.fn.executable "cmake" == 0,
|
||||
run = vim.fn.executable "cmake" == 1
|
||||
and "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build"
|
||||
or "make",
|
||||
disable = vim.fn.executable "make" == 0,
|
||||
run = "make",
|
||||
config = function() require("telescope").load_extension "fzf" end,
|
||||
},
|
||||
|
||||
-- Git integration
|
||||
["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,
|
||||
},
|
||||
|
||||
-- Start screen
|
||||
["goolord/alpha-nvim"] = {
|
||||
cmd = "Alpha",
|
||||
module = "alpha",
|
||||
setup = function() astronvim.lazy_load_commands("alpha-nvim", "Alpha") end,
|
||||
config = function() require "configs.alpha" end,
|
||||
},
|
||||
|
||||
-- Color highlighting
|
||||
["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,
|
||||
},
|
||||
|
||||
-- Autopairs
|
||||
["windwp/nvim-autopairs"] = {
|
||||
event = "InsertEnter",
|
||||
config = function() require "configs.autopairs" end,
|
||||
},
|
||||
["windwp/nvim-autopairs"] = { event = "InsertEnter", config = function() require "configs.autopairs" end },
|
||||
|
||||
-- Terminal
|
||||
["akinsho/toggleterm.nvim"] = {
|
||||
cmd = "ToggleTerm",
|
||||
module = { "toggleterm", "toggleterm.terminal" },
|
||||
module = "toggleterm",
|
||||
setup = function() astronvim.lazy_load_commands("toggleterm.nvim", "ToggleTerm") end,
|
||||
config = function() require "configs.toggleterm" end,
|
||||
},
|
||||
|
||||
-- Commenting
|
||||
["numToStr/Comment.nvim"] = {
|
||||
module = { "Comment", "Comment.api" },
|
||||
keys = { "gc", "gb", "g<", "g>" },
|
||||
module = "Comment",
|
||||
keys = { "gc", "gb" },
|
||||
config = function() require "configs.Comment" end,
|
||||
},
|
||||
|
||||
-- Indentation
|
||||
["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,
|
||||
},
|
||||
|
||||
-- Keymaps popup
|
||||
["folke/which-key.nvim"] = {
|
||||
module = "which-key",
|
||||
config = function() require "configs.which-key" end,
|
||||
},
|
||||
["folke/which-key.nvim"] = { module = "which-key", config = function() require "configs.which-key" end },
|
||||
|
||||
-- Smooth escaping
|
||||
["max397574/better-escape.nvim"] = {
|
||||
|
|
@ -251,8 +308,8 @@ local astro_plugins = {
|
|||
-- Session manager
|
||||
["Shatur/neovim-session-manager"] = {
|
||||
module = "session_manager",
|
||||
cmd = "SessionManager",
|
||||
event = "BufWritePost",
|
||||
setup = function() astronvim.lazy_load_commands("neovim-session-manager", "SessionManager") end,
|
||||
config = function() require "configs.session_manager" end,
|
||||
},
|
||||
}
|
||||
|
|
@ -269,8 +326,20 @@ local status_ok, packer = pcall(require, "packer")
|
|||
if status_ok then
|
||||
packer.startup {
|
||||
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 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)
|
||||
end
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
-- @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
|
||||
-- @return the result of the command
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ astronvim.user_settings = load_module_file "user.init"
|
|||
astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua"
|
||||
--- table of user created 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
|
||||
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]*})\\})+"
|
||||
|
|
@ -104,12 +108,20 @@ end
|
|||
-- @param name highlight group name
|
||||
-- @return table of highlight group properties
|
||||
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 {}
|
||||
return astronvim.default_tbl(
|
||||
vim.o.termguicolors and { fg = hl.foreground, bg = hl.background, sp = hl.special }
|
||||
or { cterfm = hl.foreground, ctermbg = hl.background },
|
||||
fallback
|
||||
)
|
||||
if vim.fn.hlexists(name) == 1 then
|
||||
local hl = vim.api.nvim_get_hl_by_name(name, vim.o.termguicolors)
|
||||
local old_true_val = hl[true]
|
||||
hl[true] = nil
|
||||
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
|
||||
|
||||
--- Trim a string or return nil
|
||||
|
|
@ -145,7 +157,15 @@ end
|
|||
-- @param msg the notification body
|
||||
-- @param type the type of the notification (:help vim.log.levels)
|
||||
-- @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
|
||||
-- @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
|
||||
function astronvim.initialize_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 not packer_avail then
|
||||
-- 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
|
||||
vim.fn.delete(packer_path, "rf")
|
||||
-- clone packer
|
||||
|
|
@ -201,10 +221,10 @@ function astronvim.initialize_packer()
|
|||
"https://github.com/wbthomason/packer.nvim",
|
||||
packer_path,
|
||||
}
|
||||
astronvim.echo { { "Initializing Packer...\n\n" } }
|
||||
-- add packer and try loading it
|
||||
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 not packer_avail then vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path) end
|
||||
end
|
||||
|
|
@ -214,12 +234,41 @@ function astronvim.initialize_packer()
|
|||
local run_me, _ = loadfile(
|
||||
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 the file loads, run the compiled function
|
||||
run_me()
|
||||
-- if there is no compiled file, prompt the user to run :PackerSync
|
||||
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
|
||||
|
|
@ -255,17 +304,19 @@ function astronvim.user_plugin_opts(module, default, extend, prefix)
|
|||
return default
|
||||
end
|
||||
|
||||
--- Open a URL under the cursor with the current operating system
|
||||
function astronvim.url_opener()
|
||||
-- if mac use the open command
|
||||
--- Open a URL under the cursor with the current operating system (Supports Mac OS X and *nix)
|
||||
-- @param path the path of the file to open with the system opener
|
||||
function astronvim.system_open(path)
|
||||
path = path or vim.fn.expand "<cfile>"
|
||||
if vim.fn.has "mac" == 1 then
|
||||
vim.fn.jobstart({ "open", vim.fn.expand "<cfile>" }, { detach = true })
|
||||
-- if unix then use xdg-open
|
||||
-- if mac use the open command
|
||||
vim.fn.jobstart({ "open", path }, { detach = true })
|
||||
elseif vim.fn.has "unix" == 1 then
|
||||
vim.fn.jobstart({ "xdg-open", vim.fn.expand "<cfile>" }, { detach = true })
|
||||
-- if any other operating system notify the user that there is currently no support
|
||||
-- if unix then use xdg-open
|
||||
vim.fn.jobstart({ "xdg-open", path }, { detach = true })
|
||||
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
|
||||
|
||||
|
|
@ -274,22 +325,19 @@ end
|
|||
|
||||
--- 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)
|
||||
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 type(term_details) == "string" then term_details = { cmd = term_details, hidden = true } end
|
||||
-- use the command as the key for the table
|
||||
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 type(opts) == "string" then opts = { cmd = opts, hidden = true } end
|
||||
local num = vim.v.count > 0 and vim.v.count or 1
|
||||
-- if terminal doesn't exist yet, create it
|
||||
if astronvim.user_terminals[term_key] == nil then
|
||||
astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details)
|
||||
if not terms[opts.cmd] then terms[opts.cmd] = {} end
|
||||
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
|
||||
-- toggle the terminal
|
||||
astronvim.user_terminals[term_key]:toggle()
|
||||
astronvim.user_terminals[opts.cmd][num]:toggle()
|
||||
end
|
||||
|
||||
--- Add a source to cmp
|
||||
|
|
@ -374,20 +422,6 @@ function astronvim.null_ls_providers(filetype)
|
|||
return registered
|
||||
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
|
||||
-- @param filetype the filetype to search null-ls for
|
||||
-- @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
|
||||
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
|
||||
-- @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
|
||||
|
|
@ -480,12 +530,13 @@ function astronvim.cmd(cmd, show_error)
|
|||
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)
|
||||
end
|
||||
return success and result or nil
|
||||
return success and result:gsub("[\27\155][][()#;?%d]*[A-PRZcf-ntqry=><~]", "") or nil
|
||||
end
|
||||
|
||||
require "core.utils.ui"
|
||||
require "core.utils.status"
|
||||
require "core.utils.updater"
|
||||
require "core.utils.mason"
|
||||
require "core.utils.lsp"
|
||||
|
||||
return astronvim
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ local tbl_contains = vim.tbl_contains
|
|||
local tbl_isempty = vim.tbl_isempty
|
||||
local user_plugin_opts = astronvim.user_plugin_opts
|
||||
local conditional_func = astronvim.conditional_func
|
||||
local is_available = astronvim.is_available
|
||||
local user_registration = user_plugin_opts("lsp.server_registration", nil, false)
|
||||
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
|
||||
astronvim.lsp.formatting.format_on_save = { enabled = astronvim.lsp.formatting.format_on_save }
|
||||
end
|
||||
|
|
@ -36,6 +38,11 @@ end
|
|||
-- @param server the name of the server to be setup
|
||||
astronvim.lsp.setup = function(server)
|
||||
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)
|
||||
if type(user_registration) == "function" then
|
||||
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"]
|
||||
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
|
||||
lsp_mappings.n["gD"] = { function() vim.lsp.buf.declaration() end, desc = "Declaration of current symbol" }
|
||||
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" }
|
||||
end
|
||||
|
||||
if capabilities.documentFormattingProvider then
|
||||
if capabilities.documentFormattingProvider and not tbl_contains(astronvim.lsp.formatting.disabled, client.name) then
|
||||
lsp_mappings.n["<leader>lf"] = {
|
||||
function() vim.lsp.buf.format(astronvim.lsp.format_opts) end,
|
||||
desc = "Format code",
|
||||
|
|
@ -137,6 +149,7 @@ astronvim.lsp.on_attach = function(client, bufnr)
|
|||
|
||||
if capabilities.referencesProvider then
|
||||
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
|
||||
|
||||
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" }
|
||||
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 })
|
||||
if not vim.tbl_isempty(lsp_mappings.v) then
|
||||
astronvim.which_key_register({ v = { ["<leader>"] = { l = { name = "LSP" } } } }, { buffer = bufnr })
|
||||
end
|
||||
|
||||
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(aerial.on_attach, aerial_avail, client, bufnr)
|
||||
end
|
||||
|
||||
--- The default AstroNvim LSP capabilities
|
||||
|
|
@ -184,7 +216,7 @@ astronvim.lsp.flags = user_plugin_opts "lsp.flags"
|
|||
function astronvim.lsp.server_settings(server_name)
|
||||
local server = require("lspconfig")[server_name]
|
||||
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
|
||||
capabilities = vim.tbl_deep_extend("force", astronvim.lsp.capabilities, server.capabilities or {}),
|
||||
flags = vim.tbl_deep_extend("force", astronvim.lsp.flags, server.flags or {}),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
-- @copyright 2022
|
||||
-- @license GNU General Public License v3.0
|
||||
astronvim.status = { hl = {}, init = {}, provider = {}, condition = {}, component = {}, utils = {}, env = {} }
|
||||
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
astronvim.status.env.modes = {
|
||||
["n"] = { "NORMAL", "normal" },
|
||||
|
|
@ -22,8 +21,8 @@ astronvim.status.env.modes = {
|
|||
["i"] = { "INSERT", "insert" },
|
||||
["ic"] = { "INSERT", "insert" },
|
||||
["ix"] = { "INSERT", "insert" },
|
||||
["t"] = { "TERM", "insert" },
|
||||
["nt"] = { "TERM", "insert" },
|
||||
["t"] = { "TERM", "terminal" },
|
||||
["nt"] = { "TERM", "terminal" },
|
||||
["v"] = { "VISUAL", "visual" },
|
||||
["vs"] = { "VISUAL", "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
|
||||
-- @return the highlight group for the current mode foreground
|
||||
-- @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
|
||||
|
||||
--- Get the foreground color group for the current filetype
|
||||
-- @return the highlight group for the current filetype foreground
|
||||
-- @usage local heirline_component = { provider = astronvim.status.provider.fileicon(), hl = astronvim.status.hl.filetype_color },
|
||||
function astronvim.status.hl.filetype_color(self)
|
||||
local devicons_avail, devicons = pcall(require, "nvim-web-devicons")
|
||||
if not devicons_avail then return {} end
|
||||
local _, color = devicons.get_icon_color(
|
||||
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
|
||||
-- @usage local heirline_component = { init = astronvim.status.init.breadcrumbs { padding = { left = 1 } } }
|
||||
function astronvim.status.init.breadcrumbs(opts)
|
||||
local aerial_avail, aerial = pcall(require, "aerial")
|
||||
opts = astronvim.default_tbl(
|
||||
opts,
|
||||
{ separator = " > ", icon = { enabled = true, hl = false }, padding = { left = 0, right = 0 } }
|
||||
)
|
||||
return function(self)
|
||||
local data = aerial_avail and aerial.get_location(true) or {}
|
||||
local data = require("aerial").get_location(true) or {}
|
||||
local children = {}
|
||||
-- create a child for each level
|
||||
for i, d in ipairs(data) do
|
||||
|
|
@ -189,6 +189,7 @@ end
|
|||
--- A provider function for showing if paste is enabled
|
||||
-- @param opts options passed to the stylize function
|
||||
-- @return the function for outputting if paste is enabled
|
||||
|
||||
-- @usage local heirline_component = { provider = astronvim.status.provider.paste() }
|
||||
-- @see astronvim.status.utils.stylize
|
||||
function astronvim.status.provider.paste(opts)
|
||||
|
|
@ -210,6 +211,31 @@ function astronvim.status.provider.macro_recording(opts)
|
|||
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
|
||||
-- @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
|
||||
|
|
@ -235,18 +261,21 @@ function astronvim.status.provider.mode_text(opts)
|
|||
end
|
||||
|
||||
--- 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
|
||||
-- @usage local heirline_component = { provider = astronvim.status.provider.percentage() }
|
||||
-- @see astronvim.status.utils.stylize
|
||||
function astronvim.status.provider.percentage(opts)
|
||||
opts = astronvim.default_tbl(opts, { fixed_width = false, edge_text = true })
|
||||
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 "."
|
||||
if current_line == 1 then
|
||||
text = "Top"
|
||||
text = (opts.fixed_width and " " or "") .. "Top"
|
||||
elseif current_line == vim.fn.line "$" then
|
||||
text = "Bot"
|
||||
text = (opts.fixed_width and " " or "") .. "Bot"
|
||||
end
|
||||
end
|
||||
return astronvim.status.utils.stylize(text, opts)
|
||||
end
|
||||
|
|
@ -305,10 +334,13 @@ end
|
|||
-- @usage local heirline_component = { provider = astronvim.status.provider.filename() }
|
||||
-- @see astronvim.status.utils.stylize
|
||||
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)
|
||||
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
|
||||
|
||||
|
|
@ -401,8 +433,9 @@ end
|
|||
-- @usage local heirline_component = { provider = astronvim.status.provider.file_icon() }
|
||||
-- @see astronvim.status.utils.stylize
|
||||
function astronvim.status.provider.file_icon(opts)
|
||||
if not devicons_avail then return "" end
|
||||
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(
|
||||
vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"),
|
||||
nil,
|
||||
|
|
@ -515,10 +548,7 @@ end
|
|||
-- @usage local heirline_component = { provider = astronvim.status.provider.treesitter_status() }
|
||||
-- @see astronvim.status.utils.stylize
|
||||
function astronvim.status.provider.treesitter_status(opts)
|
||||
return function()
|
||||
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
|
||||
return function() return astronvim.status.utils.stylize(require("nvim-treesitter.parser").has_parser() and "TS" or "", opts) end
|
||||
end
|
||||
|
||||
--- 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 }
|
||||
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
|
||||
-- @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 }
|
||||
|
|
@ -594,7 +629,8 @@ end
|
|||
--- A condition function if Aerial is available
|
||||
-- @return boolean of wether or not aerial plugin is installed
|
||||
-- @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
|
||||
-- @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
|
||||
-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.treesitter_available }
|
||||
function astronvim.status.condition.treesitter_available()
|
||||
local ts_avail, ts = pcall(require, "nvim-treesitter.parsers")
|
||||
return ts_avail and ts.has_parser()
|
||||
return package.loaded["nvim-treesitter"] and require("nvim-treesitter.parsers").has_parser()
|
||||
end
|
||||
|
||||
--- 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()
|
||||
function astronvim.status.component.file_info(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 = {},
|
||||
file_modified = { padding = { left = 1 } },
|
||||
file_read_only = { padding = { left = 1 } },
|
||||
surround = { separator = "left", color = "file_info_bg", condition = astronvim.status.condition.has_filetype },
|
||||
hl = { fg = "file_info_fg" },
|
||||
})
|
||||
for i, key in ipairs {
|
||||
return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, {
|
||||
"file_icon",
|
||||
"unique_path",
|
||||
"filename",
|
||||
|
|
@ -654,17 +689,7 @@ function astronvim.status.component.file_info(opts)
|
|||
"file_modified",
|
||||
"file_read_only",
|
||||
"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
|
||||
|
||||
--- 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" },
|
||||
update = { "CursorMoved", "BufEnter" },
|
||||
})
|
||||
for i, key in ipairs { "ruler", "percentage", "scrollbar" } do
|
||||
opts[i] = opts[key] and { provider = key, opts = opts[key], hl = opts[key].hl } or false
|
||||
end
|
||||
return astronvim.status.component.builder(opts)
|
||||
return astronvim.status.component.builder(
|
||||
astronvim.status.utils.setup_providers(opts, { "ruler", "percentage", "scrollbar" })
|
||||
)
|
||||
end
|
||||
|
||||
--- 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
|
||||
-- @return The Heirline component table
|
||||
-- @usage local heirline_component = astronvim.status.component.macro_recording()
|
||||
-- TODO: deprecate on next major version release
|
||||
function astronvim.status.component.macro_recording(opts)
|
||||
opts = astronvim.default_tbl(opts, {
|
||||
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 },
|
||||
update = { "RecordingEnter", "RecordingLeave" },
|
||||
})
|
||||
opts[1] = opts.macro_recording and { provider = "macro_recording", opts = opts.macro_recording } or false
|
||||
return astronvim.status.component.builder(opts)
|
||||
return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "macro_recording" }))
|
||||
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
|
||||
|
||||
--- 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" },
|
||||
update = "ModeChanged",
|
||||
})
|
||||
for i, key in ipairs { "mode_text", "paste", "spell" } do
|
||||
if key == "mode_text" and not opts[key] then
|
||||
opts[i] = { provider = "str", opts = { str = " " } }
|
||||
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)
|
||||
if not opts["mode_text"] then opts.str = { str = " " } end
|
||||
return astronvim.status.component.builder(
|
||||
astronvim.status.utils.setup_providers(opts, { "mode_text", "str", "paste", "spell" })
|
||||
)
|
||||
end
|
||||
|
||||
--- 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" },
|
||||
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(opts)
|
||||
return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "git_branch" }))
|
||||
end
|
||||
|
||||
--- 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" },
|
||||
init = astronvim.status.init.update_events { "BufEnter" },
|
||||
})
|
||||
for i, kind in ipairs { "added", "changed", "removed" } do
|
||||
if type(opts[kind]) == "table" then opts[kind].type = kind end
|
||||
opts[i] = opts[kind] and { provider = "git_diff", opts = opts[kind], hl = { fg = "git_" .. kind } } or false
|
||||
return astronvim.status.component.builder(
|
||||
astronvim.status.utils.setup_providers(opts, { "added", "changed", "removed" }, function(p_opts, provider)
|
||||
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
|
||||
return astronvim.status.component.builder(opts)
|
||||
return out
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
--- 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" },
|
||||
})
|
||||
for i, kind in ipairs { "ERROR", "WARN", "INFO", "HINT" } do
|
||||
if type(opts[kind]) == "table" then opts[kind].severity = kind end
|
||||
opts[i] = opts[kind] and { provider = "diagnostics", opts = opts[kind], hl = { fg = "diag_" .. kind } } or false
|
||||
return astronvim.status.component.builder(
|
||||
astronvim.status.utils.setup_providers(opts, { "ERROR", "WARN", "INFO", "HINT" }, function(p_opts, provider)
|
||||
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
|
||||
return astronvim.status.component.builder(opts)
|
||||
return out
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
--- 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" },
|
||||
init = astronvim.status.init.update_events { "BufEnter" },
|
||||
})
|
||||
opts[1] = opts.str and { provider = "str", opts = opts.str } or false
|
||||
return astronvim.status.component.builder(opts)
|
||||
return astronvim.status.component.builder(astronvim.status.utils.setup_providers(opts, { "str" }))
|
||||
end
|
||||
|
||||
--- 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()
|
||||
function astronvim.status.component.lsp(opts)
|
||||
opts = astronvim.default_tbl(opts, {
|
||||
lsp_progress = { str = "", padding = { right = 1 } },
|
||||
lsp_client_names = { str = "LSP", icon = { kind = "ActiveLSP", padding = { right = 2 } } },
|
||||
lsp_progress = {
|
||||
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" },
|
||||
surround = { separator = "right", color = "lsp_bg", condition = astronvim.status.condition.lsp_attached },
|
||||
on_click = {
|
||||
name = "heirline_lsp",
|
||||
callback = function()
|
||||
vim.defer_fn(function() vim.cmd "LspInfo" end, 100)
|
||||
vim.defer_fn(function() vim.cmd.LspInfo() end, 100)
|
||||
end,
|
||||
},
|
||||
})
|
||||
opts[1] = {}
|
||||
for i, provider in ipairs { "lsp_progress", "lsp_client_names" } do
|
||||
if type(opts[provider]) == "table" then
|
||||
local new_provider = opts[provider].str
|
||||
and astronvim.status.utils.make_flexible(
|
||||
i,
|
||||
{ provider = astronvim.status.provider[provider](opts[provider]) },
|
||||
{ provider = astronvim.status.provider.str(opts[provider]) }
|
||||
return astronvim.status.component.builder(
|
||||
astronvim.status.utils.setup_providers(
|
||||
opts,
|
||||
{ "lsp_progress", "lsp_client_names" },
|
||||
function(p_opts, provider, i)
|
||||
return p_opts
|
||||
and {
|
||||
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
|
||||
|
||||
--- 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
|
||||
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
|
||||
-- @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
|
||||
|
|
@ -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)
|
||||
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
|
||||
-- @param separator the separator index to use in `astronvim.status.env.separators`
|
||||
-- @param color the color to use as the separator foreground/component background
|
||||
|
|
|
|||
|
|
@ -11,7 +11,17 @@
|
|||
|
||||
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
|
||||
function astronvim.ui.toggle_autopairs()
|
||||
|
|
@ -23,9 +33,9 @@ function astronvim.ui.toggle_autopairs()
|
|||
autopairs.disable()
|
||||
end
|
||||
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
|
||||
astronvim.notify "autopairs not available"
|
||||
ui_notify "autopairs not available"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -46,32 +56,38 @@ function astronvim.ui.toggle_diagnostics()
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
--- Toggle background="dark"|"light"
|
||||
function astronvim.ui.toggle_background()
|
||||
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
|
||||
|
||||
--- Toggle cmp entrirely
|
||||
function astronvim.ui.toggle_cmp()
|
||||
vim.g.cmp_enabled = not vim.g.cmp_enabled
|
||||
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
|
||||
|
||||
--- Toggle auto format
|
||||
function astronvim.ui.toggle_autoformat()
|
||||
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
|
||||
|
||||
--- Toggle showtabline=2|0
|
||||
function astronvim.ui.toggle_tabline()
|
||||
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
|
||||
|
||||
--- Toggle laststatus=3|2|0
|
||||
|
|
@ -88,7 +104,7 @@ function astronvim.ui.toggle_statusline()
|
|||
vim.opt.laststatus = 0
|
||||
status = "off"
|
||||
end
|
||||
astronvim.notify(string.format("statusline %s", status))
|
||||
ui_notify(string.format("statusline %s", status))
|
||||
end
|
||||
|
||||
--- Toggle signcolumn="auto"|"no"
|
||||
|
|
@ -100,7 +116,7 @@ function astronvim.ui.toggle_signcolumn()
|
|||
else
|
||||
vim.wo.signcolumn = "no"
|
||||
end
|
||||
astronvim.notify(string.format("signcolumn=%s", vim.wo.signcolumn))
|
||||
ui_notify(string.format("signcolumn=%s", vim.wo.signcolumn))
|
||||
end
|
||||
|
||||
--- 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.softtabstop = 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
|
||||
|
||||
--- Change the number display modes
|
||||
|
|
@ -128,27 +144,25 @@ function astronvim.ui.change_number()
|
|||
else -- not number and relativenumber
|
||||
vim.wo.relativenumber = false
|
||||
end
|
||||
astronvim.notify(
|
||||
string.format("number %s, relativenumber %s", bool2str(vim.wo.number), bool2str(vim.wo.relativenumber))
|
||||
)
|
||||
ui_notify(string.format("number %s, relativenumber %s", bool2str(vim.wo.number), bool2str(vim.wo.relativenumber)))
|
||||
end
|
||||
|
||||
--- Toggle spell
|
||||
function astronvim.ui.toggle_spell()
|
||||
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
|
||||
|
||||
--- Toggle paste
|
||||
function astronvim.ui.toggle_paste()
|
||||
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
|
||||
|
||||
--- Toggle wrap
|
||||
function astronvim.ui.toggle_wrap()
|
||||
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
|
||||
|
||||
--- 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
|
||||
vim.cmd.syntax "on" -- set vim.g.syntax_on = true
|
||||
end
|
||||
astronvim.notify(string.format("syntax %s", bool2str(vim.g.syntax_on)))
|
||||
ui_notify(string.format("syntax %s", bool2str(vim.g.syntax_on)))
|
||||
end
|
||||
|
||||
--- Toggle URL/URI syntax highlighting rules
|
||||
|
|
|
|||
|
|
@ -76,22 +76,45 @@ local cancelled_message = { { "Update cancelled", "WarningMsg" } }
|
|||
-- @param quiet boolean to quietly execute or send a notification
|
||||
function astronvim.updater.reload(quiet)
|
||||
-- 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
|
||||
-- unload AstroNvim configuration files
|
||||
reload_module("user", false)
|
||||
reload_module("configs", false)
|
||||
reload_module("default_theme", false)
|
||||
reload_module("core", false)
|
||||
reload_module "user"
|
||||
reload_module "configs"
|
||||
reload_module "default_theme"
|
||||
reload_module "core"
|
||||
-- manual unload some plugins that need it if they exist
|
||||
reload_module("cmp", false)
|
||||
reload_module("which-key", false)
|
||||
reload_module "cmp"
|
||||
reload_module "which-key"
|
||||
-- source the AstroNvim configuration
|
||||
local reloaded, _ = pcall(dofile, vim.fn.expand "$MYVIMRC")
|
||||
-- if successful reload and not quiet, display a notification
|
||||
if reloaded and not quiet then astronvim.notify "Reloaded AstroNvim" 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
|
||||
function astronvim.updater.update()
|
||||
-- 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 options.auto_reload then
|
||||
-- perform a reload
|
||||
vim.opt.modifiable = true
|
||||
astronvim.updater.reload(true) -- run quiet to not show notification on reload
|
||||
-- sync packer if it is available
|
||||
local packer_avail, packer = pcall(require, "packer")
|
||||
if packer_avail then
|
||||
-- on a successful packer sync send user event
|
||||
vim.api.nvim_create_autocmd(
|
||||
"User",
|
||||
{ pattern = "PackerComplete", command = "doautocmd User AstroUpdateComplete" }
|
||||
)
|
||||
packer.sync()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
once = true,
|
||||
pattern = "AstroUpdatePackagesComplete",
|
||||
callback = function() astronvim.event "UpdateComplete" end,
|
||||
})
|
||||
require "core.plugins"
|
||||
astronvim.updater.update_packages()
|
||||
-- if packer isn't available send successful update event
|
||||
else
|
||||
vim.cmd [[doautocmd User AstroUpdateComplete]]
|
||||
end
|
||||
else
|
||||
-- send user event of successful update
|
||||
vim.cmd [[doautocmd User AstroUpdateComplete]]
|
||||
astronvim.event "UpdateComplete"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ local colors = {
|
|||
woff2 = "#abb2bf",
|
||||
zip = "#f9d71c",
|
||||
md = "#519aba",
|
||||
pkg = "#d39ede",
|
||||
}
|
||||
|
||||
return astronvim.user_plugin_opts("default_theme.colors", colors)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ for plugin, enabled in
|
|||
beacon = false,
|
||||
bufferline = true,
|
||||
cmp = true,
|
||||
dapui = true,
|
||||
dashboard = true,
|
||||
gitsigns = true,
|
||||
highlighturl = true,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ local lsp = {
|
|||
DiagnosticUnderlineHint = { sp = C.red_2, undercurl = true },
|
||||
DiagnosticUnderlineInfo = { 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 },
|
||||
LspDiagnosticsFloatingHint = { fg = C.yellow_1 },
|
||||
LspDiagnosticsFloatingInfor = { fg = C.white_2 },
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ return {
|
|||
AerialPropertyIcon = { link = "@property" },
|
||||
AerialStringIcon = { link = "@string" },
|
||||
AerialStructIcon = { link = "@type" },
|
||||
AerialTypeIcon = { link = "@type" },
|
||||
AerialTypeParameterIcon = { link = "@parameter" },
|
||||
AerialVariableIcon = { link = "@variable" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
return {
|
||||
NotifyBackground = { bg = C.bg },
|
||||
NotifyERRORBorder = { fg = C.red },
|
||||
NotifyWARNBorder = { fg = C.orange_1 },
|
||||
NotifyINFOBorder = { fg = C.green },
|
||||
|
|
|
|||
|
|
@ -29,4 +29,6 @@ return {
|
|||
DevIconXz = { fg = C.zip },
|
||||
DevIconZip = { fg = C.zip },
|
||||
DevIconMd = { fg = C.md },
|
||||
DevIconPackageJson = { fg = C.pkg },
|
||||
DevIconPackageLockJson = { fg = C.pkg },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ local treesitter = {
|
|||
["@error"] = { fg = C.red },
|
||||
["@exception"] = { fg = C.purple },
|
||||
["@field"] = { fg = C.red },
|
||||
["@float"] = { fg = C.green },
|
||||
["@float"] = { fg = C.orange },
|
||||
["@function"] = { fg = C.blue },
|
||||
["@function.builtin"] = { fg = C.blue },
|
||||
["@function.macro"] = { fg = C.yellow },
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ return {
|
|||
VimwikiLink = { fg = C.cyan, bg = C.none },
|
||||
VimwikiHeaderChar = { fg = C.grey, bg = C.none },
|
||||
VimwikiHR = { fg = C.yellow, bg = C.none },
|
||||
VimwikiList = { fg = C.orange, bg = C.orange },
|
||||
VimwikiTag = { fg = C.orange, bg = C.orange },
|
||||
VimwikiList = { fg = C.orange, bg = C.none },
|
||||
VimwikiTag = { fg = C.orange, bg = C.none },
|
||||
VimwikiMarkers = { fg = C.grey, bg = C.none },
|
||||
VimwikiHeader1 = { fg = C.orange, bg = C.none, bold = true },
|
||||
VimwikiHeader2 = { fg = C.green, bg = C.none, bold = true },
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ local config = {
|
|||
diagnostics_enabled = true, -- enable diagnostics at start
|
||||
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)
|
||||
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
|
||||
},
|
||||
},
|
||||
-- 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(...)`
|
||||
-- ensure_installed = { "prettier", "stylua" },
|
||||
},
|
||||
["mason-nvim-dap"] = { -- overrides `require("mason-nvim-dap").setup(...)`
|
||||
-- ensure_installed = { "python" },
|
||||
},
|
||||
},
|
||||
|
||||
-- LuaSnip Options
|
||||
luasnip = {
|
||||
-- Add paths for including more VS Code style snippets in luasnip
|
||||
vscode_snippet_paths = {},
|
||||
-- Extend filetypes
|
||||
filetype_extend = {
|
||||
-- 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
|
||||
|
|
|
|||
|
|
@ -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"}}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,27 @@ set $right l
|
|||
|
||||
### Output configuration
|
||||
output * bg /home/pixel/Downloads/wallhaven-q22r57.png fill
|
||||
|
||||
output * scale 1.8
|
||||
# set monitor config
|
||||
output DP-1 resolution 1920x1080@74.924Hz position 1920,650
|
||||
output HDMI-A-1 resolution 1920x1080@60Hz position 840,160 transform 90
|
||||
output DVI-D-1 resolution 1440x900@59.887Hz position 3840,910
|
||||
#output DP-1 resolution 1920x1080@74.924Hz position 1920,650
|
||||
#output HDMI-A-1 resolution 1920x1080@60Hz position 840,160 transform 90
|
||||
#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:
|
||||
# Start a terminal
|
||||
bindsym $mod+Return exec kitty
|
||||
bindsym $mod+Return exec LIBGL_ALWAYS_SOFTWARE=1 kitty
|
||||
# Kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
# Start your launcher
|
||||
bindsym $mod+Shift+d exec networkmanager_dmenu
|
||||
bindsym $mod+d exec "rofi -modi drun,run -show drun"
|
||||
# screenshots
|
||||
bindsym $mod2+Shift+t exec 'grim -g "$(slurp)" - | swappy -f -'
|
||||
# Drag floating windows by holding down $mod and left mouse button.
|
||||
# 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)
|
||||
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:
|
||||
#
|
||||
|
|
@ -175,9 +203,11 @@ bar {
|
|||
|
||||
# dbus stuff
|
||||
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
|
||||
exec $HOME/pipewire.sh
|
||||
#exec $HOME/pipewire.sh
|
||||
|
||||
#border
|
||||
default_border pixel 1
|
||||
|
|
@ -188,8 +218,9 @@ titlebar_border_thickness 0
|
|||
titlebar_padding 0
|
||||
|
||||
#gaps
|
||||
gaps inner 4
|
||||
gaps top 4
|
||||
gaps inner 2
|
||||
|
||||
|
||||
|
||||
# transparency
|
||||
#set $opacity 0.9
|
||||
|
|
|
|||
|
|
@ -1,40 +1,33 @@
|
|||
{
|
||||
// "layer": "top", // Waybar at top layer
|
||||
// "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
|
||||
"spacing": 8, // Gaps between modules (4px)
|
||||
// Choose the order of the modules
|
||||
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
|
||||
"modules-right": ["pulseaudio", "cpu", "memory", "clock", "tray"],
|
||||
"modules-left": [
|
||||
"custom/icon",
|
||||
"sway/workspaces",
|
||||
"sway/mode",
|
||||
"sway/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/spotify",
|
||||
"pulseaudio",
|
||||
"cpu",
|
||||
"memory",
|
||||
"battery",
|
||||
"network",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
// 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": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"custom/icon": {
|
||||
"format": ""
|
||||
},
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
|
|
@ -47,7 +40,7 @@
|
|||
"spacing": 10
|
||||
},
|
||||
"clock": {
|
||||
// "timezone": "America/New_York",
|
||||
"timezone": "America/Los_Angeles",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"format-alt": "{:%Y-%m-%d}"
|
||||
},
|
||||
|
|
@ -59,7 +52,6 @@
|
|||
"format": "{}% "
|
||||
},
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": "{essid} ({signalStrength}%) ",
|
||||
"format-ethernet": "{ipaddr}/{cidr} ",
|
||||
"tooltip-format": "{ifname} via {gwaddr} ",
|
||||
|
|
@ -68,7 +60,6 @@
|
|||
"format-alt": "{ifname}: {ipaddr}/{cidr}"
|
||||
},
|
||||
"pulseaudio": {
|
||||
// "scroll-step": 1, // %, can be a float
|
||||
"format": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth-muted": " {icon} {format_source}",
|
||||
|
|
@ -77,28 +68,47 @@
|
|||
"format-source-muted": "",
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
"default": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"on-click": "pavucontrol"
|
||||
},
|
||||
"sway/workspaces": {
|
||||
"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
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,41 @@
|
|||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Roboto, Helvetica, Arial, sans-serif;
|
||||
font-family: NotoSans, Roboto, Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
min-height: 0;
|
||||
/*padding-right: 2px;*/
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: #11151a;
|
||||
background: rgba(17, 21, 26, 0.4);
|
||||
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); */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="$HOME/repos/ohmyzsh"
|
||||
#export ZSH="$HOME/repos/ohmyzsh"
|
||||
|
||||
# znap
|
||||
[[ -f ~/repos/zsh-snap/znap.zsh ]] ||
|
||||
|
|
@ -8,7 +8,7 @@ export ZSH="$HOME/repos/ohmyzsh"
|
|||
source ~/repos/zsh-snap/znap.zsh
|
||||
|
||||
# OMZ
|
||||
znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}
|
||||
#znap source ohmyzsh/ohmyzsh lib/{git,theme-and-appearance}
|
||||
|
||||
# Plugins
|
||||
znap source marlonrichert/zsh-autocomplete
|
||||
|
|
@ -29,5 +29,14 @@ alias cat="bat"
|
|||
alias vim="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
|
||||
eval "$(starship init zsh)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue