From a7ec66a76975b8e8ad855f6e414813c8ae5710d5 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Tue, 18 Apr 2023 16:48:20 +0200 Subject: Moved to AstroVim --- nvim/.config/nvim/.github/CODE_OF_CONDUCT.md | 74 + nvim/.config/nvim/.github/CONTRIBUTING.md | 170 +++ nvim/.config/nvim/.github/FUNDING.yml | 4 + .../nvim/.github/ISSUE_TEMPLATE/bug_report.yaml | 78 + .../.config/nvim/.github/ISSUE_TEMPLATE/config.yml | 8 + .../.github/ISSUE_TEMPLATE/feature_request.yaml | 22 + .../nvim/.github/PULL_REQUEST_TEMPLATE/chore.md | 7 + .../nvim/.github/PULL_REQUEST_TEMPLATE/feature.md | 10 + .../nvim/.github/PULL_REQUEST_TEMPLATE/fix.md | 7 + nvim/.config/nvim/.github/README.md | 171 +++ nvim/.config/nvim/.github/stale.yml | 19 + .../nvim/.github/workflows/conventional_commit.yml | 13 + nvim/.config/nvim/.github/workflows/docs.yml | 34 + nvim/.config/nvim/.github/workflows/luacheck.yml | 13 + nvim/.config/nvim/.github/workflows/spell.yml | 14 + nvim/.config/nvim/.github/workflows/style.yml | 18 + nvim/.config/nvim/.github/workflows/updater.yml | 35 + nvim/.config/nvim/.gitignore | 9 + nvim/.config/nvim/.luacheckrc | 21 + nvim/.config/nvim/.stylua.toml | 7 + nvim/.config/nvim/.styluaignore | 1 + nvim/.config/nvim/.typos.toml | 6 + nvim/.config/nvim/config.ld | 7 + nvim/.config/nvim/init.lua | 46 +- nvim/.config/nvim/lua/astronvim/autocmds.lua | 238 +++ nvim/.config/nvim/lua/astronvim/bootstrap.lua | 131 ++ nvim/.config/nvim/lua/astronvim/health.lua | 51 + .../.config/nvim/lua/astronvim/icons/nerd_font.lua | 48 + nvim/.config/nvim/lua/astronvim/icons/text.lua | 40 + nvim/.config/nvim/lua/astronvim/lazy.lua | 44 + nvim/.config/nvim/lua/astronvim/mappings.lua | 389 +++++ nvim/.config/nvim/lua/astronvim/options.lua | 71 + nvim/.config/nvim/lua/astronvim/utils/buffer.lua | 103 ++ nvim/.config/nvim/lua/astronvim/utils/ffi.lua | 20 + nvim/.config/nvim/lua/astronvim/utils/git.lua | 180 +++ nvim/.config/nvim/lua/astronvim/utils/init.lua | 257 ++++ nvim/.config/nvim/lua/astronvim/utils/lsp.lua | 384 +++++ nvim/.config/nvim/lua/astronvim/utils/mason.lua | 119 ++ nvim/.config/nvim/lua/astronvim/utils/status.lua | 1605 ++++++++++++++++++++ nvim/.config/nvim/lua/astronvim/utils/ui.lua | 221 +++ nvim/.config/nvim/lua/astronvim/utils/updater.lua | 318 ++++ nvim/.config/nvim/lua/core/default_config.lua | 27 - nvim/.config/nvim/lua/core/init.lua | 27 - nvim/.config/nvim/lua/core/lazy_load.lua | 79 - nvim/.config/nvim/lua/core/mappings.lua | 471 ------ nvim/.config/nvim/lua/core/options.lua | 96 -- nvim/.config/nvim/lua/core/utils.lua | 192 --- nvim/.config/nvim/lua/custom/chadrc.lua | 13 - nvim/.config/nvim/lua/custom/mappings.lua | 11 - .../.config/nvim/lua/custom/plugins/catppuccin.lua | 45 - .../nvim/lua/custom/plugins/competitest.lua | 116 -- nvim/.config/nvim/lua/custom/plugins/init.lua | 30 - nvim/.config/nvim/lua/custom/plugins/lspconfig.lua | 12 - .../nvim/lua/custom/plugins/nvim-ts-autotag.lua | 5 - nvim/.config/nvim/lua/lazy_snapshot.lua | 51 + nvim/.config/nvim/lua/plugins/alpha.lua | 37 + nvim/.config/nvim/lua/plugins/cmp.lua | 103 ++ nvim/.config/nvim/lua/plugins/configs/alpha.lua | 103 +- nvim/.config/nvim/lua/plugins/configs/cmp.lua | 103 -- .../nvim/lua/plugins/configs/guess-indent.lua | 4 + nvim/.config/nvim/lua/plugins/configs/heirline.lua | 119 ++ .../.config/nvim/lua/plugins/configs/lspconfig.lua | 97 +- nvim/.config/nvim/lua/plugins/configs/lspkind.lua | 4 + nvim/.config/nvim/lua/plugins/configs/luasnip.lua | 4 + .../nvim/lua/plugins/configs/mason-lspconfig.lua | 8 + .../nvim/lua/plugins/configs/mason-null-ls.lua | 5 + .../nvim/lua/plugins/configs/mason-nvim-dap.lua | 5 + nvim/.config/nvim/lua/plugins/configs/mason.lua | 67 +- nvim/.config/nvim/lua/plugins/configs/notify.lua | 5 + .../nvim/lua/plugins/configs/nvim-autopairs.lua | 10 + .../nvim/lua/plugins/configs/nvim-dap-ui.lua | 7 + .../nvim/lua/plugins/configs/nvim-treesitter.lua | 1 + .../nvim/lua/plugins/configs/nvim-web-devicons.lua | 4 + nvim/.config/nvim/lua/plugins/configs/nvimtree.lua | 88 -- nvim/.config/nvim/lua/plugins/configs/nvterm.lua | 34 - nvim/.config/nvim/lua/plugins/configs/others.lua | 189 --- .../.config/nvim/lua/plugins/configs/telescope.lua | 81 +- .../nvim/lua/plugins/configs/treesitter.lua | 27 - .../.config/nvim/lua/plugins/configs/which-key.lua | 4 + nvim/.config/nvim/lua/plugins/configs/whichkey.lua | 41 - nvim/.config/nvim/lua/plugins/core.lua | 96 ++ nvim/.config/nvim/lua/plugins/dap.lua | 19 + nvim/.config/nvim/lua/plugins/git.lua | 16 + nvim/.config/nvim/lua/plugins/heirline.lua | 86 ++ nvim/.config/nvim/lua/plugins/init.lua | 224 --- nvim/.config/nvim/lua/plugins/lsp.lua | 68 + nvim/.config/nvim/lua/plugins/mason.lua | 24 + nvim/.config/nvim/lua/plugins/neo-tree.lua | 133 ++ nvim/.config/nvim/lua/plugins/telescope.lua | 42 + nvim/.config/nvim/lua/plugins/treesitter.lua | 29 + nvim/.config/nvim/lua/plugins/ui.lua | 122 ++ nvim/.config/nvim/plugin/packer_compiled.lua | 644 -------- 92 files changed, 6059 insertions(+), 2782 deletions(-) create mode 100644 nvim/.config/nvim/.github/CODE_OF_CONDUCT.md create mode 100644 nvim/.config/nvim/.github/CONTRIBUTING.md create mode 100644 nvim/.config/nvim/.github/FUNDING.yml create mode 100644 nvim/.config/nvim/.github/ISSUE_TEMPLATE/bug_report.yaml create mode 100644 nvim/.config/nvim/.github/ISSUE_TEMPLATE/config.yml create mode 100644 nvim/.config/nvim/.github/ISSUE_TEMPLATE/feature_request.yaml create mode 100644 nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/chore.md create mode 100644 nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/feature.md create mode 100644 nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/fix.md create mode 100644 nvim/.config/nvim/.github/README.md create mode 100644 nvim/.config/nvim/.github/stale.yml create mode 100644 nvim/.config/nvim/.github/workflows/conventional_commit.yml create mode 100644 nvim/.config/nvim/.github/workflows/docs.yml create mode 100644 nvim/.config/nvim/.github/workflows/luacheck.yml create mode 100644 nvim/.config/nvim/.github/workflows/spell.yml create mode 100644 nvim/.config/nvim/.github/workflows/style.yml create mode 100644 nvim/.config/nvim/.github/workflows/updater.yml create mode 100644 nvim/.config/nvim/.gitignore create mode 100644 nvim/.config/nvim/.luacheckrc create mode 100644 nvim/.config/nvim/.stylua.toml create mode 100644 nvim/.config/nvim/.styluaignore create mode 100644 nvim/.config/nvim/.typos.toml create mode 100644 nvim/.config/nvim/config.ld create mode 100644 nvim/.config/nvim/lua/astronvim/autocmds.lua create mode 100644 nvim/.config/nvim/lua/astronvim/bootstrap.lua create mode 100644 nvim/.config/nvim/lua/astronvim/health.lua create mode 100644 nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua create mode 100644 nvim/.config/nvim/lua/astronvim/icons/text.lua create mode 100644 nvim/.config/nvim/lua/astronvim/lazy.lua create mode 100644 nvim/.config/nvim/lua/astronvim/mappings.lua create mode 100644 nvim/.config/nvim/lua/astronvim/options.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/buffer.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/ffi.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/git.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/init.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/lsp.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/mason.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/status.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/ui.lua create mode 100644 nvim/.config/nvim/lua/astronvim/utils/updater.lua delete mode 100644 nvim/.config/nvim/lua/core/default_config.lua delete mode 100644 nvim/.config/nvim/lua/core/init.lua delete mode 100644 nvim/.config/nvim/lua/core/lazy_load.lua delete mode 100644 nvim/.config/nvim/lua/core/mappings.lua delete mode 100644 nvim/.config/nvim/lua/core/options.lua delete mode 100644 nvim/.config/nvim/lua/core/utils.lua delete mode 100644 nvim/.config/nvim/lua/custom/chadrc.lua delete mode 100644 nvim/.config/nvim/lua/custom/mappings.lua delete mode 100644 nvim/.config/nvim/lua/custom/plugins/catppuccin.lua delete mode 100644 nvim/.config/nvim/lua/custom/plugins/competitest.lua delete mode 100644 nvim/.config/nvim/lua/custom/plugins/init.lua delete mode 100644 nvim/.config/nvim/lua/custom/plugins/lspconfig.lua delete mode 100644 nvim/.config/nvim/lua/custom/plugins/nvim-ts-autotag.lua create mode 100644 nvim/.config/nvim/lua/lazy_snapshot.lua create mode 100644 nvim/.config/nvim/lua/plugins/alpha.lua create mode 100644 nvim/.config/nvim/lua/plugins/cmp.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/cmp.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/guess-indent.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/heirline.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/lspkind.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/luasnip.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/mason-lspconfig.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/mason-null-ls.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/mason-nvim-dap.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/notify.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/nvim-autopairs.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/nvim-dap-ui.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/nvim-treesitter.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/nvim-web-devicons.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/nvimtree.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/nvterm.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/others.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/treesitter.lua create mode 100644 nvim/.config/nvim/lua/plugins/configs/which-key.lua delete mode 100644 nvim/.config/nvim/lua/plugins/configs/whichkey.lua create mode 100644 nvim/.config/nvim/lua/plugins/core.lua create mode 100644 nvim/.config/nvim/lua/plugins/dap.lua create mode 100644 nvim/.config/nvim/lua/plugins/git.lua create mode 100644 nvim/.config/nvim/lua/plugins/heirline.lua delete mode 100644 nvim/.config/nvim/lua/plugins/init.lua create mode 100644 nvim/.config/nvim/lua/plugins/lsp.lua create mode 100644 nvim/.config/nvim/lua/plugins/mason.lua create mode 100644 nvim/.config/nvim/lua/plugins/neo-tree.lua create mode 100644 nvim/.config/nvim/lua/plugins/telescope.lua create mode 100644 nvim/.config/nvim/lua/plugins/treesitter.lua create mode 100644 nvim/.config/nvim/lua/plugins/ui.lua delete mode 100644 nvim/.config/nvim/plugin/packer_compiled.lua diff --git a/nvim/.config/nvim/.github/CODE_OF_CONDUCT.md b/nvim/.config/nvim/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..86a3913 --- /dev/null +++ b/nvim/.config/nvim/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{ email }}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/nvim/.config/nvim/.github/CONTRIBUTING.md b/nvim/.config/nvim/.github/CONTRIBUTING.md new file mode 100644 index 0000000..fff45e3 --- /dev/null +++ b/nvim/.config/nvim/.github/CONTRIBUTING.md @@ -0,0 +1,170 @@ +# CONTRIBUTING + +## AstroNvim install for contributors + +If you wish to contribute to AstroNvim, you should: +1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo) +2. clone your fork to your machine + - For ssh: + ```shell + $ git clone git@github.com:/AstroNvim.git ~/.config/nvim + ``` + - For https: + ```shell + $ git clone https://github.com//AstroNvim.git ~/.config/nvim + ``` +3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams) + - this means you can push/pull as normal to your own repo, but also easily track & update from the AstroNvim repo + - for ssh: + ```shell + $ git remote add upstream git@github.com:AstroNvim/AstroNvim.git + ``` + - for https: + ```shell + $ git remote add upstream https://github.com/AstroNvim/AstroNvim.git + ``` +4. any time you create a branch to do some work, use + ```shell + $ git fetch upstream && git checkout -b dev-myFEAT upstream/main + ``` +5. only use the **--rebase** flag to update your dev branch + - this means that there are no `Merge AstroNvim/main into devBranch` commits, which are to be avoided + ```shell + $ git pull upstream --rebase + ``` + +## Things to know before contributing + +- Development happens on the `nightly` branch, so please make sure of a couple things + + - all branches are rebased on the `nightly` branch to get the latest updates. + + - all pull requests are made to merge into `nightly` + +- When making a PR (pull request), please be very descriptive about what you've done! + +- Commit messages must follow [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/) + + - PR titles and commit messages should be formatted with 'fix', 'feat', 'docs', 'refactor', or 'chore'. ex: `feat: add new plugin` + + - If your contribution mostly pertains to a single module in AstroNvim, please include that in the title. ex: If you have modified something in the `lua/configs/lsp` folder for the lsp configuration use something like `fix(lsp): typo in lsp mappings` + + - If your contribution contains any sort of breaking change include a `!` at the end of the change type. ex: `feat!: move status bar from lualine to feline` + +- PRs should follow the pull request formats where applicable + +- We are open to all PRs, but if a PR is denied for any reason please don't be discouraged! We'll still be open to discussions. If you have any questions before opening the PR feel free to join the [discord server](https://discord.gg/UcZutyeaFW). + +- AstroNvim aims to provide the best user experience when it comes to being able to support confident updating for users, for this reason please avoid opening PRs with breaking changes. Avoiding breaking changes is not always going to be possible, so if you think it is completely necessary we are open to discussion. + +## How to remove, squash, or edit commits from your PR +> You may have been directed here to remove a commit such as a merge commit: `Merge AstroNvim/main into devBranch` from your PR + +> As these commands edit your git history, you may need to **force push** with `git push origin --force-with-lease` + +1. Run the following: + ``` + $ git rebase -i HEAD~ + ``` +
Example +

