mirror of https://github.com/qpixel/dotfiles.git
chore(nvim): update astronvim
This commit is contained in:
parent
eb859f0ffb
commit
e5ab647d31
|
|
@ -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'
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
ba775276324b75e4f703cd63fea3cfe7726514de
|
||||||
Binary file not shown.
|
|
@ -1 +1,2 @@
|
||||||
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
|
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
|
||||||
|
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
|
0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith <riley@rileysmith.me> 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim
|
||||||
|
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894344 -0700 pull --rebase: Fast-forward
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 23d7faaa166f633d00a446726bab2e355143c3e2 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 1e520d7e47dc588f58f59613ab17300ff8496986 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 c7a79519290352fc5710b95285bb016176a8efd0 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
ba775276324b75e4f703cd63fea3cfe7726514de 5288bad46858f15f2290aeb3d09c8bd8e58b7882 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: fast-forward
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 0ce1b696613bc3dba23f24508ca5a2b7133fd5ba Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0 Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0000000000000000000000000000000000000000 e1a36a82a3b53ade76ea1384853d4fd387e81a8c Riley Smith <riley@rileysmith.me> 1666894323 -0700 fetch origin: storing head
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
ba775276324b75e4f703cd63fea3cfe7726514de
|
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
28bdb9800c1fdaa0f2063a2073e1af1c9c9faa6d
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
23d7faaa166f633d00a446726bab2e355143c3e2
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
1e520d7e47dc588f58f59613ab17300ff8496986
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
c7a79519290352fc5710b95285bb016176a8efd0
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0ce1b696613bc3dba23f24508ca5a2b7133fd5ba
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
b5188030d2e272f5a0cc75e0e9ba2d0cdc5093d0
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
e1a36a82a3b53ade76ea1384853d4fd387e81a8c
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
392b92d4f731d6126a1a3b946cc3a20e7aef9bfc
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
8453ed985262a23cb9ff4a1bbf02c32ca5460ea7
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
5e28adaed25853c2e1ff3d3a464d71750a38dc39
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
7ba02c5c6097a9b5a4f42ca7204fc856502bd14e
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
3c96bb087f1db8fba779546f4662bae6864e5bc8
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
9badfdd8f2e472fc79dd666679df9ed6237240a8
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
53d210d3905f65b9e8f0bdb0c8a307440ebfc3f8
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
a157c0ed2ce6b6b956819e29bc78688044f2ef1d
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0882a17b0d399c3fef12cd963fac32f8ba4f5a3c
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
f65794ed742a255498a161f8a4ccd1b334404be4
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
5148df725aebcfe2a80876762a2425c7e1820569
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
501aece937d323c534dddc0ebeb07c4560b409e5
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
3f269b70cdf41a7636b0c2472afe1dba9467ccc6
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
fa82ff92b438d764f2ed683cca2ec7e95e7ffb72
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
893665a969129eb528e54b7e4bee1e6c952d6d25
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
f5200f4b00df1db0c14a13b61bbb428594733e52
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
a4292d28b867249ba6330616e4689e6cf69ad3f0
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
5288bad46858f15f2290aeb3d09c8bd8e58b7882
|
||||||
|
|
@ -35,6 +35,12 @@ If you wish to contribute to AstroNvim, you should:
|
||||||
|
|
||||||
## Things to know before contributing
|
## 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!
|
- 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/)
|
- Commit messages must follow [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/)
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
custom: https://www.buymeacoffee.com/mehalter
|
ko_fi: mehalter
|
||||||
|
custom: https://www.buymeacoffee.com/mehalter
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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
|
||||||
|
```
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<img src="https://img.shields.io/github/license/AstroNvim/AstroNvim?label=License&logo=GNU&style=flat-square"/>
|
<img src="https://img.shields.io/github/license/AstroNvim/AstroNvim?label=License&logo=GNU&style=flat-square"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://neovim.io/">
|
<a href="https://neovim.io/">
|
||||||
<img src="https://img.shields.io/badge/Neovim-0.7+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/>
|
<img src="https://img.shields.io/badge/Neovim-0.8+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://discord.gg/UcZutyeaFW">
|
<a href="https://discord.gg/UcZutyeaFW">
|
||||||
<img src="https://img.shields.io/badge/discord-Join-7289da?color=%235865F2%20&label=Discord&logo=discord&logoColor=%23ffffff&style=flat-square"/>
|
<img src="https://img.shields.io/badge/discord-Join-7289da?color=%235865F2%20&label=Discord&logo=discord&logoColor=%23ffffff&style=flat-square"/>
|
||||||
|
|
@ -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
|
AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
**_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
|
## 🌟 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)
|
- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
|
||||||
- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp)
|
- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp)
|
||||||
- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
- 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)
|
- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim)
|
||||||
- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
||||||
- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
|
- 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
|
## ⚡ Requirements
|
||||||
|
|
||||||
- [Nerd Fonts](https://www.nerdfonts.com/font-downloads)
|
- [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.7+](https://github.com/neovim/neovim/releases/tag/v0.7.0)
|
- [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)
|
- A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions)
|
||||||
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
|
- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
|
||||||
- Optional Requirements:
|
- Optional Requirements:
|
||||||
- [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`<leader>fw`)
|
- [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`<leader>fw`)
|
||||||
- [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`<leader>tl` or `<leader>gg`)
|
- [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`<leader>tl` or `<leader>gg`)
|
||||||
- [NCDU](https://dev.yorhel.nl/ncdu) - disk usage toggle terminal (`<leader>tu`)
|
- [go DiskUsage()](https://github.com/dundee/gdu) - disk usage toggle terminal (`<leader>tu`)
|
||||||
- [Htop](https://htop.dev/) - process viewer toggle terminal (`<leader>tt`)
|
- [bottom](https://github.com/ClementTsang/bottom) - process viewer toggle terminal (`<leader>tt`)
|
||||||
- [Python](https://www.python.org/) - python repl toggle terminal (`<leader>tp`)
|
- [Python](https://www.python.org/) - python repl toggle terminal (`<leader>tp`)
|
||||||
- [Node](https://nodejs.org/en/) - node repl toggle terminal (`<leader>tn`)
|
- [Node](https://nodejs.org/en/) - node repl toggle terminal (`<leader>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 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.
|
||||||
|
|
||||||
> 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.
|
|
||||||
|
|
||||||
## 🛠️ Installation
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
|
@ -102,9 +98,10 @@ Run `:AstroUpdate` to get the latest updates from the repository<br>
|
||||||
## 🗒️ Links
|
## 🗒️ Links
|
||||||
|
|
||||||
[AstroNvim Documentation](https://astronvim.github.io/)
|
[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
|
- [Basic Usage](https://astronvim.github.io/Basic%20Usage/walkthrough) is given for basic usage
|
||||||
- [Default Mappings](https://astronvim.github.io/usage/mappings) more about the default key bindings
|
- [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
|
- [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults
|
||||||
- [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration
|
- [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ exemptLabels:
|
||||||
- notice
|
- notice
|
||||||
- wip
|
- wip
|
||||||
# Label to use when marking an issue as stale
|
# 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
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
markComment: >
|
markComment: >
|
||||||
This issue has been automatically marked as stale because it has not had
|
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
|
recent activity. It will be closed in 7 days if no further activity occurs.
|
||||||
for your contributions.
|
Thank you for your contributions.
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
closeComment: false
|
closeComment: false
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -10,6 +10,6 @@ jobs:
|
||||||
- uses: JohnnyMorganz/stylua-action@1.0.0
|
- uses: JohnnyMorganz/stylua-action@1.0.0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
version: v0.14.0
|
version: v0.14.2
|
||||||
# CLI arguments
|
# CLI arguments
|
||||||
args: --check .
|
args: --check .
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ jobs:
|
||||||
const user = src.user.login
|
const user = src.user.login
|
||||||
const tab = " "
|
const tab = " "
|
||||||
let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n`
|
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`
|
settings += tab + tab + `branch = "${src.ref}",\n`
|
||||||
}
|
}
|
||||||
if (user != "AstroNvim") {
|
if (user != "AstroNvim") {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
plugin
|
!colors/default_theme.lua
|
||||||
lua/user
|
colors/*
|
||||||
lua/packer_compiled.lua
|
docs
|
||||||
ginit.vim
|
ginit.vim
|
||||||
|
lua/packer_compiled.lua
|
||||||
|
lua/user
|
||||||
|
plugin
|
||||||
|
spell
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ globals = {
|
||||||
"astronvim",
|
"astronvim",
|
||||||
"astronvim_installation",
|
"astronvim_installation",
|
||||||
"vim",
|
"vim",
|
||||||
|
"bit",
|
||||||
"C",
|
"C",
|
||||||
"packer_plugins",
|
"packer_plugins",
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +16,6 @@ cache = true
|
||||||
self = false
|
self = false
|
||||||
|
|
||||||
ignore = {
|
ignore = {
|
||||||
"631", -- max_line_length
|
"631", -- max_line_length
|
||||||
"212/_.*", -- unused argument, for vars with "_" prefix
|
"212/_.*", -- unused argument, for vars with "_" prefix
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ for _, source in ipairs {
|
||||||
"core.options",
|
"core.options",
|
||||||
"core.bootstrap",
|
"core.bootstrap",
|
||||||
"core.plugins",
|
"core.plugins",
|
||||||
|
"core.diagnostics",
|
||||||
"core.autocmds",
|
"core.autocmds",
|
||||||
"core.mappings",
|
"core.mappings",
|
||||||
"configs.which-key-register",
|
"configs.which-key-register",
|
||||||
|
|
@ -15,3 +16,7 @@ for _, source in ipairs {
|
||||||
end
|
end
|
||||||
|
|
||||||
astronvim.conditional_func(astronvim.user_plugin_opts("polish", nil, false))
|
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
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@ local utils = require "Comment.utils"
|
||||||
Comment.setup(astronvim.user_plugin_opts("plugins.Comment", {
|
Comment.setup(astronvim.user_plugin_opts("plugins.Comment", {
|
||||||
pre_hook = function(ctx)
|
pre_hook = function(ctx)
|
||||||
local location = nil
|
local location = nil
|
||||||
if ctx.ctype == utils.ctype.block then
|
if ctx.ctype == utils.ctype.blockwise then
|
||||||
location = require("ts_context_commentstring.utils").get_cursor_location()
|
location = require("ts_context_commentstring.utils").get_cursor_location()
|
||||||
elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then
|
elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then
|
||||||
location = require("ts_context_commentstring.utils").get_visual_start_location()
|
location = require("ts_context_commentstring.utils").get_visual_start_location()
|
||||||
end
|
end
|
||||||
|
|
||||||
return require("ts_context_commentstring.internal").calculate_commentstring {
|
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,
|
location = location,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,13 @@
|
||||||
local status_ok, aerial = pcall(require, "aerial")
|
local status_ok, aerial = pcall(require, "aerial")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
|
aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
|
||||||
close_behavior = "global",
|
attach_mode = "global",
|
||||||
backends = { "lsp", "treesitter", "markdown" },
|
backends = { "lsp", "treesitter", "markdown" },
|
||||||
min_width = 28,
|
layout = {
|
||||||
|
min_width = 28,
|
||||||
|
},
|
||||||
show_guides = true,
|
show_guides = true,
|
||||||
filter_kind = false,
|
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 = {
|
guides = {
|
||||||
mid_item = "├ ",
|
mid_item = "├ ",
|
||||||
last_item = "└ ",
|
last_item = "└ ",
|
||||||
|
|
@ -41,11 +15,11 @@ aerial.setup(astronvim.user_plugin_opts("plugins.aerial", {
|
||||||
whitespace = " ",
|
whitespace = " ",
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
-- Jump forwards/backwards with '{' and '}'
|
-- Jump forwards/backwards with '[y' and ']y'
|
||||||
vim.keymap.set("n", "{", "<cmd>AerialPrev<cr>", { buffer = bufnr, desc = "Jump backwards in Aerial" })
|
vim.keymap.set("n", "[y", "<cmd>AerialPrev<cr>", { buffer = bufnr, desc = "Previous Aerial" })
|
||||||
vim.keymap.set("n", "}", "<cmd>AerialNext<cr>", { buffer = bufnr, desc = "Jump forwards in Aerial" })
|
vim.keymap.set("n", "]y", "<cmd>AerialNext<cr>", { buffer = bufnr, desc = "Next Aerial" })
|
||||||
-- Jump up the tree with '[[' or ']]'
|
-- Jump up the tree with '[Y' or ']Y'
|
||||||
vim.keymap.set("n", "[[", "<cmd>AerialPrevUp<cr>", { buffer = bufnr, desc = "Jump up and backwards in Aerial" })
|
vim.keymap.set("n", "[Y", "<cmd>AerialPrevUp<cr>", { buffer = bufnr, desc = "Previous and Up in Aerial" })
|
||||||
vim.keymap.set("n", "]]", "<cmd>AerialNextUp<cr>", { buffer = bufnr, desc = "Jump up and forwards in Aerial" })
|
vim.keymap.set("n", "]Y", "<cmd>AerialNextUp<cr>", { buffer = bufnr, desc = "Next and Up in Aerial" })
|
||||||
end,
|
end,
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ alpha.setup(astronvim.user_plugin_opts("plugins.alpha", {
|
||||||
{
|
{
|
||||||
type = "group",
|
type = "group",
|
||||||
val = {
|
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 o", " Recents "),
|
||||||
alpha_button("LDR f w", " Find Word "),
|
alpha_button("LDR f w", " Find Word "),
|
||||||
alpha_button("LDR f n", " New File "),
|
alpha_button("LDR f n", " New File "),
|
||||||
|
|
|
||||||
|
|
@ -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
|
local rules = astronvim.user_plugin_opts("nvim-autopairs").add_rules
|
||||||
if vim.tbl_contains({ "function", "table" }, type(rules)) then
|
if vim.tbl_contains({ "function", "table" }, type(rules)) then
|
||||||
npairs.add_rules(type(rules) == "function" and rules(npairs) or rules)
|
npairs.add_rules(type(rules) == "function" and rules(npairs) or rules)
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", {
|
||||||
{ filetype = "neo-tree", text = "", padding = 1 },
|
{ filetype = "neo-tree", text = "", padding = 1 },
|
||||||
{ filetype = "Outline", text = "", padding = 1 },
|
{ filetype = "Outline", text = "", padding = 1 },
|
||||||
},
|
},
|
||||||
buffer_close_icon = "",
|
buffer_close_icon = astronvim.get_icon "BufferClose",
|
||||||
modified_icon = "",
|
modified_icon = astronvim.get_icon "FileModified",
|
||||||
close_icon = "",
|
close_icon = astronvim.get_icon "NeovimClose",
|
||||||
max_name_length = 14,
|
max_name_length = 14,
|
||||||
max_prefix_length = 13,
|
max_prefix_length = 13,
|
||||||
tab_size = 20,
|
tab_size = 20,
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,10 @@
|
||||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||||
|
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||||
if not (cmp_status_ok and snip_status_ok) then return end
|
if not (cmp_status_ok and snip_status_ok) then return end
|
||||||
local setup = cmp.setup
|
local setup = cmp.setup
|
||||||
local kind_icons = {
|
local border_opts =
|
||||||
Text = "",
|
{ border = "single", winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None" }
|
||||||
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 function has_words_before()
|
local function has_words_before()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
|
@ -36,13 +12,14 @@ local function has_words_before()
|
||||||
end
|
end
|
||||||
|
|
||||||
setup(astronvim.user_plugin_opts("plugins.cmp", {
|
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,
|
preselect = cmp.PreselectMode.None,
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = { "kind", "abbr", "menu" },
|
fields = { "kind", "abbr", "menu" },
|
||||||
format = function(_, vim_item)
|
format = lspkind_status_ok and lspkind.cmp_format(astronvim.lspkind) or nil,
|
||||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||||
|
|
@ -59,17 +36,16 @@ setup(astronvim.user_plugin_opts("plugins.cmp", {
|
||||||
select = false,
|
select = false,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
documentation = {
|
completion = cmp.config.window.bordered(border_opts),
|
||||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
documentation = cmp.config.window.bordered(border_opts),
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
["<Up>"] = cmp.mapping.select_prev_item(),
|
["<Up>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select },
|
||||||
["<Down>"] = cmp.mapping.select_next_item(),
|
["<Down>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select },
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,3 @@
|
||||||
local status_ok, colorizer = pcall(require, "colorizer")
|
local status_ok, colorizer = pcall(require, "colorizer")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
local colorizer_opts = astronvim.user_plugin_opts("plugins.colorizer", {
|
colorizer.setup(astronvim.user_plugin_opts("plugins.colorizer", { user_default_options = { names = false } }))
|
||||||
{ "*" },
|
|
||||||
{
|
|
||||||
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])
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
local status_ok, dressing = pcall(require, "dressing")
|
local status_ok, dressing = pcall(require, "dressing")
|
||||||
if not status_ok then return end
|
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", {
|
dressing.setup(astronvim.user_plugin_opts("plugins.dressing", {
|
||||||
input = {
|
input = {
|
||||||
enabled = ui_opts.nui_input,
|
|
||||||
default_prompt = "➤ ",
|
default_prompt = "➤ ",
|
||||||
winhighlight = "Normal:Normal,NormalNC:Normal",
|
winhighlight = "Normal:Normal,NormalNC:Normal",
|
||||||
},
|
},
|
||||||
select = {
|
select = {
|
||||||
enabled = ui_opts.telescope_select,
|
|
||||||
backend = { "telescope", "builtin" },
|
backend = { "telescope", "builtin" },
|
||||||
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
})
|
||||||
|
|
@ -4,8 +4,6 @@ indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", {
|
||||||
buftype_exclude = {
|
buftype_exclude = {
|
||||||
"nofile",
|
"nofile",
|
||||||
"terminal",
|
"terminal",
|
||||||
"lsp-installer",
|
|
||||||
"lspinfo",
|
|
||||||
},
|
},
|
||||||
filetype_exclude = {
|
filetype_exclude = {
|
||||||
"help",
|
"help",
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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 })
|
||||||
|
)
|
||||||
|
|
@ -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 }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
@ -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 = "⟳",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
@ -2,60 +2,52 @@ local status_ok, neotree = pcall(require, "neo-tree")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", {
|
||||||
close_if_last_window = true,
|
close_if_last_window = true,
|
||||||
popup_border_style = "rounded",
|
|
||||||
enable_diagnostics = false,
|
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 = {
|
default_component_configs = {
|
||||||
indent = {
|
indent = {
|
||||||
padding = 0,
|
padding = 0,
|
||||||
with_expanders = false,
|
|
||||||
},
|
},
|
||||||
icon = {
|
icon = {
|
||||||
folder_closed = "",
|
folder_closed = astronvim.get_icon "FolderClosed",
|
||||||
folder_open = "",
|
folder_open = astronvim.get_icon "FolderOpen",
|
||||||
folder_empty = "",
|
folder_empty = astronvim.get_icon "FolderEmpty",
|
||||||
default = "",
|
default = astronvim.get_icon "DefaultFile",
|
||||||
},
|
},
|
||||||
git_status = {
|
git_status = {
|
||||||
symbols = {
|
symbols = {
|
||||||
added = "",
|
added = astronvim.get_icon "GitAdd",
|
||||||
deleted = "",
|
deleted = astronvim.get_icon "GitDelete",
|
||||||
modified = "",
|
modified = astronvim.get_icon "GitChange",
|
||||||
renamed = "➜",
|
renamed = astronvim.get_icon "GitRenamed",
|
||||||
untracked = "★",
|
untracked = astronvim.get_icon "GitUntracked",
|
||||||
ignored = "◌",
|
ignored = astronvim.get_icon "GitIgnored",
|
||||||
unstaged = "✗",
|
unstaged = astronvim.get_icon "GitUnstaged",
|
||||||
staged = "✓",
|
staged = astronvim.get_icon "GitStaged",
|
||||||
conflict = "",
|
conflict = astronvim.get_icon "GitConflict",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
width = 25,
|
width = 30,
|
||||||
mappings = {
|
mappings = {
|
||||||
["o"] = "open",
|
["o"] = "open",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filesystem = {
|
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,
|
follow_current_file = true,
|
||||||
hijack_netrw_behavior = "open_current",
|
hijack_netrw_behavior = "open_current",
|
||||||
use_libuv_file_watcher = true,
|
use_libuv_file_watcher = true,
|
||||||
},
|
},
|
||||||
git_status = {
|
|
||||||
window = {
|
|
||||||
position = "float",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
event_handlers = {
|
event_handlers = {
|
||||||
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },
|
{ event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
local status_ok, null_ls = pcall(require, "null-ls")
|
local status_ok, null_ls = pcall(require, "null-ls")
|
||||||
if not status_ok then return end
|
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 }))
|
||||||
|
|
|
||||||
|
|
@ -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" },
|
||||||
|
}))
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
json = {
|
||||||
|
schemas = require("schemastore").json.schemas(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
local status_ok, session_manager = pcall(require, "session_manager")
|
local status_ok, session_manager = pcall(require, "session_manager")
|
||||||
if not status_ok then return end
|
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")
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,13 @@ local status_ok, telescope = pcall(require, "telescope")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
local actions = require "telescope.actions"
|
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", {
|
telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
|
||||||
defaults = {
|
defaults = {
|
||||||
|
|
||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
selection_caret = "❯ ",
|
selection_caret = "❯ ",
|
||||||
path_display = { "truncate" },
|
path_display = { "truncate" },
|
||||||
selection_strategy = "reset",
|
|
||||||
sorting_strategy = "ascending",
|
sorting_strategy = "ascending",
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_config = {
|
layout_config = {
|
||||||
horizontal = {
|
horizontal = {
|
||||||
prompt_position = "top",
|
prompt_position = "top",
|
||||||
|
|
@ -32,64 +27,13 @@ telescope.setup(astronvim.user_plugin_opts("plugins.telescope", {
|
||||||
i = {
|
i = {
|
||||||
["<C-n>"] = actions.cycle_history_next,
|
["<C-n>"] = actions.cycle_history_next,
|
||||||
["<C-p>"] = actions.cycle_history_prev,
|
["<C-p>"] = actions.cycle_history_prev,
|
||||||
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
["<C-j>"] = actions.move_selection_next,
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
|
||||||
["<C-c>"] = actions.close,
|
|
||||||
|
|
||||||
["<Down>"] = actions.move_selection_next,
|
|
||||||
["<Up>"] = actions.move_selection_previous,
|
|
||||||
|
|
||||||
["<CR>"] = actions.select_default,
|
|
||||||
["<C-x>"] = actions.select_horizontal,
|
|
||||||
["<C-v>"] = actions.select_vertical,
|
|
||||||
["<C-t>"] = actions.select_tab,
|
|
||||||
|
|
||||||
["<C-u>"] = actions.preview_scrolling_up,
|
|
||||||
["<C-d>"] = actions.preview_scrolling_down,
|
|
||||||
|
|
||||||
["<PageUp>"] = actions.results_scrolling_up,
|
|
||||||
["<PageDown>"] = actions.results_scrolling_down,
|
|
||||||
|
|
||||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
|
||||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
|
||||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
|
||||||
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
|
||||||
["<C-l>"] = actions.complete_tag,
|
|
||||||
},
|
|
||||||
|
|
||||||
n = {
|
|
||||||
["<esc>"] = actions.close,
|
|
||||||
["<CR>"] = actions.select_default,
|
|
||||||
["<C-x>"] = actions.select_horizontal,
|
|
||||||
["<C-v>"] = actions.select_vertical,
|
|
||||||
["<C-t>"] = actions.select_tab,
|
|
||||||
|
|
||||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
|
||||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
|
||||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
|
||||||
["<M-q>"] = 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,
|
|
||||||
|
|
||||||
["<Down>"] = actions.move_selection_next,
|
|
||||||
["<Up>"] = actions.move_selection_previous,
|
|
||||||
["gg"] = actions.move_to_top,
|
|
||||||
["G"] = actions.move_to_bottom,
|
|
||||||
|
|
||||||
["<C-u>"] = actions.preview_scrolling_up,
|
|
||||||
["<C-d>"] = actions.preview_scrolling_down,
|
|
||||||
|
|
||||||
["<PageUp>"] = actions.results_scrolling_up,
|
|
||||||
["<PageDown>"] = 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")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ local status_ok, toggleterm = pcall(require, "toggleterm")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", {
|
toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", {
|
||||||
size = 10,
|
size = 10,
|
||||||
open_mapping = [[<c-\>]],
|
open_mapping = [[<F7>]],
|
||||||
shading_factor = 2,
|
shading_factor = 2,
|
||||||
direction = "float",
|
direction = "float",
|
||||||
float_opts = {
|
float_opts = {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
|
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||||
if not status_ok then return end
|
if not status_ok then return end
|
||||||
treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
|
treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", {
|
||||||
ensure_installed = {},
|
|
||||||
sync_install = false,
|
|
||||||
ignore_install = {},
|
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
|
|
|
||||||
|
|
@ -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 is_available = astronvim.is_available
|
||||||
local user_plugin_opts = astronvim.user_plugin_opts
|
local user_plugin_opts = astronvim.user_plugin_opts
|
||||||
local mappings = {
|
local mappings = {
|
||||||
n = {
|
n = {
|
||||||
["<leader>"] = {
|
["<leader>"] = {
|
||||||
f = { name = "File" },
|
f = { name = "File" },
|
||||||
p = { name = "Packer" },
|
p = { name = "Packages" },
|
||||||
l = { name = "LSP" },
|
l = { name = "LSP" },
|
||||||
|
u = { name = "UI" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -37,18 +36,4 @@ if is_available "telescope.nvim" then
|
||||||
init_table("n", "<leader>", "g")
|
init_table("n", "<leader>", "g")
|
||||||
end
|
end
|
||||||
|
|
||||||
mappings = user_plugin_opts("which-key.register_mappings", mappings)
|
astronvim.which_key_register(user_plugin_opts("which-key.register", mappings))
|
||||||
-- support previous legacy notation, deprecate at some point
|
|
||||||
mappings.n["<leader>"] = user_plugin_opts("which-key.register_n_leader", mappings.n["<leader>"])
|
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -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 })
|
||||||
|
)
|
||||||
|
|
@ -12,6 +12,30 @@ cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, {
|
||||||
callback = function() astronvim.set_url_match() end,
|
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
|
if is_available "alpha-nvim" then
|
||||||
augroup("alpha_settings", { clear = true })
|
augroup("alpha_settings", { clear = true })
|
||||||
if is_available "bufferline.nvim" then
|
if is_available "bufferline.nvim" then
|
||||||
|
|
@ -22,6 +46,7 @@ if is_available "alpha-nvim" then
|
||||||
callback = function()
|
callback = function()
|
||||||
local prev_showtabline = vim.opt.showtabline
|
local prev_showtabline = vim.opt.showtabline
|
||||||
vim.opt.showtabline = 0
|
vim.opt.showtabline = 0
|
||||||
|
vim.opt_local.winbar = nil
|
||||||
cmd("BufUnload", {
|
cmd("BufUnload", {
|
||||||
pattern = "<buffer>",
|
pattern = "<buffer>",
|
||||||
callback = function() vim.opt.showtabline = prev_showtabline end,
|
callback = function() vim.opt.showtabline = prev_showtabline end,
|
||||||
|
|
@ -78,31 +103,23 @@ if is_available "neo-tree.nvim" then
|
||||||
})
|
})
|
||||||
end
|
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 })
|
augroup("astronvim_highlights", { clear = true })
|
||||||
cmd({ "VimEnter", "ColorScheme" }, {
|
cmd({ "VimEnter", "ColorScheme" }, {
|
||||||
desc = "Load custom highlights from user configuration",
|
desc = "Load custom highlights from user configuration",
|
||||||
group = "astronvim_highlights",
|
group = "astronvim_highlights",
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.g.colors_name then
|
if vim.g.colors_name then
|
||||||
for group, spec in pairs(user_plugin_opts("highlights." .. vim.g.colors_name)) do
|
for _, module in ipairs { "init", vim.g.colors_name } do
|
||||||
vim.api.nvim_set_hl(0, group, spec)
|
for group, spec in pairs(user_plugin_opts("highlights." .. module)) do
|
||||||
|
vim.api.nvim_set_hl(0, group, spec)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
create_command("AstroUpdate", astronvim.updater.update, { desc = "Update AstroNvim" })
|
create_command("AstroUpdate", function() astronvim.updater.update() end, { desc = "Update AstroNvim" })
|
||||||
create_command("AstroVersion", astronvim.updater.version, { desc = "Check AstroNvim Version" })
|
create_command("AstroReload", function() astronvim.updater.reload() end, { desc = "Reload AstroNvim" })
|
||||||
create_command("ToggleHighlightURL", astronvim.toggle_url_match, { desc = "Toggle URL Highlights" })
|
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" })
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
astronvim.initialize_packer()
|
astronvim.initialize_packer()
|
||||||
|
|
||||||
local colorscheme = astronvim.user_plugin_opts("colorscheme", nil, false)
|
local colorscheme = astronvim.user_plugin_opts("colorscheme", nil, false)
|
||||||
vim.api.nvim_command(
|
vim.cmd.colorscheme(vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme")
|
||||||
"colorscheme "
|
|
||||||
.. (vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme")
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -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"])
|
||||||
|
|
@ -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 = "暈",
|
||||||
|
}
|
||||||
|
|
@ -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]",
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
local is_available = astronvim.is_available
|
local is_available = astronvim.is_available
|
||||||
|
|
||||||
local maps = { n = {}, v = {}, t = {}, [""] = {} }
|
local maps = { i = {}, n = {}, v = {}, t = {}, [""] = {} }
|
||||||
|
|
||||||
maps[""]["<Space>"] = "<Nop>"
|
maps[""]["<Space>"] = "<Nop>"
|
||||||
|
|
||||||
|
|
@ -9,7 +9,6 @@ maps[""]["<Space>"] = "<Nop>"
|
||||||
maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
|
maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
|
||||||
maps.n["<leader>q"] = { "<cmd>q<cr>", desc = "Quit" }
|
maps.n["<leader>q"] = { "<cmd>q<cr>", desc = "Quit" }
|
||||||
maps.n["<leader>h"] = { "<cmd>nohlsearch<cr>", desc = "No Highlight" }
|
maps.n["<leader>h"] = { "<cmd>nohlsearch<cr>", desc = "No Highlight" }
|
||||||
maps.n["<leader>u"] = { function() astronvim.toggle_url_match() end, desc = "Toggle URL Highlights" }
|
|
||||||
maps.n["<leader>fn"] = { "<cmd>enew<cr>", desc = "New File" }
|
maps.n["<leader>fn"] = { "<cmd>enew<cr>", desc = "New File" }
|
||||||
maps.n["gx"] = { function() astronvim.url_opener() end, desc = "Open the file under cursor with system app" }
|
maps.n["gx"] = { function() astronvim.url_opener() end, desc = "Open the file under cursor with system app" }
|
||||||
maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write" }
|
maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write" }
|
||||||
|
|
@ -23,14 +22,19 @@ maps.n["<leader>ps"] = { "<cmd>PackerSync<cr>", desc = "Packer Sync" }
|
||||||
maps.n["<leader>pS"] = { "<cmd>PackerStatus<cr>", desc = "Packer Status" }
|
maps.n["<leader>pS"] = { "<cmd>PackerStatus<cr>", desc = "Packer Status" }
|
||||||
maps.n["<leader>pu"] = { "<cmd>PackerUpdate<cr>", desc = "Packer Update" }
|
maps.n["<leader>pu"] = { "<cmd>PackerUpdate<cr>", desc = "Packer Update" }
|
||||||
|
|
||||||
|
-- AstroNvim
|
||||||
|
maps.n["<leader>pA"] = { "<cmd>AstroUpdate<cr>", desc = "AstroNvim Update" }
|
||||||
|
maps.n["<leader>pv"] = { "<cmd>AstroVersion<cr>", desc = "AstroNvim Version" }
|
||||||
|
maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" }
|
||||||
|
|
||||||
-- Alpha
|
-- Alpha
|
||||||
if is_available "alpha-nvim" then maps.n["<leader>d"] = { "<cmd>Alpha<cr>", desc = "Alpha Dashboard" } end
|
if is_available "alpha-nvim" then maps.n["<leader>d"] = { "<cmd>Alpha<cr>", desc = "Alpha Dashboard" } end
|
||||||
|
|
||||||
-- Bufdelete
|
-- Bufdelete
|
||||||
if is_available "bufdelete.nvim" then
|
if is_available "bufdelete.nvim" then
|
||||||
maps.n["<leader>c"] = { "<cmd>Bdelete<cr>", desc = "Close window" }
|
maps.n["<leader>c"] = { "<cmd>Bdelete<cr>", desc = "Close buffer" }
|
||||||
else
|
else
|
||||||
maps.n["<leader>c"] = { "<cmd>bdelete<cr>", desc = "Close window" }
|
maps.n["<leader>c"] = { "<cmd>bdelete<cr>", desc = "Close buffer" }
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Navigate buffers
|
-- Navigate buffers
|
||||||
|
|
@ -46,9 +50,9 @@ end
|
||||||
|
|
||||||
-- Comment
|
-- Comment
|
||||||
if is_available "Comment.nvim" then
|
if is_available "Comment.nvim" then
|
||||||
maps.n["<leader>/"] = { function() require("Comment.api").toggle_current_linewise() end, desc = "Comment line" }
|
maps.n["<leader>/"] = { function() require("Comment.api").toggle.linewise.current() end, desc = "Comment line" }
|
||||||
maps.v["<leader>/"] = {
|
maps.v["<leader>/"] = {
|
||||||
"<esc><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<cr>",
|
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||||
desc = "Toggle comment line",
|
desc = "Toggle comment line",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -82,12 +86,16 @@ if is_available "neovim-session-manager" then
|
||||||
{ "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" }
|
{ "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" }
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LSP Installer
|
-- Package Manager
|
||||||
if is_available "nvim-lsp-installer" then
|
if is_available "mason.nvim" then maps.n["<leader>pI"] = { "<cmd>Mason<cr>", desc = "Mason Installer" } end
|
||||||
maps.n["<leader>li"] = { "<cmd>LspInfo<cr>", desc = "LSP information" }
|
|
||||||
maps.n["<leader>lI"] = { "<cmd>LspInstallInfo<cr>", desc = "LSP installer" }
|
if is_available "mason-tool-installer.nvim" then
|
||||||
|
maps.n["<leader>pU"] = { "<cmd>MasonToolsUpdate<cr>", desc = "Mason Update" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- LSP Installer
|
||||||
|
if is_available "mason-lspconfig.nvim" then maps.n["<leader>li"] = { "<cmd>LspInfo<cr>", desc = "LSP information" } end
|
||||||
|
|
||||||
-- Smart Splits
|
-- Smart Splits
|
||||||
if is_available "smart-splits.nvim" then
|
if is_available "smart-splits.nvim" then
|
||||||
-- Better window navigation
|
-- Better window navigation
|
||||||
|
|
@ -159,6 +167,8 @@ if is_available "telescope.nvim" then
|
||||||
end,
|
end,
|
||||||
desc = "Search symbols",
|
desc = "Search symbols",
|
||||||
}
|
}
|
||||||
|
maps.n["<leader>lG"] =
|
||||||
|
{ function() require("telescope.builtin").lsp_workspace_symbols() end, desc = "Search workspace symbols" }
|
||||||
maps.n["<leader>lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" }
|
maps.n["<leader>lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" }
|
||||||
maps.n["<leader>lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" }
|
maps.n["<leader>lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" }
|
||||||
end
|
end
|
||||||
|
|
@ -166,28 +176,52 @@ end
|
||||||
-- Terminal
|
-- Terminal
|
||||||
if is_available "toggleterm.nvim" then
|
if is_available "toggleterm.nvim" then
|
||||||
local toggle_term_cmd = astronvim.toggle_term_cmd
|
local toggle_term_cmd = astronvim.toggle_term_cmd
|
||||||
maps.n["<C-\\>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
|
||||||
maps.n["<leader>gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
|
maps.n["<leader>gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
|
||||||
maps.n["<leader>tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" }
|
maps.n["<leader>tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" }
|
||||||
maps.n["<leader>tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" }
|
maps.n["<leader>tu"] = { function() toggle_term_cmd "gdu" end, desc = "ToggleTerm gdu" }
|
||||||
maps.n["<leader>tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" }
|
maps.n["<leader>tt"] = { function() toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
|
||||||
maps.n["<leader>tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" }
|
maps.n["<leader>tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" }
|
||||||
maps.n["<leader>tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
|
maps.n["<leader>tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
|
||||||
maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
||||||
maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
||||||
maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
|
maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
|
||||||
|
maps.n["<F7>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||||
|
maps.t["<F7>"] = maps.n["<F7>"]
|
||||||
|
maps.n["<C-'>"] = maps.n["<F7>"]
|
||||||
|
maps.t["<C-'>"] = maps.n["<F7>"]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Stay in indent mode
|
-- Stay in indent mode
|
||||||
maps.v["<"] = { "<gv", desc = "unindent line" }
|
maps.v["<"] = { "<gv", desc = "unindent line" }
|
||||||
maps.v[">"] = { ">gv", desc = "indent line" }
|
maps.v[">"] = { ">gv", desc = "indent line" }
|
||||||
|
|
||||||
-- Improved Terminal Mappings
|
-- Improved Terminal Navigation
|
||||||
maps.t["<esc>"] = { "<C-\\><C-n>", desc = "Terminal normal mode" }
|
|
||||||
maps.t["jk"] = { "<C-\\><C-n>", desc = "Terminal normal mode" }
|
|
||||||
maps.t["<C-h>"] = { "<c-\\><c-n><c-w>h", desc = "Terminal left window navigation" }
|
maps.t["<C-h>"] = { "<c-\\><c-n><c-w>h", desc = "Terminal left window navigation" }
|
||||||
maps.t["<C-j>"] = { "<c-\\><c-n><c-w>j", desc = "Terminal down window navigation" }
|
maps.t["<C-j>"] = { "<c-\\><c-n><c-w>j", desc = "Terminal down window navigation" }
|
||||||
maps.t["<C-k>"] = { "<c-\\><c-n><c-w>k", desc = "Terminal up window navigation" }
|
maps.t["<C-k>"] = { "<c-\\><c-n><c-w>k", desc = "Terminal up window navigation" }
|
||||||
maps.t["<C-l>"] = { "<c-\\><c-n><c-w>l", desc = "Terminal right window naviation" }
|
maps.t["<C-l>"] = { "<c-\\><c-n><c-w>l", desc = "Terminal right window naviation" }
|
||||||
|
|
||||||
|
-- Custom menu for modification of the user experience
|
||||||
|
if is_available "nvim-autopairs" then
|
||||||
|
maps.n["<leader>ua"] = { function() astronvim.ui.toggle_autopairs() end, desc = "Toggle autopairs" }
|
||||||
|
end
|
||||||
|
maps.n["<leader>ub"] = { function() astronvim.ui.toggle_background() end, desc = "Toggle background" }
|
||||||
|
if is_available "nvim-cmp" then
|
||||||
|
maps.n["<leader>uc"] = { function() astronvim.ui.toggle_cmp() end, desc = "Toggle autocompletion" }
|
||||||
|
end
|
||||||
|
if is_available "nvim-colorizer.lua" then
|
||||||
|
maps.n["<leader>uC"] = { "<cmd>ColorizerToggle<cr>", desc = "Toggle color highlight" }
|
||||||
|
end
|
||||||
|
maps.n["<leader>ud"] = { function() astronvim.ui.toggle_diagnostics() end, desc = "Toggle diagnostics" }
|
||||||
|
maps.n["<leader>ug"] = { function() astronvim.ui.toggle_signcolumn() end, desc = "Toggle signcolumn" }
|
||||||
|
maps.n["<leader>ui"] = { function() astronvim.ui.set_indent() end, desc = "Change indent setting" }
|
||||||
|
maps.n["<leader>ul"] = { function() astronvim.ui.toggle_statusline() end, desc = "Toggle statusline" }
|
||||||
|
maps.n["<leader>un"] = { function() astronvim.ui.change_number() end, desc = "Change line numbering" }
|
||||||
|
maps.n["<leader>us"] = { function() astronvim.ui.toggle_spell() end, desc = "Toggle spellcheck" }
|
||||||
|
maps.n["<leader>up"] = { function() astronvim.ui.toggle_paste() end, desc = "Toggle paste mode" }
|
||||||
|
maps.n["<leader>ut"] = { function() astronvim.ui.toggle_tabline() end, desc = "Toggle tabline" }
|
||||||
|
maps.n["<leader>uu"] = { function() astronvim.ui.toggle_url_match() end, desc = "Toggle URL highlight" }
|
||||||
|
maps.n["<leader>uw"] = { function() astronvim.ui.toggle_wrap() end, desc = "Toggle wrap" }
|
||||||
|
maps.n["<leader>uy"] = { function() astronvim.ui.toggle_syntax() end, desc = "Toggle syntax highlight" }
|
||||||
|
|
||||||
astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps))
|
astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps))
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
|
||||||
opt = {
|
opt = {
|
||||||
backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert
|
backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert
|
||||||
clipboard = "unnamedplus", -- Connection to the system clipboard
|
clipboard = "unnamedplus", -- Connection to the system clipboard
|
||||||
|
cmdheight = 0, -- hide command line unless needed
|
||||||
completeopt = { "menuone", "noselect" }, -- Options for insert mode completion
|
completeopt = { "menuone", "noselect" }, -- Options for insert mode completion
|
||||||
copyindent = true, -- Copy the previous indentation on autoindenting
|
copyindent = true, -- Copy the previous indentation on autoindenting
|
||||||
cursorline = true, -- Highlight the text line of the cursor
|
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
|
scrolloff = 8, -- Number of lines to keep above and below the cursor
|
||||||
shiftwidth = 2, -- Number of space inserted for indentation
|
shiftwidth = 2, -- Number of space inserted for indentation
|
||||||
showmode = false, -- Disable showing modes in command line
|
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
|
sidescrolloff = 8, -- Number of columns to keep at the sides of the cursor
|
||||||
signcolumn = "yes", -- Always show the sign column
|
signcolumn = "yes", -- Always show the sign column
|
||||||
smartcase = true, -- Case sensitivie searching
|
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
|
writebackup = false, -- Disable making a backup before overwriting a file
|
||||||
},
|
},
|
||||||
g = {
|
g = {
|
||||||
do_filetype_lua = 1, -- use filetype.lua
|
|
||||||
did_load_filetypes = 0, -- don't use filetype.vim
|
|
||||||
highlighturl_enabled = true, -- highlight URLs by default
|
highlighturl_enabled = true, -- highlight URLs by default
|
||||||
mapleader = " ", -- set leader key
|
mapleader = " ", -- set leader key
|
||||||
zipPlugin = false, -- disable zip
|
zipPlugin = false, -- disable zip
|
||||||
|
|
@ -57,5 +57,11 @@ astronvim.vim_opts(astronvim.user_plugin_opts("options", {
|
||||||
loaded_zipPlugin = true, -- disable zip
|
loaded_zipPlugin = true, -- disable zip
|
||||||
loaded_vimball = true, -- disable vimball
|
loaded_vimball = true, -- disable vimball
|
||||||
loaded_vimballPlugin = 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)
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -8,33 +8,24 @@ local astro_plugins = {
|
||||||
-- Lua functions
|
-- Lua functions
|
||||||
["nvim-lua/plenary.nvim"] = { module = "plenary" },
|
["nvim-lua/plenary.nvim"] = { module = "plenary" },
|
||||||
|
|
||||||
-- Popup API
|
|
||||||
["nvim-lua/popup.nvim"] = {},
|
|
||||||
|
|
||||||
-- Indent detection
|
-- Indent detection
|
||||||
["Darazaki/indent-o-matic"] = {
|
["Darazaki/indent-o-matic"] = {
|
||||||
event = "BufReadPost",
|
event = "BufEnter",
|
||||||
config = function() require "configs.indent-o-matic" end,
|
config = function() require "configs.indent-o-matic" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Notification Enhancer
|
-- Notification Enhancer
|
||||||
["rcarriga/nvim-notify"] = {
|
["rcarriga/nvim-notify"] = {
|
||||||
event = "VimEnter",
|
event = "UIEnter",
|
||||||
config = function() require "configs.notify" end,
|
config = function() require "configs.notify" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Neovim UI Enhancer
|
-- Neovim UI Enhancer
|
||||||
["stevearc/dressing.nvim"] = {
|
["stevearc/dressing.nvim"] = {
|
||||||
event = "VimEnter",
|
event = "UIEnter",
|
||||||
config = function() require "configs.dressing" end,
|
config = function() require "configs.dressing" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Cursorhold fix
|
|
||||||
["antoinemadec/FixCursorHold.nvim"] = {
|
|
||||||
event = { "BufRead", "BufNewFile" },
|
|
||||||
config = function() vim.g.cursorhold_updatetime = 100 end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Smarter Splits
|
-- Smarter Splits
|
||||||
["mrjones2014/smart-splits.nvim"] = {
|
["mrjones2014/smart-splits.nvim"] = {
|
||||||
module = "smart-splits",
|
module = "smart-splits",
|
||||||
|
|
@ -43,19 +34,33 @@ local astro_plugins = {
|
||||||
|
|
||||||
-- Icons
|
-- Icons
|
||||||
["kyazdani42/nvim-web-devicons"] = {
|
["kyazdani42/nvim-web-devicons"] = {
|
||||||
event = "VimEnter",
|
disable = not vim.g.icons_enabled,
|
||||||
config = function() require "configs.icons" end,
|
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
|
-- Bufferline
|
||||||
["akinsho/bufferline.nvim"] = {
|
["akinsho/bufferline.nvim"] = {
|
||||||
after = "nvim-web-devicons",
|
event = "UIEnter",
|
||||||
config = function() require "configs.bufferline" end,
|
config = function() require "configs.bufferline" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Better buffer closing
|
-- Better buffer closing
|
||||||
["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } },
|
["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } },
|
||||||
|
|
||||||
|
["s1n7ax/nvim-window-picker"] = {
|
||||||
|
tag = "v1.*",
|
||||||
|
module = "window-picker",
|
||||||
|
config = function() require "configs.window-picker" end,
|
||||||
|
},
|
||||||
|
|
||||||
-- File explorer
|
-- File explorer
|
||||||
["nvim-neo-tree/neo-tree.nvim"] = {
|
["nvim-neo-tree/neo-tree.nvim"] = {
|
||||||
branch = "v2.x",
|
branch = "v2.x",
|
||||||
|
|
@ -67,10 +72,7 @@ local astro_plugins = {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Statusline
|
-- Statusline
|
||||||
["feline-nvim/feline.nvim"] = {
|
["rebelot/heirline.nvim"] = { config = function() require "configs.heirline" end },
|
||||||
after = "nvim-web-devicons",
|
|
||||||
config = function() require "configs.feline" end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Parenthesis highlighting
|
-- Parenthesis highlighting
|
||||||
["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" },
|
["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" },
|
||||||
|
|
@ -84,7 +86,7 @@ local astro_plugins = {
|
||||||
-- Syntax highlighting
|
-- Syntax highlighting
|
||||||
["nvim-treesitter/nvim-treesitter"] = {
|
["nvim-treesitter/nvim-treesitter"] = {
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
event = { "BufRead", "BufNewFile" },
|
event = "BufEnter",
|
||||||
cmd = {
|
cmd = {
|
||||||
"TSInstall",
|
"TSInstall",
|
||||||
"TSInstallInfo",
|
"TSInstallInfo",
|
||||||
|
|
@ -139,15 +141,27 @@ local astro_plugins = {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Built-in LSP
|
-- 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
|
-- LSP manager
|
||||||
["williamboman/nvim-lsp-installer"] = {
|
["williamboman/mason-lspconfig.nvim"] = {
|
||||||
after = "nvim-lspconfig",
|
after = { "mason.nvim", "nvim-lspconfig" },
|
||||||
config = function()
|
config = function() require "configs.mason-lspconfig" end,
|
||||||
require "configs.nvim-lsp-installer"
|
},
|
||||||
require "configs.lsp"
|
|
||||||
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
|
-- LSP symbols
|
||||||
|
|
@ -157,12 +171,6 @@ local astro_plugins = {
|
||||||
config = function() require "configs.aerial" end,
|
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
|
-- Fuzzy finder
|
||||||
["nvim-telescope/telescope.nvim"] = {
|
["nvim-telescope/telescope.nvim"] = {
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
|
|
@ -171,10 +179,13 @@ local astro_plugins = {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Fuzzy finder syntax support
|
-- 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",
|
after = "telescope.nvim",
|
||||||
run = vim.fn.has "win32" ~= 1 and "make" or nil,
|
disable = vim.fn.executable "make" + vim.fn.executable "cmake" == 0,
|
||||||
config = function() require("telescope").load_extension(vim.fn.has "win32" == 1 and "fzy_native" or "fzf") end,
|
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
|
-- Git integration
|
||||||
|
|
@ -191,8 +202,8 @@ local astro_plugins = {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Color highlighting
|
-- Color highlighting
|
||||||
["norcalli/nvim-colorizer.lua"] = {
|
["NvChad/nvim-colorizer.lua"] = {
|
||||||
event = { "BufRead", "BufNewFile" },
|
event = "BufEnter",
|
||||||
config = function() require "configs.colorizer" end,
|
config = function() require "configs.colorizer" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -218,7 +229,7 @@ local astro_plugins = {
|
||||||
|
|
||||||
-- Indentation
|
-- Indentation
|
||||||
["lukas-reineke/indent-blankline.nvim"] = {
|
["lukas-reineke/indent-blankline.nvim"] = {
|
||||||
event = "BufRead",
|
event = "BufEnter",
|
||||||
config = function() require "configs.indent-line" end,
|
config = function() require "configs.indent-line" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -228,12 +239,6 @@ local astro_plugins = {
|
||||||
config = function() require "configs.which-key" end,
|
config = function() require "configs.which-key" end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Smooth scrolling
|
|
||||||
["declancm/cinnamon.nvim"] = {
|
|
||||||
event = { "BufRead", "BufNewFile" },
|
|
||||||
config = function() require "configs.cinnamon" end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Smooth escaping
|
-- Smooth escaping
|
||||||
["max397574/better-escape.nvim"] = {
|
["max397574/better-escape.nvim"] = {
|
||||||
event = "InsertCharPre",
|
event = "InsertCharPre",
|
||||||
|
|
|
||||||
|
|
@ -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/" }
|
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
|
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
|
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
|
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
|
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
|
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
|
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, ...)
|
function git.branch_contains(remote, branch, commit, ...)
|
||||||
return git.cmd("merge-base --is-ancestor " .. commit .. " " .. remote .. "/" .. branch, ...) ~= nil
|
return git.cmd("merge-base --is-ancestor " .. commit .. " " .. remote .. "/" .. branch, ...) ~= nil
|
||||||
end
|
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
|
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
|
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
|
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
|
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
|
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
|
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, ...)
|
function git.remote_head(remote, branch, ...)
|
||||||
return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. remote .. "/" .. branch, ...))
|
return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. remote .. "/" .. branch, ...))
|
||||||
end
|
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
|
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, ...)
|
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 {}
|
return log and vim.fn.split(log, "\n") or {}
|
||||||
end
|
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, ...)
|
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 {}
|
return tags and vim.fn.split(tags, "\n") or {}
|
||||||
end
|
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, ...)
|
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]
|
return versions[#versions]
|
||||||
end
|
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)
|
function git.parse_remote_url(str)
|
||||||
return vim.fn.match(str, astronvim.url_matcher) == -1
|
return vim.fn.match(str, astronvim.url_matcher) == -1
|
||||||
and git.url .. str .. (vim.fn.match(str, "/") == -1 and "/AstroNvim.git" or ".git")
|
and git.url .. str .. (vim.fn.match(str, "/") == -1 and "/AstroNvim.git" or ".git")
|
||||||
or str
|
or str
|
||||||
end
|
end
|
||||||
|
|
||||||
function git.breaking_changes(commits)
|
--- Check if a Conventional Commit commit message is breaking or not
|
||||||
return vim.tbl_filter(
|
-- @param commit a commit message
|
||||||
function(v) return vim.fn.match(v, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 end,
|
-- @return boolean true if the message is breaking, false if the commit message is not breaking
|
||||||
commits
|
function git.is_breaking(commit) return vim.fn.match(commit, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 end
|
||||||
)
|
|
||||||
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)
|
function git.pretty_changelog(commits)
|
||||||
local changelog = {}
|
local changelog = {}
|
||||||
for _, commit in ipairs(commits) do
|
for _, commit in ipairs(commits) do
|
||||||
local hash, type, msg = commit:match "(%[.*%])(.*:)(.*)"
|
local hash, type, msg = commit:match "(%[.*%])(.*:)(.*)"
|
||||||
if hash and type and msg then
|
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
|
||||||
end
|
end
|
||||||
return changelog
|
return changelog
|
||||||
|
|
|
||||||
|
|
@ -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 = {}
|
_G.astronvim = {}
|
||||||
local stdpath = vim.fn.stdpath
|
local stdpath = vim.fn.stdpath
|
||||||
local tbl_insert = table.insert
|
local tbl_insert = table.insert
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
--- installation details from external installers
|
||||||
astronvim.install = astronvim_installation or { home = stdpath "config" }
|
astronvim.install = astronvim_installation or { home = stdpath "config" }
|
||||||
|
--- external astronvim configuration folder
|
||||||
astronvim.install.config = stdpath("config"):gsub("nvim$", "astronvim")
|
astronvim.install.config = stdpath("config"):gsub("nvim$", "astronvim")
|
||||||
vim.opt.rtp:append(astronvim.install.config)
|
vim.opt.rtp:append(astronvim.install.config)
|
||||||
local supported_configs = { astronvim.install.home, 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)
|
local function load_module_file(module)
|
||||||
|
-- placeholder for final return value
|
||||||
local found_module = nil
|
local found_module = nil
|
||||||
|
-- search through each of the supported configuration locations
|
||||||
for _, config_path in ipairs(supported_configs) do
|
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"
|
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
|
if vim.fn.filereadable(module_path) == 1 then found_module = module_path end
|
||||||
end
|
end
|
||||||
|
-- if we found a readable lua file, try to load it
|
||||||
if found_module then
|
if found_module then
|
||||||
|
-- try to load the file
|
||||||
local status_ok, loaded_module = pcall(require, module)
|
local status_ok, loaded_module = pcall(require, module)
|
||||||
|
-- if successful at loading, set the return variable
|
||||||
if status_ok then
|
if status_ok then
|
||||||
found_module = loaded_module
|
found_module = loaded_module
|
||||||
|
-- if unsuccessful, throw an error
|
||||||
else
|
else
|
||||||
astronvim.notify("Error loading " .. found_module, "error")
|
vim.api.nvim_err_writeln("Error loading file: " .. found_module .. "\n\n" .. loaded_module)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- return the loaded module or nil if no file found
|
||||||
return found_module
|
return found_module
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- user settings from the base `user/init.lua` file
|
||||||
astronvim.user_settings = load_module_file "user.init"
|
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"
|
astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua"
|
||||||
|
--- table of user created terminals
|
||||||
astronvim.user_terminals = {}
|
astronvim.user_terminals = {}
|
||||||
|
--- regex used for matching a valid URL/URI string
|
||||||
astronvim.url_matcher =
|
astronvim.url_matcher =
|
||||||
"\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+"
|
"\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+"
|
||||||
|
|
||||||
|
--- 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)
|
local function func_or_extend(overrides, default, extend)
|
||||||
|
-- if we want to extend the default with the provided override
|
||||||
if extend then
|
if extend then
|
||||||
|
-- if the override is a table, use vim.tbl_deep_extend
|
||||||
if type(overrides) == "table" then
|
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
|
elseif type(overrides) == "function" then
|
||||||
default = overrides(default)
|
default = overrides(default)
|
||||||
end
|
end
|
||||||
|
-- if extend is set to false and we have a provided override, simply override the default
|
||||||
elseif overrides ~= nil then
|
elseif overrides ~= nil then
|
||||||
default = overrides
|
default = overrides
|
||||||
end
|
end
|
||||||
|
-- return the modified default table
|
||||||
return default
|
return default
|
||||||
end
|
end
|
||||||
|
|
||||||
function astronvim.conditional_func(func, condition, ...)
|
--- Merge extended options with a default table of options
|
||||||
if (condition == nil and true or condition) and type(func) == "function" then return func(...) end
|
-- @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
|
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.trim_or_nil(str) return type(str) == "string" and vim.trim(str) or nil end
|
||||||
|
|
||||||
function astronvim.notify(msg, type, opts)
|
--- Add left and/or right padding to a string
|
||||||
vim.notify(msg, type, vim.tbl_deep_extend("force", { title = "AstroNvim" }, opts or {}))
|
-- @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
|
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)
|
function astronvim.echo(messages)
|
||||||
|
-- if no parameter provided, echo a new line
|
||||||
messages = messages or { { "\n" } }
|
messages = messages or { { "\n" } }
|
||||||
if type(messages) == "table" then vim.api.nvim_echo(messages, false, {}) end
|
if type(messages) == "table" then vim.api.nvim_echo(messages, false, {}) end
|
||||||
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)
|
function astronvim.confirm_prompt(messages)
|
||||||
if messages then astronvim.echo(messages) end
|
if messages then astronvim.echo(messages) end
|
||||||
local confirmed = string.lower(vim.fn.input "(y/n) ") == "y"
|
local confirmed = string.lower(vim.fn.input "(y/n) ") == "y"
|
||||||
|
|
@ -67,20 +166,33 @@ function astronvim.confirm_prompt(messages)
|
||||||
return confirmed
|
return confirmed
|
||||||
end
|
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)
|
local function user_setting_table(module)
|
||||||
|
-- get the user settings table
|
||||||
local settings = astronvim.user_settings or {}
|
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
|
for tbl in string.gmatch(module, "([^%.]+)") do
|
||||||
settings = settings[tbl]
|
settings = settings[tbl]
|
||||||
|
-- if key doesn't exist, keep the nil value and stop searching
|
||||||
if settings == nil then break end
|
if settings == nil then break end
|
||||||
end
|
end
|
||||||
|
-- return the found settings
|
||||||
return settings
|
return settings
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Check if packer is installed and loadable, if not then install it and make sure it loads
|
||||||
function astronvim.initialize_packer()
|
function astronvim.initialize_packer()
|
||||||
|
-- try loading packer
|
||||||
local packer_avail, _ = pcall(require, "packer")
|
local packer_avail, _ = pcall(require, "packer")
|
||||||
|
-- if packer isn't availble, reinstall it
|
||||||
if not packer_avail then
|
if not packer_avail then
|
||||||
|
-- set the location to install packer
|
||||||
local packer_path = stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
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")
|
vim.fn.delete(packer_path, "rf")
|
||||||
|
-- clone packer
|
||||||
vim.fn.system {
|
vim.fn.system {
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
|
|
@ -90,22 +202,30 @@ function astronvim.initialize_packer()
|
||||||
packer_path,
|
packer_path,
|
||||||
}
|
}
|
||||||
astronvim.echo { { "Initializing Packer...\n\n" } }
|
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")
|
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
|
if not packer_avail then vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path) end
|
||||||
end
|
end
|
||||||
|
-- if packer is available, check if there is a compiled packer file
|
||||||
if packer_avail then
|
if packer_avail then
|
||||||
|
-- try to load the packer compiled file
|
||||||
local run_me, _ = loadfile(
|
local run_me, _ = loadfile(
|
||||||
astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path
|
astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path
|
||||||
)
|
)
|
||||||
|
-- if the file loads, run the compiled function
|
||||||
if run_me then
|
if run_me then
|
||||||
run_me()
|
run_me()
|
||||||
|
-- if there is no compiled file, prompt the user to run :PackerSync
|
||||||
else
|
else
|
||||||
astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } }
|
astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set vim options with a nested table like API with the format vim.<first_key>.<second_key>.<value>
|
||||||
|
-- @param options the nested table of vim options
|
||||||
function astronvim.vim_opts(options)
|
function astronvim.vim_opts(options)
|
||||||
for scope, table in pairs(options) do
|
for scope, table in pairs(options) do
|
||||||
for setting, value in pairs(table) do
|
for setting, value in pairs(table) do
|
||||||
|
|
@ -114,20 +234,36 @@ function astronvim.vim_opts(options)
|
||||||
end
|
end
|
||||||
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)
|
function astronvim.user_plugin_opts(module, default, extend, prefix)
|
||||||
|
-- default to extend = true
|
||||||
if extend == nil then extend = true end
|
if extend == nil then extend = true end
|
||||||
|
-- if no default table is provided set it to an empty table
|
||||||
default = default or {}
|
default = default or {}
|
||||||
|
-- try to load a module file if it exists
|
||||||
local user_settings = load_module_file((prefix or "user") .. "." .. module)
|
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 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
|
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
|
return default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Open a URL under the cursor with the current operating system
|
||||||
function astronvim.url_opener()
|
function astronvim.url_opener()
|
||||||
|
-- if mac use the open command
|
||||||
if vim.fn.has "mac" == 1 then
|
if vim.fn.has "mac" == 1 then
|
||||||
vim.fn.jobstart({ "open", vim.fn.expand "<cfile>" }, { detach = true })
|
vim.fn.jobstart({ "open", vim.fn.expand "<cfile>" }, { detach = true })
|
||||||
|
-- if unix then use xdg-open
|
||||||
elseif vim.fn.has "unix" == 1 then
|
elseif vim.fn.has "unix" == 1 then
|
||||||
vim.fn.jobstart({ "xdg-open", vim.fn.expand "<cfile>" }, { detach = true })
|
vim.fn.jobstart({ "xdg-open", vim.fn.expand "<cfile>" }, { detach = true })
|
||||||
|
-- if any other operating system notify the user that there is currently no support
|
||||||
else
|
else
|
||||||
astronvim.notify("gx is not supported on this OS!", "error")
|
astronvim.notify("gx is not supported on this OS!", "error")
|
||||||
end
|
end
|
||||||
|
|
@ -135,64 +271,142 @@ end
|
||||||
|
|
||||||
-- term_details can be either a string for just a command or
|
-- 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()
|
-- 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)
|
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
|
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
|
local term_key = term_details.cmd
|
||||||
|
-- set the count in the term details
|
||||||
if vim.v.count > 0 and term_details.count == nil then
|
if vim.v.count > 0 and term_details.count == nil then
|
||||||
term_details.count = vim.v.count
|
term_details.count = vim.v.count
|
||||||
term_key = term_key .. vim.v.count
|
term_key = term_key .. vim.v.count
|
||||||
end
|
end
|
||||||
|
-- if terminal doesn't exist yet, create it
|
||||||
if astronvim.user_terminals[term_key] == nil then
|
if astronvim.user_terminals[term_key] == nil then
|
||||||
astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details)
|
astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details)
|
||||||
end
|
end
|
||||||
|
-- toggle the terminal
|
||||||
astronvim.user_terminals[term_key]:toggle()
|
astronvim.user_terminals[term_key]:toggle()
|
||||||
end
|
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)
|
function astronvim.add_cmp_source(source)
|
||||||
|
-- load cmp if available
|
||||||
local cmp_avail, cmp = pcall(require, "cmp")
|
local cmp_avail, cmp = pcall(require, "cmp")
|
||||||
if cmp_avail then
|
if cmp_avail then
|
||||||
|
-- get the current cmp config
|
||||||
local config = cmp.get_config()
|
local config = cmp.get_config()
|
||||||
|
-- add the source to the list of sources
|
||||||
tbl_insert(config.sources, source)
|
tbl_insert(config.sources, source)
|
||||||
|
-- call the setup function again
|
||||||
cmp.setup(config)
|
cmp.setup(config)
|
||||||
end
|
end
|
||||||
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)
|
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
|
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", {
|
local priority = astronvim.user_plugin_opts("cmp.source_priority", {
|
||||||
nvim_lsp = 1000,
|
nvim_lsp = 1000,
|
||||||
luasnip = 750,
|
luasnip = 750,
|
||||||
buffer = 500,
|
buffer = 500,
|
||||||
path = 250,
|
path = 250,
|
||||||
})[source.name]
|
})[source.name]
|
||||||
|
-- if a priority is found, set it in the source
|
||||||
if priority then source.priority = priority end
|
if priority then source.priority = priority end
|
||||||
|
-- return the source table
|
||||||
return source
|
return source
|
||||||
end
|
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
|
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)
|
function astronvim.null_ls_providers(filetype)
|
||||||
local registered = {}
|
local registered = {}
|
||||||
|
-- try to load null-ls
|
||||||
local sources_avail, sources = pcall(require, "null-ls.sources")
|
local sources_avail, sources = pcall(require, "null-ls.sources")
|
||||||
if sources_avail then
|
if sources_avail then
|
||||||
|
-- get the available sources of a given filetype
|
||||||
for _, source in ipairs(sources.get_available(filetype)) do
|
for _, source in ipairs(sources.get_available(filetype)) do
|
||||||
|
-- get each source name
|
||||||
for method in pairs(source.methods) do
|
for method in pairs(source.methods) do
|
||||||
registered[method] = registered[method] or {}
|
registered[method] = registered[method] or {}
|
||||||
tbl_insert(registered[method], source.name)
|
tbl_insert(registered[method], source.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- return the found null-ls sources
|
||||||
return registered
|
return registered
|
||||||
end
|
end
|
||||||
|
|
||||||
function astronvim.null_ls_sources(filetype, source)
|
--- Register a null-ls source given a name if it has not been manually configured in the null-ls configuration
|
||||||
local methods_avail, methods = pcall(require, "null-ls.methods")
|
-- @param source the source name to register from all builtin types
|
||||||
return methods_avail and astronvim.null_ls_providers(filetype)[methods.internal[source]] or {}
|
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
|
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)
|
function astronvim.alpha_button(sc, txt)
|
||||||
|
-- replace <leader> in shortcut text with LDR for nicer printing
|
||||||
local sc_ = sc:gsub("%s", ""):gsub("LDR", "<leader>")
|
local sc_ = sc:gsub("%s", ""):gsub("LDR", "<leader>")
|
||||||
|
-- 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
|
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 {
|
return {
|
||||||
type = "button",
|
type = "button",
|
||||||
val = txt,
|
val = txt,
|
||||||
|
|
@ -213,42 +427,54 @@ function astronvim.alpha_button(sc, txt)
|
||||||
}
|
}
|
||||||
end
|
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
|
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)
|
function astronvim.set_mappings(map_table, base)
|
||||||
|
-- iterate over the first keys for each mode
|
||||||
for mode, maps in pairs(map_table) do
|
for mode, maps in pairs(map_table) do
|
||||||
|
-- iterate over each keybinding set in the current mode
|
||||||
for keymap, options in pairs(maps) do
|
for keymap, options in pairs(maps) do
|
||||||
|
-- build the options for the command accordingly
|
||||||
if options then
|
if options then
|
||||||
local cmd = options
|
local cmd = options
|
||||||
|
local keymap_opts = base or {}
|
||||||
if type(options) == "table" then
|
if type(options) == "table" then
|
||||||
cmd = options[1]
|
cmd = options[1]
|
||||||
options[1] = nil
|
keymap_opts = vim.tbl_deep_extend("force", options, keymap_opts)
|
||||||
else
|
keymap_opts[1] = nil
|
||||||
options = {}
|
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Delete the syntax matching rules for URLs/URIs if set
|
||||||
function astronvim.delete_url_match()
|
function astronvim.delete_url_match()
|
||||||
for _, match in ipairs(vim.fn.getmatches()) do
|
for _, match in ipairs(vim.fn.getmatches()) do
|
||||||
if match.group == "HighlightURL" then vim.fn.matchdelete(match.id) end
|
if match.group == "HighlightURL" then vim.fn.matchdelete(match.id) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add syntax matching rules for highlighting URLs/URIs
|
||||||
function astronvim.set_url_match()
|
function astronvim.set_url_match()
|
||||||
astronvim.delete_url_match()
|
astronvim.delete_url_match()
|
||||||
if vim.g.highlighturl_enabled then vim.fn.matchadd("HighlightURL", astronvim.url_matcher, 15) end
|
if vim.g.highlighturl_enabled then vim.fn.matchadd("HighlightURL", astronvim.url_matcher, 15) end
|
||||||
end
|
end
|
||||||
|
|
||||||
function astronvim.toggle_url_match()
|
--- Run a shell command and capture the output and if the command succeeded or failed
|
||||||
vim.g.highlighturl_enabled = not vim.g.highlighturl_enabled
|
-- @param cmd the terminal command to execute
|
||||||
astronvim.set_url_match()
|
-- @param show_error boolean of whether or not to show an unsuccessful command as an error to the user
|
||||||
end
|
-- @return the result of a successfully executed command or nil
|
||||||
|
|
||||||
function astronvim.cmd(cmd, show_error)
|
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 result = vim.fn.system(cmd)
|
||||||
local success = vim.api.nvim_get_vvar "shell_error" == 0
|
local success = vim.api.nvim_get_vvar "shell_error" == 0
|
||||||
if not success and (show_error == nil and true or show_error) then
|
if not success and (show_error == nil and true or show_error) then
|
||||||
|
|
@ -257,6 +483,9 @@ function astronvim.cmd(cmd, show_error)
|
||||||
return success and result or nil
|
return success and result or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "core.utils.ui"
|
||||||
|
require "core.utils.status"
|
||||||
require "core.utils.updater"
|
require "core.utils.updater"
|
||||||
|
require "core.utils.lsp"
|
||||||
|
|
||||||
return astronvim
|
return astronvim
|
||||||
|
|
|
||||||
|
|
@ -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 = {
|
||||||
|
["<leader>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["<leader>la"] = { function() vim.lsp.buf.code_action() end, desc = "LSP code action" }
|
||||||
|
lsp_mappings.v["<leader>la"] = lsp_mappings.n["<leader>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["<leader>lf"] = {
|
||||||
|
function() vim.lsp.buf.format(astronvim.lsp.format_opts) end,
|
||||||
|
desc = "Format code",
|
||||||
|
}
|
||||||
|
lsp_mappings.v["<leader>lf"] = lsp_mappings.n["<leader>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["<leader>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["<leader>lr"] = { function() vim.lsp.buf.rename() end, desc = "Rename current symbol" }
|
||||||
|
end
|
||||||
|
|
||||||
|
if capabilities.signatureHelpProvider then
|
||||||
|
lsp_mappings.n["<leader>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 = { ["<leader>"] = { l = { name = "LSP" } } } }, { buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
local on_attach_override = user_plugin_opts("lsp.on_attach", nil, false)
|
||||||
|
local aerial_avail, aerial = pcall(require, "aerial")
|
||||||
|
conditional_func(on_attach_override, true, client, bufnr)
|
||||||
|
conditional_func(aerial.on_attach, aerial_avail, client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- The default AstroNvim LSP capabilities
|
||||||
|
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
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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
|
||||||
|
|
@ -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 fn = vim.fn
|
||||||
local git = require "core.utils.git"
|
local git = require "core.utils.git"
|
||||||
local options = astronvim.user_plugin_opts(
|
--- Updater settings overridden with any user provided configuration
|
||||||
"updater",
|
local options = astronvim.user_plugin_opts("updater", {
|
||||||
{ remote = "origin", branch = "main", channel = "nightly", show_changelog = true }
|
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
|
if astronvim.install.is_stable ~= nil then options.channel = astronvim.install.is_stable and "stable" or "nightly" end
|
||||||
|
|
||||||
astronvim.updater = { options = options }
|
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
|
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")
|
local loaded, snapshot = pcall(fn.readfile, astronvim.install.home .. "/packer_snapshot")
|
||||||
if loaded then
|
if loaded then
|
||||||
|
-- decode the snapshot JSON and save it to a variable
|
||||||
loaded, snapshot = pcall(fn.json_decode, snapshot)
|
loaded, snapshot = pcall(fn.json_decode, snapshot)
|
||||||
astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil
|
astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil
|
||||||
end
|
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
|
if not loaded then vim.api.nvim_err_writeln "Error loading packer snapshot" end
|
||||||
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)
|
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
|
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)
|
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
|
if options.channel == "stable" or options.commit then
|
||||||
return git.checkout(target, false)
|
return git.checkout(target, false)
|
||||||
|
-- if no target, pull the latest
|
||||||
else
|
else
|
||||||
return git.pull(false)
|
return git.pull(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Cancelled update message
|
||||||
local cancelled_message = { { "Update cancelled", "WarningMsg" } }
|
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()
|
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
|
if not git.is_repo() then
|
||||||
astronvim.notify("Updater not available for non-git installations", "error")
|
astronvim.notify("Updater not available for non-git installations", "error")
|
||||||
return
|
return
|
||||||
end
|
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
|
for remote, entry in pairs(options.remotes and options.remotes or {}) do
|
||||||
local url = git.parse_remote_url(entry)
|
local url = git.parse_remote_url(entry)
|
||||||
local current_url = git.remote_url(remote, false)
|
local current_url = git.remote_url(remote, false)
|
||||||
|
|
@ -65,29 +137,43 @@ function astronvim.updater.update()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local is_stable = options.channel == "stable"
|
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
|
if not git.fetch(options.remote) then
|
||||||
vim.api.nvim_err_writeln("Error fetching remote: " .. options.remote)
|
vim.api.nvim_err_writeln("Error fetching remote: " .. options.remote)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch
|
-- switch to the necessary branch only if not on the stable channel
|
||||||
if git.current_branch() ~= local_branch then
|
if not is_stable then
|
||||||
astronvim.echo {
|
local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch
|
||||||
{ "Switching to branch: " },
|
if git.current_branch() ~= local_branch then
|
||||||
{ options.remote .. "/" .. options.branch .. "\n\n", "String" },
|
astronvim.echo {
|
||||||
}
|
{ "Switching to branch: " },
|
||||||
if not git.checkout(local_branch, false) then
|
{ options.remote .. "/" .. options.branch .. "\n\n", "String" },
|
||||||
git.checkout("-b " .. local_branch .. " " .. options.remote .. "/" .. options.branch, false)
|
}
|
||||||
|
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
|
||||||
end
|
|
||||||
if git.current_branch() ~= local_branch then
|
|
||||||
vim.api.nvim_err_writeln("Error checking out branch: " .. options.remote .. "/" .. options.branch)
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
local source = git.local_head() -- calculate current commit
|
local source = git.local_head() -- calculate current commit
|
||||||
local target -- calculate target commit
|
local target -- calculate target commit
|
||||||
if is_stable then -- if stable get tag 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)
|
target = git.tag_commit(options.version)
|
||||||
elseif options.commit then -- if commit specified use it
|
elseif options.commit then -- if commit specified use it
|
||||||
target = git.branch_contains(options.remote, options.branch, options.commit) and options.commit or nil
|
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 {
|
and not astronvim.confirm_prompt {
|
||||||
{ "Update available to ", "Title" },
|
{ "Update available to ", "Title" },
|
||||||
{ is_stable and options.version or target, "String" },
|
{ is_stable and options.version or target, "String" },
|
||||||
{ "\nContinue?" },
|
{ "\nUpdating requires a restart, continue?" },
|
||||||
}
|
}
|
||||||
then
|
then
|
||||||
astronvim.echo(cancelled_message)
|
astronvim.echo(cancelled_message)
|
||||||
return
|
return
|
||||||
else -- perform update
|
else -- perform update
|
||||||
|
-- calculate and print the changelog
|
||||||
local changelog = git.get_commit_range(source, target)
|
local changelog = git.get_commit_range(source, target)
|
||||||
local breaking = git.breaking_changes(changelog)
|
local breaking = git.breaking_changes(changelog)
|
||||||
local breaking_prompt = { { "Update contains the following breaking changes:\n", "WarningMsg" } }
|
local breaking_prompt = { { "Update contains the following breaking changes:\n", "WarningMsg" } }
|
||||||
|
|
@ -120,7 +207,9 @@ function astronvim.updater.update()
|
||||||
astronvim.echo(cancelled_message)
|
astronvim.echo(cancelled_message)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- attempt an update
|
||||||
local updated = attempt_update(target)
|
local updated = attempt_update(target)
|
||||||
|
-- check for local file conflicts and prompt user to continue or abort
|
||||||
if
|
if
|
||||||
not updated
|
not updated
|
||||||
and not options.skip_prompts
|
and not options.skip_prompts
|
||||||
|
|
@ -131,24 +220,58 @@ function astronvim.updater.update()
|
||||||
then
|
then
|
||||||
astronvim.echo(cancelled_message)
|
astronvim.echo(cancelled_message)
|
||||||
return
|
return
|
||||||
|
-- if continued and there were errors reset the base config and attempt another update
|
||||||
elseif not updated then
|
elseif not updated then
|
||||||
git.hard_reset(source)
|
git.hard_reset(source)
|
||||||
updated = attempt_update(target)
|
updated = attempt_update(target)
|
||||||
end
|
end
|
||||||
|
-- if update was unsuccessful throw an error
|
||||||
if not updated then
|
if not updated then
|
||||||
vim.api.nvim_err_writeln "Error ocurred performing update"
|
vim.api.nvim_err_writeln "Error ocurred performing update"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- print a summary of the update with the changelog
|
||||||
local summary = {
|
local summary = {
|
||||||
{ "AstroNvim updated successfully to ", "Title" },
|
{ "AstroNvim updated successfully to ", "Title" },
|
||||||
{ git.current_version(), "String" },
|
{ git.current_version(), "String" },
|
||||||
{ "!\n", "Title" },
|
{ "!\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
|
if options.show_changelog and #changelog > 0 then
|
||||||
vim.list_extend(summary, { { "Changelog:\n", "Title" } })
|
vim.list_extend(summary, { { "Changelog:\n", "Title" } })
|
||||||
vim.list_extend(summary, git.pretty_changelog(changelog))
|
vim.list_extend(summary, git.pretty_changelog(changelog))
|
||||||
end
|
end
|
||||||
astronvim.echo(summary)
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
local base = {
|
local base = {
|
||||||
Normal = { fg = C.fg, bg = C.bg },
|
Normal = { fg = C.fg, bg = C.bg },
|
||||||
|
NormalNC = { fg = C.fg, bg = C.black },
|
||||||
Comment = { fg = C.grey_2, bg = C.none },
|
Comment = { fg = C.grey_2, bg = C.none },
|
||||||
Constant = { fg = C.yellow, bg = C.none },
|
Constant = { fg = C.yellow, bg = C.none },
|
||||||
String = { fg = C.green, bg = C.none },
|
String = { fg = C.green, bg = C.none },
|
||||||
|
|
@ -43,13 +44,13 @@ local base = {
|
||||||
DiffDelete = { fg = C.grey_3, bg = C.red },
|
DiffDelete = { fg = C.grey_3, bg = C.red },
|
||||||
DiffText = { fg = C.grey_3, bg = C.yellow },
|
DiffText = { fg = C.grey_3, bg = C.yellow },
|
||||||
ErrorMsg = { fg = C.red, bg = C.none },
|
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 },
|
Folded = { fg = C.grey, bg = C.none },
|
||||||
FoldColumn = { fg = C.none, bg = C.none },
|
FoldColumn = { fg = C.none, bg = C.none },
|
||||||
IncSearch = { fg = C.yellow, bg = C.grey },
|
IncSearch = { fg = C.yellow, bg = C.grey },
|
||||||
LineNr = { fg = C.grey_1, bg = C.none },
|
LineNr = { fg = C.grey_1, bg = C.none },
|
||||||
NonText = { 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 },
|
PmenuSel = { fg = C.none, bg = C.grey_4 },
|
||||||
PmenuSbar = { fg = C.none, bg = C.grey_3 },
|
PmenuSbar = { fg = C.none, bg = C.grey_3 },
|
||||||
PmenuThumb = { fg = C.none, bg = C.fg },
|
PmenuThumb = { fg = C.none, bg = C.fg },
|
||||||
|
|
@ -58,14 +59,16 @@ local base = {
|
||||||
Search = { fg = C.grey_3, bg = C.yellow },
|
Search = { fg = C.grey_3, bg = C.yellow },
|
||||||
SignColumn = { fg = C.none, bg = C.none },
|
SignColumn = { fg = C.none, bg = C.none },
|
||||||
SpecialKey = { fg = C.grey_1, bg = C.none },
|
SpecialKey = { fg = C.grey_1, bg = C.none },
|
||||||
SpellBad = { fg = C.red, bg = C.none },
|
SpellBad = { undercurl = true },
|
||||||
SpellCap = { fg = C.yellow, bg = C.none },
|
SpellCap = { undercurl = true },
|
||||||
SpellLocal = { fg = C.yellow, bg = C.none },
|
SpellLocal = { undercurl = true },
|
||||||
SpellRare = { fg = C.yellow, bg = C.none },
|
SpellRare = { undercurl = true },
|
||||||
StatusLine = { fg = C.fg, bg = C.grey_4 },
|
StatusLine = { fg = C.fg, bg = C.grey_4 },
|
||||||
StatusLineNC = { fg = C.grey, bg = C.none },
|
StatusLineNC = { fg = C.grey, bg = C.none },
|
||||||
StatusLineTerm = { fg = C.fg, bg = C.grey_4 },
|
StatusLineTerm = { fg = C.fg, bg = C.grey_4 },
|
||||||
StatusLineTermNC = { fg = C.grey_4, bg = C.none },
|
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 },
|
TabLine = { fg = C.grey, bg = C.none },
|
||||||
TabLineSel = { fg = C.fg, bg = C.none },
|
TabLineSel = { fg = C.fg, bg = C.none },
|
||||||
TabLineFill = { fg = C.none, bg = C.grey_3 },
|
TabLineFill = { fg = C.none, bg = C.grey_3 },
|
||||||
|
|
@ -75,14 +78,7 @@ local base = {
|
||||||
WarningMsg = { fg = C.yellow, bg = C.none },
|
WarningMsg = { fg = C.yellow, bg = C.none },
|
||||||
WildMenu = { fg = C.grey_3, bg = C.blue },
|
WildMenu = { fg = C.grey_3, bg = C.blue },
|
||||||
EndOfBuffer = { fg = C.bg, bg = C.none },
|
EndOfBuffer = { fg = C.bg, bg = C.none },
|
||||||
CmpItemAbbrDefault = { fg = C.fg },
|
FloatBorder = { fg = C.grey_6, bg = C.bg },
|
||||||
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 },
|
|
||||||
MatchParen = { fg = C.none, bg = C.grey_5 },
|
MatchParen = { fg = C.none, bg = C.grey_5 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ local colors = {
|
||||||
blue_1 = "#40d9ff",
|
blue_1 = "#40d9ff",
|
||||||
blue_2 = "#1b1f27",
|
blue_2 = "#1b1f27",
|
||||||
blue_3 = "#8094B4",
|
blue_3 = "#8094B4",
|
||||||
|
blue_4 = "#90c7f3",
|
||||||
orange = "#d19a66",
|
orange = "#d19a66",
|
||||||
orange_1 = "#ff9640",
|
orange_1 = "#ff9640",
|
||||||
orange_2 = "#ff8800",
|
orange_2 = "#ff8800",
|
||||||
|
|
@ -26,6 +27,7 @@ local colors = {
|
||||||
red_2 = "#ffbba6",
|
red_2 = "#ffbba6",
|
||||||
red_3 = "#cc626a",
|
red_3 = "#cc626a",
|
||||||
red_4 = "#d47d85",
|
red_4 = "#d47d85",
|
||||||
|
red_5 = "#e9989e",
|
||||||
grey = "#5c6370",
|
grey = "#5c6370",
|
||||||
grey_1 = "#4b5263",
|
grey_1 = "#4b5263",
|
||||||
grey_2 = "#777d86",
|
grey_2 = "#777d86",
|
||||||
|
|
@ -39,8 +41,10 @@ local colors = {
|
||||||
grey_10 = "#D3D3D3",
|
grey_10 = "#D3D3D3",
|
||||||
gold = "#ffcc00",
|
gold = "#ffcc00",
|
||||||
cyan = "#56b6c2",
|
cyan = "#56b6c2",
|
||||||
|
cyan_1 = "#88cbd4",
|
||||||
purple = "#c678dd",
|
purple = "#c678dd",
|
||||||
purple_1 = "#a9a1e1",
|
purple_1 = "#a9a1e1",
|
||||||
|
purple_2 = "#c2bdea",
|
||||||
|
|
||||||
-- icon colors
|
-- icon colors
|
||||||
c = "#519aba",
|
c = "#519aba",
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
vim.cmd "highlight clear"
|
vim.cmd.highlight "clear"
|
||||||
if vim.fn.exists "syntax_on" then vim.cmd "syntax reset" end
|
if vim.fn.exists "syntax_on" then vim.cmd.syntax "reset" end
|
||||||
vim.o.background = "dark"
|
vim.o.background = "dark"
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.g.colors_name = "default_theme"
|
vim.g.colors_name = "default_theme"
|
||||||
|
|
||||||
local user_plugin_opts = astronvim.user_plugin_opts
|
local user_plugin_opts = astronvim.user_plugin_opts
|
||||||
local utils = require "default_theme.utils"
|
|
||||||
|
|
||||||
C = require "default_theme.colors"
|
C = require "default_theme.colors"
|
||||||
|
|
||||||
local highlights = {}
|
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))
|
highlights = vim.tbl_deep_extend("force", highlights, require("default_theme." .. module))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -20,6 +19,7 @@ for plugin, enabled in
|
||||||
aerial = true,
|
aerial = true,
|
||||||
beacon = false,
|
beacon = false,
|
||||||
bufferline = true,
|
bufferline = true,
|
||||||
|
cmp = true,
|
||||||
dashboard = true,
|
dashboard = true,
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
highlighturl = true,
|
highlighturl = true,
|
||||||
|
|
@ -33,6 +33,7 @@ for plugin, enabled in
|
||||||
rainbow = true,
|
rainbow = true,
|
||||||
symbols_outline = false,
|
symbols_outline = false,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
|
treesitter = true,
|
||||||
vimwiki = false,
|
vimwiki = false,
|
||||||
["which-key"] = true,
|
["which-key"] = true,
|
||||||
}))
|
}))
|
||||||
|
|
@ -41,5 +42,26 @@ do
|
||||||
end
|
end
|
||||||
|
|
||||||
for group, spec in pairs(user_plugin_opts("default_theme.highlights", highlights)) do
|
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
|
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,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue