diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..12d436d --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,161 @@ +# [CONTRIBUTING](https://nvchad.github.io/contribute) + +## NvChad install for contributors + +If you wish to contribute to NvChad, 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:/NvChad.git ~/.config/nvim + ``` + - For https: + ```shell + $ git clone https://github.com//NvChad.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 NvChad repo + - for ssh: + ```shell + $ git remote add upstream git@github.com:NvChad/NvChad.git + ``` + - for https: + ```shell + $ git remote add upstream https://github.com/NvChad/NvChad.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 NvChad/main into devBranch` commits, which are to be avoided + ```shell + $ git pull upstream --rebase + ``` + +## Things to know before contributing + +- When making a PR (pull request), please be very descriptive about what you've done! + +- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin` + +- PRs should follow the pull request formats where applicable + +- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions. + +- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged. + +- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed! + +- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ). + +## How to remove or edit commits from your PR +> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR + +> As these commands edit your git history, you may need to **force push** with `git push origin --force` + +1. Run the following: + ``` + $ git rebase -i HEAD~ + ``` +
Example +

+ + ```shell + $ git rebase -i HEAD~4 + ``` + + ```shell + pick 28b2dcb statusline add lsp status + pick dad9a39 feat: Added lsp radial progress + 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 `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it. + +
Example +

+ + ```shell {3,4} + pick 28b2dcb statusline add lsp status + pick dad9a39 feat: Added lsp radial progress + 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 `edit` then edit your files, then run: + ```shell + $ git add + ``` + +4. Once you have edited & added your files, run: + ```shell + $ git rebase --continue + ``` + +5. You will likely need to push using: + ```shell + $ git push origin --force + ``` + +## Help +For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..02611f2 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +patreon: siduck +ko_fi: siduck +custom: ["https://www.buymeacoffee.com/siduck", "https://www.paypal.com/paypalme/siduck76"] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..43b4ec0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - Operating System + - Terminal + - Version of Neovim + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3495e93 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Wiki + url: https://github.com/siduck76/NvChad/wiki + about: "Walks you through how to use and Configure NvChad." + - name: Visit our gitter chat + url: https://gitter.im/neovim-dotfiles/community + about: "A place where we dicuss NvChad related stuff." diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..24d2f24 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem was. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. + +**Screenshot** +Maybe a screenshot of the feature diff --git a/.github/PULL_REQUEST_TEMPLATE/feature.md b/.github/PULL_REQUEST_TEMPLATE/feature.md new file mode 100644 index 0000000..a622846 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/feature.md @@ -0,0 +1,14 @@ + +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 + +Speed (If applicable): +Show the impact on the speed of nvChad + +Other: +Anything else relevant goes here diff --git a/.github/PULL_REQUEST_TEMPLATE/plugin.md b/.github/PULL_REQUEST_TEMPLATE/plugin.md new file mode 100644 index 0000000..28ae8d3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/plugin.md @@ -0,0 +1,16 @@ +(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`) + +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Plugins Added: +- [Plugin Name](Plugin Link) +- [Plugin Name](Plugin Link) + +Reasoning: +List why the plugin(s) should be added + +Speed: +Show the impact on the speed of nvChad + +Other: +Anything else relevant goes here diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..8f3ec47 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,122 @@ +

NvChad

+ +
+ Home + + Install + + Contribute + + Support + + Features +

+
+ +
+ +[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.9.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim) +[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues) +[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb) +[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org) +[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/DE_WM) + +
+ +## Showcase + + + + + + + +## What is it? + +- NvChad is a neovim config written in lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). We tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience. + +- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD. + +- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir). + +## Theme Showcase + +
Images (Click to expand!) + +![4 themes](https://nvchad.com/screenshots/four_Themes.webp) +![radium 1](https://nvchad.com/screenshots/radium1.webp) +![radium 2](https://nvchad.com/screenshots/radium2.webp) +![radium 3](https://nvchad.com/screenshots/radium3.webp) + + +(Note: these are just 4-5 themes, NvChad has around 56 themes) +
+ +## UI related plugins used + +
Images (Click to expand!) + +

Nvim-tree.lua

+ +Fast file tree: + + + +

Telescope-nvim

+ +A fuzzy file finder, picker, sorter, previewer and much more: + + + +

Our own statusline written from scratch

+ +[NvChad UI](https://github.com/NvChad/ui) + + + +

Tabufline (our own pertab bufferline)

+ + +- Here's a [video](https://www.youtube.com/watch?v=V_9iJ96U_k8&ab_channel=siduck) that showcases it. + +

NvCheatsheet ( our UI Plugin )

+ + +
+ +## Plugins list + +- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46) +- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm) +- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more! +- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) +- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) +- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) +- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim) +- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +- File searching, previewing image and text files and more with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim). +- Syntax highlighting with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) +- Autoclosing braces and html tags with [nvim-autopairs](https://github.com/windwp/nvim-autopairs) +- Indentlines with [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) +- Useful snippets with [friendly snippets](https://github.com/rafamadriz/friendly-snippets) + [LuaSnip](https://github.com/L3MON4D3/LuaSnip). +- Popup mappings keysheet [whichkey.nvim](https://github.com/folke/which-key.nvim) + +## History + +- I (@siduck i.e creator of NvChad) in my initial days of learning to program wanted a lightweight IDE for writing code, I had a very low end system which was like 1.4ghz pentium + 4gb ram & HDD. I was into web dev stuff so many suggested me to use vscode but that thing was very heavy on my system, It took more ram than my browser! ( minimal ungoogled chromium ) so I never tried it again, sublime text was nice but the fear of using proprietary software XD for a linux user bugged me a lot. Then I tried doom-emacs which looked pretty but it was slow and I was lost within its docs, I tried lunarvim but too lazy to read the docs. Doom-emacs and lunarvim inspired me to make a config which is the prettiest + very fast and simple. + +- I'm decent at ricing i.e customizing system and making it look pretty so I posted my neovim rice on [neovim subreddit](https://www.reddit.com/r/neovim/comments/m3xl4f/neovim_rice/), my neovim-dotfiles github repo blew up and then I had to come up with a name, I was amazed by the chad meme lol so I put NvChad as the name, the chad word in here doesnt literally mean the chad guy but in the sense such as chad linux vs windows i.e meaning superior, best etc. NvChad was made for my personal use but it gained some popularity which inspired me to make a public config i.e config usable by many and less hassle to update as everyone's going to use the same base config (NvChad) with their custom modifications (which are gitignored so that wont mess up), without the custom config stuff users would have to keep a track of every commit and copy paste git diffs to manually update nvchad. + +## :gift_heart: Support + +If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it. + +[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/siduck) +[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck13) +[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/siduck) +[![patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/siduck) + +## Credits + +- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all as he helped me in my initial neovim journey! +- @lorvethe for making the beautiful NvChad logo. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..1f16ea2 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,22 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + exempt-all-issue-assignees: true # doesn't close an issue if someone was assigned to it. + close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' + exempt-all-pr-assignees: true # doesn't close a pr if someone was assigned to it. + days-before-issue-stale: 30 + days-before-pr-stale: 45 + days-before-issue-close: 5 + days-before-pr-close: 10 diff --git a/README.md b/README.md new file mode 100644 index 0000000..ac40e9b --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Neovim Configuration + +My attempt to create my own neovim configuration with just enough features to be productive and not too many to be bloated. + +## Features + +- file tree with nvim-tree +- lsp management with mason-nvim +- telescope for searching/grepping x +- theming with themery x +- tabfluline x +- terminal with f-term x +- harpoon for deving on subsets of files x +- extended history x +- auto-pairs x +- lua vim linting x +- dashboard x + +## Installation + +1. Clone this repository to your `~/.config/nvim` directory. +2. Run `:Lazy` to install all plugins. + +## TODO + +- Add debugger diff --git a/lazy-lock.json b/lazy-lock.json index 915a420..ad25d33 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,36 +1,35 @@ { "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" }, + "catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "797de8f79055334104cf77893cd93fe3fc2ac154" }, + "conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" }, "copilot.vim": { "branch": "release", "commit": "25f73977033c597d530c7ab0e211d99b60927d2d" }, "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, - "git-blame.nvim": { "branch": "master", "commit": "408d5487d908dfe5d48e5645d8b27ddcc16b11e0" }, + "git-blame.nvim": { "branch": "master", "commit": "50543e3993f4b996eea01ff5ccc8fe2a354c5388" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, - "lazy.nvim": { "branch": "main", "commit": "9a374a0fb4d3ac42dac4a129d4bead7252473c77" }, - "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "monokai.nvim": { "branch": "master", "commit": "b8bd44d5796503173627d7a1fc51f77ec3a08a63" }, - "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, + "nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, "nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" }, "nvim-dap": { "branch": "master", "commit": "bc03b83c94d0375145ff5ac6a6dcf28c1241e06f" }, "nvim-grey": { "branch": "main", "commit": "b57f62baddc5a295bd0ffd61ff9a671a149df95a" }, - "nvim-lspconfig": { "branch": "master", "commit": "e26da408cf955afa8e9ddbadd510e84ea8976cd7" }, - "nvim-tree.lua": { "branch": "master", "commit": "f9ff00bc06d7cb70548a3847d7a2a05e928bc988" }, - "nvim-treesitter": { "branch": "master", "commit": "4e387dd47833c1bb8c8df6c3a7cab0d4c55583f3" }, - "nvim-ts-autotag": { "branch": "main", "commit": "1624866a1379fc1861797f0ed05899a9c1d2ff61" }, - "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, + "nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" }, + "nvim-tree.lua": { "branch": "master", "commit": "48d0e82f9434691cc50d970898142a8c084a49d6" }, + "nvim-treesitter": { "branch": "master", "commit": "2d5133f67429f82547ea5fad33a0b1e7d4f78a1c" }, + "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, + "nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "themery.nvim": { "branch": "main", "commit": "f745a49d9c103babde35e1111b91faa6bc591d5c" }, "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, - "vscode-js-debug": { "branch": "main", "commit": "29ba3af04e436d85b035a08c03f55e421679fc25" } + "vscode-js-debug": { "branch": "main", "commit": "14b430024ccadd5e573228214a39fac7781bd759" } } diff --git a/lua/config/conform.lua b/lua/config/conform.lua index 1de3bc9..765b3f9 100644 --- a/lua/config/conform.lua +++ b/lua/config/conform.lua @@ -9,6 +9,16 @@ require("conform").setup({ jsonc = { { "prettierd", "prettier" } }, markdown = { { "marksman", "prettier", "prettierd" } }, }, + stop_after_first = { + lua = true, + javascript = true, + typescript = true, + javascriptreact = true, + typescriptreact = true, + json = true, + jsonc = true, + markdown = true, + }, }) local M = {} diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua new file mode 100755 index 0000000..32ed4b0 --- /dev/null +++ b/lua/custom/chadrc.lua @@ -0,0 +1,70 @@ +---@type ChadrcConfig +local M = {} + +-- Path to overriding theme and highlights files +local highlights = require "custom.highlights" + +M.ui = { + theme = "catppuccin", + theme_toggle = { "catppuccin", "one_light" }, + + hl_override = highlights.override, + hl_add = highlights.add, + tabufline = { + enabled = false, + }, +} + +M.plugins = "custom.plugins" + +M.mappings = require "custom.mappings" + +-- M.options = require "custom.options" +local opt = vim.opt +local api = vim.api +-- line numbers +opt.number = true + +-- tabs & indentation +opt.tabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = true +opt.smartindent = true +opt.autoindent = true +opt.cindent = true +opt.softtabstop = 4 + +-- lne wrapping +opt.wrap = false + +-- search settings +opt.ignorecase = true +opt.smartcase = true + +-- cursor line +opt.cursorline = true + +-- backspace +opt.backspace = "indent,eol,start" + +-- autoread +opt.autoread = true +-- Function to set autocmd +local function set_autocmd(event, pattern, command) + vim.cmd(string.format("autocmd %s %s %s", event, pattern, command)) +end + +-- Trigger 'checktime' on 'CursorHold' event +set_autocmd("CursorHold", "*", "checktime") + +-- Show trailing whitespace +api.nvim_set_option("list", true) +api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<") + +-- remove whitespace on save +api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]], +}) + +return M diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua new file mode 100755 index 0000000..6558882 --- /dev/null +++ b/lua/custom/configs/lspconfig.lua @@ -0,0 +1,24 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" + +-- if you just want default config for the servers then put them in a table +local servers = { + "html", + "cssls", + "tsserver", + "intelephense", + "pyright", + "tailwindcss", + "cssmodules_ls", + "emmet_ls", + "lua_ls", +} + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end diff --git a/lua/custom/configs/null-ls.lua b/lua/custom/configs/null-ls.lua new file mode 100755 index 0000000..bc857e4 --- /dev/null +++ b/lua/custom/configs/null-ls.lua @@ -0,0 +1,33 @@ +--------------------------------- +-- Formatting +--------------------------------- +local diagnostics = require("null-ls").builtins.diagnostics +local formatting = require("null-ls").builtins.formatting +local code_actions = require("null-ls").builtins.code_actions +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + +require("null-ls").setup { + debug = true, + sources = { + formatting.black, + formatting.rustfmt, + formatting.prettier, + formatting.stylua, + diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" }, + diagnostics.eslint_d.with { diagnostics_format = "#{m} [#{c}]" }, + code_actions.eslint, + code_actions.eslint_d, + }, + on_attach = function(client, bufnr) + if client.supports_method "textDocument/formatting" then + vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr } + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format { bufnr = bufnr } + end, + }) + end + end, +} diff --git a/lua/custom/configs/overrides.lua b/lua/custom/configs/overrides.lua new file mode 100755 index 0000000..3d2b42c --- /dev/null +++ b/lua/custom/configs/overrides.lua @@ -0,0 +1,62 @@ +local M = {} + +M.treesitter = { + ensure_installed = { + "lua", + "css", + "javascript", + "html", + "typescript", + "tsx", + }, + indent = { + enable = true, + }, + highlight = { + enable = true, + }, + autotag = { + enable = true, + }, + context_commentstring = { + enable = true, + }, +} + +M.mason = { + ensure_installed = { + -- lua stuff + "lua-language-server", + "stylua", + + -- web dev stuff + "html-lsp", + "json-lsp", + "typescript-language-server", + "deno", + "prettier", + "intelephense", + "tailwindcss", + "lua", + "prisma-language-server", + "graphql", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/lua/custom/highlights.lua b/lua/custom/highlights.lua new file mode 100755 index 0000000..5f88435 --- /dev/null +++ b/lua/custom/highlights.lua @@ -0,0 +1,21 @@ +-- To find any highlight groups: " Telescope highlights" +-- Each highlight group can take a table with variables fg, bg, bold, italic, etc +-- base30 variable names can also be used as colors + +local M = {} + +---@type Base46HLGroupsList + +M.override = { + Comment = { + fg = "#8294c2", -- Lightened color + italic = true, + }, +} + +---@type HLTable +M.add = { + NvimTreeOpenedFolderName = { fg = "green", bold = true }, +} + +return M diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua new file mode 100755 index 0000000..5cb76c5 --- /dev/null +++ b/lua/custom/mappings.lua @@ -0,0 +1,34 @@ +---@type MappingsTable +-- +local M = {} + +local opts = { noremap = true, silent = true } + +M.general = { + n = { + ["nh"] = { ":nohl", "nohl", opts }, + ["sv"] = { "s", "split window vertically", opts }, + ["sh"] = { "v", "split window horizontally", opts }, + ["se"] = { "=", "make split windows even width", opts }, + ["sx"] = { ":close", "close current split window", opts }, + ["tx"] = { ":tabclose", "close current tab", opts }, + ["e"] = { ":NvimTreeToggle", "nvim-tree", opts }, + ["ls"] = { ":LspStop", "LSP", opts }, + ["lo"] = { ":LspStart", "LSP", opts }, + ["cf"] = { ":NvimTreeCollapse", "nvim-tree", opts }, + }, + + x = { + ["J"] = { ":move '>+1gv-gv", "Move text up", opts }, + ["K"] = { ":move '<-2gv-gv", "Move text down", opts }, + [""] = { ":move '>+1gv-gv", "Move text up", opts }, + [""] = { ":move '<-2gv-gv", "Move text down", opts }, + }, + + i = { + ["C-j"] = { 'copilot#Accept("")', "Copilot accept", { silent = true, expr = true } }, + [""] = { "", "escape", opts }, + }, +} + +return M diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 0000000..573332b --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,34 @@ +local opt = vim.opt +local api = vim.api +-- line numbers +opt.number = true + +-- tabs & indentation +opt.tabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = true +opt.autoindent = true +opt.softtabstop = 2 + +-- lne wrapping +opt.wrap = false + +-- search settings +opt.ignorecase = true +opt.smartcase = true + +-- cursor line +opt.cursorline = true + +-- backspace +opt.backspace = "indent,eol,start" + +-- Show trailing whitespace +api.nvim_set_option("list", true) +api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<") + +-- remove whitespace on save +api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]], +}) diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua new file mode 100755 index 0000000..6be06f5 --- /dev/null +++ b/lua/custom/plugins.lua @@ -0,0 +1,61 @@ +local overrides = require "custom.configs.overrides" +---@type NvPluginSpec[] +local plugins = { + + { + "neovim/nvim-lspconfig", + dependencies = { + -- format & linting + { + "jose-elias-alvarez/null-ls.nvim", + config = function() + require "custom.configs.null-ls" + end, + }, + }, + config = function() + require "plugins.configs.lspconfig" + require "custom.configs.lspconfig" + end, -- Override to setup mason-lspconfig + }, + + { + "williamboman/mason.nvim", + opts = overrides.mason, + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = overrides.treesitter, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + require("ts_context_commentstring").setup {} + end, + }, + + { + "nvim-tree/nvim-tree.lua", + opts = overrides.nvimtree, + }, + { + "github/copilot.vim", + lazy = false, + }, + { + "prettier/vim-prettier", + run = "yarn install", + }, + { + "windwp/nvim-ts-autotag", + lazy = false, + config = function() + require("nvim-ts-autotag").setup() + end, + }, + { "akinsho/git-conflict.nvim", version = "*", config = true, lazy = false }, + { "f-person/git-blame.nvim", lazy = false }, +} + +return plugins