diff --git a/dot_config/nvim/config.ld b/dot_config/nvim/config.ld
new file mode 100644
index 0000000..0bb9d28
--- /dev/null
+++ b/dot_config/nvim/config.ld
@@ -0,0 +1,10 @@
+project='AstroNvim'
+title='AstroNvim API'
+description='Documentation of AstroNvim\'s core API'
+format = 'markdown'
+file='lua'
+dir='docs'
+no_space_before_args=true
+examples = {
+ 'lua/user_example/init.lua'
+}
diff --git a/dot_config/nvim/dot_git/FETCH_HEAD b/dot_config/nvim/dot_git/FETCH_HEAD
new file mode 100644
index 0000000..3178159
--- /dev/null
+++ b/dot_config/nvim/dot_git/FETCH_HEAD
@@ -0,0 +1,8 @@
+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
diff --git a/dot_config/nvim/dot_git/ORIG_HEAD b/dot_config/nvim/dot_git/ORIG_HEAD
new file mode 100644
index 0000000..17680fa
--- /dev/null
+++ b/dot_config/nvim/dot_git/ORIG_HEAD
@@ -0,0 +1 @@
+ba775276324b75e4f703cd63fea3cfe7726514de
diff --git a/dot_config/nvim/dot_git/index b/dot_config/nvim/dot_git/index
index 2cb1d1b..3021d34 100644
Binary files a/dot_config/nvim/dot_git/index and b/dot_config/nvim/dot_git/index differ
diff --git a/dot_config/nvim/dot_git/logs/HEAD b/dot_config/nvim/dot_git/logs/HEAD
index 89b4775..aa5ebfe 100644
--- a/dot_config/nvim/dot_git/logs/HEAD
+++ b/dot_config/nvim/dot_git/logs/HEAD
@@ -1 +1,2 @@
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
+ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith 1666894344 -0700 pull --rebase: Fast-forward
diff --git a/dot_config/nvim/dot_git/logs/refs/heads/main b/dot_config/nvim/dot_git/logs/refs/heads/main
index 89b4775..aa5ebfe 100644
--- a/dot_config/nvim/dot_git/logs/refs/heads/main
+++ b/dot_config/nvim/dot_git/logs/refs/heads/main
@@ -1 +1,2 @@
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
+ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith 1666894344 -0700 pull --rebase: Fast-forward
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/dap b/dot_config/nvim/dot_git/logs/refs/remotes/origin/dap
new file mode 100644
index 0000000..8ed9719
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/dap
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/devicon b/dot_config/nvim/dot_git/logs/refs/remotes/origin/devicon
new file mode 100644
index 0000000..2d57ab0
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/devicon
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 23d7faaa166f633d00a446726bab2e355143c3e2 Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/gh-pages b/dot_config/nvim/dot_git/logs/refs/remotes/origin/gh-pages
new file mode 100644
index 0000000..699119a
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/gh-pages
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 1e520d7e47dc588f58f59613ab17300ff8496986 Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/heirline_bufferline b/dot_config/nvim/dot_git/logs/refs/remotes/origin/heirline_bufferline
new file mode 100644
index 0000000..266ab4b
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/heirline_bufferline
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 c7a79519290352fc5710b95285bb016176a8efd0 Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/main b/dot_config/nvim/dot_git/logs/refs/remotes/origin/main
new file mode 100644
index 0000000..91182d0
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/main
@@ -0,0 +1 @@
+ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith 1666894323 -0700 fetch origin: fast-forward
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/nightly b/dot_config/nvim/dot_git/logs/refs/remotes/origin/nightly
new file mode 100644
index 0000000..7151148
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/nightly
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 0ce1b696613bc3dba23f24508ca5a2b7133fd5ba Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/readme b/dot_config/nvim/dot_git/logs/refs/remotes/origin/readme
new file mode 100644
index 0000000..d75e48b
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/readme
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0 Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/shields b/dot_config/nvim/dot_git/logs/refs/remotes/origin/shields
new file mode 100644
index 0000000..6748cf9
--- /dev/null
+++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/shields
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 e1a36a82a3b53ade76ea1384853d4fd387e81a8c Riley Smith 1666894323 -0700 fetch origin: storing head
diff --git a/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.idx b/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.idx
new file mode 100644
index 0000000..fef90cd
Binary files /dev/null and b/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.idx differ
diff --git a/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.pack b/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.pack
new file mode 100644
index 0000000..3ec4888
Binary files /dev/null and b/dot_config/nvim/dot_git/objects/pack/readonly_pack-fa6b3ca507f5c08d5f27e1e3a21c78b58166d508.pack differ
diff --git a/dot_config/nvim/dot_git/refs/heads/main b/dot_config/nvim/dot_git/refs/heads/main
index 17680fa..b326264 100644
--- a/dot_config/nvim/dot_git/refs/heads/main
+++ b/dot_config/nvim/dot_git/refs/heads/main
@@ -1 +1 @@
-ba775276324b75e4f703cd63fea3cfe7726514de
+5288bad46858f15f2290aeb3d09c8bd8e58b7882
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/dap b/dot_config/nvim/dot_git/refs/remotes/origin/dap
new file mode 100644
index 0000000..956b73a
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/dap
@@ -0,0 +1 @@
+28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/devicon b/dot_config/nvim/dot_git/refs/remotes/origin/devicon
new file mode 100644
index 0000000..d0ee1a7
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/devicon
@@ -0,0 +1 @@
+23d7faaa166f633d00a446726bab2e355143c3e2
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/gh-pages b/dot_config/nvim/dot_git/refs/remotes/origin/gh-pages
new file mode 100644
index 0000000..8448bc8
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/gh-pages
@@ -0,0 +1 @@
+1e520d7e47dc588f58f59613ab17300ff8496986
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/heirline_bufferline b/dot_config/nvim/dot_git/refs/remotes/origin/heirline_bufferline
new file mode 100644
index 0000000..cf1c4b7
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/heirline_bufferline
@@ -0,0 +1 @@
+c7a79519290352fc5710b95285bb016176a8efd0
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/main b/dot_config/nvim/dot_git/refs/remotes/origin/main
new file mode 100644
index 0000000..b326264
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/main
@@ -0,0 +1 @@
+5288bad46858f15f2290aeb3d09c8bd8e58b7882
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/nightly b/dot_config/nvim/dot_git/refs/remotes/origin/nightly
new file mode 100644
index 0000000..06ead8e
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/nightly
@@ -0,0 +1 @@
+0ce1b696613bc3dba23f24508ca5a2b7133fd5ba
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/readme b/dot_config/nvim/dot_git/refs/remotes/origin/readme
new file mode 100644
index 0000000..b8aaa4e
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/readme
@@ -0,0 +1 @@
+b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0
diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/shields b/dot_config/nvim/dot_git/refs/remotes/origin/shields
new file mode 100644
index 0000000..36a4089
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/remotes/origin/shields
@@ -0,0 +1 @@
+e1a36a82a3b53ade76ea1384853d4fd387e81a8c
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.10.0 b/dot_config/nvim/dot_git/refs/tags/v1.10.0
new file mode 100644
index 0000000..50abb89
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.10.0
@@ -0,0 +1 @@
+392b92d4f731d6126a1a3b946cc3a20e7aef9bfc
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.8.0 b/dot_config/nvim/dot_git/refs/tags/v1.8.0
new file mode 100644
index 0000000..7753671
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.8.0
@@ -0,0 +1 @@
+8453ed985262a23cb9ff4a1bbf02c32ca5460ea7
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.8.1 b/dot_config/nvim/dot_git/refs/tags/v1.8.1
new file mode 100644
index 0000000..b191c57
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.8.1
@@ -0,0 +1 @@
+5e28adaed25853c2e1ff3d3a464d71750a38dc39
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.9.0 b/dot_config/nvim/dot_git/refs/tags/v1.9.0
new file mode 100644
index 0000000..bd11fae
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.9.0
@@ -0,0 +1 @@
+7ba02c5c6097a9b5a4f42ca7204fc856502bd14e
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.9.1 b/dot_config/nvim/dot_git/refs/tags/v1.9.1
new file mode 100644
index 0000000..0ff1e6b
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.9.1
@@ -0,0 +1 @@
+3c96bb087f1db8fba779546f4662bae6864e5bc8
diff --git a/dot_config/nvim/dot_git/refs/tags/v1.9.2 b/dot_config/nvim/dot_git/refs/tags/v1.9.2
new file mode 100644
index 0000000..ace3655
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v1.9.2
@@ -0,0 +1 @@
+9badfdd8f2e472fc79dd666679df9ed6237240a8
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.0.0 b/dot_config/nvim/dot_git/refs/tags/v2.0.0
new file mode 100644
index 0000000..b1b5c44
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.0.0
@@ -0,0 +1 @@
+53d210d3905f65b9e8f0bdb0c8a307440ebfc3f8
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.0.1 b/dot_config/nvim/dot_git/refs/tags/v2.0.1
new file mode 100644
index 0000000..3cafbf3
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.0.1
@@ -0,0 +1 @@
+a157c0ed2ce6b6b956819e29bc78688044f2ef1d
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.0.2 b/dot_config/nvim/dot_git/refs/tags/v2.0.2
new file mode 100644
index 0000000..7fddd4b
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.0.2
@@ -0,0 +1 @@
+0882a17b0d399c3fef12cd963fac32f8ba4f5a3c
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.1.0 b/dot_config/nvim/dot_git/refs/tags/v2.1.0
new file mode 100644
index 0000000..d12dddc
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.1.0
@@ -0,0 +1 @@
+f65794ed742a255498a161f8a4ccd1b334404be4
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.1.1 b/dot_config/nvim/dot_git/refs/tags/v2.1.1
new file mode 100644
index 0000000..593c82e
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.1.1
@@ -0,0 +1 @@
+5148df725aebcfe2a80876762a2425c7e1820569
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.2.0 b/dot_config/nvim/dot_git/refs/tags/v2.2.0
new file mode 100644
index 0000000..dc27c4d
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.2.0
@@ -0,0 +1 @@
+501aece937d323c534dddc0ebeb07c4560b409e5
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.2.1 b/dot_config/nvim/dot_git/refs/tags/v2.2.1
new file mode 100644
index 0000000..f15e3fa
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.2.1
@@ -0,0 +1 @@
+3f269b70cdf41a7636b0c2472afe1dba9467ccc6
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.2.2 b/dot_config/nvim/dot_git/refs/tags/v2.2.2
new file mode 100644
index 0000000..3c34c78
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.2.2
@@ -0,0 +1 @@
+fa82ff92b438d764f2ed683cca2ec7e95e7ffb72
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.3.0 b/dot_config/nvim/dot_git/refs/tags/v2.3.0
new file mode 100644
index 0000000..57f460a
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.3.0
@@ -0,0 +1 @@
+893665a969129eb528e54b7e4bee1e6c952d6d25
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.4.0 b/dot_config/nvim/dot_git/refs/tags/v2.4.0
new file mode 100644
index 0000000..761633a
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.4.0
@@ -0,0 +1 @@
+f5200f4b00df1db0c14a13b61bbb428594733e52
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.4.1 b/dot_config/nvim/dot_git/refs/tags/v2.4.1
new file mode 100644
index 0000000..db28c40
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.4.1
@@ -0,0 +1 @@
+a4292d28b867249ba6330616e4689e6cf69ad3f0
diff --git a/dot_config/nvim/dot_git/refs/tags/v2.4.2 b/dot_config/nvim/dot_git/refs/tags/v2.4.2
new file mode 100644
index 0000000..b326264
--- /dev/null
+++ b/dot_config/nvim/dot_git/refs/tags/v2.4.2
@@ -0,0 +1 @@
+5288bad46858f15f2290aeb3d09c8bd8e58b7882
diff --git a/dot_config/nvim/dot_github/CONTRIBUTING.md b/dot_config/nvim/dot_github/CONTRIBUTING.md
index 3c6166a..fff45e3 100644
--- a/dot_config/nvim/dot_github/CONTRIBUTING.md
+++ b/dot_config/nvim/dot_github/CONTRIBUTING.md
@@ -35,6 +35,12 @@ If you wish to contribute to AstroNvim, you should:
## Things to know before contributing
+- Development happens on the `nightly` branch, so please make sure of a couple things
+
+ - all branches are rebased on the `nightly` branch to get the latest updates.
+
+ - all pull requests are made to merge into `nightly`
+
- When making a PR (pull request), please be very descriptive about what you've done!
- Commit messages must follow [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/)
diff --git a/dot_config/nvim/dot_github/FUNDING.yml b/dot_config/nvim/dot_github/FUNDING.yml
index 77746f6..ec71cb6 100644
--- a/dot_config/nvim/dot_github/FUNDING.yml
+++ b/dot_config/nvim/dot_github/FUNDING.yml
@@ -1 +1,2 @@
-custom: https://www.buymeacoffee.com/mehalter
+ko_fi: mehalter
+custom: https://www.buymeacoffee.com/mehalter
diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.yaml b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.yaml
new file mode 100644
index 0000000..3edf891
--- /dev/null
+++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.yaml
@@ -0,0 +1,78 @@
+name: Bug report
+description: Create a report to help us improve
+labels: [bug]
+
+body:
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: Checklist
+ description: Have you completed the following steps and are still able to replicate the issue?
+ options:
+ - label: "Using a stable version of Neovim (i.e. not neovim nightly)"
+ required: true
+ - label: "`:PackerSync`"
+ required: true
+ - label: "`:AstroUpdate`"
+ required: true
+ - label: Restarted AstroNvim
+ required: true
+ - type: input
+ id: version
+ attributes:
+ label: AstroNvim version
+ placeholder: |
+ output of :AstroVersion
+ validations:
+ required: true
+ - type: input
+ id: nvim-version
+ attributes:
+ label: Neovim version (>= 0.8)
+ description: "Output of `nvim --version`"
+ placeholder: |
+ NVIM v0.8.0
+ validations:
+ required: true
+ - type: input
+ id: system-version
+ attributes:
+ label: "Operating system/version"
+ placeholder: "macOS 11.5"
+ validations:
+ required: true
+ - type: textarea
+ id: description
+ attributes:
+ label: Describe the bug
+ placeholder: A clear and concise description of what the bug is.
+ validations:
+ required: true
+ - type: textarea
+ id: reproduce
+ attributes:
+ label: Steps to Reproduce
+ placeholder: |
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected behavior
+ placeholder: A clear and concise description of what you expected to happen
+ validations:
+ required: true
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: Screenshots
+ description: If applicable, add screenshots or recording ([Asciinema](asciinema.org)) to help explain your problem.
+ - type: textarea
+ id: additional-context
+ attributes:
+ label: Additional Context
+ placeholder: Add any additional context about the problem here.
diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/config.yml b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..28a5f70
--- /dev/null
+++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,6 @@
+blank_issues_enabled: true
+
+contact_links:
+ - name: Discord community
+ url: https://discord.gg/UcZutyeaFW
+ about: Ask questions and discussions about AstroNvim on Discord
diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.yaml b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.yaml
new file mode 100644
index 0000000..e28e766
--- /dev/null
+++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.yaml
@@ -0,0 +1,22 @@
+name: Feature request
+description: Suggest an idea for this project
+labels: [enhancement]
+
+body:
+ - type: textarea
+ id: problem
+ attributes:
+ label: Is your feature related to a problem?
+ placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+ - type: textarea
+ id: solution
+ attributes:
+ label: Describe the new feature
+ placeholder: A clear and concise description of what the new feature is.
+ validations:
+ required: true
+ - type: textarea
+ id: additional-context
+ attributes:
+ label: Additional context
+ placeholder: Add any other context or screenshots about the feature request here.
diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.yaml b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.yaml
new file mode 100644
index 0000000..6edc4c2
--- /dev/null
+++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.yaml
@@ -0,0 +1,24 @@
+name: Question
+description: Ask a general question about AstroNvim usage
+labels: [question]
+
+body:
+ - type: textarea
+ id: question
+ attributes:
+ label: Question
+ validations:
+ required: true
+ - type: textarea
+ id: user-config
+ attributes:
+ label: User Configuration
+ description: "Please include your `user/init.lua` file here if relevant"
+ placeholder: |
+ ```lua
+ local config = {
+ header = "My Custom Config",
+ }
+
+ return config
+ ```
diff --git a/dot_config/nvim/dot_github/README.md b/dot_config/nvim/dot_github/README.md
index 7bad7ca..7ceaeae 100644
--- a/dot_config/nvim/dot_github/README.md
+++ b/dot_config/nvim/dot_github/README.md
@@ -12,7 +12,7 @@
-
+
@@ -24,8 +24,6 @@
AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
-**_Notice:_** AstroNvim v1.4.0 has added `stable` and `nightly` update channels. For the time being we have kept the default update channel to `nightly` so that the behavior of AstroNvim doesn't change (this could be considered a breaking change to some). We are planning to make the `stable` channel the default update channel when Neovim v0.8 is released and we tag AstroNvim v2.0.0 to incorporate this "breaking" change.
-
## 🌟 Preview