+ + ```shell + $ git rebase -i HEAD~4 + ``` + + ```shell + pick 28b2dcb feat: statusline add lsp status + pick dad9a39 fix: typo + pick 68f72f1 add clickable btn for exiting nvim + pick b281b53 avoid using q! for quitting vim + + # Rebase 52b655b..b281b53 onto 52b655b (4 commands) + # + # Commands: + # p, pick = use commit + # r, reword = use commit, but edit the commit message + # e, edit = use commit, but stop for amending + # s, squash = use commit, but meld into previous commit + # f, fixup = like "squash", but discard this commit's log message + # x, exec = run command (the rest of the line) using shell + # b, break = stop here (continue rebase later with 'git rebase --continue') + # d, drop = remove commit + # l, label

+
+ +2. Change the `pick` commands to whatever you wish, you may wish to `s` `squash`, `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it. + +
Example +

+ + ```shell {3,4} + pick 28b2dcb feat: statusline add lsp status + squash dad9a39 fix: typo + edit 68f72f1 add clickable btn for exiting nvim + d b281b53 avoid using q! for quitting vim + + # Rebase 52b655b..b281b53 onto 52b655b (4 commands) + # + # Commands: + # p, pick = use commit + # r, reword = use commit, but edit the commit message + # e, edit = use commit, but stop for amending + # s, squash = use commit, but meld into previous commit + # f, fixup = like "squash", but discard this commit's log message + # x, exec = run command (the rest of the line) using shell + # b, break = stop here (continue rebase later with 'git rebase --continue') + # d, drop = remove commit + # l, label

+
+ +3. If you picked `drop` you are done. If you picked `squash` then you will be brought to a screen to update the commit message for the new aggregated commit, please make sure the new commit message follows the Conventional Commit specification. If you picked `edit` then edit your files, then run: + ```shell + $ git add + ``` + +4. Continue rebasing until all edits are finished. Run the following command to continue through the rebase if there are more changes: + + ```shell + $ git rebase --continue + ``` + +5. Push the changes with `--force-with-lease`: + ```shell + $ git push origin --force-with-lease + ``` + +## Help +For help with contributing and anything else AstroNvim related join the [discord](https://discord.gg/UcZutyeaFW) diff --git a/nvim/.config/nvim/.github/FUNDING.yml b/nvim/.config/nvim/.github/FUNDING.yml new file mode 100644 index 0000000..7666e69 --- /dev/null +++ b/nvim/.config/nvim/.github/FUNDING.yml @@ -0,0 +1,4 @@ +github: AstroNvim +ko_fi: mehalter +liberapay: mehalter +custom: https://www.buymeacoffee.com/mehalter diff --git a/nvim/.config/nvim/.github/ISSUE_TEMPLATE/bug_report.yaml b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..5a6e95c --- /dev/null +++ b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,78 @@ +name: Bug report +description: Create a report to help us improve +labels: [bug] + +body: + - type: checkboxes + id: terms + attributes: + label: Checklist + description: Have you completed the following steps and are still able to replicate the issue? + options: + - label: "Using a stable version of Neovim (i.e. not neovim nightly)" + required: true + - label: "`:AstroUpdate`" + required: true + - label: Restarted AstroNvim + required: true + - type: input + id: system-version + attributes: + label: "Operating system/version" + placeholder: "macOS 11.5" + validations: + required: true + - type: input + id: terminal + attributes: + label: "Terminal/GUI" + placeholder: "kitty" + validations: + required: true + - type: textarea + id: health + attributes: + label: AstroNvim Health + description: Output of `:checkhealth astronvim` + placeholder: | + ## AstroNvim + - INFO: AstroNvim Version: nightly (v2.11.8-181-g11d5990) + - INFO: Neovim Version: v0.8.3 + - OK: Using stable Neovim >= 0.8.0 + validations: + required: true + - type: textarea + id: description + attributes: + label: Describe the bug + placeholder: A clear and concise description of what the bug is. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to Reproduce + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behavior + placeholder: A clear and concise description of what you expected to happen + validations: + required: true + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: If applicable, add screenshots or recording ([Asciinema](asciinema.org)) to help explain your problem. + - type: textarea + id: additional-context + attributes: + label: Additional Context + placeholder: Add any additional context about the problem here. diff --git a/nvim/.config/nvim/.github/ISSUE_TEMPLATE/config.yml b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..9248681 --- /dev/null +++ b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: r/AstroNvim (Reddit) + url: https://www.reddit.com/r/AstroNvim + about: Ask questions about AstroNvim on the official Subreddit + - name: Discord Chat + url: https://discord.gg/UcZutyeaFW + about: Ask questions and have discussions about AstroNvim on Discord diff --git a/nvim/.config/nvim/.github/ISSUE_TEMPLATE/feature_request.yaml b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..e28e766 --- /dev/null +++ b/nvim/.config/nvim/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,22 @@ +name: Feature request +description: Suggest an idea for this project +labels: [enhancement] + +body: + - type: textarea + id: problem + attributes: + label: Is your feature related to a problem? + placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + - type: textarea + id: solution + attributes: + label: Describe the new feature + placeholder: A clear and concise description of what the new feature is. + validations: + required: true + - type: textarea + id: additional-context + attributes: + label: Additional context + placeholder: Add any other context or screenshots about the feature request here. diff --git a/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/chore.md b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/chore.md new file mode 100644 index 0000000..60c219a --- /dev/null +++ b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/chore.md @@ -0,0 +1,7 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Description: +Describe the refactor or cleanup that was completed + +Other: +Anything else relevant goes here diff --git a/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/feature.md b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/feature.md new file mode 100644 index 0000000..b2ff3d5 --- /dev/null +++ b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/feature.md @@ -0,0 +1,10 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Features Added: +- Plugin Name (Add links if possible too) + +Reasoning: +List why the feature is needed + +Other: +Anything else relevant goes here diff --git a/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/fix.md b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/fix.md new file mode 100644 index 0000000..a173370 --- /dev/null +++ b/nvim/.config/nvim/.github/PULL_REQUEST_TEMPLATE/fix.md @@ -0,0 +1,7 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Bugs Fixed: +- A bullet for each bug fixed and a description + +Other: +Anything else relevant goes here diff --git a/nvim/.config/nvim/.github/README.md b/nvim/.config/nvim/.github/README.md new file mode 100644 index 0000000..54bdad8 --- /dev/null +++ b/nvim/.config/nvim/.github/README.md @@ -0,0 +1,171 @@ +
+ +
+ +

AstroNvim

+ +

+ Install + · + Configure + · + Community Plugins + · + Docs + · + Discord +

+ +

+ + + + + + + + + + +
+ + + + + + + + + + + + +

+ +

+AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins +

+ +## 🌟 Preview + +![Dashboard Preview Image](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dashboard.png) +![Coding Preview Image](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/overview.png) +![Debugging Preview Image](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dap.png) + +## ✨ Features + +- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) +- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp) +- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- Statusline, Winbar, and Bufferline with [Heirline](https://github.com/rebelot/heirline.nvim) +- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim) +- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim) +- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) +- Formatting and Linting with [Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim) +- Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig) +- Debug Adapter Protocol with [nvim-dap](https://github.com/mfussenegger/nvim-dap) + +## ⚡ Requirements + +- [Nerd Fonts](https://www.nerdfonts.com/font-downloads) (_Optional with manual intervention:_ See [Documentation on customizing icons](https://astronvim.com/Recipes/icons)) +- [Neovim 0.8+ (_Not_ including nightly)](https://github.com/neovim/neovim/releases/tag/stable) +- [Tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/cli/README.md) (_Note:_ This is only necessary if you want to use `auto_install` feature with Treesitter) +- A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions) +- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) +- Optional Requirements: + - [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`fw`) + - [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`tl` or `gg`) + - [go DiskUsage()](https://github.com/dundee/gdu) - disk usage toggle terminal (`tu`) + - [bottom](https://github.com/ClementTsang/bottom) - process viewer toggle terminal (`tt`) + - [Python](https://www.python.org/) - python repl toggle terminal (`tp`) + - [Node](https://nodejs.org/en/) - node repl toggle terminal (`tn`) + +> Note when using default theme: For MacOS, the default terminal does not have true color support. You will need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support. + +## 🛠️ Installation + +#### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +``` + +#### Clone the repository + +```shell +git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim +nvim +``` + +## 📦 Basic Setup + +#### Install LSP + +Enter `:LspInstall` followed by the name of the server you want to install
+Example: `:LspInstall pyright` + +#### Install language parser + +Enter `:TSInstall` followed by the name of the language you want to install
+Example: `:TSInstall python` + +#### Install Debugger + +Enter `:DapInstall` followed by the name of the debugger you want to install
+Example: `:DapInstall python` + +#### Manage plugins + +Run `:Lazy check` to check for plugin updates + +Run `:Lazy update` to apply any pending plugin updates + +Run `:Lazy clean` to remove any disabled or unused plugins + +Run `:Lazy sync` to update and clean plugins + +#### Update AstroNvim + +Run `:AstroUpdate` to get the latest updates from the repository
+ +#### Update AstroNvim Packages + +Run `:AstroUpdatePackages` (`pa`) to update both Neovim plugins and Mason packages + +## 🗒️ Links + +[AstroNvim Documentation](https://astronvim.com) +[Core AstroNvim LUA API Documentation](https://api.astronvim.com) + +- [Basic Usage](https://astronvim.com/Basic%20Usage/walkthrough) is given for basic usage +- [Default Mappings](https://astronvim.com/Basic%20Usage/mappings) more about the default key bindings +- [Default Plugin Configuration](https://astronvim.com/configuration/plugin_defaults) more about the provided plugin defaults +- [Advanced Configuration](https://astronvim.com/configuration/config_options) more about advanced configuration + +### 📹 Videos + +There have been some great review videos released by members of the community! Here are a few: + +- [Neovim With AstroNvim | Your New Advanced Development Editor](https://www.youtube.com/watch?v=GEHPiZ10gOk) (Version: 3, Content By: [@Cretezy](https://github.com/Cretezy)) +- [Why I'm quitting VIM by Carlos Mafla](https://www.youtube.com/watch?v=71GDopdc9rw) (Version: 2, Content By: [@gigo6000](https://github.com/gigo6000)) +- [Astro Vim - All in one Nvim config!! by John McBride](https://www.youtube.com/watch?v=JQLZ7NJRTEo) (Version: 1, Content By: [@jpmcb](https://github.com/jpmcb)) + +## 🚀 Contributing + +If you plan to contribute, please check the [contribution guidelines](CONTRIBUTING.md) first. + +## ⭐ Credits + +Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible. + +- [Plugins](https://astronvim.com/acknowledgements#plugins-used-in-astronvim) +- [NvChad](https://github.com/NvChad/NvChad) +- [LunarVim](https://github.com/LunarVim) +- [CosmicVim](https://github.com/CosmicNvim/CosmicNvim) + +
+ +[![Lua](https://img.shields.io/badge/Made%20with%20Lua-blue.svg?style=for-the-badge&logo=lua)](https://lua.org) + +
diff --git a/nvim/.config/nvim/.github/stale.yml b/nvim/.config/nvim/.github/stale.yml new file mode 100644 index 0000000..80a5164 --- /dev/null +++ b/nvim/.config/nvim/.github/stale.yml @@ -0,0 +1,19 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + - notice + - wip +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed in 7 days if no further activity occurs. + Thank you for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/nvim/.config/nvim/.github/workflows/conventional_commit.yml b/nvim/.config/nvim/.github/workflows/conventional_commit.yml new file mode 100644 index 0000000..76819c4 --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/conventional_commit.yml @@ -0,0 +1,13 @@ +name: Conventional Commits + +on: + pull_request: + branches: [ main ] + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: webiny/action-conventional-commits@v1.0.3 diff --git a/nvim/.config/nvim/.github/workflows/docs.yml b/nvim/.config/nvim/.github/workflows/docs.yml new file mode 100644 index 0000000..67a997d --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/docs.yml @@ -0,0 +1,34 @@ +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: Set CNAME + run: | + echo "api.astronvim.com" > docs/CNAME + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs diff --git a/nvim/.config/nvim/.github/workflows/luacheck.yml b/nvim/.config/nvim/.github/workflows/luacheck.yml new file mode 100644 index 0000000..f8d48a7 --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/luacheck.yml @@ -0,0 +1,13 @@ +name: Lua Linting + +on: + push: + branches: ["main"] + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: lunarmodules/luacheck@v1 diff --git a/nvim/.config/nvim/.github/workflows/spell.yml b/nvim/.config/nvim/.github/workflows/spell.yml new file mode 100644 index 0000000..7bae68e --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/spell.yml @@ -0,0 +1,14 @@ +name: Spell Check + +on: + pull_request: + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v3 + - name: Check spelling + uses: crate-ci/typos@v1.13.26 diff --git a/nvim/.config/nvim/.github/workflows/style.yml b/nvim/.config/nvim/.github/workflows/style.yml new file mode 100644 index 0000000..3473f5e --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/style.yml @@ -0,0 +1,18 @@ +name: Style Check + +on: + push: + branches: ["main"] + pull_request: + +jobs: + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: JohnnyMorganz/stylua-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + # CLI arguments + args: --check . diff --git a/nvim/.config/nvim/.github/workflows/updater.yml b/nvim/.config/nvim/.github/workflows/updater.yml new file mode 100644 index 0000000..8bb5ab2 --- /dev/null +++ b/nvim/.config/nvim/.github/workflows/updater.yml @@ -0,0 +1,35 @@ +name: Updater Comment + +on: + pull_request_target: + paths: ["**.lua"] + types: ["opened"] + +jobs: + updater-comment: + name: Comment updater settings + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + const src = context.payload.pull_request.head + const user = src.user.login + const tab = " " + let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n` + if (src.ref != "nightly") { + settings += tab + tab + `branch = "${src.ref}",\n` + } + if (user != "AstroNvim") { + settings += tab + tab + `remote = "${user}",\n` + settings += tab + tab + `remotes = {\n` + settings += tab + tab + tab + `["${user}"] = "${user}/${src.repo.name}",\n` + settings += tab + tab + `},\n` + } + settings += tab + "}," + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Use the following `updater` settings in your `user/init.lua` file, restart, and run `:AstroUpdate` to test this pull request:\n```\n" + settings + "\n```", + }) diff --git a/nvim/.config/nvim/.gitignore b/nvim/.config/nvim/.gitignore new file mode 100644 index 0000000..11b67c8 --- /dev/null +++ b/nvim/.config/nvim/.gitignore @@ -0,0 +1,9 @@ +!colors/astronvim.lua +colors/* +docs +ginit.vim +lua/user +plugin +ftplugin +spell +.luarc.json diff --git a/nvim/.config/nvim/.luacheckrc b/nvim/.config/nvim/.luacheckrc new file mode 100644 index 0000000..809581e --- /dev/null +++ b/nvim/.config/nvim/.luacheckrc @@ -0,0 +1,21 @@ +-- Global objects +globals = { + "PACKER_BOOTSTRAP", + "astronvim", + "astronvim_installation", + "vim", + "bit", + "C", + "packer_plugins", +} + +-- Rerun tests only if their modification time changed +cache = true + +-- Don't report unused self arguments of methods +self = false + +ignore = { + "631", -- max_line_length + "212/_.*", -- unused argument, for vars with "_" prefix +} diff --git a/nvim/.config/nvim/.stylua.toml b/nvim/.config/nvim/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/nvim/.config/nvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/nvim/.config/nvim/.styluaignore b/nvim/.config/nvim/.styluaignore new file mode 100644 index 0000000..52ccbc0 --- /dev/null +++ b/nvim/.config/nvim/.styluaignore @@ -0,0 +1 @@ +lua/lazy_snapshot.lua diff --git a/nvim/.config/nvim/.typos.toml b/nvim/.config/nvim/.typos.toml new file mode 100644 index 0000000..f9de14e --- /dev/null +++ b/nvim/.config/nvim/.typos.toml @@ -0,0 +1,6 @@ +# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos +[default.extend-words] +enew = "enew" +fo = "fo" +[files] +extend-exclude = ["LICENSE"] diff --git a/nvim/.config/nvim/config.ld b/nvim/.config/nvim/config.ld new file mode 100644 index 0000000..61784df --- /dev/null +++ b/nvim/.config/nvim/config.ld @@ -0,0 +1,7 @@ +project='AstroNvim' +title='AstroNvim API' +description='Documentation of AstroNvim\'s core API' +format = 'markdown' +file='lua' +dir='docs' +no_space_before_args=true diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 7324b73..a887f21 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,34 +1,18 @@ -vim.defer_fn(function() - pcall(require, "impatient") -end, 0) - -require "core" -require "core.options" - --- setup packer + plugins -local fn = vim.fn -local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" - -if fn.empty(fn.glob(install_path)) > 0 then - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) - print "Cloning packer .." - fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path } - - -- install plugins + compile their configs - vim.cmd "packadd packer.nvim" - require "plugins" - vim.cmd "PackerSync" - - -- install binaries from mason.nvim & tsparsers - vim.api.nvim_create_autocmd("User", { - pattern = "PackerComplete", - callback = function() - vim.cmd "bw | silent! MasonInstallAll" -- close packer window - require("packer").loader "nvim-treesitter" - end, - }) +for _, source in ipairs { + "astronvim.bootstrap", + "astronvim.options", + "astronvim.lazy", + "astronvim.autocmds", + "astronvim.mappings", +} do + local status_ok, fault = pcall(require, source) + if not status_ok then vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) end end -pcall(require, "custom") +if astronvim.default_colorscheme then + if not pcall(vim.cmd.colorscheme, astronvim.default_colorscheme) then + require("astronvim.utils").notify("Error setting up colorscheme: " .. astronvim.default_colorscheme, "error") + end +end -require("core.utils").load_mappings() +require("astronvim.utils").conditional_func(astronvim.user_opts("polish", nil, false), true) diff --git a/nvim/.config/nvim/lua/astronvim/autocmds.lua b/nvim/.config/nvim/lua/astronvim/autocmds.lua new file mode 100644 index 0000000..c3b1734 --- /dev/null +++ b/nvim/.config/nvim/lua/astronvim/autocmds.lua @@ -0,0 +1,238 @@ +local augroup = vim.api.nvim_create_augroup +local autocmd = vim.api.nvim_create_autocmd +local cmd = vim.api.nvim_create_user_command +local namespace = vim.api.nvim_create_namespace + +local utils = require "astronvim.utils" +local is_available = utils.is_available +local astroevent = utils.event + +vim.on_key(function(char) + if vim.fn.mode() == "n" then + local new_hlsearch = vim.tbl_contains({ "", "n", "N", "*", "#", "?", "/" }, vim.fn.keytrans(char)) + if vim.opt.hlsearch:get() ~= new_hlsearch then vim.opt.hlsearch = new_hlsearch end + end +end, namespace "auto_hlsearch") + +local bufferline_group = augroup("bufferline", { clear = true }) +autocmd({ "BufAdd", "BufEnter" }, { + desc = "Update buffers when adding new buffers", + group = bufferline_group, + callback = function(args) + if not vim.t.bufs then vim.t.bufs = {} end + local bufs = vim.t.bufs + if not vim.tbl_contains(bufs, args.buf) then + table.insert(bufs, args.buf) + vim.t.bufs = bufs + end + vim.t.bufs = vim.tbl_filter(require("astronvim.utils.buffer").is_valid, vim.t.bufs) + astroevent "BufsUpdated" + end, +}) +autocmd("BufDelete", { + desc = "Update buffers when deleting buffers", + group = bufferline_group, + callback = function(args) + for _, tab in ipairs(vim.api.nvim_list_tabpages()) do + local bufs = vim.t[tab].bufs + if bufs then + for i, bufnr in ipairs(bufs) do + if bufnr == args.buf then + table.remove(bufs, i) + vim.t[tab].bufs = bufs + break + end + end + end + end + vim.t.bufs = vim.tbl_filter(require("astronvim.utils.buffer").is_valid, vim.t.bufs) + astroevent "BufsUpdated" + vim.cmd.redrawtabline() + end, +}) + +autocmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, { + desc = "URL Highlighting", + group = augroup("highlighturl", { clear = true }), + pattern = "*", + callback = function() utils.set_url_match() end, +}) + +local view_group = augroup("auto_view", { clear = true }) +autocmd({ "BufWinLeave", "BufWritePost", "WinLeave" }, { + desc = "Save view with mkview for real files", + group = view_group, + callback = function(event) + if vim.b[event.buf].view_activated then vim.cmd.mkview { mods = { emsg_silent = true } } end + end, +}) +autocmd("BufWinEnter", { + desc = "Try to load file view if available and enable view saving for real files", + group = view_group, + callback = function(event) + if not vim.b[event.buf].view_activated then + local filetype = vim.api.nvim_get_option_value("filetype", { buf = event.buf }) + local buftype = vim.api.nvim_get_option_value("buftype", { buf = event.buf }) + local ignore_filetypes = { "gitcommit", "gitrebase", "svg", "hgcommit" } + if buftype == "" and filetype and filetype ~= "" and not vim.tbl_contains(ignore_filetypes, filetype) then + vim.b[event.buf].view_activated = true + vim.cmd.loadview { mods = { emsg_silent = true } } + end + end + end, +}) + +autocmd("BufWinEnter", { + desc = "Make q close help, man, quickfix, dap floats", + group = augroup("q_close_windows", { clear = true }), + callback = function(event) + local filetype = vim.api.nvim_get_option_value("filetype", { buf = event.buf }) + local buftype = vim.api.nvim_get_option_value("buftype", { buf = event.buf }) + if buftype == "nofile" or filetype == "help" then + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true, nowait = true }) + end + end, +}) + +autocmd("TextYankPost", { + desc = "Highlight yanked text", + group = augroup("highlightyank", { clear = true }), + pattern = "*", + callback = function() vim.highlight.on_yank() end, +}) + +autocmd("FileType", { + desc = "Unlist quickfist buffers", + group = augroup("unlist_quickfist", { clear = true }), + pattern = "qf", + callback = function() vim.opt_local.buflisted = false end, +}) + +autocmd("BufEnter", { + desc = "Quit AstroNvim if more than one window is open and only sidebar windows are list", + group = augroup("auto_quit", { clear = true }), + callback = function() + local wins = vim.api.nvim_tabpage_list_wins(0) + -- Both neo-tree and aerial will auto-quit if there is only a single window left + 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) + local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr }) + -- If any visible windows are not sidebars, early return + if not sidebar_fts[filetype] then + return + -- If the visible window is a sidebar + else + -- only count filetypes once, so remove a found sidebar from the detection + sidebar_fts[filetype] = nil + end + end + end + if #vim.api.nvim_list_tabpages() > 1 then + vim.cmd.tabclose() + else + vim.cmd.qall() + end + end, +}) + +if is_available "alpha-nvim" then + local group_name = augroup("alpha_settings", { clear = true }) + autocmd("User", { + desc = "Disable status and tablines for alpha", + group = group_name, + pattern = "AlphaReady", + callback = function() + local prev_showtabline = vim.opt.showtabline + local prev_status = vim.opt.laststatus + vim.opt.laststatus = 0 + vim.opt.showtabline = 0 + vim.opt_local.winbar = nil + autocmd("BufUnload", { + pattern = "", + callback = function() + vim.opt.laststatus = prev_status + vim.opt.showtabline = prev_showtabline + end, + }) + end, + }) + autocmd("VimEnter", { + desc = "Start Alpha when vim is opened with no arguments", + group = group_name, + callback = function() + local should_skip = false + if vim.fn.argc() > 0 or vim.fn.line2byte(vim.fn.line "$") ~= -1 or not vim.o.modifiable then + should_skip = true + else + for _, arg in pairs(vim.v.argv) do + if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then + should_skip = true + break + end + end + end + if not should_skip then require("alpha").start(true, require("alpha").default_config) end + end, + }) +end + +if is_available "neo-tree.nvim" then + autocmd("BufEnter", { + desc = "Open Neo-Tree on startup with directory", + group = augroup("neotree_start", { clear = true }), + callback = function() + if package.loaded["neo-tree"] then + vim.api.nvim_del_augroup_by_name "neotree_start" + else + local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) + if stats and stats.type == "directory" then + require "neo-tree" + vim.api.nvim_del_augroup_by_name "neotree_start" + vim.api.nvim_exec_autocmds("BufEnter", {}) + end + end + end, + }) +end + +autocmd({ "VimEnter", "ColorScheme" }, { + desc = "Load custom highlights from user configuration", + group = augroup("astronvim_highlights", { clear = true }), + callback = function() + if vim.g.colors_name then + for _, module in ipairs { "init", vim.g.colors_name } do + for group, spec in pairs(astronvim.user_opts("highlights." .. module)) do + vim.api.nvim_set_hl(0, group, spec) + end + end + end + astroevent "ColorScheme" + end, +}) + +autocmd({ "BufReadPost", "BufNewFile" }, { + group = augroup("file_user_events", { clear = true }), + callback = function(args) + if not (vim.fn.expand "%" == "" or vim.api.nvim_get_option_value("buftype", { buf = args.buf }) == "nofile") then + utils.event "File" + if utils.cmd('git -C "' .. vim.fn.expand "%:p:h" .. '" rev-parse', false) then utils.event "GitFile" end + end + end, +}) + +cmd( + "AstroChangelog", + function() require("astronvim.utils.updater").changelog() end, + { desc = "Check AstroNvim Changelog" } +) +cmd( + "AstroUpdatePackages", + function() require("astronvim.utils.updater").update_packages() end, + { desc = "Update Plugins and Mason" } +) +cmd("AstroRollback", function() require("astronvim.utils.updater").rollback() end, { desc = "Rollback AstroNvim" }) +cmd("AstroUpdate", function() require("astronvim.utils.updater").update() end, { desc = "Update AstroNvim" }) +cmd("AstroVersion", function() require("astronvim.utils.updater").version() end, { desc = "Check AstroNvim Version" }) diff --git a/nvim/.config/nvim/lua/astronvim/bootstrap.lua b/nvim/.config/nvim/lua/astronvim/bootstrap.lua new file mode 100644 index 0000000..98e9b9c --- /dev/null +++ b/nvim/.config/nvim/lua/astronvim/bootstrap.lua @@ -0,0 +1,131 @@ +--- ### AstroNvim Core Bootstrap +-- +-- This module simply sets up the global `astronvim` module. +-- This is automatically loaded and should not be resourced, everything is accessible through the global `astronvim` variable. +-- +-- @module astronvim.bootstrap +-- @copyright 2022 +-- @license GNU General Public License v3.0 + +_G.astronvim = {} + +--- installation details from external installers +astronvim.install = _G["astronvim_installation"] or { home = vim.fn.stdpath "config" } +astronvim.supported_configs = { astronvim.install.home } +--- external astronvim configuration folder +astronvim.install.config = vim.fn.stdpath("config"):gsub("[^/\\]+$", "astronvim") +-- check if they are the same, protects against NVIM_APPNAME use for isolated install +if astronvim.install.home ~= astronvim.install.config then + vim.opt.rtp:append(astronvim.install.config) + --- supported astronvim user conifg folders + table.insert(astronvim.supported_configs, astronvim.install.config) +end + +--- 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 string The module path to try and load +---@return table|nil # The loaded module if successful or nil +local function load_module_file(module) + -- placeholder for final return value + local found_module = nil + -- search through each of the supported configuration locations + for _, config_path in ipairs(astronvim.supported_configs) do + -- convert the module path to a file path (example user.init -> user/init.lua) + local module_path = config_path .. "/lua/" .. module:gsub("%.", "/") .. ".lua" + -- check if there is a readable file, if so, set it as found + if vim.fn.filereadable(module_path) == 1 then found_module = module_path end + end + -- if we found a readable lua file, try to load it + if found_module then + -- try to load the file + local status_ok, loaded_module = pcall(require, module) + -- if successful at loading, set the return variable + if status_ok then + found_module = loaded_module + -- if unsuccessful, throw an error + else + vim.api.nvim_err_writeln("Error loading file: " .. found_module .. "\n\n" .. loaded_module) + end + end + -- return the loaded module or nil if no file found + return found_module +end + +--- Main configuration engine logic for extending a default configuration table with either a function override or a table to merge into the default option +-- @param overrides the override definition, either a table or a function that takes a single parameter of the original table +-- @param default the default configuration table +-- @param extend boolean value to either extend the default or simply overwrite it if an override is provided +-- @return the new configuration table +local function func_or_extend(overrides, default, extend) + -- if we want to extend the default with the provided override + if extend then + -- if the override is a table, use vim.tbl_deep_extend + if type(overrides) == "table" then + local opts = overrides or {} + default = default and vim.tbl_deep_extend("force", default, opts) or opts + -- if the override is a function, call it with the default and overwrite default with the return value + elseif type(overrides) == "function" then + default = overrides(default) + end + -- if extend is set to false and we have a provided override, simply override the default + elseif overrides ~= nil then + default = overrides + end + -- return the modified default table + return default +end + +--- user settings from the base `user/init.lua` file +local user_settings = load_module_file "user.init" + +--- Search the user settings (user/init.lua table) for a table with a module like path string +-- @param module the module path like string to look up in the user settings table +-- @return the value of the table entry if exists or nil +local function user_setting_table(module) + -- get the user settings table + local settings = user_settings or {} + -- iterate over the path string split by '.' to look up the table value + for tbl in string.gmatch(module, "([^%.]+)") do + settings = settings[tbl] + -- if key doesn't exist, keep the nil value and stop searching + if settings == nil then break end + end + -- return the found settings + return settings +end + +--- 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 string The module path of the override setting +---@param default? table The default settings that will be overridden +---@param extend? boolean # Whether extend the default settings or overwrite them with the user settings entirely (default: true) +---@return any # The new configuration settings with the user overrides applied +function astronvim.user_opts(module, default, extend) + -- default to extend = true + if extend == nil then extend = true end + -- if no default table is provided set it to an empty table + if default == nil then default = {} end + -- try to load a module file if it exists + local user_module_settings = load_module_file("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_module_settings == nil then user_module_settings = user_setting_table(module) end + -- if a user override was found call the configuration engine + if user_module_settings ~= nil then default = func_or_extend(user_module_settings, default, extend) end + -- return the final configuration table with any overrides applied + return default +end + +--- Updater settings overridden with any user provided configuration +astronvim.updater = { + options = astronvim.user_opts("updater", { remote = "origin", channel = "stable" }), + snapshot = { module = "lazy_snapshot", path = vim.fn.stdpath "config" .. "/lua/lazy_snapshot.lua" }, + rollback_file = vim.fn.stdpath "cache" .. "/astronvim_rollback.lua", +} +local options = astronvim.updater.options +if astronvim.install.is_stable ~= nil then options.channel = astronvim.install.is_stable and "stable" or "nightly" end +if options.pin_plugins == nil then options.pin_plugins = options.channel == "stable" end + +--- table of user created terminals +astronvim.user_terminals = {} +--- table of language servers to ignore the setup of, configured through lsp.skip_setup in the user configuration +astronvim.lsp = { skip_setup = astronvim.user_opts("lsp.skip_setup", {}) } +--- the default colorscheme to apply on startup +astronvim.default_colorscheme = astronvim.user_opts("colorscheme", "astrotheme", false) diff --git a/nvim/.config/nvim/lua/astronvim/health.lua b/nvim/.config/nvim/lua/astronvim/health.lua new file mode 100644 index 0000000..9e48adf --- /dev/null +++ b/nvim/.config/nvim/lua/astronvim/health.lua @@ -0,0 +1,51 @@ +local M = {} + +function M.check() + vim.health.report_start "AstroNvim" + + vim.health.report_info("AstroNvim Version: " .. require("astronvim.utils.updater").version(true)) + vim.health.report_info("Neovim Version: v" .. vim.fn.matchstr(vim.fn.execute "version", "NVIM v\\zs[^\n]*")) + + if vim.version().prerelease then + vim.health.report_warn "Neovim nightly is not officially supported and may have breaking changes" + elseif vim.fn.has "nvim-0.8" == 1 then + vim.health.report_ok "Using stable Neovim >= 0.8.0" + else + vim.health.report_error "Neovim >= 0.8.0 is required" + end + + local programs = { + { cmd = "git", type = "error", msg = "Used for core functionality such as updater and plugin management" }, + { + cmd = { "xdg-open", "open", "explorer" }, + type = "warn", + msg = "Used for `gx` mapping for opening files with system opener (Optional)", + }, + { cmd = "lazygit", type = "warn", msg = "Used for mappings to pull up git TUI (Optional)" }, + { cmd = "node", type = "warn", msg = "Used for mappings to pull up node REPL (Optional)" }, + { cmd = "gdu", type = "warn", msg = "Used for mappings to pull up disk usage analyzer (Optional)" }, + { cmd = "btm", type = "warn", msg = "Used for mappings to pull up system monitor (Optional)" }, + { cmd = { "python", "python3" }, type = "warn", msg = "Used for mappings to pull up python REPL (Optional)" }, + } + + for _, program in ipairs(programs) do + if type(program.cmd) == "string" then program.cmd = { program.cmd } end + local name = table.concat(program.cmd, "/") + local found = false + for _, cmd in ipairs(program.cmd) do + if vim.fn.executable(cmd) == 1 then + name = cmd + found = true + break + end + end + + if found then + vim.health.report_ok(("`%s` is installed: %s"):format(name, program.msg)) + else + vim.health["report_" .. program.type](("`%s` is not installed: %s"):format(name, program.msg)) + end + end +end + +return M diff --git a/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua b/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua new file mode 100644 index 0000000..d6f7f47 --- /dev/null +++ b/nvim/.conf