@@ -37,7 +35,7 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp)
- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim)
-- Statusline with [Feline](https://github.com/feline-nvim/feline.nvim)
+- Statusline with [Heirline](https://github.com/rebelot/heirline.nvim)
- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim)
- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
@@ -47,21 +45,19 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and
## ⚡ Requirements
-- [Nerd Fonts](https://www.nerdfonts.com/font-downloads)
-- [Neovim 0.7+](https://github.com/neovim/neovim/releases/tag/v0.7.0)
+- [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)
- 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:
- [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`fw`)
- [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`tl` or `gg`)
- - [NCDU](https://dev.yorhel.nl/ncdu) - disk usage toggle terminal (`tu`)
- - [Htop](https://htop.dev/) - process viewer toggle terminal (`tt`)
+ - [go DiskUsage()](https://github.com/dundee/gdu) - disk usage toggle terminal (`tu`)
+ - [bottom](https://github.com/ClementTsang/bottom) - process viewer toggle terminal (`tt`)
- [Python](https://www.python.org/) - python repl toggle terminal (`tp`)
- [Node](https://nodejs.org/en/) - node repl toggle terminal (`tn`)
-> Note when using default theme: For MacOS, the default terminal does not have true color support. You wil need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support.
-
-> Note if you are still on Neovim v0.6: You can still install the previous version of AstroNvim that supported. After cloning the repository run `git checkout nvim-0.6` to check out this version. This will no longer be receiving updates.
+> Note when using default theme: For MacOS, the default terminal does not have true color support. You will need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support.
## 🛠️ Installation
@@ -102,9 +98,10 @@ Run `:AstroUpdate` to get the latest updates from the repository
## 🗒️ Links
[AstroNvim Documentation](https://astronvim.github.io/)
+[Core AstroNvim LUA API Documentation](https://astronvim.github.io/AstroNvim/)
-- [Basic Usage](https://astronvim.github.io/usage/walkthrough) is given for basic usage
-- [Default Mappings](https://astronvim.github.io/usage/mappings) more about the default key bindings
+- [Basic Usage](https://astronvim.github.io/Basic%20Usage/walkthrough) is given for basic usage
+- [Default Mappings](https://astronvim.github.io/Basic%20Usage/mappings) more about the default key bindings
- [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults
- [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration
diff --git a/dot_config/nvim/dot_github/stale.yml b/dot_config/nvim/dot_github/stale.yml
index 0ccfb1b..80a5164 100644
--- a/dot_config/nvim/dot_github/stale.yml
+++ b/dot_config/nvim/dot_github/stale.yml
@@ -9,11 +9,11 @@ exemptLabels:
- notice
- wip
# Label to use when marking an issue as stale
-staleLabel: wontfix
+staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
- recent activity. It will be closed if no further activity occurs. Thank you
- for your contributions.
+ recent activity. It will be closed in 7 days if no further activity occurs.
+ Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
diff --git a/dot_config/nvim/dot_github/workflows/docs.yml b/dot_config/nvim/dot_github/workflows/docs.yml
new file mode 100644
index 0000000..f40569e
--- /dev/null
+++ b/dot_config/nvim/dot_github/workflows/docs.yml
@@ -0,0 +1,32 @@
+name: Documentation
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+
+jobs:
+ docs:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Setup Lua
+ uses: leafo/gh-actions-lua@v8
+ with:
+ luaVersion: 5.4
+ - name: Install LDoc
+ uses: leafo/gh-actions-luarocks@v4
+ - name: Setup dependencies
+ run: luarocks install ldoc
+ - name: Build Docs
+ run: |
+ ldoc .
+ - name: Deploy
+ uses: peaceiris/actions-gh-pages@v3
+ if: ${{ github.ref == 'refs/heads/main' }}
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: ./docs
diff --git a/dot_config/nvim/dot_github/workflows/style.yml b/dot_config/nvim/dot_github/workflows/style.yml
index b11412a..f0e770f 100644
--- a/dot_config/nvim/dot_github/workflows/style.yml
+++ b/dot_config/nvim/dot_github/workflows/style.yml
@@ -10,6 +10,6 @@ jobs:
- uses: JohnnyMorganz/stylua-action@1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- version: v0.14.0
+ version: v0.14.2
# CLI arguments
args: --check .
diff --git a/dot_config/nvim/dot_github/workflows/updater.yml b/dot_config/nvim/dot_github/workflows/updater.yml
index 43b71c2..aca2641 100644
--- a/dot_config/nvim/dot_github/workflows/updater.yml
+++ b/dot_config/nvim/dot_github/workflows/updater.yml
@@ -20,7 +20,7 @@ jobs:
const user = src.user.login
const tab = " "
let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n`
- if (src.ref != "main") {
+ if (src.ref != "nightly") {
settings += tab + tab + `branch = "${src.ref}",\n`
}
if (user != "AstroNvim") {
diff --git a/dot_config/nvim/dot_gitignore b/dot_config/nvim/dot_gitignore
index 3f29aef..1d03414 100644
--- a/dot_config/nvim/dot_gitignore
+++ b/dot_config/nvim/dot_gitignore
@@ -1,4 +1,8 @@
-plugin
-lua/user
-lua/packer_compiled.lua
+!colors/default_theme.lua
+colors/*
+docs
ginit.vim
+lua/packer_compiled.lua
+lua/user
+plugin
+spell
diff --git a/dot_config/nvim/dot_luacheckrc b/dot_config/nvim/dot_luacheckrc
index 00ce173..809581e 100644
--- a/dot_config/nvim/dot_luacheckrc
+++ b/dot_config/nvim/dot_luacheckrc
@@ -4,6 +4,7 @@ globals = {
"astronvim",
"astronvim_installation",
"vim",
+ "bit",
"C",
"packer_plugins",
}
@@ -15,6 +16,6 @@ cache = true
self = false
ignore = {
- "631", -- max_line_length
- "212/_.*", -- unused argument, for vars with "_" prefix
+ "631", -- max_line_length
+ "212/_.*", -- unused argument, for vars with "_" prefix
}
diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua
index 0c5f0fa..773cdbe 100644
--- a/dot_config/nvim/init.lua
+++ b/dot_config/nvim/init.lua
@@ -6,6 +6,7 @@ for _, source in ipairs {
"core.options",
"core.bootstrap",
"core.plugins",
+ "core.diagnostics",
"core.autocmds",
"core.mappings",
"configs.which-key-register",
@@ -15,3 +16,7 @@ for _, source in ipairs {
end
astronvim.conditional_func(astronvim.user_plugin_opts("polish", nil, false))
+
+if vim.fn.has "nvim-0.8" ~= 1 or vim.version().prerelease then
+ vim.schedule(function() astronvim.notify("Unsupported Neovim Version! Please check the requirements", "error") end)
+end
diff --git a/dot_config/nvim/lua/configs/Comment.lua b/dot_config/nvim/lua/configs/Comment.lua
index b1cd8cd..d08004c 100644
--- a/dot_config/nvim/lua/configs/Comment.lua
+++ b/dot_config/nvim/lua/configs/Comment.lua
@@ -4,14 +4,14 @@ local utils = require "Comment.utils"
Comment.setup(astronvim.user_plugin_opts("plugins.Comment", {
pre_hook = function(ctx)
local location = nil
- if ctx.ctype == utils.ctype.block then
+ if ctx.ctype == utils.ctype.blockwise then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
- key = ctx.ctype == utils.ctype.line and "__default" or "__multiline",
+ key = ctx.ctype == utils.ctype.linewise and "__default" or "__multiline",
location = location,
}
end,
diff --git a/dot_config/nvim/lua/configs/aerial.lua b/dot_config/nvim/lua/configs/aerial.lua
index 1b3f0f9..f05e865 100644
--- a/dot_config/nvim/lua/configs/aerial.lua
+++ b/dot_config/nvim/lua/configs/aerial.lua
@@ -1,39 +1,13 @@
local status_ok, aerial = pcall(require, "aerial")
if not status_ok then return end
aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
- close_behavior = "global",
+ attach_mode = "global",
backends = { "lsp", "treesitter", "markdown" },
- min_width = 28,
+ layout = {
+ min_width = 28,
+ },
show_guides = true,
filter_kind = false,
- icons = {
- Array = "",
- Boolean = "⊨",
- Class = "",
- Constant = "",
- Constructor = "",
- Key = "",
- Function = "",
- Method = "ƒ",
- Namespace = "",
- Null = "NULL",
- Number = "#",
- Object = "⦿",
- Property = "",
- TypeParameter = "𝙏",
- Variable = "",
- Enum = "ℰ",
- Package = "",
- EnumMember = "",
- File = "",
- Module = "",
- Field = "",
- Interface = "ﰮ",
- String = "𝓐",
- Struct = "𝓢",
- Event = "",
- Operator = "+",
- },
guides = {
mid_item = "├ ",
last_item = "└ ",
@@ -41,11 +15,11 @@ aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
whitespace = " ",
},
on_attach = function(bufnr)
- -- Jump forwards/backwards with '{' and '}'
- vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr, desc = "Jump backwards in Aerial" })
- vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr, desc = "Jump forwards in Aerial" })
- -- Jump up the tree with '[[' or ']]'
- vim.keymap.set("n", "[[", "AerialPrevUp", { buffer = bufnr, desc = "Jump up and backwards in Aerial" })
- vim.keymap.set("n", "]]", "AerialNextUp", { buffer = bufnr, desc = "Jump up and forwards in Aerial" })
+ -- Jump forwards/backwards with '[y' and ']y'
+ vim.keymap.set("n", "[y", "AerialPrev", { buffer = bufnr, desc = "Previous Aerial" })
+ vim.keymap.set("n", "]y", "AerialNext", { buffer = bufnr, desc = "Next Aerial" })
+ -- Jump up the tree with '[Y' or ']Y'
+ vim.keymap.set("n", "[Y", "AerialPrevUp", { buffer = bufnr, desc = "Previous and Up in Aerial" })
+ vim.keymap.set("n", "]Y", "AerialNextUp", { buffer = bufnr, desc = "Next and Up in Aerial" })
end,
}))
diff --git a/dot_config/nvim/lua/configs/alpha.lua b/dot_config/nvim/lua/configs/alpha.lua
index c5a004a..36cea18 100644
--- a/dot_config/nvim/lua/configs/alpha.lua
+++ b/dot_config/nvim/lua/configs/alpha.lua
@@ -25,7 +25,7 @@ alpha.setup(astronvim.user_plugin_opts("plugins.alpha", {
{
type = "group",
val = {
- alpha_button("LDR f f", " Find File "),
+ 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 "),
diff --git a/dot_config/nvim/lua/configs/autopairs.lua b/dot_config/nvim/lua/configs/autopairs.lua
index 063ae3a..8f75648 100644
--- a/dot_config/nvim/lua/configs/autopairs.lua
+++ b/dot_config/nvim/lua/configs/autopairs.lua
@@ -21,6 +21,8 @@ npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", {
},
}))
+if not vim.g.autopairs_enabled then npairs.disable() end
+
local rules = astronvim.user_plugin_opts("nvim-autopairs").add_rules
if vim.tbl_contains({ "function", "table" }, type(rules)) then
npairs.add_rules(type(rules) == "function" and rules(npairs) or rules)
diff --git a/dot_config/nvim/lua/configs/bufferline.lua b/dot_config/nvim/lua/configs/bufferline.lua
index 2959391..b8456f9 100644
--- a/dot_config/nvim/lua/configs/bufferline.lua
+++ b/dot_config/nvim/lua/configs/bufferline.lua
@@ -7,9 +7,9 @@ bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", {
{ filetype = "neo-tree", text = "", padding = 1 },
{ filetype = "Outline", text = "", padding = 1 },
},
- buffer_close_icon = "",
- modified_icon = "",
- close_icon = "",
+ buffer_close_icon = astronvim.get_icon "BufferClose",
+ modified_icon = astronvim.get_icon "FileModified",
+ close_icon = astronvim.get_icon "NeovimClose",
max_name_length = 14,
max_prefix_length = 13,
tab_size = 20,
diff --git a/dot_config/nvim/lua/configs/cmp.lua b/dot_config/nvim/lua/configs/cmp.lua
index 174eb2b..0a155e2 100644
--- a/dot_config/nvim/lua/configs/cmp.lua
+++ b/dot_config/nvim/lua/configs/cmp.lua
@@ -1,34 +1,10 @@
local cmp_status_ok, cmp = pcall(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
local setup = cmp.setup
-local kind_icons = {
- Text = "",
- Method = "",
- Function = "",
- Constructor = "",
- Field = "ﰠ",
- Variable = "",
- Class = "",
- Interface = "",
- Module = "",
- Property = "",
- Unit = "",
- Value = "",
- Enum = "",
- Keyword = "",
- Snippet = "",
- Color = "",
- File = "",
- Reference = "",
- Folder = "",
- EnumMember = "",
- Constant = "",
- Struct = "פּ",
- Event = "",
- Operator = "",
- TypeParameter = "",
-}
+local border_opts =
+ { border = "single", winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None" }
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@@ -36,13 +12,14 @@ local function has_words_before()
end
setup(astronvim.user_plugin_opts("plugins.cmp", {
+ enabled = function()
+ if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
+ return vim.g.cmp_enabled
+ end,
preselect = cmp.PreselectMode.None,
formatting = {
fields = { "kind", "abbr", "menu" },
- format = function(_, vim_item)
- vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
- return vim_item
- end,
+ format = lspkind_status_ok and lspkind.cmp_format(astronvim.lspkind) or nil,
},
snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end,
@@ -59,17 +36,16 @@ setup(astronvim.user_plugin_opts("plugins.cmp", {
select = false,
},
window = {
- documentation = {
- border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
- },
+ completion = cmp.config.window.bordered(border_opts),
+ documentation = cmp.config.window.bordered(border_opts),
},
mapping = {
- [""] = cmp.mapping.select_prev_item(),
- [""] = cmp.mapping.select_next_item(),
- [""] = cmp.mapping.select_prev_item(),
- [""] = cmp.mapping.select_next_item(),
- [""] = cmp.mapping.select_prev_item(),
- [""] = cmp.mapping.select_next_item(),
+ [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select },
+ [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select },
+ [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
+ [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
+ [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
+ [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
[""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
[""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
[""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
diff --git a/dot_config/nvim/lua/configs/colorizer.lua b/dot_config/nvim/lua/configs/colorizer.lua
index 0f59361..b6e0438 100644
--- a/dot_config/nvim/lua/configs/colorizer.lua
+++ b/dot_config/nvim/lua/configs/colorizer.lua
@@ -1,17 +1,3 @@
local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then return end
-local colorizer_opts = astronvim.user_plugin_opts("plugins.colorizer", {
- { "*" },
- {
- RGB = true, -- #RGB hex codes
- RRGGBB = true, -- #RRGGBB hex codes
- names = false, -- "Name" codes like Blue
- RRGGBBAA = false, -- #RRGGBBAA hex codes
- rgb_fn = false, -- CSS rgb() and rgba() functions
- hsl_fn = false, -- CSS hsl() and hsla() functions
- css = false, -- Enable all css features: rgb_fn, hsl_fn, names, RGB, RRGGBB
- css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
- mode = "background", -- Set the display mode
- },
-})
-colorizer.setup(colorizer_opts[1], colorizer_opts[2])
+colorizer.setup(astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } }))
diff --git a/dot_config/nvim/lua/configs/dressing.lua b/dot_config/nvim/lua/configs/dressing.lua
index b790705..c5b8e5f 100644
--- a/dot_config/nvim/lua/configs/dressing.lua
+++ b/dot_config/nvim/lua/configs/dressing.lua
@@ -1,15 +1,11 @@
local status_ok, dressing = pcall(require, "dressing")
if not status_ok then return end
--- TODO: Deprecate user ui options table with v2
-local ui_opts = astronvim.user_plugin_opts("ui", { nui_input = true, telescope_select = true })
dressing.setup(astronvim.user_plugin_opts("plugins.dressing", {
input = {
- enabled = ui_opts.nui_input,
default_prompt = "➤ ",
winhighlight = "Normal:Normal,NormalNC:Normal",
},
select = {
- enabled = ui_opts.telescope_select,
backend = { "telescope", "builtin" },
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" },
},
diff --git a/dot_config/nvim/lua/configs/heirline.lua b/dot_config/nvim/lua/configs/heirline.lua
new file mode 100644
index 0000000..d06d4c9
--- /dev/null
+++ b/dot_config/nvim/lua/configs/heirline.lua
@@ -0,0 +1,119 @@
+local status_ok, heirline = pcall(require, "heirline")
+if not status_ok or not astronvim.status then return end
+local C = require "default_theme.colors"
+
+local function setup_colors()
+ local StatusLine = astronvim.get_hlgroup("StatusLine", { fg = C.fg, bg = C.grey_4 })
+ local WinBar = astronvim.get_hlgroup("WinBar", { fg = C.grey_2, bg = C.bg })
+ local WinBarNC = astronvim.get_hlgroup("WinBarNC", { fg = C.grey, bg = C.bg })
+ 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 })
+ local DiagnosticError = astronvim.get_hlgroup("DiagnosticError", { fg = C.red_1, bg = C.grey_4 })
+ local DiagnosticWarn = astronvim.get_hlgroup("DiagnosticWarn", { fg = C.orange_1, bg = C.grey_4 })
+ local DiagnosticInfo = astronvim.get_hlgroup("DiagnosticInfo", { fg = C.white_2, bg = C.grey_4 })
+ local DiagnosticHint = astronvim.get_hlgroup("DiagnosticHint", { fg = C.yellow_1, bg = C.grey_4 })
+ local colors = astronvim.user_plugin_opts("heirline.colors", {
+ fg = StatusLine.fg,
+ bg = StatusLine.bg,
+ section_fg = StatusLine.fg,
+ section_bg = StatusLine.bg,
+ git_branch_fg = Conditional.fg,
+ treesitter_fg = String.fg,
+ scrollbar = TypeDef.fg,
+ git_added = GitSignsAdd.fg,
+ git_changed = GitSignsChange.fg,
+ git_removed = GitSignsDelete.fg,
+ diag_ERROR = DiagnosticError.fg,
+ 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,
+ })
+
+ for _, section in ipairs {
+ "git_branch",
+ "file_info",
+ "git_diff",
+ "diagnostics",
+ "lsp",
+ "macro_recording",
+ "treesitter",
+ "nav",
+ } do
+ if not colors[section .. "_bg"] then colors[section .. "_bg"] = colors["section_bg"] end
+ if not colors[section .. "_fg"] then colors[section .. "_fg"] = colors["section_fg"] end
+ end
+ return colors
+end
+
+heirline.load_colors(setup_colors())
+local heirline_opts = astronvim.user_plugin_opts("plugins.heirline", {
+ {
+ hl = { fg = "fg", bg = "bg" },
+ astronvim.status.component.mode(),
+ astronvim.status.component.git_branch(),
+ astronvim.status.component.file_info(
+ astronvim.is_available "bufferline.nvim" and { filetype = {}, filename = false, file_modified = false } or nil
+ ),
+ astronvim.status.component.git_diff(),
+ astronvim.status.component.diagnostics(),
+ astronvim.status.component.fill(),
+ astronvim.status.component.macro_recording(),
+ astronvim.status.component.fill(),
+ astronvim.status.component.lsp(),
+ astronvim.status.component.treesitter(),
+ astronvim.status.component.nav(),
+ astronvim.status.component.mode { surround = { separator = "right" } },
+ },
+ {
+ fallthrough = false,
+ {
+ condition = function()
+ return 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())
+ end,
+})
diff --git a/dot_config/nvim/lua/configs/indent-line.lua b/dot_config/nvim/lua/configs/indent-line.lua
index 80618b0..9aa222e 100644
--- a/dot_config/nvim/lua/configs/indent-line.lua
+++ b/dot_config/nvim/lua/configs/indent-line.lua
@@ -4,8 +4,6 @@ indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
buftype_exclude = {
"nofile",
"terminal",
- "lsp-installer",
- "lspinfo",
},
filetype_exclude = {
"help",
diff --git a/dot_config/nvim/lua/configs/lspconfig.lua b/dot_config/nvim/lua/configs/lspconfig.lua
new file mode 100644
index 0000000..ac9b872
--- /dev/null
+++ b/dot_config/nvim/lua/configs/lspconfig.lua
@@ -0,0 +1,7 @@
+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)
diff --git a/dot_config/nvim/lua/configs/lspkind.lua b/dot_config/nvim/lua/configs/lspkind.lua
new file mode 100644
index 0000000..4aad11a
--- /dev/null
+++ b/dot_config/nvim/lua/configs/lspkind.lua
@@ -0,0 +1,25 @@
+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 = {
+ NONE = "",
+ Array = "",
+ Boolean = "⊨",
+ Class = "",
+ Constructor = "",
+ Key = "",
+ Namespace = "",
+ Null = "NULL",
+ Number = "#",
+ Object = "⦿",
+ Package = "",
+ Property = "",
+ Reference = "",
+ Snippet = "",
+ String = "𝓐",
+ TypeParameter = "",
+ Unit = "",
+ },
+})
+lspkind.init(astronvim.lspkind)
diff --git a/dot_config/nvim/lua/configs/mason-lspconfig.lua b/dot_config/nvim/lua/configs/mason-lspconfig.lua
new file mode 100644
index 0000000..0123d19
--- /dev/null
+++ b/dot_config/nvim/lua/configs/mason-lspconfig.lua
@@ -0,0 +1,6 @@
+local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
+if not status_ok then return end
+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 })
+)
diff --git a/dot_config/nvim/lua/configs/mason-null-ls.lua b/dot_config/nvim/lua/configs/mason-null-ls.lua
new file mode 100644
index 0000000..10479ae
--- /dev/null
+++ b/dot_config/nvim/lua/configs/mason-null-ls.lua
@@ -0,0 +1,9 @@
+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 }
+ )
+)
diff --git a/dot_config/nvim/lua/configs/mason.lua b/dot_config/nvim/lua/configs/mason.lua
new file mode 100644
index 0000000..a593220
--- /dev/null
+++ b/dot_config/nvim/lua/configs/mason.lua
@@ -0,0 +1,11 @@
+local status_ok, mason = pcall(require, "mason")
+if not status_ok then return end
+mason.setup(astronvim.user_plugin_opts("plugins.mason", {
+ ui = {
+ icons = {
+ package_installed = "✓",
+ package_uninstalled = "✗",
+ package_pending = "⟳",
+ },
+ },
+}))
diff --git a/dot_config/nvim/lua/configs/neo-tree.lua b/dot_config/nvim/lua/configs/neo-tree.lua
index 1d4ee1a..e904737 100644
--- a/dot_config/nvim/lua/configs/neo-tree.lua
+++ b/dot_config/nvim/lua/configs/neo-tree.lua
@@ -2,60 +2,52 @@ local status_ok, neotree = pcall(require, "neo-tree")
if not status_ok then return end
neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
close_if_last_window = true,
- popup_border_style = "rounded",
enable_diagnostics = false,
+ source_selector = {
+ winbar = true,
+ content_layout = "center",
+ tab_labels = {
+ filesystem = astronvim.get_icon "FolderClosed" .. " File",
+ buffers = astronvim.get_icon "DefaultFile" .. " Bufs",
+ git_status = astronvim.get_icon "Git" .. " Git",
+ diagnostics = astronvim.get_icon "Diagnostic" .. " Diagnostic",
+ },
+ },
default_component_configs = {
indent = {
padding = 0,
- with_expanders = false,
},
icon = {
- folder_closed = "",
- folder_open = "",
- folder_empty = "",
- default = "",
+ folder_closed = astronvim.get_icon "FolderClosed",
+ folder_open = astronvim.get_icon "FolderOpen",
+ folder_empty = astronvim.get_icon "FolderEmpty",
+ default = astronvim.get_icon "DefaultFile",
},
git_status = {
symbols = {
- added = "",
- deleted = "",
- modified = "",
- renamed = "➜",
- untracked = "★",
- ignored = "◌",
- unstaged = "✗",
- staged = "✓",
- conflict = "",
+ added = astronvim.get_icon "GitAdd",
+ deleted = astronvim.get_icon "GitDelete",
+ modified = astronvim.get_icon "GitChange",
+ renamed = astronvim.get_icon "GitRenamed",
+ untracked = astronvim.get_icon "GitUntracked",
+ ignored = astronvim.get_icon "GitIgnored",
+ unstaged = astronvim.get_icon "GitUnstaged",
+ staged = astronvim.get_icon "GitStaged",
+ conflict = astronvim.get_icon "GitConflict",
},
},
},
window = {
- width = 25,
+ width = 30,
mappings = {
["o"] = "open",
},
},
filesystem = {
- filtered_items = {
- visible = false,
- hide_dotfiles = true,
- hide_gitignored = false,
- hide_by_name = {
- ".DS_Store",
- "thumbs.db",
- "node_modules",
- "__pycache__",
- },
- },
follow_current_file = true,
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
},
- git_status = {
- window = {
- position = "float",
- },
- },
event_handlers = {
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },
},
diff --git a/dot_config/nvim/lua/configs/null-ls.lua b/dot_config/nvim/lua/configs/null-ls.lua
index 1b6d853..eefb445 100644
--- a/dot_config/nvim/lua/configs/null-ls.lua
+++ b/dot_config/nvim/lua/configs/null-ls.lua
@@ -1,3 +1,3 @@
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")
+null_ls.setup(astronvim.user_plugin_opts("plugins.null-ls", { on_attach = astronvim.lsp.on_attach }))
diff --git a/dot_config/nvim/lua/configs/nvim-web-devicons.lua b/dot_config/nvim/lua/configs/nvim-web-devicons.lua
new file mode 100644
index 0000000..a519d71
--- /dev/null
+++ b/dot_config/nvim/lua/configs/nvim-web-devicons.lua
@@ -0,0 +1,16 @@
+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", {
+ deb = { icon = "", name = "Deb" },
+ lock = { icon = "", name = "Lock" },
+ mp3 = { icon = "", name = "Mp3" },
+ mp4 = { icon = "", name = "Mp4" },
+ out = { icon = "", name = "Out" },
+ ["robots.txt"] = { icon = "ﮧ", name = "Robots" },
+ ttf = { icon = "", name = "TrueTypeFont" },
+ rpm = { icon = "", name = "Rpm" },
+ woff = { icon = "", name = "WebOpenFontFormat" },
+ woff2 = { icon = "", name = "WebOpenFontFormat2" },
+ xz = { icon = "", name = "Xz" },
+ zip = { icon = "", name = "Zip" },
+}))
diff --git a/dot_config/nvim/lua/configs/server-settings/jsonls.lua b/dot_config/nvim/lua/configs/server-settings/jsonls.lua
new file mode 100644
index 0000000..612a249
--- /dev/null
+++ b/dot_config/nvim/lua/configs/server-settings/jsonls.lua
@@ -0,0 +1,7 @@
+return {
+ settings = {
+ json = {
+ schemas = require("schemastore").json.schemas(),
+ },
+ },
+}
diff --git a/dot_config/nvim/lua/configs/server-settings/sumneko_lua.lua b/dot_config/nvim/lua/configs/server-settings/sumneko_lua.lua
new file mode 100644
index 0000000..6765639
--- /dev/null
+++ b/dot_config/nvim/lua/configs/server-settings/sumneko_lua.lua
@@ -0,0 +1,16 @@
+return {
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { "vim", "astronvim", "bit" },
+ },
+ workspace = {
+ library = {
+ [vim.fn.expand "$VIMRUNTIME/lua"] = true,
+ [astronvim.install.home .. "/lua"] = true,
+ [astronvim.install.config .. "/lua"] = true,
+ },
+ },
+ },
+ },
+}
diff --git a/dot_config/nvim/lua/configs/session_manager.lua b/dot_config/nvim/lua/configs/session_manager.lua
index 9a330f2..52143ec 100644
--- a/dot_config/nvim/lua/configs/session_manager.lua
+++ b/dot_config/nvim/lua/configs/session_manager.lua
@@ -1,3 +1,3 @@
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", { autosave_last_session = false }))
+session_manager.setup(astronvim.user_plugin_opts "plugins.session_manager")
diff --git a/dot_config/nvim/lua/configs/telescope.lua b/dot_config/nvim/lua/configs/telescope.lua
index c5f5b4f..992ba25 100644
--- a/dot_config/nvim/lua/configs/telescope.lua
+++ b/dot_config/nvim/lua/configs/telescope.lua
@@ -2,18 +2,13 @@ local status_ok, telescope = pcall(require, "telescope")
if not status_ok then return end
local actions = require "telescope.actions"
-astronvim.conditional_func(telescope.load_extension, pcall(require, "notify"), "notify")
-astronvim.conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial")
-
telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
defaults = {
- prompt_prefix = " ",
+ prompt_prefix = " ",
selection_caret = "❯ ",
path_display = { "truncate" },
- selection_strategy = "reset",
sorting_strategy = "ascending",
- layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
@@ -32,64 +27,13 @@ telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
i = {
[""] = actions.cycle_history_next,
[""] = actions.cycle_history_prev,
-
[""] = actions.move_selection_next,
[""] = actions.move_selection_previous,
-
- [""] = actions.close,
-
- [""] = actions.move_selection_next,
- [""] = actions.move_selection_previous,
-
- [""] = actions.select_default,
- [""] = actions.select_horizontal,
- [""] = actions.select_vertical,
- [""] = actions.select_tab,
-
- [""] = actions.preview_scrolling_up,
- [""] = actions.preview_scrolling_down,
-
- [""] = actions.results_scrolling_up,
- [""] = actions.results_scrolling_down,
-
- [""] = actions.toggle_selection + actions.move_selection_worse,
- [""] = actions.toggle_selection + actions.move_selection_better,
- [""] = actions.send_to_qflist + actions.open_qflist,
- [""] = actions.send_selected_to_qflist + actions.open_qflist,
- [""] = actions.complete_tag,
- },
-
- n = {
- [""] = actions.close,
- [""] = actions.select_default,
- [""] = actions.select_horizontal,
- [""] = actions.select_vertical,
- [""] = actions.select_tab,
-
- [""] = actions.toggle_selection + actions.move_selection_worse,
- [""] = actions.toggle_selection + actions.move_selection_better,
- [""] = actions.send_to_qflist + actions.open_qflist,
- [""] = actions.send_selected_to_qflist + actions.open_qflist,
-
- ["j"] = actions.move_selection_next,
- ["k"] = actions.move_selection_previous,
- ["H"] = actions.move_to_top,
- ["M"] = actions.move_to_middle,
- ["L"] = actions.move_to_bottom,
-
- [""] = actions.move_selection_next,
- [""] = actions.move_selection_previous,
- ["gg"] = actions.move_to_top,
- ["G"] = actions.move_to_bottom,
-
- [""] = actions.preview_scrolling_up,
- [""] = actions.preview_scrolling_down,
-
- [""] = actions.results_scrolling_up,
- [""] = actions.results_scrolling_down,
},
+ n = { ["q"] = actions.close },
},
},
- pickers = {},
- extensions = {},
}))
+
+astronvim.conditional_func(telescope.load_extension, pcall(require, "notify"), "notify")
+astronvim.conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial")
diff --git a/dot_config/nvim/lua/configs/toggleterm.lua b/dot_config/nvim/lua/configs/toggleterm.lua
index 1e6a891..b19cd25 100644
--- a/dot_config/nvim/lua/configs/toggleterm.lua
+++ b/dot_config/nvim/lua/configs/toggleterm.lua
@@ -2,7 +2,7 @@ local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then return end
toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", {
size = 10,
- open_mapping = [[]],
+ open_mapping = [[]],
shading_factor = 2,
direction = "float",
float_opts = {
diff --git a/dot_config/nvim/lua/configs/treesitter.lua b/dot_config/nvim/lua/configs/treesitter.lua
index 47f581d..615d2eb 100644
--- a/dot_config/nvim/lua/configs/treesitter.lua
+++ b/dot_config/nvim/lua/configs/treesitter.lua
@@ -1,9 +1,6 @@
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
if not status_ok then return end
treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
- ensure_installed = {},
- sync_install = false,
- ignore_install = {},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
diff --git a/dot_config/nvim/lua/configs/which-key-register.lua b/dot_config/nvim/lua/configs/which-key-register.lua
index 91c42b5..7972ee7 100644
--- a/dot_config/nvim/lua/configs/which-key-register.lua
+++ b/dot_config/nvim/lua/configs/which-key-register.lua
@@ -1,13 +1,12 @@
-local status_ok, which_key = pcall(require, "which-key")
-if not status_ok then return end
local is_available = astronvim.is_available
local user_plugin_opts = astronvim.user_plugin_opts
local mappings = {
n = {
[""] = {
f = { name = "File" },
- p = { name = "Packer" },
+ p = { name = "Packages" },
l = { name = "LSP" },
+ u = { name = "UI" },
},
},
}
@@ -37,18 +36,4 @@ if is_available "telescope.nvim" then
init_table("n", "", "g")
end
-mappings = user_plugin_opts("which-key.register_mappings", mappings)
--- support previous legacy notation, deprecate at some point
-mappings.n[""] = user_plugin_opts("which-key.register_n_leader", mappings.n[""])
-for mode, prefixes in pairs(mappings) do
- for prefix, mapping_table in pairs(prefixes) do
- which_key.register(mapping_table, {
- mode = mode,
- prefix = prefix,
- buffer = nil,
- silent = true,
- noremap = true,
- nowait = true,
- })
- end
-end
+astronvim.which_key_register(user_plugin_opts("which-key.register", mappings))
diff --git a/dot_config/nvim/lua/configs/window-picker.lua b/dot_config/nvim/lua/configs/window-picker.lua
new file mode 100644
index 0000000..036807e
--- /dev/null
+++ b/dot_config/nvim/lua/configs/window-picker.lua
@@ -0,0 +1,6 @@
+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(
+ astronvim.user_plugin_opts("plugins.window-picker", { use_winbar = "smart", other_win_hl_color = colors.grey_4 })
+)
diff --git a/dot_config/nvim/lua/core/autocmds.lua b/dot_config/nvim/lua/core/autocmds.lua
index b03e195..bfebe3c 100644
--- a/dot_config/nvim/lua/core/autocmds.lua
+++ b/dot_config/nvim/lua/core/autocmds.lua
@@ -12,6 +12,30 @@ cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
callback = function() astronvim.set_url_match() end,
})
+augroup("auto_quit", { clear = true })
+cmd("BufEnter", {
+ desc = "Quit AstroNvim if more than one window is open and only sidebar windows are list",
+ group = "auto_quit",
+ 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
+ if #wins <= 1 then return end
+ local sidebar_fts = { aerial = true, ["neo-tree"] = true }
+ for _, winid in ipairs(wins) do
+ if vim.api.nvim_win_is_valid(winid) then
+ local bufnr = vim.api.nvim_win_get_buf(winid)
+ -- If any visible windows are not sidebars, early return
+ if not sidebar_fts[vim.api.nvim_buf_get_option(bufnr, "filetype")] then return end
+ end
+ end
+ if #vim.api.nvim_list_tabpages() > 1 then
+ vim.cmd.tabclose()
+ else
+ vim.cmd.qall()
+ end
+ end,
+})
+
if is_available "alpha-nvim" then
augroup("alpha_settings", { clear = true })
if is_available "bufferline.nvim" then
@@ -22,6 +46,7 @@ if is_available "alpha-nvim" then
callback = function()
local prev_showtabline = vim.opt.showtabline
vim.opt.showtabline = 0
+ vim.opt_local.winbar = nil
cmd("BufUnload", {
pattern = "",
callback = function() vim.opt.showtabline = prev_showtabline end,
@@ -78,31 +103,23 @@ if is_available "neo-tree.nvim" then
})
end
-if is_available "feline.nvim" then
- augroup("feline_setup", { clear = true })
- cmd("ColorScheme", {
- desc = "Reload feline on colorscheme change",
- group = "feline_setup",
- callback = function()
- package.loaded["configs.feline"] = nil
- require "configs.feline"
- end,
- })
-end
-
augroup("astronvim_highlights", { clear = true })
cmd({ "VimEnter", "ColorScheme" }, {
desc = "Load custom highlights from user configuration",
group = "astronvim_highlights",
callback = function()
if vim.g.colors_name then
- for group, spec in pairs(user_plugin_opts("highlights." .. vim.g.colors_name)) do
- vim.api.nvim_set_hl(0, group, spec)
+ for _, module in ipairs { "init", vim.g.colors_name } do
+ for group, spec in pairs(user_plugin_opts("highlights." .. module)) do
+ vim.api.nvim_set_hl(0, group, spec)
+ end
end
end
end,
})
-create_command("AstroUpdate", astronvim.updater.update, { desc = "Update AstroNvim" })
-create_command("AstroVersion", astronvim.updater.version, { desc = "Check AstroNvim Version" })
-create_command("ToggleHighlightURL", astronvim.toggle_url_match, { desc = "Toggle URL Highlights" })
+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" })
diff --git a/dot_config/nvim/lua/core/bootstrap.lua b/dot_config/nvim/lua/core/bootstrap.lua
index bc91db9..48839f8 100644
--- a/dot_config/nvim/lua/core/bootstrap.lua
+++ b/dot_config/nvim/lua/core/bootstrap.lua
@@ -1,7 +1,4 @@
astronvim.initialize_packer()
local colorscheme = astronvim.user_plugin_opts("colorscheme", nil, false)
-vim.api.nvim_command(
- "colorscheme "
- .. (vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme")
-)
+vim.cmd.colorscheme(vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme")
diff --git a/dot_config/nvim/lua/core/diagnostics.lua b/dot_config/nvim/lua/core/diagnostics.lua
new file mode 100644
index 0000000..c214098
--- /dev/null
+++ b/dot_config/nvim/lua/core/diagnostics.lua
@@ -0,0 +1,43 @@
+local signs = {
+ { name = "DiagnosticSignError", text = astronvim.get_icon "DiagnosticError" },
+ { name = "DiagnosticSignWarn", text = astronvim.get_icon "DiagnosticWarn" },
+ { name = "DiagnosticSignHint", text = astronvim.get_icon "DiagnosticHint" },
+ { name = "DiagnosticSignInfo", text = astronvim.get_icon "DiagnosticInfo" },
+ { name = "DiagnosticSignError", text = astronvim.get_icon "DiagnosticError" },
+ { name = "DapStopped", text = astronvim.get_icon "DapStopped", texthl = "DiagnosticWarn" },
+ { name = "DapBreakpoint", text = astronvim.get_icon "DapBreakpoint", texthl = "DiagnosticInfo" },
+ { name = "DapBreakpointRejected", text = astronvim.get_icon "DapBreakpointRejected", texthl = "DiagnosticError" },
+ { name = "DapBreakpointCondition", text = astronvim.get_icon "DapBreakpointCondition", texthl = "DiagnosticInfo" },
+ { name = "DapLogPoint", text = astronvim.get_icon "DapLogPoint", texthl = "DiagnosticInfo" },
+}
+
+for _, sign in ipairs(signs) do
+ if not sign.texthl then sign.texthl = sign.name end
+ vim.fn.sign_define(sign.name, sign)
+end
+
+astronvim.lsp.diagnostics = {
+ off = {
+ underline = false,
+ virtual_text = false,
+ signs = false,
+ update_in_insert = false,
+ },
+ on = astronvim.user_plugin_opts("diagnostics", {
+ virtual_text = true,
+ signs = { active = signs },
+ update_in_insert = true,
+ underline = true,
+ severity_sort = true,
+ float = {
+ focused = false,
+ style = "minimal",
+ border = "rounded",
+ source = "always",
+ header = "",
+ prefix = "",
+ },
+ }),
+}
+
+vim.diagnostic.config(astronvim.lsp.diagnostics[vim.g.diagnostics_enabled and "on" or "off"])
diff --git a/dot_config/nvim/lua/core/icons/nerd_font.lua b/dot_config/nvim/lua/core/icons/nerd_font.lua
new file mode 100644
index 0000000..8d43054
--- /dev/null
+++ b/dot_config/nvim/lua/core/icons/nerd_font.lua
@@ -0,0 +1,41 @@
+return {
+ ActiveLSP = "",
+ ActiveTS = "綠",
+ BufferClose = "",
+ DapBreakpoint = "",
+ DapBreakpointCondition = "",
+ DapBreakpointRejected = "",
+ DapLogPoint = ".>",
+ DapStopped = "",
+ DefaultFile = "",
+ Diagnostic = "裂",
+ DiagnosticError = "",
+ DiagnosticHint = "",
+ DiagnosticInfo = "",
+ DiagnosticWarn = "",
+ Ellipsis = "…",
+ FileModified = "",
+ FileReadOnly = "",
+ FolderClosed = "",
+ FolderEmpty = "",
+ FolderOpen = "",
+ Git = "",
+ GitAdd = "",
+ GitBranch = "",
+ GitChange = "",
+ GitConflict = "",
+ GitDelete = "",
+ GitIgnored = "◌",
+ GitRenamed = "➜",
+ GitStaged = "✓",
+ GitUnstaged = "✗",
+ GitUntracked = "★",
+ LSPLoaded = "",
+ LSPLoading1 = "",
+ LSPLoading2 = "",
+ LSPLoading3 = "",
+ MacroRecording = "",
+ NeovimClose = "",
+ Paste = "",
+ Spellcheck = "暈",
+}
diff --git a/dot_config/nvim/lua/core/icons/text.lua b/dot_config/nvim/lua/core/icons/text.lua
new file mode 100644
index 0000000..1d23594
--- /dev/null
+++ b/dot_config/nvim/lua/core/icons/text.lua
@@ -0,0 +1,33 @@
+return {
+ ActiveLSP = "LSP:",
+ BufferClose = "x",
+ DapBreakpoint = "B",
+ DapBreakpointCondition = "C",
+ DapBreakpointRejected = "R",
+ DapLogPoint = "L",
+ DapStopped = ">",
+ DefaultFile = "[F]",
+ DiagnosticError = "X",
+ DiagnosticHint = "?",
+ DiagnosticInfo = "i",
+ DiagnosticWarn = "!",
+ Ellipsis = "...",
+ FileModified = "*",
+ FileReadOnly = "[lock]",
+ FolderClosed = "[D]",
+ FolderEmpty = "[E]",
+ FolderOpen = "[O]",
+ GitAdd = "[+]",
+ GitChange = "[/]",
+ GitConflict = "[!]",
+ GitDelete = "[-]",
+ GitIgnored = "[I]",
+ GitRenamed = "[R]",
+ GitStaged = "[S]",
+ GitUnstaged = "[U]",
+ GitUntracked = "[?]",
+ MacroRecording = "Recording:",
+ NeovimClose = "X",
+ Paste = "[PASTE]",
+ Spellcheck = "[SPELL]",
+}
diff --git a/dot_config/nvim/lua/core/mappings.lua b/dot_config/nvim/lua/core/mappings.lua
index 80b2812..ef0e614 100644
--- a/dot_config/nvim/lua/core/mappings.lua
+++ b/dot_config/nvim/lua/core/mappings.lua
@@ -1,6 +1,6 @@
local is_available = astronvim.is_available
-local maps = { n = {}, v = {}, t = {}, [""] = {} }
+local maps = { i = {}, n = {}, v = {}, t = {}, [""] = {} }
maps[""][""] = ""
@@ -9,7 +9,6 @@ maps[""][""] = ""
maps.n["w"] = { "w", desc = "Save" }
maps.n["q"] = { "q", desc = "Quit" }
maps.n["h"] = { "nohlsearch", desc = "No Highlight" }
-maps.n["u"] = { function() astronvim.toggle_url_match() end, desc = "Toggle URL Highlights" }
maps.n["fn"] = { "enew", desc = "New File" }
maps.n["gx"] = { function() astronvim.url_opener() end, desc = "Open the file under cursor with system app" }
maps.n[""] = { "w!", desc = "Force write" }
@@ -23,14 +22,19 @@ maps.n["ps"] = { "PackerSync", desc = "Packer Sync" }
maps.n["pS"] = { "PackerStatus", desc = "Packer Status" }
maps.n["pu"] = { "PackerUpdate", desc = "Packer Update" }
+-- AstroNvim
+maps.n["pA"] = { "AstroUpdate", desc = "AstroNvim Update" }
+maps.n["pv"] = { "AstroVersion", desc = "AstroNvim Version" }
+maps.n["pl"] = { "AstroChangelog", desc = "AstroNvim Changelog" }
+
-- Alpha
if is_available "alpha-nvim" then maps.n["d"] = { "Alpha", desc = "Alpha Dashboard" } end
-- Bufdelete
if is_available "bufdelete.nvim" then
- maps.n["c"] = { "Bdelete", desc = "Close window" }
+ maps.n["c"] = { "Bdelete", desc = "Close buffer" }
else
- maps.n["c"] = { "bdelete", desc = "Close window" }
+ maps.n["c"] = { "bdelete", desc = "Close buffer" }
end
-- Navigate buffers
@@ -46,9 +50,9 @@ end
-- Comment
if is_available "Comment.nvim" then
- maps.n["/"] = { function() require("Comment.api").toggle_current_linewise() end, desc = "Comment line" }
+ maps.n["/"] = { function() require("Comment.api").toggle.linewise.current() end, desc = "Comment line" }
maps.v["/"] = {
- "lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())",
+ "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())",
desc = "Toggle comment line",
}
end
@@ -82,12 +86,16 @@ if is_available "neovim-session-manager" then
{ "SessionManager! load_current_dir_session", desc = "Load current directory session" }
end
--- LSP Installer
-if is_available "nvim-lsp-installer" then
- maps.n["li"] = { "LspInfo", desc = "LSP information" }
- maps.n["lI"] = { "LspInstallInfo", desc = "LSP installer" }
+-- Package Manager
+if is_available "mason.nvim" then maps.n["pI"] = { "Mason", desc = "Mason Installer" } end
+
+if is_available "mason-tool-installer.nvim" then
+ maps.n["pU"] = { "MasonToolsUpdate", desc = "Mason Update" }
end
+-- LSP Installer
+if is_available "mason-lspconfig.nvim" then maps.n["li"] = { "LspInfo", desc = "LSP information" } end
+
-- Smart Splits
if is_available "smart-splits.nvim" then
-- Better window navigation
@@ -159,6 +167,8 @@ if is_available "telescope.nvim" then
end,
desc = "Search symbols",
}
+ maps.n["lG"] =
+ { function() require("telescope.builtin").lsp_workspace_symbols() end, desc = "Search workspace symbols" }
maps.n["lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" }
maps.n["lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" }
end
@@ -166,28 +176,52 @@ end
-- Terminal
if is_available "toggleterm.nvim" then
local toggle_term_cmd = astronvim.toggle_term_cmd
- maps.n[""] = { "ToggleTerm", desc = "Toggle terminal" }
maps.n["gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
maps.n["tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" }
- maps.n["tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" }
- maps.n["tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" }
+ maps.n["tu"] = { function() toggle_term_cmd "gdu" end, desc = "ToggleTerm gdu" }
+ maps.n["tt"] = { function() toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
maps.n["tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" }
maps.n["tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
maps.n["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" }
maps.n["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" }
maps.n["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" }
+ maps.n[""] = { "ToggleTerm", desc = "Toggle terminal" }
+ maps.t[""] = maps.n[""]
+ maps.n[""] = maps.n[""]
+ maps.t[""] = maps.n[""]
end
-- Stay in indent mode
maps.v["<"] = { ""] = { ">gv", desc = "indent line" }
--- Improved Terminal Mappings
-maps.t[""] = { "", desc = "Terminal normal mode" }
-maps.t["jk"] = { "", desc = "Terminal normal mode" }
+-- Improved Terminal Navigation
maps.t[""] = { "h", desc = "Terminal left window navigation" }
maps.t[""] = { "j", desc = "Terminal down window navigation" }
maps.t[""] = { "k", desc = "Terminal up window navigation" }
maps.t[""] = { "l", desc = "Terminal right window naviation" }
+-- Custom menu for modification of the user experience
+if is_available "nvim-autopairs" then
+ maps.n["ua"] = { function() astronvim.ui.toggle_autopairs() end, desc = "Toggle autopairs" }
+end
+maps.n["ub"] = { function() astronvim.ui.toggle_background() end, desc = "Toggle background" }
+if is_available "nvim-cmp" then
+ maps.n["uc"] = { function() astronvim.ui.toggle_cmp() end, desc = "Toggle autocompletion" }
+end
+if is_available "nvim-colorizer.lua" then
+ maps.n["uC"] = { "ColorizerToggle", desc = "Toggle color highlight" }
+end
+maps.n["ud"] = { function() astronvim.ui.toggle_diagnostics() end, desc = "Toggle diagnostics" }
+maps.n["ug"] = { function() astronvim.ui.toggle_signcolumn() end, desc = "Toggle signcolumn" }
+maps.n["ui"] = { function() astronvim.ui.set_indent() end, desc = "Change indent setting" }
+maps.n["ul"] = { function() astronvim.ui.toggle_statusline() end, desc = "Toggle statusline" }
+maps.n["un"] = { function() astronvim.ui.change_number() end, desc = "Change line numbering" }
+maps.n["us"] = { function() astronvim.ui.toggle_spell() end, desc = "Toggle spellcheck" }
+maps.n["up"] = { function() astronvim.ui.toggle_paste() end, desc = "Toggle paste mode" }
+maps.n["ut"] = { function() astronvim.ui.toggle_tabline() end, desc = "Toggle tabline" }
+maps.n["uu"] = { function() astronvim.ui.toggle_url_match() end, desc = "Toggle URL highlight" }
+maps.n["uw"] = { function() astronvim.ui.toggle_wrap() end, desc = "Toggle wrap" }
+maps.n["uy"] = { function() astronvim.ui.toggle_syntax() end, desc = "Toggle syntax highlight" }
+
astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps))
diff --git a/dot_config/nvim/lua/core/options.lua b/dot_config/nvim/lua/core/options.lua
index 38dcc93..f59010b 100644
--- a/dot_config/nvim/lua/core/options.lua
+++ b/dot_config/nvim/lua/core/options.lua
@@ -2,6 +2,7 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
opt = {
backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert
clipboard = "unnamedplus", -- Connection to the system clipboard
+ cmdheight = 0, -- hide command line unless needed
completeopt = { "menuone", "noselect" }, -- Options for insert mode completion
copyindent = true, -- Copy the previous indentation on autoindenting
cursorline = true, -- Highlight the text line of the cursor
@@ -20,6 +21,7 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
scrolloff = 8, -- Number of lines to keep above and below the cursor
shiftwidth = 2, -- Number of space inserted for indentation
showmode = false, -- Disable showing modes in command line
+ showtabline = 2, -- always display tabline
sidescrolloff = 8, -- Number of columns to keep at the sides of the cursor
signcolumn = "yes", -- Always show the sign column
smartcase = true, -- Case sensitivie searching
@@ -35,8 +37,6 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
writebackup = false, -- Disable making a backup before overwriting a file
},
g = {
- do_filetype_lua = 1, -- use filetype.lua
- did_load_filetypes = 0, -- don't use filetype.vim
highlighturl_enabled = true, -- highlight URLs by default
mapleader = " ", -- set leader key
zipPlugin = false, -- disable zip
@@ -57,5 +57,11 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
loaded_zipPlugin = true, -- disable zip
loaded_vimball = true, -- disable vimball
loaded_vimballPlugin = true, -- disable vimball
+ autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
+ cmp_enabled = true, -- enable completion at start
+ autopairs_enabled = true, -- enable autopairs at start
+ 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)
},
}))
diff --git a/dot_config/nvim/lua/core/plugins.lua b/dot_config/nvim/lua/core/plugins.lua
index 3e495ab..a7c4481 100644
--- a/dot_config/nvim/lua/core/plugins.lua
+++ b/dot_config/nvim/lua/core/plugins.lua
@@ -8,33 +8,24 @@ local astro_plugins = {
-- Lua functions
["nvim-lua/plenary.nvim"] = { module = "plenary" },
- -- Popup API
- ["nvim-lua/popup.nvim"] = {},
-
-- Indent detection
["Darazaki/indent-o-matic"] = {
- event = "BufReadPost",
+ event = "BufEnter",
config = function() require "configs.indent-o-matic" end,
},
-- Notification Enhancer
["rcarriga/nvim-notify"] = {
- event = "VimEnter",
+ event = "UIEnter",
config = function() require "configs.notify" end,
},
-- Neovim UI Enhancer
["stevearc/dressing.nvim"] = {
- event = "VimEnter",
+ event = "UIEnter",
config = function() require "configs.dressing" end,
},
- -- Cursorhold fix
- ["antoinemadec/FixCursorHold.nvim"] = {
- event = { "BufRead", "BufNewFile" },
- config = function() vim.g.cursorhold_updatetime = 100 end,
- },
-
-- Smarter Splits
["mrjones2014/smart-splits.nvim"] = {
module = "smart-splits",
@@ -43,19 +34,33 @@ local astro_plugins = {
-- Icons
["kyazdani42/nvim-web-devicons"] = {
- event = "VimEnter",
- config = function() require "configs.icons" end,
+ disable = not vim.g.icons_enabled,
+ module = "nvim-web-devicons",
+ config = function() require "configs.nvim-web-devicons" end,
+ },
+
+ -- LSP Icons
+ ["onsails/lspkind.nvim"] = {
+ disable = not vim.g.icons_enabled,
+ module = "lspkind",
+ config = function() require "configs.lspkind" end,
},
-- Bufferline
["akinsho/bufferline.nvim"] = {
- after = "nvim-web-devicons",
+ event = "UIEnter",
config = function() require "configs.bufferline" end,
},
-- Better buffer closing
["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } },
+ ["s1n7ax/nvim-window-picker"] = {
+ tag = "v1.*",
+ module = "window-picker",
+ config = function() require "configs.window-picker" end,
+ },
+
-- File explorer
["nvim-neo-tree/neo-tree.nvim"] = {
branch = "v2.x",
@@ -67,10 +72,7 @@ local astro_plugins = {
},
-- Statusline
- ["feline-nvim/feline.nvim"] = {
- after = "nvim-web-devicons",
- config = function() require "configs.feline" end,
- },
+ ["rebelot/heirline.nvim"] = { config = function() require "configs.heirline" end },
-- Parenthesis highlighting
["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" },
@@ -84,7 +86,7 @@ local astro_plugins = {
-- Syntax highlighting
["nvim-treesitter/nvim-treesitter"] = {
run = ":TSUpdate",
- event = { "BufRead", "BufNewFile" },
+ event = "BufEnter",
cmd = {
"TSInstall",
"TSInstallInfo",
@@ -139,15 +141,27 @@ local astro_plugins = {
},
-- Built-in LSP
- ["neovim/nvim-lspconfig"] = { event = "VimEnter" },
+ ["neovim/nvim-lspconfig"] = { config = function() require "configs.lspconfig" end },
+
+ -- Formatting and linting
+ ["jose-elias-alvarez/null-ls.nvim"] = {
+ event = "BufEnter",
+ config = function() require "configs.null-ls" end,
+ },
+
+ -- Package Manager
+ ["williamboman/mason.nvim"] = { config = function() require "configs.mason" end },
-- LSP manager
- ["williamboman/nvim-lsp-installer"] = {
- after = "nvim-lspconfig",
- config = function()
- require "configs.nvim-lsp-installer"
- require "configs.lsp"
- end,
+ ["williamboman/mason-lspconfig.nvim"] = {
+ after = { "mason.nvim", "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,
},
-- LSP symbols
@@ -157,12 +171,6 @@ local astro_plugins = {
config = function() require "configs.aerial" end,
},
- -- Formatting and linting
- ["jose-elias-alvarez/null-ls.nvim"] = {
- event = { "BufRead", "BufNewFile" },
- config = function() require "configs.null-ls" end,
- },
-
-- Fuzzy finder
["nvim-telescope/telescope.nvim"] = {
cmd = "Telescope",
@@ -171,10 +179,13 @@ local astro_plugins = {
},
-- Fuzzy finder syntax support
- [("nvim-telescope/telescope-%s-native.nvim"):format(vim.fn.has "win32" == 1 and "fzy" or "fzf")] = {
+ ["nvim-telescope/telescope-fzf-native.nvim"] = {
after = "telescope.nvim",
- run = vim.fn.has "win32" ~= 1 and "make" or nil,
- config = function() require("telescope").load_extension(vim.fn.has "win32" == 1 and "fzy_native" or "fzf") end,
+ 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",
+ config = function() require("telescope").load_extension "fzf" end,
},
-- Git integration
@@ -191,8 +202,8 @@ local astro_plugins = {
},
-- Color highlighting
- ["norcalli/nvim-colorizer.lua"] = {
- event = { "BufRead", "BufNewFile" },
+ ["NvChad/nvim-colorizer.lua"] = {
+ event = "BufEnter",
config = function() require "configs.colorizer" end,
},
@@ -218,7 +229,7 @@ local astro_plugins = {
-- Indentation
["lukas-reineke/indent-blankline.nvim"] = {
- event = "BufRead",
+ event = "BufEnter",
config = function() require "configs.indent-line" end,
},
@@ -228,12 +239,6 @@ local astro_plugins = {
config = function() require "configs.which-key" end,
},
- -- Smooth scrolling
- ["declancm/cinnamon.nvim"] = {
- event = { "BufRead", "BufNewFile" },
- config = function() require "configs.cinnamon" end,
- },
-
-- Smooth escaping
["max397574/better-escape.nvim"] = {
event = "InsertCharPre",
diff --git a/dot_config/nvim/lua/core/utils/git.lua b/dot_config/nvim/lua/core/utils/git.lua
index 3a3870b..ea1e7d4 100644
--- a/dot_config/nvim/lua/core/utils/git.lua
+++ b/dot_config/nvim/lua/core/utils/git.lua
@@ -1,73 +1,154 @@
+--- ### Git LUA API
+--
+-- This module can be loaded with `local git = require "core.utils.git"`
+--
+-- @module core.utils.git
+-- @copyright 2022
+-- @license GNU General Public License v3.0
+
local git = { url = "https://github.com/" }
+--- Run a git command from the AstroNvim installation directory
+-- @param args the git arguments
+-- @return the result of the command or nil if unsuccessful
function git.cmd(args, ...) return astronvim.cmd("git -C " .. astronvim.install.home .. " " .. args, ...) end
+--- 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
+
+--- Check if the AstroNvim home is a git repo
+-- @return the result of the command
function git.is_repo() return git.cmd("rev-parse --is-inside-work-tree", false) end
+--- Fetch git remote
+-- @param remote the remote to fetch
+-- @return the result of the command
function git.fetch(remote, ...) return git.cmd("fetch " .. remote, ...) end
+--- Pull the git repo
+-- @return the result of the command
function git.pull(...) return git.cmd("pull --rebase", ...) end
+--- Checkout git target
+-- @param dest the target to checkout
+-- @return the result of the command
function git.checkout(dest, ...) return git.cmd("checkout " .. dest, ...) end
+--- Hard reset to a git target
+-- @param dest the target to hard reset to
+-- @return the result of the command
function git.hard_reset(dest, ...) return git.cmd("reset --hard " .. dest, ...) end
+--- Check if a branch contains a commit
+-- @param remote the git remote to check
+-- @param branch the git branch to check
+-- @param commit the git commit to check for
+-- @return the result of the command
function git.branch_contains(remote, branch, commit, ...)
return git.cmd("merge-base --is-ancestor " .. commit .. " " .. remote .. "/" .. branch, ...) ~= nil
end
+--- Add a git remote
+-- @param remote the remote to add
+-- @param url the url of the remote
+-- @return the result of the command
function git.remote_add(remote, url, ...) return git.cmd("remote add " .. remote .. " " .. url, ...) end
+--- Update a git remote URL
+-- @param remote the remote to update
+-- @param url the new URL of the remote
+-- @return the result of the command
function git.remote_update(remote, url, ...) return git.cmd("remote set-url " .. remote .. " " .. url, ...) end
+--- Get the URL of a given git remote
+-- @param remote the remote to get the URL of
+-- @return the url of the remote
function git.remote_url(remote, ...) return astronvim.trim_or_nil(git.cmd("remote get-url " .. remote, ...)) end
+--- Get the current version with git describe including tags
+-- @return the current git describe string
function git.current_version(...) return astronvim.trim_or_nil(git.cmd("describe --tags", ...)) end
+--- Get the current branch
+-- @return the branch of the AstroNvim installation
function git.current_branch(...) return astronvim.trim_or_nil(git.cmd("rev-parse --abbrev-ref HEAD", ...)) end
+--- Get the current head of the git repo
+-- @return the head string
function git.local_head(...) return astronvim.trim_or_nil(git.cmd("rev-parse HEAD", ...)) end
+--- Get the current head of a git remote
+-- @param remote the remote to check
+-- @param branch the branch to check
+-- @return the head string of the remote branch
function git.remote_head(remote, branch, ...)
return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. remote .. "/" .. branch, ...))
end
+--- Get the commit hash of a given tag
+-- @param tag the tag to resolve
+-- @return the commit hash of a git tag
function git.tag_commit(tag, ...) return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. tag, ...)) end
+--- Get the commit log between two commit hashes
+-- @param start_hash the start commit hash
+-- @param end_hash the end commit hash
+-- @return an array like table of commit messages
function git.get_commit_range(start_hash, end_hash, ...)
- local log = git.cmd("log --no-merges --pretty='format:[%h] %s' " .. start_hash .. ".." .. end_hash, ...)
+ local range = ""
+ if start_hash and end_hash then range = start_hash .. ".." .. end_hash end
+ local log = git.cmd('log --no-merges --pretty="format:[%h] %s" ' .. range, ...)
return log and vim.fn.split(log, "\n") or {}
end
+--- Get a list of all tags with a regex filter
+-- @param search a regex to search the tags with (defaults to "v*" for version tags)
+-- @return an array like table of tags that match the search
function git.get_versions(search, ...)
- local tags = git.cmd("tag -l --sort=version:refname '" .. (search == "latest" and "v*" or search) .. "'", ...)
+ local tags = git.cmd('tag -l --sort=version:refname "' .. (search == "latest" and "v*" or search) .. '"', ...)
return tags and vim.fn.split(tags, "\n") or {}
end
+--- Get the latest version of a list of versions
+-- @param versions a list of versions to search (defaults to all versions available)
+-- @return the latest version from the array
function git.latest_version(versions, ...)
- versions = versions and versions or git.get_versions(...)
+ if not versions then versions = git.get_versions(...) end
return versions[#versions]
end
+--- Parse a remote url
+-- @param str the remote to parse to a full git url
+-- @return the full git url for the given remote string
function git.parse_remote_url(str)
return vim.fn.match(str, astronvim.url_matcher) == -1
and git.url .. str .. (vim.fn.match(str, "/") == -1 and "/AstroNvim.git" or ".git")
or str
end
-function git.breaking_changes(commits)
- return vim.tbl_filter(
- function(v) return vim.fn.match(v, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 end,
- commits
- )
-end
+--- Check if a Conventional Commit commit message is breaking or not
+-- @param commit a commit message
+-- @return boolean true if the message is breaking, false if the commit message is not breaking
+function git.is_breaking(commit) return vim.fn.match(commit, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 end
+--- Get a list of breaking commits from commit messages using Conventional Commit standard
+-- @param commits an array like table of commit messages
+-- @return an array like table of commits that are breaking
+function git.breaking_changes(commits) return vim.tbl_filter(git.is_breaking, commits) end
+
+--- Generate a table of commit messages for neovim's echo API with highlighting
+-- @param commits an array like table of commit messages
+-- @return an array like table of echo messages to provide to nvim_echo or astronvim.echo
function git.pretty_changelog(commits)
local changelog = {}
for _, commit in ipairs(commits) do
local hash, type, msg = commit:match "(%[.*%])(.*:)(.*)"
if hash and type and msg then
- vim.list_extend(changelog, { { hash, "DiffText" }, { type, "Typedef" }, { msg }, { "\n" } })
+ vim.list_extend(
+ changelog,
+ { { hash, "DiffText" }, { type, git.is_breaking(commit) and "DiffDelete" or "DiffChange" }, { msg }, { "\n" } }
+ )
end
end
return changelog
diff --git a/dot_config/nvim/lua/core/utils/init.lua b/dot_config/nvim/lua/core/utils/init.lua
index edc8cbd..84c2328 100644
--- a/dot_config/nvim/lua/core/utils/init.lua
+++ b/dot_config/nvim/lua/core/utils/init.lua
@@ -1,64 +1,163 @@
+--- ### AstroNvim Utilities
+--
+-- This module is automatically loaded by AstroNvim on during it's initialization into global variable `astronvim`
+--
+-- This module can also be manually loaded with `local astronvim = require "core.utils"`
+--
+-- @module core.utils
+-- @copyright 2022
+-- @license GNU General Public License v3.0
+
_G.astronvim = {}
local stdpath = vim.fn.stdpath
local tbl_insert = table.insert
local map = vim.keymap.set
+--- installation details from external installers
astronvim.install = astronvim_installation or { home = stdpath "config" }
+--- external astronvim configuration folder
astronvim.install.config = stdpath("config"):gsub("nvim$", "astronvim")
vim.opt.rtp:append(astronvim.install.config)
local supported_configs = { astronvim.install.home, astronvim.install.config }
+--- Looks to see if a module path references a lua file in a configuration folder and tries to load it. If there is an error loading the file, write an error and continue
+-- @param module the module path to try and load
+-- @return the loaded module if successful or nil
local function load_module_file(module)
+ -- placeholder for final return value
local found_module = nil
+ -- search through each of the supported configuration locations
for _, config_path in ipairs(supported_configs) do
+ -- convert the module path to a file path (example user.init -> user/init.lua)
local module_path = config_path .. "/lua/" .. module:gsub("%.", "/") .. ".lua"
+ -- check if there is a readable file, if so, set it as found
if vim.fn.filereadable(module_path) == 1 then found_module = module_path end
end
+ -- if we found a readable lua file, try to load it
if found_module then
+ -- try to load the file
local status_ok, loaded_module = pcall(require, module)
+ -- if successful at loading, set the return variable
if status_ok then
found_module = loaded_module
+ -- if unsuccessful, throw an error
else
- astronvim.notify("Error loading " .. found_module, "error")
+ vim.api.nvim_err_writeln("Error loading file: " .. found_module .. "\n\n" .. loaded_module)
end
end
+ -- return the loaded module or nil if no file found
return found_module
end
+--- user settings from the base `user/init.lua` file
astronvim.user_settings = load_module_file "user.init"
+--- default packer compilation location to be used in bootstrapping and packer setup call
astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua"
+--- table of user created terminals
astronvim.user_terminals = {}
+--- 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]*})\\})+"
+--- Main configuration engine logic for extending a default configuration table with either a function override or a table to merge into the default option
+-- @function astronvim.func_or_extend
+-- @param overrides the override definition, either a table or a function that takes a single parameter of the original table
+-- @param default the default configuration table
+-- @param extend boolean value to either extend the default or simply overwrite it if an override is provided
+-- @return the new configuration table
local function func_or_extend(overrides, default, extend)
+ -- if we want to extend the default with the provided override
if extend then
+ -- if the override is a table, use vim.tbl_deep_extend
if type(overrides) == "table" then
- default = vim.tbl_deep_extend("force", default, overrides)
+ default = astronvim.default_tbl(overrides, default)
+ -- if the override is a function, call it with the default and overwrite default with the return value
elseif type(overrides) == "function" then
default = overrides(default)
end
+ -- if extend is set to false and we have a provided override, simply override the default
elseif overrides ~= nil then
default = overrides
end
+ -- return the modified default table
return default
end
-function astronvim.conditional_func(func, condition, ...)
- if (condition == nil and true or condition) and type(func) == "function" then return func(...) end
+--- Merge extended options with a default table of options
+-- @param opts the new options that should be merged with the default table
+-- @param default the default table that you want to merge into
+-- @return the merged table
+function astronvim.default_tbl(opts, default)
+ opts = opts or {}
+ return default and vim.tbl_deep_extend("force", default, opts) or opts
end
+--- Call function if a condition is met
+-- @param func the function to run
+-- @param condition a boolean value of whether to run the function or not
+function astronvim.conditional_func(func, condition, ...)
+ -- if the condition is true or no condition is provided, evaluate the function with the rest of the parameters and return the result
+ if (condition == nil or condition) and type(func) == "function" then return func(...) end
+end
+
+--- Get highlight properties for a given highlight name
+-- @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
+ )
+end
+
+--- Trim a string or return nil
+-- @param str the string to trim
+-- @return a trimmed version of the string or nil if the parameter isn't a string
function astronvim.trim_or_nil(str) return type(str) == "string" and vim.trim(str) or nil end
-function astronvim.notify(msg, type, opts)
- vim.notify(msg, type, vim.tbl_deep_extend("force", { title = "AstroNvim" }, opts or {}))
+--- Add left and/or right padding to a string
+-- @param str the string to add padding to
+-- @param padding a table of the format `{ left = 0, right = 0}` that defines the number of spaces to include to the left and the right of the string
+-- @return the padded string
+function astronvim.pad_string(str, padding)
+ padding = padding or {}
+ return str and str ~= "" and string.rep(" ", padding.left or 0) .. str .. string.rep(" ", padding.right or 0) or ""
end
+--- Initialize icons used throughout the user interface
+function astronvim.initialize_icons()
+ astronvim.icons = astronvim.user_plugin_opts("icons", require "core.icons.nerd_font")
+ astronvim.text_icons = astronvim.user_plugin_opts("text_icons", require "core.icons.text")
+end
+
+--- Get an icon from `lspkind` if it is available and return it
+-- @param kind the kind of icon in `lspkind` to retrieve
+-- @return the icon
+function astronvim.get_icon(kind)
+ local icon_pack = vim.g.icons_enabled and "icons" or "text_icons"
+ if not astronvim[icon_pack] then astronvim.initialize_icons() end
+ return astronvim[icon_pack] and astronvim[icon_pack][kind] or ""
+end
+
+--- Serve a notification with a title of AstroNvim
+-- @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
+
+--- Wrapper function for neovim echo API
+-- @param messages an array like table where each item is an array like table of strings to echo
function astronvim.echo(messages)
+ -- if no parameter provided, echo a new line
messages = messages or { { "\n" } }
if type(messages) == "table" then vim.api.nvim_echo(messages, false, {}) end
end
+--- Echo a message and prompt the user for yes or no response
+-- @param messages the message to echo
+-- @return True if the user responded y, False for any other response
function astronvim.confirm_prompt(messages)
if messages then astronvim.echo(messages) end
local confirmed = string.lower(vim.fn.input "(y/n) ") == "y"
@@ -67,20 +166,33 @@ function astronvim.confirm_prompt(messages)
return confirmed
end
+--- Search the user settings (user/init.lua table) for a table with a module like path string
+-- @param module the module path like string to look up in the user settings table
+-- @return the value of the table entry if exists or nil
local function user_setting_table(module)
+ -- get the user settings table
local settings = astronvim.user_settings or {}
+ -- iterate over the path string split by '.' to look up the table value
for tbl in string.gmatch(module, "([^%.]+)") do
settings = settings[tbl]
+ -- if key doesn't exist, keep the nil value and stop searching
if settings == nil then break end
end
+ -- return the found settings
return settings
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")
+ -- 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
vim.fn.system {
"git",
"clone",
@@ -90,22 +202,30 @@ function astronvim.initialize_packer()
packer_path,
}
astronvim.echo { { "Initializing Packer...\n\n" } }
- vim.cmd "packadd packer.nvim"
+ -- add packer and try loading it
+ vim.cmd.packadd "packer.nvim"
packer_avail, _ = pcall(require, "packer")
+ -- 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
+ -- if packer is available, check if there is a compiled packer file
if packer_avail then
+ -- try to load the packer compiled file
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
run_me()
+ -- if there is no compiled file, prompt the user to run :PackerSync
else
astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } }
end
end
end
+--- Set vim options with a nested table like API with the format vim...
+-- @param options the nested table of vim options
function astronvim.vim_opts(options)
for scope, table in pairs(options) do
for setting, value in pairs(table) do
@@ -114,20 +234,36 @@ function astronvim.vim_opts(options)
end
end
+--- User configuration entry point to override the default options of a configuration table with a user configuration file or table in the user/init.lua user settings
+-- @param module the module path of the override setting
+-- @param default the default settings that will be overridden
+-- @param extend boolean value to either extend the default settings or overwrite them with the user settings entirely (default: true)
+-- @param prefix a module prefix for where to search (default: user)
+-- @return the new configuration settings with the user overrides applied
function astronvim.user_plugin_opts(module, default, extend, prefix)
+ -- default to extend = true
if extend == nil then extend = true end
+ -- if no default table is provided set it to an empty table
default = default or {}
+ -- try to load a module file if it exists
local user_settings = load_module_file((prefix or "user") .. "." .. module)
+ -- if no user module file is found, try to load an override from the user settings table from user/init.lua
if user_settings == nil and prefix == nil then user_settings = user_setting_table(module) end
+ -- if a user override was found call the configuration engine
if user_settings ~= nil then default = func_or_extend(user_settings, default, extend) end
+ -- return the final configuration table with any overrides applied
return default
end
+--- Open a URL under the cursor with the current operating system
function astronvim.url_opener()
+ -- if mac use the open command
if vim.fn.has "mac" == 1 then
vim.fn.jobstart({ "open", vim.fn.expand "" }, { detach = true })
+ -- if unix then use xdg-open
elseif vim.fn.has "unix" == 1 then
vim.fn.jobstart({ "xdg-open", vim.fn.expand "" }, { detach = true })
+ -- if any other operating system notify the user that there is currently no support
else
astronvim.notify("gx is not supported on this OS!", "error")
end
@@ -135,64 +271,142 @@ end
-- term_details can be either a string for just a command or
-- a complete table to provide full access to configuration when calling Terminal:new()
+
+--- 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)
+ -- 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 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)
end
+ -- toggle the terminal
astronvim.user_terminals[term_key]:toggle()
end
+--- Add a source to cmp
+-- @param source the cmp source string or table to add (see cmp documentation for source table format)
function astronvim.add_cmp_source(source)
+ -- load cmp if available
local cmp_avail, cmp = pcall(require, "cmp")
if cmp_avail then
+ -- get the current cmp config
local config = cmp.get_config()
+ -- add the source to the list of sources
tbl_insert(config.sources, source)
+ -- call the setup function again
cmp.setup(config)
end
end
+--- Get the priority of a cmp source
+-- @param source the cmp source string or table (see cmp documentation for source table format)
+-- @return a cmp source table with the priority set from the user configuration
function astronvim.get_user_cmp_source(source)
+ -- if the source is a string, convert it to a cmp source table
source = type(source) == "string" and { name = source } or source
+ -- get the priority of the source name from the user configuration
local priority = astronvim.user_plugin_opts("cmp.source_priority", {
nvim_lsp = 1000,
luasnip = 750,
buffer = 500,
path = 250,
})[source.name]
+ -- if a priority is found, set it in the source
if priority then source.priority = priority end
+ -- return the source table
return source
end
+--- add a source to cmp with the user configured priority
+-- @param source a cmp source string or table (see cmp documentation for source table format)
function astronvim.add_user_cmp_source(source) astronvim.add_cmp_source(astronvim.get_user_cmp_source(source)) end
+--- register mappings table with which-key
+-- @param mappings nested table of mappings where the first key is the mode, the second key is the prefix, and the value is the mapping table for which-key
+-- @param opts table of which-key options when setting the mappings (see which-key documentation for possible values)
+function astronvim.which_key_register(mappings, opts)
+ local status_ok, which_key = pcall(require, "which-key")
+ if not status_ok then return end
+ for mode, prefixes in pairs(mappings) do
+ for prefix, mapping_table in pairs(prefixes) do
+ which_key.register(
+ mapping_table,
+ astronvim.default_tbl(opts, {
+ mode = mode,
+ prefix = prefix,
+ buffer = nil,
+ silent = true,
+ noremap = true,
+ nowait = true,
+ })
+ )
+ end
+ end
+end
+
+--- Get a list of registered null-ls providers for a given filetype
+-- @param filetype the filetype to search null-ls for
+-- @return a list of null-ls sources
function astronvim.null_ls_providers(filetype)
local registered = {}
+ -- try to load null-ls
local sources_avail, sources = pcall(require, "null-ls.sources")
if sources_avail then
+ -- get the available sources of a given filetype
for _, source in ipairs(sources.get_available(filetype)) do
+ -- get each source name
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
tbl_insert(registered[method], source.name)
end
end
end
+ -- return the found null-ls sources
return registered
end
-function astronvim.null_ls_sources(filetype, source)
- local methods_avail, methods = pcall(require, "null-ls.methods")
- return methods_avail and astronvim.null_ls_providers(filetype)[methods.internal[source]] or {}
+--- 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)
+-- @return the available sources for the given filetype and method
+function astronvim.null_ls_sources(filetype, method)
+ local methods_avail, methods = pcall(require, "null-ls.methods")
+ return methods_avail and astronvim.null_ls_providers(filetype)[methods.internal[method]] or {}
+end
+
+--- Create a button entity to use with the alpha dashboard
+-- @param sc the keybinding string to convert to a button
+-- @param txt the explanation text of what the keybinding does
+-- @return a button entity table for an alpha configuration
function astronvim.alpha_button(sc, txt)
+ -- replace in shortcut text with LDR for nicer printing
local sc_ = sc:gsub("%s", ""):gsub("LDR", "")
+ -- if the leader is set, replace the text with the actual leader key for nicer printing
if vim.g.mapleader then sc = sc:gsub("LDR", vim.g.mapleader == " " and "SPC" or vim.g.mapleader) end
+ -- return the button entity to display the correct text and send the correct keybinding on press
return {
type = "button",
val = txt,
@@ -213,42 +427,54 @@ function astronvim.alpha_button(sc, txt)
}
end
+--- Check if a plugin is defined in packer. Useful with lazy loading when a plugin is not necessarily loaded yet
+-- @param plugin the plugin string to search for
+-- @return boolean value if the plugin is available
function astronvim.is_available(plugin) return packer_plugins ~= nil and packer_plugins[plugin] ~= nil 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
function astronvim.set_mappings(map_table, base)
+ -- iterate over the first keys for each mode
for mode, maps in pairs(map_table) do
+ -- iterate over each keybinding set in the current mode
for keymap, options in pairs(maps) do
+ -- build the options for the command accordingly
if options then
local cmd = options
+ local keymap_opts = base or {}
if type(options) == "table" then
cmd = options[1]
- options[1] = nil
- else
- options = {}
+ keymap_opts = vim.tbl_deep_extend("force", options, keymap_opts)
+ keymap_opts[1] = nil
end
- map(mode, keymap, cmd, vim.tbl_deep_extend("force", options, base or {}))
+ -- extend the keybinding options with the base provided and set the mapping
+ map(mode, keymap, cmd, keymap_opts)
end
end
end
end
+--- Delete the syntax matching rules for URLs/URIs if set
function astronvim.delete_url_match()
for _, match in ipairs(vim.fn.getmatches()) do
if match.group == "HighlightURL" then vim.fn.matchdelete(match.id) end
end
end
+--- Add syntax matching rules for highlighting URLs/URIs
function astronvim.set_url_match()
astronvim.delete_url_match()
if vim.g.highlighturl_enabled then vim.fn.matchadd("HighlightURL", astronvim.url_matcher, 15) end
end
-function astronvim.toggle_url_match()
- vim.g.highlighturl_enabled = not vim.g.highlighturl_enabled
- astronvim.set_url_match()
-end
-
+--- Run a shell command and capture the output and if the command succeeded or failed
+-- @param cmd the terminal command to execute
+-- @param show_error boolean of whether or not to show an unsuccessful command as an error to the user
+-- @return the result of a successfully executed command or nil
function astronvim.cmd(cmd, show_error)
+ if vim.fn.has "win32" == 1 then cmd = { "cmd.exe", "/C", cmd } end
local result = vim.fn.system(cmd)
local success = vim.api.nvim_get_vvar "shell_error" == 0
if not success and (show_error == nil and true or show_error) then
@@ -257,6 +483,9 @@ function astronvim.cmd(cmd, show_error)
return success and result or nil
end
+require "core.utils.ui"
+require "core.utils.status"
require "core.utils.updater"
+require "core.utils.lsp"
return astronvim
diff --git a/dot_config/nvim/lua/core/utils/lsp.lua b/dot_config/nvim/lua/core/utils/lsp.lua
new file mode 100644
index 0000000..b40403e
--- /dev/null
+++ b/dot_config/nvim/lua/core/utils/lsp.lua
@@ -0,0 +1,203 @@
+--- ### AstroNvim LSP
+--
+-- This module is automatically loaded by AstroNvim on during it's initialization into global variable `astronvim.lsp`
+--
+-- This module can also be manually loaded with `local updater = require("core.utils").lsp`
+--
+-- @module core.utils.lsp
+-- @see core.utils
+-- @copyright 2022
+-- @license GNU General Public License v3.0
+
+astronvim.lsp = {}
+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 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 } })
+if type(astronvim.lsp.formatting.format_on_save) == "boolean" then
+ astronvim.lsp.formatting.format_on_save = { enabled = astronvim.lsp.formatting.format_on_save }
+end
+
+astronvim.lsp.format_opts = vim.deepcopy(astronvim.lsp.formatting)
+astronvim.lsp.format_opts.disabled = nil
+astronvim.lsp.format_opts.format_on_save = nil
+astronvim.lsp.format_opts.filter = function(client)
+ local filter = astronvim.lsp.formatting.filter
+ local disabled = astronvim.lsp.formatting.disabled or {}
+ -- check if client is fully disabled or filtered by function
+ return not (vim.tbl_contains(disabled, client.name) or (type(filter) == "function" and not filter(client)))
+end
+
+--- Helper function to set up a given server with the Neovim LSP client
+-- @param server the name of the server to be setup
+astronvim.lsp.setup = function(server)
+ if not tbl_contains(skip_setup, server) then
+ local opts = astronvim.lsp.server_settings(server)
+ if type(user_registration) == "function" then
+ user_registration(server, opts)
+ else
+ require("lspconfig")[server].setup(opts)
+ end
+ end
+end
+
+--- The `on_attach` function used by AstroNvim
+-- @param client the LSP client details when attaching
+-- @param bufnr the number of the buffer that the LSP client is attaching to
+astronvim.lsp.on_attach = function(client, bufnr)
+ local capabilities = client.server_capabilities
+ local lsp_mappings = {
+ n = {
+ ["ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" },
+ ["[d"] = { function() vim.diagnostic.goto_prev() end, desc = "Previous diagnostic" },
+ ["]d"] = { function() vim.diagnostic.goto_next() end, desc = "Next diagnostic" },
+ ["gl"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" },
+ },
+ v = {},
+ }
+
+ if capabilities.codeActionProvider then
+ lsp_mappings.n["la"] = { function() vim.lsp.buf.code_action() end, desc = "LSP code action" }
+ lsp_mappings.v["la"] = lsp_mappings.n["la"]
+ end
+
+ if capabilities.declarationProvider then
+ lsp_mappings.n["gD"] = { function() vim.lsp.buf.declaration() end, desc = "Declaration of current symbol" }
+ end
+
+ if capabilities.definitionProvider then
+ lsp_mappings.n["gd"] = { function() vim.lsp.buf.definition() end, desc = "Show the definition of current symbol" }
+ end
+
+ if capabilities.documentFormattingProvider then
+ lsp_mappings.n["lf"] = {
+ function() vim.lsp.buf.format(astronvim.lsp.format_opts) end,
+ desc = "Format code",
+ }
+ lsp_mappings.v["lf"] = lsp_mappings.n["lf"]
+
+ vim.api.nvim_buf_create_user_command(
+ bufnr,
+ "Format",
+ function() vim.lsp.buf.format(astronvim.lsp.format_opts) end,
+ { desc = "Format file with LSP" }
+ )
+ local autoformat = astronvim.lsp.formatting.format_on_save
+ local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
+ if
+ autoformat.enabled
+ and (tbl_isempty(autoformat.allow_filetypes or {}) or tbl_contains(autoformat.allow_filetypes, filetype))
+ and (tbl_isempty(autoformat.ignore_filetypes or {}) or not tbl_contains(autoformat.ignore_filetypes, filetype))
+ then
+ local autocmd_group = "auto_format_" .. bufnr
+ vim.api.nvim_create_augroup(autocmd_group, { clear = true })
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ group = autocmd_group,
+ buffer = bufnr,
+ desc = "Auto format buffer " .. bufnr .. " before save",
+ callback = function()
+ if vim.g.autoformat_enabled then
+ vim.lsp.buf.format(astronvim.default_tbl({ bufnr = bufnr }, astronvim.lsp.format_opts))
+ end
+ end,
+ })
+ lsp_mappings.n["uf"] = {
+ function() astronvim.ui.toggle_autoformat() end,
+ desc = "Toggle autoformatting",
+ }
+ end
+ end
+
+ if capabilities.documentHighlightProvider then
+ local highlight_name = vim.fn.printf("lsp_document_highlight_%d", bufnr)
+ vim.api.nvim_create_augroup(highlight_name, {})
+ vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
+ group = highlight_name,
+ buffer = bufnr,
+ callback = function() vim.lsp.buf.document_highlight() end,
+ })
+ vim.api.nvim_create_autocmd("CursorMoved", {
+ group = highlight_name,
+ buffer = bufnr,
+ callback = function() vim.lsp.buf.clear_references() end,
+ })
+ end
+
+ if capabilities.hoverProvider then
+ lsp_mappings.n["K"] = { function() vim.lsp.buf.hover() end, desc = "Hover symbol details" }
+ end
+
+ if capabilities.implementationProvider then
+ lsp_mappings.n["gI"] = { function() vim.lsp.buf.implementation() end, desc = "Implementation of current symbol" }
+ end
+
+ if capabilities.referencesProvider then
+ lsp_mappings.n["gr"] = { function() vim.lsp.buf.references() end, desc = "References of current symbol" }
+ end
+
+ if capabilities.renameProvider then
+ lsp_mappings.n["lr"] = { function() vim.lsp.buf.rename() end, desc = "Rename current symbol" }
+ end
+
+ if capabilities.signatureHelpProvider then
+ lsp_mappings.n["lh"] = { function() vim.lsp.buf.signature_help() end, desc = "Signature help" }
+ end
+
+ if capabilities.typeDefinitionProvider then
+ lsp_mappings.n["gT"] = { function() vim.lsp.buf.type_definition() end, desc = "Definition of current type" }
+ 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 = { [""] = { 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
+astronvim.lsp.capabilities = vim.lsp.protocol.make_client_capabilities()
+astronvim.lsp.capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
+astronvim.lsp.capabilities.textDocument.completion.completionItem.snippetSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.preselectSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.deprecatedSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
+astronvim.lsp.capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
+astronvim.lsp.capabilities.textDocument.completion.completionItem.resolveSupport = {
+ properties = { "documentation", "detail", "additionalTextEdits" },
+}
+astronvim.lsp.capabilities = user_plugin_opts("lsp.capabilities", astronvim.lsp.capabilities)
+astronvim.lsp.flags = user_plugin_opts "lsp.flags"
+
+--- Get the server settings for a given language server to be provided to the server's `setup()` call
+-- @param server_name the name of the server
+-- @return the table of LSP options used when setting up the given language server
+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,
+ 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 {}),
+ }, true, "configs")
+ )
+ local old_on_attach = server.on_attach
+ local user_on_attach = opts.on_attach
+ opts.on_attach = function(client, bufnr)
+ conditional_func(old_on_attach, true, client, bufnr)
+ astronvim.lsp.on_attach(client, bufnr)
+ conditional_func(user_on_attach, true, client, bufnr)
+ end
+ return opts
+end
+
+return astronvim.lsp
diff --git a/dot_config/nvim/lua/core/utils/status.lua b/dot_config/nvim/lua/core/utils/status.lua
new file mode 100644
index 0000000..4e29bd7
--- /dev/null
+++ b/dot_config/nvim/lua/core/utils/status.lua
@@ -0,0 +1,1016 @@
+--- ### AstroNvim Status
+--
+-- This module is automatically loaded by AstroNvim on during it's initialization into global variable `astronvim.status`
+--
+-- This module can also be manually loaded with `local status = require "core.utils.status"`
+--
+-- @module core.utils.status
+-- @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" },
+ ["no"] = { "OP", "normal" },
+ ["nov"] = { "OP", "normal" },
+ ["noV"] = { "OP", "normal" },
+ ["no"] = { "OP", "normal" },
+ ["niI"] = { "NORMAL", "normal" },
+ ["niR"] = { "NORMAL", "normal" },
+ ["niV"] = { "NORMAL", "normal" },
+ ["i"] = { "INSERT", "insert" },
+ ["ic"] = { "INSERT", "insert" },
+ ["ix"] = { "INSERT", "insert" },
+ ["t"] = { "TERM", "insert" },
+ ["nt"] = { "TERM", "insert" },
+ ["v"] = { "VISUAL", "visual" },
+ ["vs"] = { "VISUAL", "visual" },
+ ["V"] = { "LINES", "visual" },
+ ["Vs"] = { "LINES", "visual" },
+ [""] = { "BLOCK", "visual" },
+ ["s"] = { "BLOCK", "visual" },
+ ["R"] = { "REPLACE", "replace" },
+ ["Rc"] = { "REPLACE", "replace" },
+ ["Rx"] = { "REPLACE", "replace" },
+ ["Rv"] = { "V-REPLACE", "replace" },
+ ["s"] = { "SELECT", "visual" },
+ ["S"] = { "SELECT", "visual" },
+ [""] = { "BLOCK", "visual" },
+ ["c"] = { "COMMAND", "command" },
+ ["cv"] = { "COMMAND", "command" },
+ ["ce"] = { "COMMAND", "command" },
+ ["r"] = { "PROMPT", "inactive" },
+ ["rm"] = { "MORE", "inactive" },
+ ["r?"] = { "CONFIRM", "inactive" },
+ ["!"] = { "SHELL", "inactive" },
+ ["null"] = { "null", "inactive" },
+}
+
+local function pattern_match(str, pattern_list)
+ for _, pattern in ipairs(pattern_list) do
+ if str:find(pattern) then return true end
+ end
+ return false
+end
+
+astronvim.status.env.buf_matchers = {
+ filetype = function(pattern_list) return pattern_match(vim.bo.filetype, pattern_list) end,
+ buftype = function(pattern_list) return pattern_match(vim.bo.buftype, pattern_list) end,
+ bufname = function(pattern_list) return pattern_match(vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t"), pattern_list) end,
+}
+
+astronvim.status.env.separators = astronvim.user_plugin_opts("heirline.separators", {
+ none = { "", "" },
+ left = { "", " " },
+ right = { " ", "" },
+ center = { " ", " " },
+ tab = { "", "" },
+})
+
+--- Get the highlight background color of the lualine theme for the current colorscheme
+-- @param mode the neovim mode to get the color of
+-- @param fallback the color to fallback on if a lualine theme is not present
+-- @return The background color of the lualine theme or the fallback parameter if one doesn't exist
+function astronvim.status.hl.lualine_mode(mode, fallback)
+ local lualine_avail, lualine = pcall(require, "lualine.themes." .. (vim.g.colors_name or "default_theme"))
+ local lualine_opts = lualine_avail and lualine[mode]
+ return lualine_opts and type(lualine_opts.a) == "table" and lualine_opts.a.bg or fallback
+end
+
+--- Get the highlight for the current mode
+-- @return the highlight group for the current mode
+-- @usage local heirline_component = { provider = "Example Provider", hl = astronvim.status.hl.mode },
+function astronvim.status.hl.mode() return { bg = astronvim.status.hl.mode_bg() } end
+
+--- 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)
+ 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"),
+ nil,
+ { default = true }
+ )
+ return { fg = color }
+end
+
+--- An `init` function to build a set of children components for LSP breadcrumbs
+-- @param opts options for configuring the breadcrumbs (default: `{ separator = " > ", icon = { enabled = true, hl = false }, padding = { left = 0, right = 0 } }`)
+-- @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 children = {}
+ -- create a child for each level
+ for i, d in ipairs(data) do
+ local pos = astronvim.status.utils.encode_pos(d.lnum, d.col, self.winnr)
+ local child = {
+ { provider = string.gsub(d.name, "%%", "%%%%"):gsub("%s*->%s*", "") }, -- add symbol name
+ on_click = { -- add on click function
+ minwid = pos,
+ callback = function(_, minwid)
+ local lnum, col, winnr = astronvim.status.utils.decode_pos(minwid)
+ vim.api.nvim_win_set_cursor(vim.fn.win_getid(winnr), { lnum, col })
+ end,
+ name = "heirline_breadcrumbs",
+ },
+ }
+ if opts.icon.enabled then -- add icon and highlight if enabled
+ table.insert(child, 1, {
+ provider = string.format("%s ", d.icon),
+ hl = opts.icon.hl and string.format("Aerial%sIcon", d.kind) or nil,
+ })
+ end
+ if #data > 1 and i < #data then table.insert(child, { provider = opts.separator }) end -- add a separator only if needed
+ table.insert(children, child)
+ end
+ if opts.padding.left > 0 then -- add left padding
+ table.insert(children, 1, { provider = astronvim.pad_string(" ", { left = opts.padding.left - 1 }) })
+ end
+ if opts.padding.right > 0 then -- add right padding
+ table.insert(children, { provider = astronvim.pad_string(" ", { right = opts.padding.right - 1 }) })
+ end
+ -- instantiate the new child
+ self[1] = self:new(children, 1)
+ end
+end
+
+--- An `init` function to build multiple update events which is not supported yet by Heirline's update field
+-- @param opts an array like table of autocmd events as either just a string or a table with custom patterns and callbacks.
+-- @return The Heirline init function
+-- @usage local heirline_component = { init = astronvim.status.init.update_events { "BufEnter", { "User", pattern = "LspProgressUpdate" } } }
+function astronvim.status.init.update_events(opts)
+ return function(self)
+ if not rawget(self, "once") then
+ local clear_cache = function() self._win_cache = nil end
+ for _, event in ipairs(opts) do
+ local event_opts = { callback = clear_cache }
+ if type(event) == "table" then
+ event_opts.pattern = event.pattern
+ event_opts.callback = event.callback or clear_cache
+ event.pattern = nil
+ event.callback = nil
+ end
+ vim.api.nvim_create_autocmd(event, event_opts)
+ end
+ self.once = true
+ end
+ end
+end
+
+--- A provider function for the fill string
+-- @return the statusline string for filling the empty space
+-- @usage local heirline_component = { provider = astronvim.status.provider.fill }
+function astronvim.status.provider.fill() return "%=" end
+
+--- A provider function for showing if spellcheck is on
+-- @param opts options passed to the stylize function
+-- @return the function for outputting if spell is enabled
+-- @usage local heirline_component = { provider = astronvim.status.provider.spell() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.spell(opts)
+ opts = astronvim.default_tbl(opts, { str = "", icon = { kind = "Spellcheck" }, show_empty = true })
+ return function() return astronvim.status.utils.stylize(vim.wo.spell and opts.str, opts) end
+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)
+ opts = astronvim.default_tbl(opts, { str = "", icon = { kind = "Paste" }, show_empty = true })
+ return function() return astronvim.status.utils.stylize(vim.opt.paste:get() and opts.str, opts) end
+end
+
+--- A provider function for displaying if a macro is currently being recorded
+-- @param opts a prefix before the recording register and options passed to the stylize function
+-- @return a function that returns a string of the current recording status
+-- @usage local heirline_component = { provider = astronvim.status.provider.macro_recording() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.macro_recording(opts)
+ opts = astronvim.default_tbl(opts, { prefix = "@" })
+ return function()
+ local register = vim.fn.reg_recording()
+ if register ~= "" then register = opts.prefix .. register end
+ return astronvim.status.utils.stylize(register, opts)
+ 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
+-- @usage local heirline_component = { provider = astronvim.status.provider.mode_text() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.mode_text(opts)
+ local max_length =
+ math.max(unpack(vim.tbl_map(function(str) return #str[1] end, vim.tbl_values(astronvim.status.env.modes))))
+ return function()
+ local text = astronvim.status.env.modes[vim.fn.mode()][1]
+ if opts.pad_text then
+ local padding = max_length - #text
+ if opts.pad_text == "right" then
+ text = string.rep(" ", padding) .. text
+ elseif opts.pad_text == "left" then
+ text = text .. string.rep(" ", padding)
+ elseif opts.pad_text == "center" then
+ text = string.rep(" ", math.floor(padding / 2)) .. text .. string.rep(" ", math.ceil(padding / 2))
+ end
+ end
+ return astronvim.status.utils.stylize(text, opts)
+ end
+end
+
+--- A provider function for showing the percentage of the current location in a document
+-- @param opts 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)
+ return function()
+ local text = "%p%%"
+ local current_line = vim.fn.line "."
+ if current_line == 1 then
+ text = "Top"
+ elseif current_line == vim.fn.line "$" then
+ text = "Bot"
+ end
+ return astronvim.status.utils.stylize(text, opts)
+ end
+end
+
+--- A provider function for showing the current line and character in a document
+-- @param opts options for padding the line and character locations and options passed to the stylize function
+-- @return the statusline string for showing location in document line_num:char_num
+-- @usage local heirline_component = { provider = astronvim.status.provider.ruler({ pad_ruler = { line = 3, char = 2 } }) }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.ruler(opts)
+ opts = astronvim.default_tbl(opts, { pad_ruler = { line = 0, char = 0 } })
+ return astronvim.status.utils.stylize(string.format("%%%dl:%%%dc", opts.pad_ruler.line, opts.pad_ruler.char), opts)
+end
+
+--- A provider function for showing the current location as a scrollbar
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the scrollbar
+-- @usage local heirline_component = { provider = astronvim.status.provider.scrollbar() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.scrollbar(opts)
+ local sbar = { "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" }
+ return function()
+ local curr_line = vim.api.nvim_win_get_cursor(0)[1]
+ local lines = vim.api.nvim_buf_line_count(0)
+ local i = math.floor((curr_line - 1) / lines * #sbar) + 1
+ return astronvim.status.utils.stylize(string.rep(sbar[i], 2), opts)
+ end
+end
+
+--- A provider to simply show a cloes button icon
+-- @param opts options passed to the stylize function and the kind of icon to use
+-- @return return the stylized icon
+-- @usage local heirline_component = { provider = astronvim.status.provider.close_button() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.close_button(opts)
+ opts = astronvim.default_tbl(opts, { kind = "BufferClose" })
+ return astronvim.status.utils.stylize(astronvim.get_icon(opts.kind), opts)
+end
+
+--- A provider function for showing the current filetype
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the filetype
+-- @usage local heirline_component = { provider = astronvim.status.provider.filetype() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.filetype(opts)
+ return function(self)
+ local buffer = vim.bo[self and self.bufnr or 0]
+ return astronvim.status.utils.stylize(string.lower(buffer.filetype), opts)
+ end
+end
+
+--- A provider function for showing the current filename
+-- @param opts options for argument to fnamemodify to format filename and options passed to the stylize function
+-- @return the function for outputting the filename
+-- @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" })
+ 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)
+ end
+end
+
+--- Get a unique filepath between all buffers
+-- @param opts options for function to get the buffer name, a buffer number, max length, and options passed to the stylize function
+-- @return path to file that uniquely identifies each buffer
+-- @usage local heirline_component = { provider = astronvim.status.provider.unique_path() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.unique_path(opts)
+ opts = astronvim.default_tbl(opts, {
+ buf_name = function(bufnr) return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":t") end,
+ bufnr = 0,
+ max_length = 16,
+ })
+ return function(self)
+ opts.bufnr = self and self.bufnr or opts.bufnr
+ local name = opts.buf_name(opts.bufnr)
+ local unique_path = ""
+ -- check for same buffer names under different dirs
+ for _, value in ipairs(astronvim.status.utils.get_valid_buffers()) do
+ if name == opts.buf_name(value) and value ~= opts.bufnr then
+ local other = {}
+ for match in (vim.api.nvim_buf_get_name(value) .. "/"):gmatch("(.-)" .. "/") do
+ table.insert(other, match)
+ end
+
+ local current = {}
+ for match in (vim.api.nvim_buf_get_name(opts.bufnr) .. "/"):gmatch("(.-)" .. "/") do
+ table.insert(current, match)
+ end
+
+ unique_path = ""
+
+ for i = #current - 1, 1, -1 do
+ local value_current = current[i]
+ local other_current = other[i]
+
+ if value_current ~= other_current then
+ unique_path = value_current .. "/"
+ break
+ end
+ end
+ break
+ end
+ end
+ return astronvim.status.utils.stylize(
+ (
+ opts.max_length > 0
+ and #unique_path > opts.max_length
+ and string.sub(unique_path, 1, opts.max_length - 2) .. astronvim.get_icon "Ellipsis" .. "/"
+ ) or unique_path,
+ opts
+ )
+ end
+end
+
+--- A provider function for showing if the current file is modifiable
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the indicator if the file is modified
+-- @usage local heirline_component = { provider = astronvim.status.provider.file_modified() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.file_modified(opts)
+ opts = astronvim.default_tbl(opts, { str = "", icon = { kind = "FileModified" }, show_empty = true })
+ return function(self)
+ return astronvim.status.utils.stylize(
+ astronvim.status.condition.file_modified((self or {}).bufnr) and opts.str,
+ opts
+ )
+ end
+end
+
+--- A provider function for showing if the current file is read-only
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the indicator if the file is read-only
+-- @usage local heirline_component = { provider = astronvim.status.provider.file_read_only() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.file_read_only(opts)
+ opts = astronvim.default_tbl(opts, { str = "", icon = { kind = "FileReadOnly" }, show_empty = true })
+ return function(self)
+ return astronvim.status.utils.stylize(
+ astronvim.status.condition.file_read_only((self or {}).bufnr) and opts.str,
+ opts
+ )
+ end
+end
+
+--- A provider function for showing the current filetype icon
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the filetype icon
+-- @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 ft_icon, _ = devicons.get_icon(
+ vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self and self.bufnr or 0), ":t"),
+ nil,
+ { default = true }
+ )
+ return astronvim.status.utils.stylize(ft_icon, opts)
+ end
+end
+
+--- A provider function for showing the current git branch
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the git branch
+-- @usage local heirline_component = { provider = astronvim.status.provider.git_branch() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.git_branch(opts)
+ return function(self) return astronvim.status.utils.stylize(vim.b[self and self.bufnr or 0].gitsigns_head or "", opts) end
+end
+
+--- A provider function for showing the current git diff count of a specific type
+-- @param opts options for type of git diff and options passed to the stylize function
+-- @return the function for outputting the git diff
+-- @usage local heirline_component = { provider = astronvim.status.provider.git_diff({ type = "added" }) }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.git_diff(opts)
+ if not opts or not opts.type then return end
+ return function(self)
+ local status = vim.b[self and self.bufnr or 0].gitsigns_status_dict
+ return astronvim.status.utils.stylize(
+ status and status[opts.type] and status[opts.type] > 0 and tostring(status[opts.type]) or "",
+ opts
+ )
+ end
+end
+
+--- A provider function for showing the current diagnostic count of a specific severity
+-- @param opts options for severity of diagnostic and options passed to the stylize function
+-- @return the function for outputting the diagnostic count
+-- @usage local heirline_component = { provider = astronvim.status.provider.diagnostics({ severity = "ERROR" }) }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.diagnostics(opts)
+ if not opts or not opts.severity then return end
+ return function(self)
+ local bufnr = self and self.bufnr or 0
+ local count = #vim.diagnostic.get(bufnr, opts.severity and { severity = vim.diagnostic.severity[opts.severity] })
+ return astronvim.status.utils.stylize(count ~= 0 and tostring(count) or "", opts)
+ end
+end
+
+--- A provider function for showing the current progress of loading language servers
+-- @param opts options passed to the stylize function
+-- @return the function for outputting the LSP progress
+-- @usage local heirline_component = { provider = astronvim.status.provider.lsp_progress() }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.lsp_progress(opts)
+ return function()
+ local Lsp = vim.lsp.util.get_progress_messages()[1]
+ return astronvim.status.utils.stylize(
+ Lsp
+ and string.format(
+ " %%<%s %s %s (%s%%%%) ",
+ astronvim.get_icon("LSP" .. ((Lsp.percentage or 0) >= 70 and { "Loaded", "Loaded", "Loaded" } or {
+ "Loading1",
+ "Loading2",
+ "Loading3",
+ })[math.floor(vim.loop.hrtime() / 12e7) % 3 + 1]),
+ Lsp.title or "",
+ Lsp.message or "",
+ Lsp.percentage or 0
+ )
+ or "",
+ opts
+ )
+ end
+end
+
+--- A provider function for showing the connected LSP client names
+-- @param opts options for explanding null_ls clients, max width percentage, and options passed to the stylize function
+-- @return the function for outputting the LSP client names
+-- @usage local heirline_component = { provider = astronvim.status.provider.lsp_client_names({ expand_null_ls = true, truncate = 0.25 }) }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.lsp_client_names(opts)
+ opts = astronvim.default_tbl(opts, { expand_null_ls = true, truncate = 0.25 })
+ return function(self)
+ local buf_client_names = {}
+ for _, client in pairs(vim.lsp.get_active_clients { bufnr = self and self.bufnr or 0 }) do
+ if client.name == "null-ls" and opts.expand_null_ls then
+ local null_ls_sources = {}
+ for _, type in ipairs { "FORMATTING", "DIAGNOSTICS" } do
+ for _, source in ipairs(astronvim.null_ls_sources(vim.bo.filetype, type)) do
+ null_ls_sources[source] = true
+ end
+ end
+ vim.list_extend(buf_client_names, vim.tbl_keys(null_ls_sources))
+ else
+ table.insert(buf_client_names, client.name)
+ end
+ end
+ local str = table.concat(buf_client_names, ", ")
+ if type(opts.truncate) == "number" then
+ local max_width = math.floor(astronvim.status.utils.width() * opts.truncate)
+ if #str > max_width then str = string.sub(str, 0, max_width) .. "…" end
+ end
+ return astronvim.status.utils.stylize(str, opts)
+ end
+end
+
+--- A provider function for showing if treesitter is connected
+-- @param opts options passed to the stylize function
+-- @return the function for outputting TS if treesitter is connected
+-- @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
+end
+
+--- A provider function for displaying a single string
+-- @param opts options passed to the stylize function
+-- @return the stylized statusline string
+-- @usage local heirline_component = { provider = astronvim.status.provider.str({ str = "Hello" }) }
+-- @see astronvim.status.utils.stylize
+function astronvim.status.provider.str(opts)
+ opts = astronvim.default_tbl(opts, { str = " " })
+ return astronvim.status.utils.stylize(opts.str, opts)
+end
+
+--- A condition function if the window is currently active
+-- @return boolean of wether or not the window is currently actie
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.is_active }
+function astronvim.status.condition.is_active() return vim.api.nvim_get_current_win() == tonumber(vim.g.actual_curwin) end
+
+--- A condition function if the buffer filetype,buftype,bufname match a pattern
+-- @return boolean of wether or not LSP is attached
+-- @usage local heirline_component = { provider = "Example Provider", condition = function() return astronvim.status.condition.buffer_matches { buftype = { "terminal" } } end }
+function astronvim.status.condition.buffer_matches(patterns)
+ for kind, pattern_list in pairs(patterns) do
+ if astronvim.status.env.buf_matchers[kind](pattern_list) then return true end
+ end
+ return false
+end
+
+--- A condition function if a macro is being recorded
+-- @return boolean of wether or not a macro is currently being recorded
+-- @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 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 }
+function astronvim.status.condition.is_git_repo() return vim.b.gitsigns_head or vim.b.gitsigns_status_dict end
+
+--- A condition function if there are any git changes
+-- @return boolean of wether or not there are any git changes
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.git_changed }
+function astronvim.status.condition.git_changed()
+ local git_status = vim.b.gitsigns_status_dict
+ return git_status and (git_status.added or 0) + (git_status.removed or 0) + (git_status.changed or 0) > 0
+end
+
+--- A condition function if the current buffer is modified
+-- @return boolean of wether or not the current buffer is modified
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.file_modified }
+function astronvim.status.condition.file_modified(bufnr) return vim.bo[bufnr or 0].modified end
+
+--- A condition function if the current buffer is read only
+-- @return boolean of wether or not the current buffer is read only or not modifiable
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.file_read_only }
+function astronvim.status.condition.file_read_only(bufnr)
+ local buffer = vim.bo[bufnr or 0]
+ return not buffer.modifiable or buffer.readonly
+end
+
+--- A condition function if the current file has any diagnostics
+-- @return boolean of wether or not the current file has any diagnostics
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.has_diagnostics }
+function astronvim.status.condition.has_diagnostics()
+ return vim.g.status_diagnostics_enabled and #vim.diagnostic.get(0) > 0
+end
+
+--- A condition function if there is a defined filetype
+-- @return boolean of wether or not there is a filetype
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.has_filetype }
+function astronvim.status.condition.has_filetype()
+ return vim.fn.empty(vim.fn.expand "%:t") ~= 1 and vim.bo.filetype and vim.bo.filetype ~= ""
+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
+
+--- A condition function if LSP is attached
+-- @return boolean of wether or not LSP is attached
+-- @usage local heirline_component = { provider = "Example Provider", condition = astronvim.status.condition.lsp_attached }
+function astronvim.status.condition.lsp_attached() return next(vim.lsp.buf_get_clients()) ~= nil end
+
+--- A condition function if treesitter is in use
+-- @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()
+end
+
+--- A utility function to stylize a string with an icon from lspkind, separators, and left/right padding
+-- @param str the string to stylize
+-- @param opts options of `{ padding = { left = 0, right = 0 }, separator = { left = "|", right = "|" }, show_empty = false, icon = { kind = "NONE", padding = { left = 0, right = 0 } } }`
+-- @return the stylized string
+-- @usage local string = astronvim.status.utils.stylize("Hello", { padding = { left = 1, right = 1 }, icon = { kind = "String" } })
+function astronvim.status.utils.stylize(str, opts)
+ opts = astronvim.default_tbl(opts, {
+ padding = { left = 0, right = 0 },
+ separator = { left = "", right = "" },
+ show_empty = false,
+ icon = { kind = "NONE", padding = { left = 0, right = 0 } },
+ })
+ local icon = astronvim.pad_string(astronvim.get_icon(opts.icon.kind), opts.icon.padding)
+ return str
+ and (str ~= "" or opts.show_empty)
+ and opts.separator.left .. astronvim.pad_string(icon .. str, opts.padding) .. opts.separator.right
+ or ""
+end
+
+--- A Heirline component for filling in the empty space of the bar
+-- @return The heirline component table
+-- @usage local heirline_component = astronvim.status.component.fill()
+function astronvim.status.component.fill() return { provider = astronvim.status.provider.fill() } end
+
+--- A function to build a set of children components for an entire file information section
+-- @param opts options for configuring file_icon, filename, filetype, file_modified, file_read_only, and the overall padding
+-- @return The Heirline component table
+-- @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 } },
+ 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 {
+ "file_icon",
+ "unique_path",
+ "filename",
+ "filetype",
+ "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
+-- @param opts options for configuring ruler, percentage, scrollbar, and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.nav()
+function astronvim.status.component.nav(opts)
+ opts = astronvim.default_tbl(opts, {
+ ruler = {},
+ percentage = { padding = { left = 1 } },
+ scrollbar = { padding = { left = 1 }, hl = { fg = "scrollbar" } },
+ surround = { separator = "right", color = "nav_bg" },
+ 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)
+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()
+function astronvim.status.component.macro_recording(opts)
+ opts = astronvim.default_tbl(opts, {
+ macro_recording = { icon = { kind = "MacroRecording", padding = { right = 1 } } },
+ surround = {
+ separator = "center",
+ color = "macro_recording_bg",
+ condition = astronvim.status.condition.is_macro_recording,
+ },
+ 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)
+end
+
+--- A function to build a set of children components for a mode section
+-- @param opts options for configuring mode_text, paste, spell, and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.mode { mode_text = true }
+function astronvim.status.component.mode(opts)
+ opts = astronvim.default_tbl(opts, {
+ mode_text = false,
+ paste = false,
+ spell = false,
+ surround = { separator = "left", color = astronvim.status.hl.mode_bg },
+ 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)
+end
+
+--- A function to build a set of children components for an LSP breadcrumbs section
+-- @param opts options for configuring breadcrumbs and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.breadcumbs()
+function astronvim.status.component.breadcrumbs(opts)
+ opts = astronvim.default_tbl(
+ opts,
+ { padding = { left = 1 }, condition = astronvim.status.condition.aerial_available, update = "CursorMoved" }
+ )
+ opts.init = astronvim.status.init.breadcrumbs(opts)
+ return opts
+end
+
+--- A function to build a set of children components for a git branch section
+-- @param opts options for configuring git branch and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.git_branch()
+function astronvim.status.component.git_branch(opts)
+ opts = astronvim.default_tbl(opts, {
+ git_branch = { icon = { kind = "GitBranch", padding = { right = 1 } } },
+ surround = { separator = "left", color = "git_branch_bg", condition = astronvim.status.condition.is_git_repo },
+ hl = { fg = "git_branch_fg", bold = true },
+ on_click = {
+ name = "heirline_branch",
+ callback = function()
+ if astronvim.is_available "telescope.nvim" then
+ vim.defer_fn(function() require("telescope.builtin").git_branches() end, 100)
+ end
+ end,
+ },
+ 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)
+end
+
+--- A function to build a set of children components for a git difference section
+-- @param opts options for configuring git changes and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.git_diff()
+function astronvim.status.component.git_diff(opts)
+ opts = astronvim.default_tbl(opts, {
+ added = { icon = { kind = "GitAdd", padding = { left = 1, right = 1 } } },
+ changed = { icon = { kind = "GitChange", padding = { left = 1, right = 1 } } },
+ removed = { icon = { kind = "GitDelete", padding = { left = 1, right = 1 } } },
+ hl = { fg = "git_diff_fg", bold = true },
+ on_click = {
+ name = "heirline_git",
+ callback = function()
+ if astronvim.is_available "telescope.nvim" then
+ vim.defer_fn(function() require("telescope.builtin").git_status() end, 100)
+ end
+ end,
+ },
+ surround = { separator = "left", color = "git_diff_bg", condition = astronvim.status.condition.git_changed },
+ 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
+ end
+ return astronvim.status.component.builder(opts)
+end
+
+--- A function to build a set of children components for a diagnostics section
+-- @param opts options for configuring diagnostic providers and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.diagnostics()
+function astronvim.status.component.diagnostics(opts)
+ opts = astronvim.default_tbl(opts, {
+ ERROR = { icon = { kind = "DiagnosticError", padding = { left = 1, right = 1 } } },
+ WARN = { icon = { kind = "DiagnosticWarn", padding = { left = 1, right = 1 } } },
+ INFO = { icon = { kind = "DiagnosticInfo", padding = { left = 1, right = 1 } } },
+ HINT = { icon = { kind = "DiagnosticHint", padding = { left = 1, right = 1 } } },
+ surround = { separator = "left", color = "diagnostics_bg", condition = astronvim.status.condition.has_diagnostics },
+ hl = { fg = "diagnostics_fg" },
+ on_click = {
+ name = "heirline_diagnostic",
+ callback = function()
+ if astronvim.is_available "telescope.nvim" then
+ vim.defer_fn(function() require("telescope.builtin").diagnostics() end, 100)
+ end
+ end,
+ },
+ 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
+ end
+ return astronvim.status.component.builder(opts)
+end
+
+--- A function to build a set of children components for a Treesitter section
+-- @param opts options for configuring diagnostic providers and the overall padding
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.component.treesitter()
+function astronvim.status.component.treesitter(opts)
+ opts = astronvim.default_tbl(opts, {
+ str = { str = "TS", icon = { kind = "ActiveTS" } },
+ surround = {
+ separator = "right",
+ color = "treesitter_bg",
+ condition = astronvim.status.condition.treesitter_available,
+ },
+ hl = { fg = "treesitter_fg" },
+ 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)
+end
+
+--- A function to build a set of children components for an LSP section
+-- @param opts options for configuring lsp progress and client_name providers and the overall padding
+-- @return The Heirline component table
+-- @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 } } },
+ 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)
+ 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]) }
+ )
+ 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
+-- @param opts a list of components to build into a section
+-- @return The Heirline component table
+-- @usage local heirline_component = astronvim.status.components.builder({ { provider = "file_icon", opts = { padding = { right = 1 } } }, { provider = "filename" } })
+function astronvim.status.component.builder(opts)
+ opts = astronvim.default_tbl(opts, { padding = { left = 0, right = 0 } })
+ local children = {}
+ if opts.padding.left > 0 then -- add left padding
+ table.insert(children, { provider = astronvim.pad_string(" ", { left = opts.padding.left - 1 }) })
+ end
+ for key, entry in pairs(opts) do
+ if
+ type(key) == "number"
+ and type(entry) == "table"
+ and astronvim.status.provider[entry.provider]
+ and (entry.opts == nil or type(entry.opts) == "table")
+ then
+ entry.provider = astronvim.status.provider[entry.provider](entry.opts)
+ end
+ children[key] = entry
+ end
+ if opts.padding.right > 0 then -- add right padding
+ table.insert(children, { provider = astronvim.pad_string(" ", { right = opts.padding.right - 1 }) })
+ end
+ return opts.surround
+ and astronvim.status.utils.surround(
+ opts.surround.separator,
+ opts.surround.color,
+ children,
+ opts.surround.condition
+ )
+ or children
+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
+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
+-- @param component the component to surround
+-- @param condition the condition for displaying the surrounded component
+-- @return the new surrounded component
+function astronvim.status.utils.surround(separator, color, component, condition)
+ local function surround_color(self)
+ local colors = type(color) == "function" and color(self) or color
+ return type(colors) == "string" and { main = colors } or colors
+ end
+
+ separator = type(separator) == "string" and astronvim.status.env.separators[separator] or separator
+ local surrounded = { condition = condition }
+ if separator[1] ~= "" then
+ table.insert(surrounded, {
+ provider = separator[1],
+ hl = function(self)
+ local s_color = surround_color(self)
+ if s_color then return { fg = s_color.main, bg = s_color.left } end
+ end,
+ })
+ end
+ table.insert(surrounded, {
+ hl = function(self)
+ local s_color = surround_color(self)
+ if s_color then return { bg = s_color.main } end
+ end,
+ astronvim.default_tbl({}, component),
+ })
+ if separator[2] ~= "" then
+ table.insert(surrounded, {
+ provider = separator[2],
+ hl = function(self)
+ local s_color = surround_color(self)
+ if s_color then return { fg = s_color.main, bg = s_color.right } end
+ end,
+ })
+ end
+ return surrounded
+end
+
+--- Check if a buffer is valid
+-- @param bufnr the buffer to check
+-- @return true if the buffer is valid or false
+function astronvim.status.utils.is_valid_buffer(bufnr)
+ if not bufnr or bufnr < 1 then return false end
+ return vim.bo[bufnr].buflisted and vim.api.nvim_buf_is_valid(bufnr)
+end
+
+--- Get all valid buffers
+-- @return array-like table of valid buffer numbers
+function astronvim.status.utils.get_valid_buffers()
+ return vim.tbl_filter(astronvim.status.utils.is_valid_buffer, vim.api.nvim_list_bufs())
+end
+
+--- Encode a position to a single value that can be decoded later
+-- @param line line number of position
+-- @param col column number of position
+-- @param winnr a window number
+-- @return the encoded position
+function astronvim.status.utils.encode_pos(line, col, winnr)
+ return bit.bor(bit.lshift(line, 16), bit.lshift(col, 6), winnr)
+end
+
+--- Decode a previously encoded position to it's sub parts
+-- @param c the encoded position
+-- @return line number, column number, window id
+function astronvim.status.utils.decode_pos(c)
+ return bit.rshift(c, 16), bit.band(bit.rshift(c, 6), 1023), bit.band(c, 63)
+end
+
+return astronvim.status
diff --git a/dot_config/nvim/lua/core/utils/ui.lua b/dot_config/nvim/lua/core/utils/ui.lua
new file mode 100644
index 0000000..bc47c4f
--- /dev/null
+++ b/dot_config/nvim/lua/core/utils/ui.lua
@@ -0,0 +1,171 @@
+--- ### AstroNvim UI Options
+--
+-- This module is automatically loaded by AstroNvim on during it's initialization into global variable `astronvim.ui`
+--
+-- This module can also be manually loaded with `local updater = require("core.utils").ui`
+--
+-- @module core.utils.ui
+-- @see core.utils
+-- @copyright 2022
+-- @license GNU General Public License v3.0
+
+astronvim.ui = {}
+
+local bool2str = function(bool) return bool and "on" or "off" end
+
+--- Toggle autopairs
+function astronvim.ui.toggle_autopairs()
+ local ok, autopairs = pcall(require, "nvim-autopairs")
+ if ok then
+ if autopairs.state.disabled then
+ autopairs.enable()
+ else
+ autopairs.disable()
+ end
+ vim.g.autopairs_enabled = autopairs.state.disabled
+ astronvim.notify(string.format("autopairs %s", bool2str(not autopairs.state.disabled)))
+ else
+ astronvim.notify "autopairs not available"
+ end
+end
+
+--- Toggle diagnostics
+function astronvim.ui.toggle_diagnostics()
+ local status = "on"
+ if vim.g.status_diagnostics_enabled then
+ if vim.g.diagnostics_enabled then
+ vim.g.diagnostics_enabled = false
+ status = "virtual text off"
+ else
+ vim.g.status_diagnostics_enabled = false
+ status = "fully off"
+ end
+ else
+ vim.g.diagnostics_enabled = true
+ vim.g.status_diagnostics_enabled = true
+ end
+
+ vim.diagnostic.config(astronvim.lsp.diagnostics[bool2str(vim.g.diagnostics_enabled)])
+ astronvim.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))
+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")
+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)))
+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)))
+end
+
+--- Toggle laststatus=3|2|0
+function astronvim.ui.toggle_statusline()
+ local laststatus = vim.opt.laststatus:get()
+ local status
+ if laststatus == 0 then
+ vim.opt.laststatus = 2
+ status = "local"
+ elseif laststatus == 2 then
+ vim.opt.laststatus = 3
+ status = "global"
+ elseif laststatus == 3 then
+ vim.opt.laststatus = 0
+ status = "off"
+ end
+ astronvim.notify(string.format("statusline %s", status))
+end
+
+--- Toggle signcolumn="auto"|"no"
+function astronvim.ui.toggle_signcolumn()
+ if vim.wo.signcolumn == "no" then
+ vim.wo.signcolumn = "yes"
+ elseif vim.wo.signcolumn == "yes" then
+ vim.wo.signcolumn = "auto"
+ else
+ vim.wo.signcolumn = "no"
+ end
+ astronvim.notify(string.format("signcolumn=%s", vim.wo.signcolumn))
+end
+
+--- Set the indent and tab related numbers
+function astronvim.ui.set_indent()
+ local indent = tonumber(vim.fn.input "Set indent value (>0 expandtab, <=0 noexpandtab): ")
+ if not indent or indent == 0 then return end
+ vim.bo.expandtab = (indent > 0) -- local to buffer
+ indent = math.abs(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"))
+end
+
+--- Change the number display modes
+function astronvim.ui.change_number()
+ local number = vim.wo.number -- local to window
+ local relativenumber = vim.wo.relativenumber -- local to window
+ if not number and not relativenumber then
+ vim.wo.number = true
+ elseif number and not relativenumber then
+ vim.wo.relativenumber = true
+ elseif number and relativenumber then
+ vim.wo.number = false
+ 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))
+ )
+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)))
+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())))
+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)))
+end
+
+--- Toggle syntax highlighting and treesitter
+function astronvim.ui.toggle_syntax()
+ local ts_avail, parsers = pcall(require, "nvim-treesitter.parsers")
+ if vim.g.syntax_on then -- global var for on//off
+ if ts_avail and parsers.has_parser() then vim.cmd.TSBufDisable "highlight" end
+ vim.cmd.syntax "off" -- set vim.g.syntax_on = false
+ else
+ 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)))
+end
+
+--- Toggle URL/URI syntax highlighting rules
+function astronvim.ui.toggle_url_match()
+ vim.g.highlighturl_enabled = not vim.g.highlighturl_enabled
+ astronvim.set_url_match()
+end
diff --git a/dot_config/nvim/lua/core/utils/updater.lua b/dot_config/nvim/lua/core/utils/updater.lua
index 8dad31f..5653347 100644
--- a/dot_config/nvim/lua/core/utils/updater.lua
+++ b/dot_config/nvim/lua/core/utils/updater.lua
@@ -1,42 +1,114 @@
+--- ### AstroNvim Updater
+--
+-- This module is automatically loaded by AstroNvim on during it's initialization into global variable `astronvim.updater`
+--
+-- This module can also be manually loaded with `local updater = require("core.utils").updater`
+--
+-- @module core.utils.updater
+-- @see core.utils
+-- @copyright 2022
+-- @license GNU General Public License v3.0
+
local fn = vim.fn
local git = require "core.utils.git"
-local options = astronvim.user_plugin_opts(
- "updater",
- { remote = "origin", branch = "main", channel = "nightly", show_changelog = true }
-)
+--- Updater settings overridden with any user provided configuration
+local options = astronvim.user_plugin_opts("updater", {
+ remote = "origin",
+ channel = "stable",
+ show_changelog = true,
+ auto_reload = true,
+ auto_quit = true,
+})
+-- set the install channel
+if options.branch then options.channel = "nightly" end
if astronvim.install.is_stable ~= nil then options.channel = astronvim.install.is_stable and "stable" or "nightly" end
astronvim.updater = { options = options }
+-- if the channel is stable or the user has chosen to pin the system plugins
if options.pin_plugins == nil and options.channel == "stable" or options.pin_plugins then
+ -- load the current packer snapshot from the installation home location
local loaded, snapshot = pcall(fn.readfile, astronvim.install.home .. "/packer_snapshot")
if loaded then
+ -- decode the snapshot JSON and save it to a variable
loaded, snapshot = pcall(fn.json_decode, snapshot)
astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil
end
+ -- if there is an error loading the snapshot, print an error
if not loaded then vim.api.nvim_err_writeln "Error loading packer snapshot" end
end
-function astronvim.updater.version()
+--- Get the current AstroNvim version
+-- @param quiet boolean to quietly execute or send a notification
+-- @return the current AstroNvim version string
+function astronvim.updater.version(quiet)
local version = astronvim.install.version or git.current_version(false)
- if version then astronvim.notify("Version: " .. version) end
+ if version and not quiet then astronvim.notify("Version: " .. version) end
+ return version
end
+--- Get the full AstroNvim changelog
+-- @param quiet boolean to quietly execute or display the changelog
+-- @return the current AstroNvim changelog table of commit messages
+function astronvim.updater.changelog(quiet)
+ local summary = {}
+ vim.list_extend(summary, git.pretty_changelog(git.get_commit_range()))
+ if not quiet then astronvim.echo(summary) end
+ return summary
+end
+
+--- Attempt an update of AstroNvim
+-- @param target the target if checking out a specific tag or commit or nil if just pulling
local function attempt_update(target)
+ -- if updating to a new stable version or a specific commit checkout the provided target
if options.channel == "stable" or options.commit then
return git.checkout(target, false)
+ -- if no target, pull the latest
else
return git.pull(false)
end
end
+--- Cancelled update message
local cancelled_message = { { "Update cancelled", "WarningMsg" } }
+--- Reload the AstroNvim configuration live (Experimental)
+-- @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
+ 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)
+ -- manual unload some plugins that need it if they exist
+ reload_module("cmp", false)
+ reload_module("which-key", false)
+ -- 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
+
+--- AstroNvim's updater function
function astronvim.updater.update()
+ -- if the git command is not available, then throw an error
+ if not git.available() then
+ astronvim.notify(
+ "git command is not available, please verify it is accessible in a command line. This may be an issue with your PATH",
+ "error"
+ )
+ return
+ end
+
+ -- if installed with an external package manager, disable the internal updater
if not git.is_repo() then
astronvim.notify("Updater not available for non-git installations", "error")
return
end
+ -- set up any remotes defined by the user if they do not exist
for remote, entry in pairs(options.remotes and options.remotes or {}) do
local url = git.parse_remote_url(entry)
local current_url = git.remote_url(remote, false)
@@ -65,29 +137,43 @@ function astronvim.updater.update()
end
end
local is_stable = options.channel == "stable"
- options.branch = is_stable and "main" or options.branch
+ if is_stable then
+ options.branch = "main"
+ elseif not options.branch then
+ options.branch = "nightly"
+ end
+ -- fetch the latest remote
if not git.fetch(options.remote) then
vim.api.nvim_err_writeln("Error fetching remote: " .. options.remote)
return
end
- local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch
- if git.current_branch() ~= local_branch then
- astronvim.echo {
- { "Switching to branch: " },
- { options.remote .. "/" .. options.branch .. "\n\n", "String" },
- }
- if not git.checkout(local_branch, false) then
- git.checkout("-b " .. local_branch .. " " .. options.remote .. "/" .. options.branch, false)
+ -- switch to the necessary branch only if not on the stable channel
+ if not is_stable then
+ local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch
+ if git.current_branch() ~= local_branch then
+ astronvim.echo {
+ { "Switching to branch: " },
+ { options.remote .. "/" .. options.branch .. "\n\n", "String" },
+ }
+ if not git.checkout(local_branch, false) then
+ git.checkout("-b " .. local_branch .. " " .. options.remote .. "/" .. options.branch, false)
+ end
+ end
+ -- check if the branch was switched to successfully
+ if git.current_branch() ~= local_branch then
+ vim.api.nvim_err_writeln("Error checking out branch: " .. options.remote .. "/" .. options.branch)
+ return
end
- end
- if git.current_branch() ~= local_branch then
- vim.api.nvim_err_writeln("Error checking out branch: " .. options.remote .. "/" .. options.branch)
- return
end
local source = git.local_head() -- calculate current commit
local target -- calculate target commit
if is_stable then -- if stable get tag commit
- options.version = git.latest_version(git.get_versions(options.version or "latest"))
+ local version_search = options.version or "latest"
+ options.version = git.latest_version(git.get_versions(version_search))
+ if not options.version then -- continue only if stable version is found
+ vim.api.nvim_err_writeln("Error finding version: " .. version_search)
+ return
+ end
target = git.tag_commit(options.version)
elseif options.commit then -- if commit specified use it
target = git.branch_contains(options.remote, options.branch, options.commit) and options.commit or nil
@@ -105,12 +191,13 @@ function astronvim.updater.update()
and not astronvim.confirm_prompt {
{ "Update available to ", "Title" },
{ is_stable and options.version or target, "String" },
- { "\nContinue?" },
+ { "\nUpdating requires a restart, continue?" },
}
then
astronvim.echo(cancelled_message)
return
else -- perform update
+ -- calculate and print the changelog
local changelog = git.get_commit_range(source, target)
local breaking = git.breaking_changes(changelog)
local breaking_prompt = { { "Update contains the following breaking changes:\n", "WarningMsg" } }
@@ -120,7 +207,9 @@ function astronvim.updater.update()
astronvim.echo(cancelled_message)
return
end
+ -- attempt an update
local updated = attempt_update(target)
+ -- check for local file conflicts and prompt user to continue or abort
if
not updated
and not options.skip_prompts
@@ -131,24 +220,58 @@ function astronvim.updater.update()
then
astronvim.echo(cancelled_message)
return
+ -- if continued and there were errors reset the base config and attempt another update
elseif not updated then
git.hard_reset(source)
updated = attempt_update(target)
end
+ -- if update was unsuccessful throw an error
if not updated then
vim.api.nvim_err_writeln "Error ocurred performing update"
return
end
+ -- print a summary of the update with the changelog
local summary = {
{ "AstroNvim updated successfully to ", "Title" },
{ git.current_version(), "String" },
{ "!\n", "Title" },
- { "Please restart and run :PackerSync.\n\n", "WarningMsg" },
+ {
+ options.auto_reload and "AstroNvim will now sync packer and quit.\n\n"
+ or "Please restart and run :PackerSync.\n\n",
+ "WarningMsg",
+ },
}
if options.show_changelog and #changelog > 0 then
vim.list_extend(summary, { { "Changelog:\n", "Title" } })
vim.list_extend(summary, git.pretty_changelog(changelog))
end
astronvim.echo(summary)
+
+ -- if the user wants to auto quit, create an autocommand to quit AstroNvim on the update completing
+ if options.auto_quit then
+ vim.api.nvim_create_autocmd("User", { pattern = "AstroUpdateComplete", command = "quitall" })
+ end
+
+ -- if the user wants to reload and sync packer
+ if options.auto_reload then
+ -- perform a reload
+ 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()
+ -- 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]]
+ end
end
end
diff --git a/dot_config/nvim/lua/default_theme/base.lua b/dot_config/nvim/lua/default_theme/base.lua
index 0e945d2..9cd88dc 100644
--- a/dot_config/nvim/lua/default_theme/base.lua
+++ b/dot_config/nvim/lua/default_theme/base.lua
@@ -1,5 +1,6 @@
local base = {
Normal = { fg = C.fg, bg = C.bg },
+ NormalNC = { fg = C.fg, bg = C.black },
Comment = { fg = C.grey_2, bg = C.none },
Constant = { fg = C.yellow, bg = C.none },
String = { fg = C.green, bg = C.none },
@@ -43,13 +44,13 @@ local base = {
DiffDelete = { fg = C.grey_3, bg = C.red },
DiffText = { fg = C.grey_3, bg = C.yellow },
ErrorMsg = { fg = C.red, bg = C.none },
- VertSplit = { fg = C.grey_4, bg = C.none },
+ WinSeparator = { fg = C.grey_4, bg = C.none },
Folded = { fg = C.grey, bg = C.none },
FoldColumn = { fg = C.none, bg = C.none },
IncSearch = { fg = C.yellow, bg = C.grey },
LineNr = { fg = C.grey_1, bg = C.none },
NonText = { fg = C.grey_1, bg = C.none },
- Pmenu = { fg = C.fg, bg = C.black_1 },
+ Pmenu = { fg = C.fg, bg = C.bg },
PmenuSel = { fg = C.none, bg = C.grey_4 },
PmenuSbar = { fg = C.none, bg = C.grey_3 },
PmenuThumb = { fg = C.none, bg = C.fg },
@@ -58,14 +59,16 @@ local base = {
Search = { fg = C.grey_3, bg = C.yellow },
SignColumn = { fg = C.none, bg = C.none },
SpecialKey = { fg = C.grey_1, bg = C.none },
- SpellBad = { fg = C.red, bg = C.none },
- SpellCap = { fg = C.yellow, bg = C.none },
- SpellLocal = { fg = C.yellow, bg = C.none },
- SpellRare = { fg = C.yellow, bg = C.none },
+ SpellBad = { undercurl = true },
+ SpellCap = { undercurl = true },
+ SpellLocal = { undercurl = true },
+ SpellRare = { undercurl = true },
StatusLine = { fg = C.fg, bg = C.grey_4 },
StatusLineNC = { fg = C.grey, bg = C.none },
StatusLineTerm = { fg = C.fg, bg = C.grey_4 },
StatusLineTermNC = { fg = C.grey_4, bg = C.none },
+ WinBar = { fg = C.grey_2, bg = C.bg },
+ WinBarNC = { fg = C.grey, bg = C.black },
TabLine = { fg = C.grey, bg = C.none },
TabLineSel = { fg = C.fg, bg = C.none },
TabLineFill = { fg = C.none, bg = C.grey_3 },
@@ -75,14 +78,7 @@ local base = {
WarningMsg = { fg = C.yellow, bg = C.none },
WildMenu = { fg = C.grey_3, bg = C.blue },
EndOfBuffer = { fg = C.bg, bg = C.none },
- CmpItemAbbrDefault = { fg = C.fg },
- CmpItemAbbrDeprecatedDefault = { fg = C.grey_2 },
- CmpItemAbbrMatchDefault = { fg = C.white },
- CmpItemAbbrMatchFuzzyDefault = { fg = C.white },
- CmpItemKind = { fg = C.yellow },
- CmpItemAbbr = { fg = C.fg },
- CmpItemMenuDefault = { fg = C.fg },
- FloatBorder = { bg = C.none },
+ FloatBorder = { fg = C.grey_6, bg = C.bg },
MatchParen = { fg = C.none, bg = C.grey_5 },
}
diff --git a/dot_config/nvim/lua/default_theme/colors.lua b/dot_config/nvim/lua/default_theme/colors.lua
index 558d8f5..81c42d8 100644
--- a/dot_config/nvim/lua/default_theme/colors.lua
+++ b/dot_config/nvim/lua/default_theme/colors.lua
@@ -15,6 +15,7 @@ local colors = {
blue_1 = "#40d9ff",
blue_2 = "#1b1f27",
blue_3 = "#8094B4",
+ blue_4 = "#90c7f3",
orange = "#d19a66",
orange_1 = "#ff9640",
orange_2 = "#ff8800",
@@ -26,6 +27,7 @@ local colors = {
red_2 = "#ffbba6",
red_3 = "#cc626a",
red_4 = "#d47d85",
+ red_5 = "#e9989e",
grey = "#5c6370",
grey_1 = "#4b5263",
grey_2 = "#777d86",
@@ -39,8 +41,10 @@ local colors = {
grey_10 = "#D3D3D3",
gold = "#ffcc00",
cyan = "#56b6c2",
+ cyan_1 = "#88cbd4",
purple = "#c678dd",
purple_1 = "#a9a1e1",
+ purple_2 = "#c2bdea",
-- icon colors
c = "#519aba",
diff --git a/dot_config/nvim/lua/default_theme/init.lua b/dot_config/nvim/lua/default_theme/init.lua
index 50202e1..95e3eea 100644
--- a/dot_config/nvim/lua/default_theme/init.lua
+++ b/dot_config/nvim/lua/default_theme/init.lua
@@ -1,17 +1,16 @@
-vim.cmd "highlight clear"
-if vim.fn.exists "syntax_on" then vim.cmd "syntax reset" end
+vim.cmd.highlight "clear"
+if vim.fn.exists "syntax_on" then vim.cmd.syntax "reset" end
vim.o.background = "dark"
vim.o.termguicolors = true
vim.g.colors_name = "default_theme"
local user_plugin_opts = astronvim.user_plugin_opts
-local utils = require "default_theme.utils"
C = require "default_theme.colors"
local highlights = {}
-for _, module in ipairs { "base", "treesitter", "lsp" } do
+for _, module in ipairs { "base", "lsp" } do
highlights = vim.tbl_deep_extend("force", highlights, require("default_theme." .. module))
end
@@ -20,6 +19,7 @@ for plugin, enabled in
aerial = true,
beacon = false,
bufferline = true,
+ cmp = true,
dashboard = true,
gitsigns = true,
highlighturl = true,
@@ -33,6 +33,7 @@ for plugin, enabled in
rainbow = true,
symbols_outline = false,
telescope = true,
+ treesitter = true,
vimwiki = false,
["which-key"] = true,
}))
@@ -41,5 +42,26 @@ do
end
for group, spec in pairs(user_plugin_opts("default_theme.highlights", highlights)) do
- vim.api.nvim_set_hl(0, group, utils.parse_style(spec))
+ vim.api.nvim_set_hl(0, group, spec)
end
+
+astronvim.vim_opts {
+ g = {
+ terminal_color_0 = C.terminal_color_0 or C.bg,
+ terminal_color_1 = C.terminal_color_1 or C.red,
+ terminal_color_2 = C.terminal_color_2 or C.green_1,
+ terminal_color_3 = C.terminal_color_3 or C.yellow_1,
+ terminal_color_4 = C.terminal_color_4 or C.blue,
+ terminal_color_5 = C.terminal_color_5 or C.purple_1,
+ terminal_color_6 = C.terminal_color_6 or C.cyan,
+ terminal_color_7 = C.terminal_color_7 or C.white,
+ terminal_color_8 = C.terminal_color_8 or C.white_1,
+ terminal_color_9 = C.terminal_color_9 or C.red_5,
+ terminal_color_10 = C.terminal_color_10 or C.green,
+ terminal_color_11 = C.terminal_color_11 or C.yellow,
+ terminal_color_12 = C.terminal_color_12 or C.blue_4,
+ terminal_color_13 = C.terminal_color_13 or C.purple_2,
+ terminal_color_14 = C.terminal_color_14 or C.cyan_1,
+ terminal_color_15 = C.terminal_color_15 or C.fg,
+ },
+}
diff --git a/dot_config/nvim/lua/default_theme/lsp.lua b/dot_config/nvim/lua/default_theme/lsp.lua
index c801c9a..0fdab1c 100644
--- a/dot_config/nvim/lua/default_theme/lsp.lua
+++ b/dot_config/nvim/lua/default_theme/lsp.lua
@@ -1,10 +1,8 @@
-local utils = require "default_theme.utils"
-
local lsp = {
- DiagnosticError = utils.parse_diagnostic_style { fg = C.red_1 },
- DiagnosticHint = utils.parse_diagnostic_style { fg = C.yellow_1 },
- DiagnosticInfo = utils.parse_diagnostic_style { fg = C.white_2 },
- DiagnosticWarn = utils.parse_diagnostic_style { fg = C.orange_1 },
+ DiagnosticError = { fg = C.red_1 },
+ DiagnosticHint = { fg = C.yellow_1 },
+ DiagnosticInfo = { fg = C.white_2 },
+ DiagnosticWarn = { fg = C.orange_1 },
DiagnosticInformation = { fg = C.yellow, bold = true },
DiagnosticTruncateLine = { fg = C.white_1, bold = true },
DiagnosticUnderlineError = { sp = C.red_2, undercurl = true },
diff --git a/dot_config/nvim/lua/default_theme/plugins/aerial.lua b/dot_config/nvim/lua/default_theme/plugins/aerial.lua
index d4c4686..e2a307e 100644
--- a/dot_config/nvim/lua/default_theme/plugins/aerial.lua
+++ b/dot_config/nvim/lua/default_theme/plugins/aerial.lua
@@ -1,30 +1,30 @@
return {
- AerialLine = { fg = C.yellow, bg = C.none },
+ AerialArrayIcon = { link = "@constant" },
+ AerialBooleanIcon = { link = "@boolean" },
+ AerialClassIcon = { link = "@type" },
+ AerialConstantIcon = { link = "@constant" },
+ AerialConstructorIcon = { link = "@constructor" },
+ AerialEnumIcon = { link = "@type" },
+ AerialEnumMemberIcon = { link = "@field" },
+ AerialEventIcon = { link = "@type" },
+ AerialFieldIcon = { link = "@field" },
+ AerialFileIcon = { link = "@text.uri" },
+ AerialFunctionIcon = { link = "@function" },
AerialGuide = { fg = C.grey_2 },
- AerialBooleanIcon = { link = "TSBoolean" },
- AerialClassIcon = { link = "TSType" },
- AerialConstantIcon = { link = "TSConstant" },
- AerialConstructorIcon = { link = "TSConstructor" },
- AerialFieldIcon = { link = "TSField" },
- AerialFunctionIcon = { link = "TSFunction" },
- AerialMethodIcon = { link = "TSMethod" },
- AerialNamespaceIcon = { link = "TSNamespace" },
- AerialNumberIcon = { link = "TSNumber" },
- AerialOperatorIcon = { link = "TSOperator" },
- AerialTypeParameterIcon = { link = "TSParameter" },
- AerialPropertyIcon = { link = "TSProperty" },
- AerialStringIcon = { link = "TSString" },
- AerialVariableIcon = { link = "TSConstant" },
- AerialEnumMemberIcon = { link = "TSField" },
- AerialEnumIcon = { link = "TSType" },
- AerialFileIcon = { link = "TSURI" },
- AerialModuleIcon = { link = "TSNamespace" },
- AerialPackageIcon = { link = "TSNamespace" },
- AerialInterfaceIcon = { link = "TSType" },
- AerialStructIcon = { link = "TSType" },
- AerialEventIcon = { link = "TSType" },
- AerialArrayIcon = { link = "TSConstant" },
- AerialObjectIcon = { link = "TSType" },
- AerialKeyIcon = { link = "TSType" },
- AerialNullIcon = { link = "TSType" },
+ AerialInterfaceIcon = { link = "@type" },
+ AerialKeyIcon = { link = "@type" },
+ AerialLine = { fg = C.yellow, bg = C.none },
+ AerialMethodIcon = { link = "@method" },
+ AerialModuleIcon = { link = "@namespace" },
+ AerialNamespaceIcon = { link = "@namespace" },
+ AerialNullIcon = { link = "@type" },
+ AerialNumberIcon = { link = "@number" },
+ AerialObjectIcon = { link = "@type" },
+ AerialOperatorIcon = { link = "@operator" },
+ AerialPackageIcon = { link = "@namespace" },
+ AerialPropertyIcon = { link = "@property" },
+ AerialStringIcon = { link = "@string" },
+ AerialStructIcon = { link = "@type" },
+ AerialTypeParameterIcon = { link = "@parameter" },
+ AerialVariableIcon = { link = "@variable" },
}
diff --git a/dot_config/nvim/lua/default_theme/plugins/bufferline.lua b/dot_config/nvim/lua/default_theme/plugins/bufferline.lua
index 8dc2a2d..324a475 100644
--- a/dot_config/nvim/lua/default_theme/plugins/bufferline.lua
+++ b/dot_config/nvim/lua/default_theme/plugins/bufferline.lua
@@ -1,19 +1,12 @@
return {
- BufferLineFill = { fg = C.grey_9, bg = C.grey_4 },
- BufferLineBackground = { fg = C.grey_9, bg = C.grey_4 },
BufferLineBufferVisible = { fg = C.fg, bg = C.bg },
BufferLineBufferSelected = { fg = C.white, bg = C.bg, bold = true },
BufferLineTab = { fg = C.grey_9, bg = C.bg },
BufferLineTabSelected = { fg = C.fg, bg = C.bg },
BufferLineTabClose = { fg = C.red_4, bg = C.bg },
BufferLineIndicatorSelected = { fg = C.bg, bg = C.bg },
- BufferLineSeparator = { fg = C.grey_4, bg = C.grey_4 },
- BufferLineSeparatorVisible = { fg = C.bg, bg = C.bg },
- BufferLineSeparatorSelected = { fg = C.grey_4, bg = C.grey_4 },
- BufferLineCloseButton = { fg = C.grey_9, bg = C.grey_4 },
BufferLineCloseButtonVisible = { fg = C.grey_10, bg = C.bg },
BufferLineCloseButtonSelected = { fg = C.red_4, bg = C.bg },
- BufferLineModified = { fg = C.red_4, bg = C.grey_4 },
BufferLineModifiedVisible = { fg = C.fg, bg = C.bg },
BufferLineModifiedSelected = { fg = C.green_2, bg = C.bg },
BufferLineError = { fg = C.red_1, bg = C.red_1 },
diff --git a/dot_config/nvim/lua/default_theme/plugins/cmp.lua b/dot_config/nvim/lua/default_theme/plugins/cmp.lua
new file mode 100644
index 0000000..09fadcb
--- /dev/null
+++ b/dot_config/nvim/lua/default_theme/plugins/cmp.lua
@@ -0,0 +1,34 @@
+return {
+ CmpItemAbbr = { fg = C.fg },
+ CmpItemAbbrDefault = { fg = C.fg },
+ CmpItemAbbrDeprecated = { fg = C.grey_2 },
+ CmpItemAbbrMatch = { fg = C.white },
+ CmpItemAbbrMatchFuzzy = { fg = C.white },
+ CmpItemKind = { fg = C.yellow },
+ CmpItemKindClass = { link = "@type" },
+ CmpItemKindColor = { link = "@constant" },
+ CmpItemKindConstant = { link = "@constant" },
+ CmpItemKindConstructor = { link = "@constructor" },
+ CmpItemKindEnum = { link = "@type" },
+ CmpItemKindEnumMember = { link = "@field" },
+ CmpItemKindEvent = { link = "@type" },
+ CmpItemKindField = { link = "@field" },
+ CmpItemKindFile = { link = "@text.uri" },
+ CmpItemKindFolder = { link = "@constant" },
+ CmpItemKindFunction = { link = "@function" },
+ CmpItemKindInterface = { link = "@type" },
+ CmpItemKindKeyword = { link = "@keyword" },
+ CmpItemKindMethod = { link = "@method" },
+ CmpItemKindModule = { link = "@namespace" },
+ CmpItemKindOperator = { link = "@operator" },
+ CmpItemKindProperty = { link = "@property" },
+ CmpItemKindReference = { link = "@type" },
+ CmpItemKindSnippet = { link = "@constant" },
+ CmpItemKindStruct = { link = "@type" },
+ CmpItemKindText = { link = "@text" },
+ CmpItemKindTypeParameter = { link = "@type" },
+ CmpItemKindUnit = { link = "@constant" },
+ CmpItemKindValue = { link = "@constant" },
+ CmpItemKindVariable = { link = "@variable" },
+ CmpItemMenuDefault = { fg = C.fg },
+}
diff --git a/dot_config/nvim/lua/default_theme/plugins/treesitter.lua b/dot_config/nvim/lua/default_theme/plugins/treesitter.lua
new file mode 100644
index 0000000..586bd09
--- /dev/null
+++ b/dot_config/nvim/lua/default_theme/plugins/treesitter.lua
@@ -0,0 +1,63 @@
+local treesitter = {
+ ["@annotation"] = { fg = C.yellow },
+ ["@attribute"] = { fg = C.red },
+ ["@boolean"] = { fg = C.orange },
+ ["@character"] = { fg = C.green },
+ ["@conditional"] = { fg = C.purple },
+ ["@constant"] = { fg = C.yellow },
+ ["@constant.builtin"] = { fg = C.orange },
+ ["@constant.macro"] = { fg = C.red },
+ ["@constant.rust"] = { fg = C.cyan },
+ ["@constructor"] = { fg = C.yellow },
+ ["@error"] = { fg = C.red },
+ ["@exception"] = { fg = C.purple },
+ ["@field"] = { fg = C.red },
+ ["@float"] = { fg = C.green },
+ ["@function"] = { fg = C.blue },
+ ["@function.builtin"] = { fg = C.blue },
+ ["@function.macro"] = { fg = C.yellow },
+ ["@function.macro.rust"] = { fg = C.orange },
+ ["@include"] = { fg = C.purple },
+ ["@keyword"] = { fg = C.purple },
+ ["@keyword.function"] = { fg = C.purple },
+ ["@keyword.function.rust"] = { fg = C.orange },
+ ["@keyword.operator"] = { fg = C.purple },
+ ["@label"] = { fg = C.blue },
+ ["@literal.markdown"] = { fg = C.green },
+ ["@method"] = { fg = C.blue },
+ ["@namespace"] = { fg = C.purple },
+ ["@namespace.rust"] = { fg = C.yellow },
+ ["@none.markdown"] = { fg = C.fg },
+ ["@number"] = { fg = C.orange },
+ ["@operator"] = { fg = C.cyan },
+ ["@parameter"] = { fg = C.red },
+ ["@parameter.reference"] = { fg = C.cyan },
+ ["@property"] = { fg = C.yellow },
+ ["@punctuation.bracket"] = { fg = C.fg },
+ ["@punctuation.delimiter"] = { fg = C.fg },
+ ["@punctuation.delimiter.markdown"] = { fg = C.fg },
+ ["@punctuation.special"] = { fg = C.fg },
+ ["@punctuation.special.markdown"] = { fg = C.red },
+ ["@repeat"] = { fg = C.purple },
+ ["@string"] = { fg = C.green },
+ ["@string.escape"] = { fg = C.red },
+ ["@string.regex"] = { fg = C.green },
+ ["@tag"] = { fg = C.red },
+ ["@tag.delimiter"] = { fg = C.fg },
+ ["@text"] = { fg = C.fg },
+ ["@text.emphasis"] = { fg = C.purple, italic = true },
+ ["@text.literal"] = { fg = C.fg },
+ ["@text.reference"] = { fg = C.yellow },
+ ["@text.strong"] = { fg = C.blue, bold = true },
+ ["@text.title"] = { fg = C.fg },
+ ["@text.underline"] = { fg = C.fg },
+ ["@text.uri"] = { fg = C.green },
+ ["@title.markdown"] = { fg = C.red },
+ ["@type"] = { fg = C.blue },
+ ["@type.builtin"] = { fg = C.blue },
+ ["@type.rust"] = { fg = C.yellow },
+ ["@variable"] = { fg = C.red },
+ ["@variable.builtin"] = { fg = C.yellow },
+}
+
+return treesitter
diff --git a/dot_config/nvim/lua/user_example/init.lua b/dot_config/nvim/lua/user_example/init.lua
index 43ef125..129169f 100644
--- a/dot_config/nvim/lua/user_example/init.lua
+++ b/dot_config/nvim/lua/user_example/init.lua
@@ -1,3 +1,9 @@
+-- AstroNvim Configuration Table
+-- All configuration changes should go inside of the table below
+
+-- You can think of a Lua "table" as a dictionary like data structure the
+-- normal format is "key = value". These also handle array like data structures
+-- where a value with no key simply has an implicit numeric key
local config = {
-- Configure AstroNvim updates
@@ -10,6 +16,8 @@ local config = {
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
+ auto_reload = false, -- automatically reload and sync packer after a successful update
+ auto_quit = false, -- automatically quit the current session after a successful update
-- remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
@@ -17,43 +25,90 @@ local config = {
-- },
},
- -- Set colorscheme
+ -- Set colorscheme to use
colorscheme = "default_theme",
- -- Override highlight groups in any theme
+ -- Add highlight groups in any theme
highlights = {
- -- duskfox = { -- a table of overrides
+ -- init = { -- this table overrides highlights in all themes
+ -- Normal = { bg = "#000000" },
+ -- }
+ -- duskfox = { -- a table of overrides/changes to the duskfox theme
-- Normal = { bg = "#000000" },
-- },
- default_theme = function(highlights) -- or a function that returns one
- local C = require "default_theme.colors"
-
- highlights.Normal = { fg = C.fg, bg = C.bg }
- return highlights
- end,
},
-- set vim options here (vim.. = value)
options = {
opt = {
+ -- set to true or false etc.
relativenumber = true, -- sets vim.opt.relativenumber
+ number = true, -- sets vim.opt.number
+ spell = false, -- sets vim.opt.spell
+ signcolumn = "auto", -- sets vim.opt.signcolumn to auto
+ wrap = false, -- sets vim.opt.wrap
},
g = {
mapleader = " ", -- sets vim.g.mapleader
+ autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
+ cmp_enabled = true, -- enable completion at start
+ autopairs_enabled = true, -- enable autopairs at start
+ 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)
},
},
+ -- If you need more control, you can use the function()...end notation
+ -- options = function(local_vim)
+ -- local_vim.opt.relativenumber = true
+ -- local_vim.g.mapleader = " "
+ -- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list
+ -- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list
+ --
+ -- return local_vim
+ -- end,
+
+ -- Set dashboard header
+ header = {
+ " █████ ███████ ████████ ██████ ██████",
+ "██ ██ ██ ██ ██ ██ ██ ██",
+ "███████ ███████ ██ ██████ ██ ██",
+ "██ ██ ██ ██ ██ ██ ██ ██",
+ "██ ██ ███████ ██ ██ ██ ██████",
+ " ",
+ " ███ ██ ██ ██ ██ ███ ███",
+ " ████ ██ ██ ██ ██ ████ ████",
+ " ██ ██ ██ ██ ██ ██ ██ ████ ██",
+ " ██ ██ ██ ██ ██ ██ ██ ██ ██",
+ " ██ ████ ████ ██ ██ ██",
+ },
-- Default theme configuration
default_theme = {
- diagnostics_style = { italic = true },
- -- Modify the color table
+ -- Modify the color palette for the default theme
colors = {
fg = "#abb2bf",
+ bg = "#1e222a",
},
- plugins = { -- enable or disable extra plugin highlighting
+ highlights = function(hl) -- or a function that returns a new table of colors to set
+ local C = require "default_theme.colors"
+
+ hl.Normal = { fg = C.fg, bg = C.bg }
+
+ -- New approach instead of diagnostic_style
+ hl.DiagnosticError.italic = true
+ hl.DiagnosticHint.italic = true
+ hl.DiagnosticInfo.italic = true
+ hl.DiagnosticWarn.italic = true
+
+ return hl
+ end,
+ -- enable or disable highlighting for extra plugins
+ plugins = {
aerial = true,
beacon = false,
bufferline = true,
+ cmp = true,
dashboard = true,
highlighturl = true,
hop = false,
@@ -66,25 +121,106 @@ local config = {
rainbow = true,
symbols_outline = false,
telescope = true,
+ treesitter = true,
vimwiki = false,
["which-key"] = true,
},
},
- -- Disable AstroNvim ui features
- ui = {
- nui_input = true,
- telescope_select = true,
+ -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
+ diagnostics = {
+ virtual_text = true,
+ underline = true,
+ },
+
+ -- Extend LSP configuration
+ lsp = {
+ -- enable servers that you already have installed without mason
+ servers = {
+ -- "pyright"
+ },
+ formatting = {
+ -- control auto formatting on save
+ format_on_save = {
+ enabled = true, -- enable or disable format on save globally
+ allow_filetypes = { -- enable format on save for specified filetypes only
+ -- "go",
+ },
+ ignore_filetypes = { -- disable format on save for specified filetypes
+ -- "python",
+ },
+ },
+ disabled = { -- disable formatting capabilities for the listed language servers
+ -- "sumneko_lua",
+ },
+ timeout_ms = 1000, -- default format timeout
+ -- filter = function(client) -- fully override the default formatting function
+ -- return true
+ -- end
+ },
+ -- easily add or disable built in mappings added during LSP attaching
+ mappings = {
+ n = {
+ -- ["lf"] = false -- disable formatting keymap
+ },
+ },
+ -- add to the global LSP on_attach function
+ -- on_attach = function(client, bufnr)
+ -- end,
+
+ -- override the mason server-registration function
+ -- server_registration = function(server, opts)
+ -- require("lspconfig")[server].setup(opts)
+ -- end,
+
+ -- Add overrides for LSP server settings, the keys are the name of the server
+ ["server-settings"] = {
+ -- example for addings schemas to yamlls
+ -- yamlls = { -- override table for require("lspconfig").yamlls.setup({...})
+ -- settings = {
+ -- yaml = {
+ -- schemas = {
+ -- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
+ -- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
+ -- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
+ -- },
+ -- },
+ -- },
+ -- },
+ },
+ },
+
+ -- Mapping data with "desc" stored directly by vim.keymap.set().
+ --
+ -- Please use this mappings table to set keyboard mapping since this is the
+ -- lower level configuration and more robust one. (which-key will
+ -- automatically pick-up stored data by this setting.)
+ mappings = {
+ -- first key is the mode
+ n = {
+ -- second key is the lefthand side of the map
+ -- mappings seen under group name "Buffer"
+ ["