Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4252f585a6 | ||
|
|
6061f9455d | ||
|
|
3d78ef3474 | ||
|
|
3585ae3dfd | ||
|
|
cbc813388d | ||
|
|
4a888ad037 | ||
|
|
d7522a940d | ||
|
|
b21defd4e4 | ||
|
|
03563f30cc | ||
|
|
232b453c29 | ||
|
|
af22bee84a | ||
|
|
bf89f0bf5f | ||
|
|
63d54926a4 | ||
|
|
4ca8d781cf | ||
|
|
e328b86336 | ||
|
|
1face444b8 | ||
|
|
b9e8f489ed | ||
|
|
6e9c78d1af | ||
|
|
47e4f0361f | ||
|
|
ec5017126c | ||
|
|
958a62bc67 | ||
|
|
75dbf5027d | ||
|
|
229ad7e00d | ||
|
|
ec274db8b2 | ||
|
|
4ad0bf1b22 | ||
|
|
f58c7e7b9e | ||
|
|
1278a3b703 | ||
|
|
ef6ecab861 | ||
|
|
e1cdf92a01 | ||
|
|
ac392cd29b | ||
|
|
cb531cd90b | ||
|
|
1777be0064 | ||
|
|
5ec6112a59 | ||
|
|
0cf5d77f72 | ||
|
|
05e48656de | ||
|
|
76d194b141 | ||
|
|
ceaf02e0bf | ||
|
|
c1e372e2cd | ||
|
|
9ca0af1a24 | ||
|
|
4be722d4a6 | ||
|
|
d9d380e41b | ||
|
|
f81531df42 | ||
|
|
a21e884983 | ||
|
|
ca481b1385 | ||
|
|
e7bba86ccf | ||
|
|
baaa7f0d4b | ||
|
|
748f0db485 | ||
|
|
7b7c204e23 | ||
|
|
f4c4d8f6c6 | ||
|
|
70baf718d2 | ||
|
|
46db63749f | ||
|
|
5a3ac7300d | ||
|
|
71295f9b61 | ||
|
|
3ee787fe08 | ||
|
|
2eab84f8f1 | ||
|
|
d0ad028efc | ||
|
|
195f6f3621 | ||
|
|
1f73ef0ec6 | ||
|
|
6b06bb9ed4 | ||
|
|
d8dabe9e5e | ||
|
|
bd98d76ad6 | ||
|
|
e87c10f225 | ||
|
|
4bda425371 | ||
|
|
4b68a75853 | ||
|
|
a3a5b506de | ||
|
|
de246fa0f5 | ||
|
|
64c32d2e5e | ||
|
|
e8b31c9308 | ||
|
|
50aa25f307 | ||
|
|
0349de6d10 | ||
|
|
2a02054a39 | ||
|
|
ee5b79d3d4 | ||
|
|
20e8249efa | ||
|
|
4511b84d6c | ||
|
|
ddd13df5af | ||
|
|
c2a1298ac0 | ||
|
|
b9fcaf610f | ||
|
|
bad06dc44f | ||
|
|
4c85f25a09 | ||
|
|
b86ae3b170 | ||
|
|
a0dd82a292 | ||
|
|
4077ff3520 | ||
|
|
bccd8e4ab9 | ||
|
|
82211ed829 | ||
|
|
c3beea11ee | ||
|
|
cf7f8a557a | ||
|
|
8f7b19f23b | ||
|
|
e6223cc587 | ||
|
|
b1338beb0f | ||
|
|
a21ee2f22f | ||
|
|
fa9f9aad0b | ||
|
|
8c2bbd2143 | ||
|
|
e9b25e5912 | ||
|
|
71b710b35b | ||
|
|
ea6f2a1490 | ||
|
|
83ad616dd3 | ||
|
|
6f65cffaa1 | ||
|
|
4e54ee0081 | ||
|
|
799432e99e | ||
|
|
0a546e4720 | ||
|
|
4c88eaec49 | ||
|
|
1e6f9a2e52 | ||
|
|
9d013a3529 | ||
|
|
9551ce7031 | ||
|
|
abe720b881 | ||
|
|
edcf93ea81 | ||
|
|
e77be17fe6 | ||
|
|
de9b702f0e | ||
|
|
688586eeec | ||
|
|
331754a890 | ||
|
|
60212005cb | ||
|
|
19cb35d80e | ||
|
|
a2d91acc84 | ||
|
|
7be01383ab | ||
|
|
ae90cca3f0 | ||
|
|
344a9aa90c | ||
|
|
e5435e93de | ||
|
|
dbc95e41bf | ||
|
|
3a966955d4 | ||
|
|
31e551af30 | ||
|
|
1cd5150b70 | ||
|
|
f718060260 | ||
|
|
abcd035e89 | ||
|
|
01f652fcc4 | ||
|
|
7c9bf9cbe3 | ||
|
|
d2db2cc1cd | ||
|
|
16d035c031 | ||
|
|
2293b16709 | ||
|
|
773d25980c | ||
|
|
52d4b564ba | ||
|
|
01babafd72 | ||
|
|
2a8afcb7b6 | ||
|
|
27c33790ef | ||
|
|
fc593d0321 | ||
|
|
ef6c1d4c27 | ||
|
|
310d84d47f | ||
|
|
97572ee1bb | ||
|
|
03d55e94a4 | ||
|
|
84c3a18fab | ||
|
|
6347a00023 | ||
|
|
653a2f5337 | ||
|
|
9e8af5ad93 | ||
|
|
067c6cc7fc | ||
|
|
7114ebd945 | ||
|
|
b4da490138 | ||
|
|
5c69d46dd6 | ||
|
|
07b4d19b8f | ||
|
|
3330d1cc06 | ||
|
|
aa9667a5de | ||
|
|
1567a9c73a | ||
|
|
e8b919723e | ||
|
|
bdd6dc12c2 | ||
|
|
5db36d44fb | ||
|
|
8de3f4e84c | ||
|
|
a256591e90 | ||
|
|
b4c50fa443 | ||
|
|
c8a27d701c | ||
|
|
fd668e559e | ||
|
|
c5fe1f711e | ||
|
|
4b2bbe5d1c | ||
|
|
01eec524be | ||
|
|
c7a36fe7d8 | ||
|
|
69c0f38a7a | ||
|
|
2cf5fe7cea | ||
|
|
6e3e0bf029 | ||
|
|
0e493bcacc | ||
|
|
068ae08f6c | ||
|
|
67962828bb | ||
|
|
56d05ac9d9 | ||
|
|
003038b2a7 | ||
|
|
eefee5e17d | ||
|
|
16a0c97fc9 | ||
|
|
9a45bb3f20 | ||
|
|
1b4a67a1e1 | ||
|
|
a24a65ab6b | ||
|
|
fb9c54bc5d | ||
|
|
cb977a5313 | ||
|
|
1b44d4f2b9 | ||
|
|
e8bbe1e4a1 | ||
|
|
d221504482 | ||
|
|
1ec9f80bdb | ||
|
|
1af5510d03 | ||
|
|
8a426b9e62 | ||
|
|
40554c80ad | ||
|
|
5799af49e2 | ||
|
|
d47fcda9ef | ||
|
|
5aa370e375 | ||
|
|
7449c9e4f6 | ||
|
|
e0ac314fab | ||
|
|
86d92a2fd2 | ||
|
|
4a349a3b45 | ||
|
|
7d5a15f7ce | ||
|
|
6fb97be55c | ||
|
|
b2cd5e38f5 | ||
|
|
2356ba069e | ||
|
|
585266dcef | ||
|
|
d810cc35a7 | ||
|
|
317eedd9b2 | ||
|
|
a1c234e001 | ||
|
|
ba3af27de0 | ||
|
|
bd1319895d | ||
|
|
cd9b2c4810 | ||
|
|
9a2430132f | ||
|
|
1c9b5b46e4 | ||
|
|
bcb4b15669 | ||
|
|
1756c92609 | ||
|
|
0b55d45845 | ||
|
|
5db8d84515 | ||
|
|
e137fddf6e | ||
|
|
5bf92c5246 | ||
|
|
3d7f0159f5 | ||
|
|
92a9e13e7c | ||
|
|
7cab4295ee | ||
|
|
8726de1faa | ||
|
|
dc80ae5795 | ||
|
|
94b01be483 | ||
|
|
f2a0051aa9 | ||
|
|
548e4e4a9d | ||
|
|
962c2bfe69 | ||
|
|
1cd3faffb3 | ||
|
|
cb3c5682a8 | ||
|
|
98ec153e8f | ||
|
|
54d5c13d38 | ||
|
|
f65338092d | ||
|
|
5bb7cd3360 | ||
|
|
d6e08ba2aa | ||
|
|
ac28a9f99e | ||
|
|
7051afe43c | ||
|
|
555f61493a | ||
|
|
a41ab8b830 | ||
|
|
8e0dfc1de6 | ||
|
|
50a5bcc870 | ||
|
|
2685ad8e30 | ||
|
|
e408a1168f | ||
|
|
9e8fb9db74 | ||
|
|
a820c3cafd | ||
|
|
595be18680 | ||
|
|
cc48bfb5c8 | ||
|
|
3d0a0e53f7 | ||
|
|
ee586047e5 | ||
|
|
9961cc0113 | ||
|
|
80c8bf4243 | ||
|
|
a5a5a8220c | ||
|
|
a5ae8899d5 | ||
|
|
eced5f2ec4 | ||
|
|
bfc10e6034 | ||
|
|
ca1ad15ad2 | ||
|
|
22f89cfeef | ||
|
|
f3fe3d46c8 | ||
|
|
0b30ed27d5 | ||
|
|
1658bf9fc6 | ||
|
|
c84f3cd6cf | ||
|
|
31d605608f | ||
|
|
1b2473bb9c | ||
|
|
62538e0b37 | ||
|
|
61b6eda6af | ||
|
|
a52382c6fa | ||
|
|
256ba205e1 | ||
|
|
67e1038b59 | ||
|
|
d0980b7109 | ||
|
|
cafd078e8f | ||
|
|
4fcf9524ee | ||
|
|
4c025cd1bf | ||
|
|
14f0460317 | ||
|
|
2309f7c249 | ||
|
|
85117ef95e | ||
|
|
f73ba68c08 | ||
|
|
3d6d429793 | ||
|
|
fe84f3952d | ||
|
|
d53761839d | ||
|
|
8056b07cdc | ||
|
|
f6f13908fc | ||
|
|
5c22354817 | ||
|
|
094ad61785 | ||
|
|
ddb11c6bc1 | ||
|
|
daa05d6688 | ||
|
|
72812acb76 | ||
|
|
62fc276f8c | ||
|
|
b515097dce | ||
|
|
803143c2e9 | ||
|
|
562a3b2824 | ||
|
|
fed72bd15d | ||
|
|
f016bf634e | ||
|
|
299ce1cde3 | ||
|
|
1107be6417 | ||
|
|
2ac6931c69 | ||
|
|
9ee56ce229 | ||
|
|
d1777dfbdf | ||
|
|
0fece65c3f | ||
|
|
53b7498d64 | ||
|
|
5c71f1421b | ||
|
|
98b531682e | ||
|
|
472fab40cf | ||
|
|
69718c7138 | ||
|
|
13abea4340 | ||
|
|
287b4bae9a | ||
|
|
ba6592c4a9 | ||
|
|
873b846d50 | ||
|
|
5742567630 | ||
|
|
19e17eac58 | ||
|
|
a3e436d16d | ||
|
|
ec7b15fead | ||
|
|
a125c388c3 | ||
|
|
2cf3e2cac5 | ||
|
|
a12455509b | ||
|
|
56ea1714f6 | ||
|
|
ad35d6b6e2 | ||
|
|
e1dfaa7a45 | ||
|
|
60db2ec626 | ||
|
|
7ddd394172 | ||
|
|
28015f639c | ||
|
|
146c0ed54f | ||
|
|
1dacbeb462 | ||
|
|
df9a780846 | ||
|
|
5db010e870 | ||
|
|
d5f4c04424 | ||
|
|
2efac1cd67 | ||
|
|
e800122b45 | ||
|
|
d90747415f | ||
|
|
cdf9250636 | ||
|
|
6b31861aeb | ||
|
|
b63e1502a5 | ||
|
|
57d0714362 | ||
|
|
0e09c3f471 | ||
|
|
2c33e3dd38 | ||
|
|
a1c103b6a8 | ||
|
|
97e155f3a2 | ||
|
|
f7ff16e84e | ||
|
|
130b2bfe00 | ||
|
|
828217b9da | ||
|
|
c87482f107 | ||
|
|
647c3730ae | ||
|
|
253047747a | ||
|
|
475a4c5f38 | ||
|
|
59ec5a5fed | ||
|
|
3c7de7a890 | ||
|
|
e107e1aaf7 | ||
|
|
4e645c3c9f | ||
|
|
780142b150 | ||
|
|
adf0168dcc | ||
|
|
66de975543 | ||
|
|
af597372ec | ||
|
|
ee981f4f4a | ||
|
|
8a21e73cc5 | ||
|
|
8f733755e8 | ||
|
|
80b632ee95 | ||
|
|
2f2389a31b | ||
|
|
21b2680e56 | ||
|
|
7d8f6b85c7 | ||
|
|
80d36cca00 | ||
|
|
9635b45404 | ||
|
|
c02b1a063f | ||
|
|
9b4b288d01 | ||
|
|
753f144d3f | ||
|
|
1b2ec94b75 | ||
|
|
49216a9c93 | ||
|
|
4828cfd282 | ||
|
|
3dc1db884c | ||
|
|
c66fb4ff3d | ||
|
|
cd5433d24b | ||
|
|
bf3e9a323f | ||
|
|
2f61dbfcd8 | ||
|
|
7d74ca4767 | ||
|
|
a3dbef5872 | ||
|
|
bce7e624e2 | ||
|
|
fba26a3a40 | ||
|
|
09f6c4c067 | ||
|
|
6fbb503a16 | ||
|
|
ac83f1d580 | ||
|
|
b2ec48ef30 | ||
|
|
49c809b6be | ||
|
|
a65368aed9 | ||
|
|
f97490d179 | ||
|
|
bf3d4b31a6 | ||
|
|
a28a838c06 | ||
|
|
a82f71334f | ||
|
|
ef40dfcbc1 | ||
|
|
3ee3b0368a | ||
|
|
e08a460543 | ||
|
|
aa95c05179 | ||
|
|
3719521d9a | ||
|
|
e1d0678f6e | ||
|
|
9ffddb6b52 | ||
|
|
44ae0178f4 | ||
|
|
ce5d33a93b | ||
|
|
dceb6a70d4 | ||
|
|
7a06fbb0be | ||
|
|
18705c4da4 | ||
|
|
c60df482e9 | ||
|
|
83992378a4 | ||
|
|
cbb0ddc0a5 | ||
|
|
b5668a037a | ||
|
|
6206a9e27b | ||
|
|
513a279788 | ||
|
|
aca4353902 | ||
|
|
b57cb6cdc0 | ||
|
|
b817c55542 | ||
|
|
4c04160b87 | ||
|
|
e15e79b519 | ||
|
|
1f6dbed26b | ||
|
|
dbf0b56059 | ||
|
|
fd5d50f194 | ||
|
|
3ccd804da9 | ||
|
|
5fab35f2e1 | ||
|
|
f7d2bacb51 | ||
|
|
d84b2d5ee1 | ||
|
|
44182c0ca1 | ||
|
|
89c371397f |
No files matched your search
@@ -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:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
|
||||
```
|
||||
- For https:
|
||||
```shell
|
||||
$ git clone https://github.com/<YOUR GITHUB USERNAME>/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~<NUMBER OF COMMITS TO GO BACK>
|
||||
```
|
||||
<details><summary>Example</summary>
|
||||
<p>
|
||||
|
||||
```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 <commit> = use commit
|
||||
# r, reword <commit> = use commit, but edit the commit message
|
||||
# e, edit <commit> = use commit, but stop for amending
|
||||
# s, squash <commit> = use commit, but meld into previous commit
|
||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
||||
# x, exec <command> = run command (the rest of the line) using shell
|
||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
||||
# d, drop <commit> = remove commit
|
||||
# l, label <label> = label current HEAD with a name
|
||||
# t, reset <label> = reset HEAD to a label
|
||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
||||
# . create a merge commit using the original merge commit's
|
||||
# . message (or the oneline, if no original merge commit was
|
||||
# . specified). Use -c <commit> to reword the commit message.
|
||||
#
|
||||
# These lines can be re-ordered; they are executed from top to bottom.
|
||||
#
|
||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
||||
#
|
||||
# However, if you remove everything, the rebase will be aborted.
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
```
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
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.
|
||||
|
||||
<details><summary>Example</summary>
|
||||
<p>
|
||||
|
||||
```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 <commit> = use commit
|
||||
# r, reword <commit> = use commit, but edit the commit message
|
||||
# e, edit <commit> = use commit, but stop for amending
|
||||
# s, squash <commit> = use commit, but meld into previous commit
|
||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
||||
# x, exec <command> = run command (the rest of the line) using shell
|
||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
||||
# d, drop <commit> = remove commit
|
||||
# l, label <label> = label current HEAD with a name
|
||||
# t, reset <label> = reset HEAD to a label
|
||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
||||
# . create a merge commit using the original merge commit's
|
||||
# . message (or the oneline, if no original merge commit was
|
||||
# . specified). Use -c <commit> to reword the commit message.
|
||||
#
|
||||
# These lines can be re-ordered; they are executed from top to bottom.
|
||||
#
|
||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
||||
#
|
||||
# However, if you remove everything, the rebase will be aborted.
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
```
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
|
||||
```shell
|
||||
$ git add <files>
|
||||
```
|
||||
|
||||
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)
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,175 @@
|
||||
<h1 align="center">NvChad</h1>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://nvchad.github.io/">Home</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/getting-started/setup">Install</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/contribute">Contribute</a>
|
||||
<span> • </span>
|
||||
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/Extras">Extras</a>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[]()
|
||||
<a href="https://github.com/NvChad/NvChad/blob/main/LICENSE"
|
||||
><img
|
||||
src="https://img.shields.io/github/license/NvChad/NvChad?style=flat-square&logo=GNU&label=License&color=df967f"
|
||||
alt="License"
|
||||
/>
|
||||
[](https://github.com/neovim/neovim)
|
||||
[](https://github.com/NvChad/NvChad/issues)
|
||||
[](https://discord.gg/gADmkJb9Fb)
|
||||
[](https://matrix.to/#/#nvchad:matrix.org)
|
||||
[](https://t.me/DE_WM)
|
||||
|
||||
</div>
|
||||
|
||||
## Showcase
|
||||
|
||||
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/dashboard-nvim.png"><hr>
|
||||
<img src="https://cdn.discordapp.com/attachments/610012460828852229/853933487295299584/unknown.png"><hr>
|
||||
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/initialNvim1.png"><hr>
|
||||
<img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/initialNvim.png"><hr>
|
||||
|
||||
## Theme Showcase
|
||||
|
||||
<details><summary> <b>Images (Click to expand!)</b></summary>
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
</details>
|
||||
|
||||
## Very useful plugins used
|
||||
|
||||
<details><summary> <b>Images (Click to expand!)</b></summary>
|
||||
|
||||
<h3> Nvim-tree.lua </h3>
|
||||
|
||||
Fast file tree:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/nvimtree.png"></kbd><hr>
|
||||
|
||||
<h3> Telescope-nvim </h3>
|
||||
|
||||
A fuzzy file finder, picker, sorter, previewer and much more:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/tel.png"></kbd>
|
||||
|
||||
<h3> Indent-blankline.nvim </h3>
|
||||
|
||||
Adds indentline:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/blanklineNvim.png"></kbd><hr>
|
||||
|
||||
<h3> Feline.nvim </h3>
|
||||
|
||||
Highly configurable statusline plugin:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/statusline.png"></kbd><hr>
|
||||
|
||||
<h3> Nvim-bufferline.lua </h3>
|
||||
|
||||
Better tab implementation:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/bufferline.png"></kbd><hr>
|
||||
|
||||
<h3> Nvim-web-devicons </h3>
|
||||
|
||||
Lua fork of Vim Devicons which offers more file icon customisability:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/image.png"></kbd><hr>
|
||||
|
||||
<h3> Nvim-treesitter </h3
|
||||
|
||||
Better syntax highlighting for programming languages (NvChad by default comes with Lua/bash treesitter parsers).
|
||||
|
||||
Without/with Treesitter:
|
||||
|
||||
<kbd><img src="https://raw.githubusercontent.com/siduck/dotfiles/all/rice%20flex/woTree.png"></kbd><hr>
|
||||
|
||||
</details>
|
||||
|
||||
## Credits
|
||||
|
||||
- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all.
|
||||
- @lorvethe for making the beautiful NvChad logo.
|
||||
|
||||
## Features
|
||||
|
||||
- Many beautiful themes to choose from.
|
||||
- Fast plugin loading.
|
||||
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua).
|
||||
- Managing tabs, buffers with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim).
|
||||
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons).
|
||||
- Pretty and functional statusline with [feline.nvim](https://github.com/Famiu/feline.nvim).
|
||||
- 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).
|
||||
- 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 [LuaSnip](https://github.com/L3MON4D3/LuaSnip).
|
||||
|
||||
## Bloat
|
||||
|
||||
To everyone who thinks that NvChad is bloat: Bloat means different things to everyone.
|
||||
|
||||
NvChad has 38 plugins installed by default, yet it is still very fast because it uses the Packer plugin manager. Packer.nvim allows you to lazy load plugins, meaning they only get loaded when absolutely required. Furthermore, you can disable plugins you don't use in `chadrc.lua`.
|
||||
|
||||
<img src = "https://chadpaste.com/f/kdmxdabxbk.png">
|
||||
|
||||
# TODO
|
||||
|
||||
NvChad is focusing more on improving its already existing plugins and features instead of adding more plugins. Things you can do to help currently are:
|
||||
|
||||
- Improving base plugins configurations
|
||||
- Debloating the config.
|
||||
- Adding more themes.
|
||||
|
||||
## Try NvChad in a Docker container
|
||||
|
||||
This will leave your current Neovim configuration untouched. Once you exit Neovim, the image is deleted.
|
||||
|
||||
```zsh
|
||||
docker run -w /root -it --rm alpine:edge sh -uelic '
|
||||
apk add git nodejs neovim ripgrep alpine-sdk --update
|
||||
git clone https://github.com/NvChad/NvChad ~/.config/nvim
|
||||
nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
||||
nvim
|
||||
'
|
||||
```
|
||||
|
||||
## Chadributors
|
||||
|
||||
<a href="https://github.com/NvChad/NvChad/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=NvChad/NvChad"/>
|
||||
</a>
|
||||
|
||||
## Warning
|
||||
|
||||
If you have an issue with a plugin in NvChad, first you should report it to NvChad to see if it's an issue with it.
|
||||
|
||||
## :gift_heart: Support
|
||||
|
||||
I would happily accept donations but would feel awful since I'm not the only one who has worked on NvChad. The project has only been made possible by the many great contributors and plugin developers, thus taking the donations just for me feels unjustified. If you enjoy using NvChad and would like to show your support then try to be a better you! Help the people in need whenever possible and do charity work. Be nice to loved ones and strangers alike. Do not be rude, always try to be helpful and caring for one another. It's easy to hate but hard to care. Be respectful to any software/work done by other people rather than making fun of them. Do not compare software (In a bad way). I'm grateful to even be able to use NeoVim! But I still cannot be fully happy when I know that there are people who barely have any food to eat, starve for weeks, don't have access to proper education, computers, basic health care facilities and more. Here are some charities and gofundme links you can donate to instead:
|
||||
|
||||
- https://www.gofundme.com/f/WeCareAboutSyria
|
||||
- https://www.gofundme.com/f/Burundi-Nutrition
|
||||
- https://charity.gofundme.com/o/en/campaign/feedingyemen
|
||||
- https://www.gofundme.com/f/6p8ea-give-ghanaian-orphans-the-gift-of-a-ride-to-school
|
||||
- https://www.isupportmyanmar.com
|
||||
- https://www.justgiving.com/campaign/somaliawater
|
||||
- https://www.justgiving.com/crowdfunding/acaappeal
|
||||
- https://www.justgiving.com/fundraising/muslim-chat
|
||||
- https://www.gofundme.com/f/help-kids-in-mali-have-warm-clothing-in-winter
|
||||
- https://www.justgiving.com/crowdfunding/carevenezuela
|
||||
- https://www.justgiving.com/campaign/yemen
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Super-Linter
|
||||
|
||||
# Run this workflow every time a new commit pushed to your repository
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
# Set the job key. The key is displayed as the job name
|
||||
# when a job name is not provided
|
||||
super-lint:
|
||||
# Name the Job
|
||||
name: Lint code base
|
||||
# Set the type of machine to run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checks out a copy of your repository on the ubuntu-latest machine
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Runs the Super-Linter action
|
||||
- name: Run Super-Linter
|
||||
uses: github/super-linter@v3
|
||||
env:
|
||||
VALIDATE_YAML: true
|
||||
VALIDATE_BASH_EXEC: true
|
||||
#VALIDATE_LUA: true #removed because the lua gets caught with all the vim
|
||||
OUTPUT_FOLDER: super-linter.report
|
||||
OUTPUT_DETAILS: detailed
|
||||
DEFAULT_BRANCH: main
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
plugin
|
||||
custom
|
||||
spell
|
||||
@@ -1,161 +0,0 @@
|
||||
<h1 align="center">NvChad</h1>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://nvchad.netlify.app/">Home</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.netlify.app/docs/Getting%20started/Setup">Install</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.netlify.app/docs/Contribute">Contribute</a>
|
||||
<span> • </span>
|
||||
<a href="https://github.com/siduck76/NvChad#gift_heart-support">Support</a>
|
||||
<span> • </span>
|
||||
<a href="https://github.com/siduck76/NvChad/wiki/Chad-user-configs">Extras</a>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[]()
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[]()
|
||||
<a href="https://github.com/siduck76/NvChad"
|
||||
><img
|
||||
src="https://img.shields.io/github/repo-size/siduck76/NvChad?style=flat-square&label=Repo"
|
||||
alt="GitHub repository size"
|
||||
/></a>
|
||||
<a href="https://github.com/siduck76/NvChad/blob/main/LICENSE"
|
||||
><img
|
||||
src="https://img.shields.io/github/license/siduck76/NvChad?style=flat-square&logo=GNU&label=License"
|
||||
alt="License"
|
||||
/>
|
||||
[](https://discord.gg/gADmkJb9Fb)
|
||||
[](https://github.com/neovim/neovim)
|
||||
[](https://github.com/siduck76/NvChad/issues)
|
||||
[](https://github.com/siduck76/NvChad/pulse)
|
||||
|
||||
</div>
|
||||
|
||||
# Showcase
|
||||
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/dashboard-nvim.png"><hr>
|
||||
<img src ="https://cdn.discordapp.com/attachments/610012460828852229/853933487295299584/unknown.png"><hr>
|
||||
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/initialNvim1.png"><hr>
|
||||
<img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/initialNvim.png"><hr>
|
||||
|
||||
# Very Very Useful lua plugins used in my config
|
||||
|
||||
#### Lspkind-nvim
|
||||
|
||||
This tiny plugin adds vscode-like pictograms to neovim built-in lsp completion items:
|
||||
|
||||
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/lspkind.png"></kbd><hr>
|
||||
|
||||
#### Nvim-tree.lua
|
||||
|
||||
fast file tree:
|
||||
|
||||
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/nvimtree.png"></kbd><hr>
|
||||
|
||||
### Telescope-nvim
|
||||
|
||||
A fuzzy file finder, picker, sorter, previewer and much more:
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/tel.png"></kbd>
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/telmedia.png"></kbd><hr>
|
||||
|
||||
### Indent-blankline.nvim
|
||||
|
||||
adds indentline:
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/blanklineNvim.png"></kbd>
|
||||
|
||||
### Galaxyline
|
||||
|
||||
fastest statusline plugin I've used so far:
|
||||
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/statusline.png"></kbd><hr>
|
||||
|
||||
### Nvim-bufferline.lua
|
||||
|
||||
As a top tabline like thing which lets me handle tabs and buffers like switching , sorting and closing them etc.
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/bufferline.png"></kbd>
|
||||
|
||||
### Nvim-web-devicons
|
||||
|
||||
Lua fork of vim devicons which lets me change icons of filetypes:
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/image.png"></kbd>
|
||||
|
||||
### Nvim-treesitter
|
||||
|
||||
Better syntax highlighting for programming languages ( NvChad by default comes with lua/bash treesitter parsers ).
|
||||
|
||||
without / with Treesitter:
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/woTree.png"></kbd>
|
||||
|
||||
# Credits
|
||||
|
||||
- [Elianiva](https://github.com/elianiva) helped me with neovim lua related issues many times, NvChad wouldnt exist without his help at all!
|
||||
- @lorvethe for making NvChad logo!
|
||||
|
||||
# Features
|
||||
|
||||
- File navigation with Nvimtree
|
||||
- Using plugins that are mouse friendly
|
||||
- Beautiful inbuilt themes
|
||||
- lazy loading 100% of plugins
|
||||
- managing tabs, buffers with bufferline
|
||||
- autosave
|
||||
- icons on nvimtree, telescope, bufferline/statusline and almost everywhere! with nvim-web-devicons
|
||||
- minimal status line (galaxyline)
|
||||
- gitsigns (colored bars for git in my config)
|
||||
- nvim-lspconfig for nvim-lsp configuration
|
||||
- lspInstall for installing lsp servers easily
|
||||
- nvim-compe for autocompletion
|
||||
- lspkind to show pictograms on autocompletion items
|
||||
- telescope for file finding, picking, previewing (files and even images)
|
||||
- nvim-treesitter for syntax highlighting
|
||||
- nvim-autopairs for autolosing braces and stuffs
|
||||
- neoformat for prettifying/formatting code
|
||||
- packer.nvim as package manager
|
||||
- indent-blankline.Nvim for indentlines
|
||||
- smooth scrolling
|
||||
- luasnip for snippet plugin and snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
|
||||
- Distraction free modes (modes in which statusline, tabline etc. stuff get disabled so its just the text visible in the buffer similar to goyo.vim)
|
||||
- Code formatting/prettifying
|
||||
- gitsigns for git diffs
|
||||
|
||||
# Bloat
|
||||
|
||||
- To all those who think this is probably bloated, sure it is. Bloat means different to everyone. NvChad has like 30 ~ plugins but that doesn't mean those plugins are compromising neovim's speed, snappiness, or making it slow. No matter how many plugins I'd add on NvChad, it wouldn't compromise speed/snappiness/make it slow or whatever since it uses packer.nvim as plugin manager. packer.nvim lets you lazy load plugins i.e. loading plugins on certain events, mappings, sequentially loading them, etc, thus loading them only when needed. I have lazy loaded all the plugins so most plugins aren't loaded by default, hence not affecting neovim's startup/launch time.
|
||||
|
||||
<img src = "https://chadpaste.com/f/kdmxdabxbk.png">
|
||||
|
||||
# TODO
|
||||
|
||||
It would be nice if NvChad focuses on existing plugins and config before adding new things. Some plugins like whichkey, telescope and treesitter still have basic configs! Also adding new features that'd make NvChad slow or its startup time slow wouldn't be encouraged. If that feature is really needed then it'll be mentioned in the wiki with its config.
|
||||
|
||||
- Debloat the config.
|
||||
- Make NvChad more and more faster (reduce startup time as low as possible).
|
||||
- Add more themes.
|
||||
|
||||
# Chad contributors
|
||||
|
||||
<a href = "https://github.com/NvChad/NvChad/graphs/contributors">
|
||||
<img src = "https://contrib.rocks/image?repo=siduck76/NvChad"/>
|
||||
</a>
|
||||
|
||||
## :gift_heart: Support
|
||||
|
||||
If you enjoy using NvChad and would like to show your appreciation, you may want to tip me here.
|
||||
|
||||
It is never required but always appreciated.
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.buymeacoffee.com/siduck7" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/1.png"></a>
|
||||
<a href="https://ko-fi.com/siduck76" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/2.png"></a>
|
||||
<a href="https://www.paypal.com/paypalme/siduck76" target="_blank"><img alt="undefined" width="48px" src="https://raw.githubusercontent.com/adi1090x/files/master/other/3.png"></a>
|
||||
</p>
|
||||
|
||||
## Warning
|
||||
|
||||
I get hearings from some plugin devs that nvchad users bring issues on discourse/reddit/matrix/gh repos etc. Please dont do that :/ . Bring NvChad related issues here ONLY and dont ever bother plugin devs, THIS IS A CLEAR WARNING! 😠
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Just an example, supposed to be placed in /lua/custom/
|
||||
|
||||
local M = {}
|
||||
|
||||
-- make sure you maintain the structure of `core/default_config.lua` here,
|
||||
-- example of changing theme:
|
||||
|
||||
M.ui = {
|
||||
theme = "gruvchad",
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Please check NvChad docs if you're totally new to nvchad + dont know lua!!
|
||||
-- This is an example init file in /lua/custom/
|
||||
-- this init.lua can load stuffs etc too so treat it like your ~/.config/nvim/
|
||||
|
||||
-- MAPPINGS
|
||||
local map = require("core.utils").map
|
||||
|
||||
map("n", "<leader>cc", ":Telescope <CR>")
|
||||
map("n", "<leader>q", ":q <CR>")
|
||||
|
||||
-- NOTE: the 4th argument in the map function is be a table i.e options but its most likely un-needed so dont worry about it
|
||||
@@ -1,12 +1,31 @@
|
||||
local chad_modules = {
|
||||
"options",
|
||||
"mappings",
|
||||
local present, impatient = pcall(require, "impatient")
|
||||
|
||||
if present then
|
||||
impatient.enable_profile()
|
||||
end
|
||||
|
||||
local core_modules = {
|
||||
"core.options",
|
||||
"core.autocmds",
|
||||
"core.mappings",
|
||||
}
|
||||
|
||||
for i = 1, #chad_modules, 1 do
|
||||
if not pcall(require, chad_modules[i]) then
|
||||
error("Error loading " .. chad_modules[i] .. "\n")
|
||||
for _, module in ipairs(core_modules) do
|
||||
local ok, err = pcall(require, module)
|
||||
if not ok then
|
||||
error("Error loading " .. module .. "\n\n" .. err)
|
||||
end
|
||||
end
|
||||
|
||||
require("mappings").misc()
|
||||
-- non plugin mappings
|
||||
require("core.mappings").misc()
|
||||
|
||||
-- check if custom init.lua file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/init.lua") == 1 then
|
||||
-- try to call custom init, if not successful, show error
|
||||
local ok, err = pcall(require, "custom")
|
||||
if not ok then
|
||||
vim.notify("Error loading custom/init.lua\n\n" .. err)
|
||||
end
|
||||
return
|
||||
end
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
-- IMPORTANT NOTE : This is user config
|
||||
|
||||
local M = {}
|
||||
|
||||
M.ui = {
|
||||
theme = "onedark",
|
||||
|
||||
-- theme toggle
|
||||
theme_toggler = false,
|
||||
fav_themes = {
|
||||
"onedark",
|
||||
"gruvchad",
|
||||
},
|
||||
italic_comments = false,
|
||||
|
||||
-- Enable this only if your terminal has the colorscheme set which nvchad uses
|
||||
-- For Ex : if you have onedark set in nvchad , set onedark's bg color on your terminal
|
||||
transparency = false,
|
||||
|
||||
hidden_statusline = {
|
||||
-- these are filetypes, not pattern matched
|
||||
"NvimTree",
|
||||
-- "terminal",
|
||||
},
|
||||
statusline_style = "default", -- default, round , slant , block , arrow
|
||||
}
|
||||
|
||||
M.options = {
|
||||
permanent_undo = true,
|
||||
ruler = false,
|
||||
hidden = true,
|
||||
ignorecase = true,
|
||||
mouse = "a",
|
||||
cmdheight = 1,
|
||||
updatetime = 250,
|
||||
timeoutlen = 400,
|
||||
clipboard = "unnamedplus",
|
||||
number = true,
|
||||
-- relative numbers in normal mode tool at the bottom of options.lua
|
||||
relativenumber = false,
|
||||
numberwidth = 2,
|
||||
expandtab = true,
|
||||
shiftwidth = 2,
|
||||
smartindent = true,
|
||||
mapleader = " ",
|
||||
autosave = false,
|
||||
enable_insertNav = true, -- navigation in insertmode
|
||||
-- used for updater
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "main",
|
||||
}
|
||||
|
||||
-- enable and disable plugins (false for disable)
|
||||
M.plugin_status = {
|
||||
-- UI
|
||||
nvim_bufferline = true,
|
||||
galaxyline = true,
|
||||
nvim_colorizer = true,
|
||||
dashboard_nvim = true,
|
||||
blankline = true,
|
||||
truezen_nvim = true,
|
||||
better_esc = true,
|
||||
-- lsp stuff
|
||||
lspkind = true,
|
||||
lspsignature = true,
|
||||
-- git stuff
|
||||
gitsigns = true,
|
||||
vim_fugitive = true,
|
||||
-- misc
|
||||
neoformat = true,
|
||||
vim_matchup = true,
|
||||
autosave_nvim = true,
|
||||
nvim_comment = true,
|
||||
neoscroll_nvim = true,
|
||||
telescope_media = true,
|
||||
cheatsheet = true,
|
||||
}
|
||||
|
||||
-- make sure you dont use same keys twice
|
||||
M.mappings = {
|
||||
-- plugin specific
|
||||
truezen = {
|
||||
ataraxisMode = "<leader>zz",
|
||||
minimalisticmode = "<leader>zm",
|
||||
focusmode = "<leader>zf",
|
||||
},
|
||||
comment_nvim = {
|
||||
comment_toggle = "<leader>/",
|
||||
},
|
||||
nvimtree = {
|
||||
treetoggle = "<C-n>", -- file manager
|
||||
},
|
||||
neoformat = {
|
||||
format = "<leader>fm",
|
||||
},
|
||||
dashboard = {
|
||||
open = "<leader>db",
|
||||
newfile = "<leader>fn",
|
||||
bookmarks = "<leader>bm",
|
||||
sessionload = "<leader>l",
|
||||
sessionsave = "<leader>s",
|
||||
},
|
||||
telescope = {
|
||||
live_grep = "<leader>fw",
|
||||
git_status = "<leader>gt",
|
||||
git_commits = "<leader>cm",
|
||||
find_files = "<leader>ff",
|
||||
buffers = "<leader>fb",
|
||||
help_tags = "<leader>fh",
|
||||
oldfiles = "<leader>fo",
|
||||
themes = "<leader>th",
|
||||
},
|
||||
telescope_media = {
|
||||
media_files = "<leader>fp",
|
||||
},
|
||||
chadsheet = {
|
||||
default_keys = "<leader>dk",
|
||||
user_keys = "<leader>uk",
|
||||
},
|
||||
bufferline = {
|
||||
new_buffer = "<S-t>",
|
||||
newtab = "<C-t>b",
|
||||
close = "<S-x>", -- close a buffer with custom func in utils.lua
|
||||
cycleNext = "<TAB>", -- next buffer
|
||||
cyclePrev = "<S-Tab>", -- previous buffer
|
||||
},
|
||||
fugitive = {
|
||||
Git = "<leader>gs",
|
||||
diffget_2 = "<leader>gh",
|
||||
diffget_3 = "<leader>gl",
|
||||
git_blame = "<leader>gb",
|
||||
},
|
||||
terms = { -- below are NvChad mappings, not plugin mappings
|
||||
esc_termmode = "jk",
|
||||
esc_hide_termmode = "JK",
|
||||
pick_term = "<leader>W", -- note: this is a telescope extension
|
||||
new_wind = "<leader>w",
|
||||
new_vert = "<leader>v",
|
||||
new_hori = "<leader>h",
|
||||
},
|
||||
-- navigation in insert mode
|
||||
insert_nav = {
|
||||
forward = "<C-l>",
|
||||
backward = "<C-h>",
|
||||
top_of_line = "<C-a>",
|
||||
end_of_line = "<C-e>",
|
||||
prev_line = "<C-j>",
|
||||
next_line = "<C-k>",
|
||||
},
|
||||
misc = {
|
||||
copywhole_file = "<C-a>",
|
||||
toggle_linenr = "<leader>n", -- show or hide line number
|
||||
theme_toggle = "<leader>x",
|
||||
update_nvchad = "<leader>uu",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,168 @@
|
||||
local cmd = vim.cmd
|
||||
|
||||
local colors = require("colors").get()
|
||||
local ui = require("core.utils").load_config().ui
|
||||
|
||||
local black = colors.black
|
||||
local black2 = colors.black2
|
||||
local blue = colors.blue
|
||||
local darker_black = colors.darker_black
|
||||
local folder_bg = colors.folder_bg
|
||||
local green = colors.green
|
||||
local grey = colors.grey
|
||||
local grey_fg = colors.grey_fg
|
||||
local light_grey = colors.light_grey
|
||||
local line = colors.line
|
||||
local nord_blue = colors.nord_blue
|
||||
local one_bg = colors.one_bg
|
||||
local one_bg2 = colors.one_bg2
|
||||
local pmenu_bg = colors.pmenu_bg
|
||||
local purple = colors.purple
|
||||
local red = colors.red
|
||||
local white = colors.white
|
||||
local yellow = colors.yellow
|
||||
local orange = colors.orange
|
||||
local one_bg3 = colors.one_bg3
|
||||
|
||||
-- functions for setting highlights
|
||||
local fg = require("core.utils").fg
|
||||
local fg_bg = require("core.utils").fg_bg
|
||||
local bg = require("core.utils").bg
|
||||
|
||||
-- Comments
|
||||
if ui.italic_comments then
|
||||
fg("Comment", grey_fg .. " gui=italic")
|
||||
else
|
||||
fg("Comment", grey_fg)
|
||||
end
|
||||
|
||||
-- Disable cursor line
|
||||
cmd "hi clear CursorLine"
|
||||
-- Line number
|
||||
fg("cursorlinenr", white)
|
||||
|
||||
-- same it bg, so it doesn't appear
|
||||
fg("EndOfBuffer", black)
|
||||
|
||||
-- For floating windows
|
||||
fg("FloatBorder", blue)
|
||||
bg("NormalFloat", darker_black)
|
||||
|
||||
-- Pmenu
|
||||
bg("Pmenu", one_bg)
|
||||
bg("PmenuSbar", one_bg2)
|
||||
bg("PmenuSel", pmenu_bg)
|
||||
bg("PmenuThumb", nord_blue)
|
||||
fg("CmpItemAbbr", white)
|
||||
fg("CmpItemAbbrMatch", white)
|
||||
fg("CmpItemKind", white)
|
||||
fg("CmpItemMenu", white)
|
||||
|
||||
-- misc
|
||||
|
||||
-- inactive statuslines as thin lines
|
||||
fg("StatusLineNC", one_bg3 .. " gui=underline")
|
||||
|
||||
fg("LineNr", grey)
|
||||
fg("NvimInternalError", red)
|
||||
fg("VertSplit", one_bg2)
|
||||
|
||||
if ui.transparency then
|
||||
bg("Normal", "NONE")
|
||||
bg("Folded", "NONE")
|
||||
fg("Folded", "NONE")
|
||||
fg("Comment", grey)
|
||||
end
|
||||
|
||||
-- [[ Plugin Highlights
|
||||
|
||||
-- Dashboard
|
||||
fg("AlphaHeader", grey_fg)
|
||||
fg("AlphaButtons", light_grey)
|
||||
|
||||
-- Git signs
|
||||
fg_bg("DiffAdd", blue, "NONE")
|
||||
fg_bg("DiffChange", grey_fg, "NONE")
|
||||
fg_bg("DiffChangeDelete", red, "NONE")
|
||||
fg_bg("DiffModified", red, "NONE")
|
||||
fg_bg("DiffDelete", red, "NONE")
|
||||
|
||||
-- Indent blankline plugin
|
||||
fg("IndentBlanklineChar", line)
|
||||
fg("IndentBlanklineSpaceChar", line)
|
||||
|
||||
-- Lsp diagnostics
|
||||
|
||||
fg("DiagnosticHint", purple)
|
||||
fg("DiagnosticError", red)
|
||||
fg("DiagnosticWarn", yellow)
|
||||
fg("DiagnosticInformation", green)
|
||||
|
||||
-- NvimTree
|
||||
fg("NvimTreeEmptyFolderName", folder_bg)
|
||||
fg("NvimTreeEndOfBuffer", darker_black)
|
||||
fg("NvimTreeFolderIcon", folder_bg)
|
||||
fg("NvimTreeFolderName", folder_bg)
|
||||
fg("NvimTreeGitDirty", red)
|
||||
fg("NvimTreeIndentMarker", one_bg2)
|
||||
bg("NvimTreeNormal", darker_black)
|
||||
bg("NvimTreeNormalNC", darker_black)
|
||||
fg("NvimTreeOpenedFolderName", folder_bg)
|
||||
fg("NvimTreeRootFolder", red .. " gui=underline") -- enable underline for root folder in nvim tree
|
||||
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
|
||||
fg_bg("NvimTreeVertSplit", darker_black, darker_black)
|
||||
fg_bg("NvimTreeWindowPicker", red, black2)
|
||||
|
||||
-- Telescope
|
||||
fg_bg("TelescopeBorder", darker_black, darker_black)
|
||||
fg_bg("TelescopePromptBorder", black2, black2)
|
||||
|
||||
fg_bg("TelescopePromptNormal", white, black2)
|
||||
fg_bg("TelescopePromptPrefix", red, black2)
|
||||
|
||||
bg("TelescopeNormal", darker_black)
|
||||
|
||||
fg_bg("TelescopePreviewTitle", black, green)
|
||||
fg_bg("TelescopePromptTitle", black, red)
|
||||
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
|
||||
|
||||
bg("TelescopeSelection", black2)
|
||||
|
||||
-- keybinds cheatsheet
|
||||
|
||||
fg_bg("CheatsheetBorder", black, black)
|
||||
bg("CheatsheetSectionContent", black)
|
||||
fg("CheatsheetHeading", white)
|
||||
|
||||
local section_title_colors = {
|
||||
white,
|
||||
blue,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
purple,
|
||||
orange,
|
||||
}
|
||||
for i, color in ipairs(section_title_colors) do
|
||||
vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black)
|
||||
end
|
||||
|
||||
-- Disable some highlight in nvim tree if transparency enabled
|
||||
if ui.transparency then
|
||||
bg("NormalFloat", "NONE")
|
||||
bg("NvimTreeNormal", "NONE")
|
||||
bg("NvimTreeNormalNC", "NONE")
|
||||
bg("NvimTreeStatusLineNC", "NONE")
|
||||
fg_bg("NvimTreeVertSplit", grey, "NONE")
|
||||
|
||||
-- telescope
|
||||
bg("TelescopeBorder", "NONE")
|
||||
bg("TelescopePrompt", "NONE")
|
||||
bg("TelescopeResults", "NONE")
|
||||
bg("TelescopePromptBorder", "NONE")
|
||||
bg("TelescopePromptNormal", "NONE")
|
||||
bg("TelescopeNormal", "NONE")
|
||||
bg("TelescopePromptPrefix", "NONE")
|
||||
fg("TelescopeBorder", one_bg)
|
||||
fg_bg("TelescopeResultsTitle", black, blue)
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
local colors = require("core.utils").load_config().ui.colors
|
||||
local override = require("core.utils").load_config().ui.hl_override
|
||||
|
||||
local M = {}
|
||||
|
||||
-- if theme given, load given theme if given, otherwise nvchad_theme
|
||||
M.init = function(theme)
|
||||
if not theme then
|
||||
theme = require("core.utils").load_config().ui.theme
|
||||
end
|
||||
|
||||
-- set the global theme, used at various places like theme switcher, highlights
|
||||
vim.g.nvchad_theme = theme
|
||||
|
||||
local present, base16 = pcall(require, "base16")
|
||||
|
||||
if present then
|
||||
-- first load the base16 theme
|
||||
local ok, array = pcall(base16.themes, theme)
|
||||
|
||||
if ok then
|
||||
base16(array, true)
|
||||
-- unload to force reload
|
||||
package.loaded["colors.highlights" or false] = nil
|
||||
-- then load the highlights
|
||||
require "colors.highlights"
|
||||
else
|
||||
pcall(vim.cmd, "colo " .. theme)
|
||||
end
|
||||
else
|
||||
pcall(vim.cmd, "colo " .. theme)
|
||||
end
|
||||
|
||||
if #override ~= 0 then
|
||||
package.loaded[override] = nil
|
||||
require(override)
|
||||
end
|
||||
end
|
||||
|
||||
-- returns a table of colors for given or current theme
|
||||
M.get = function(theme)
|
||||
if #colors ~= 0 then
|
||||
return require(colors)
|
||||
else
|
||||
if not theme then
|
||||
theme = vim.g.nvchad_theme
|
||||
end
|
||||
return require("hl_themes." .. theme)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,22 @@
|
||||
local settings=require("core.utils").load_config().options.nvChad
|
||||
-- uncomment this if you want to open nvim with a dir
|
||||
-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]]
|
||||
|
||||
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
|
||||
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
|
||||
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
|
||||
|
||||
-- Don't show any numbers inside terminals
|
||||
if not settings.terminal_numbers then
|
||||
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]]
|
||||
end
|
||||
|
||||
-- Don't show status line on certain windows
|
||||
if not require("core.utils").load_config().plugins.options.statusline.hide_disable then
|
||||
vim.cmd [[ autocmd BufEnter,BufRead,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]]
|
||||
end
|
||||
|
||||
-- Open a file from its last left off position
|
||||
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
|
||||
-- File extension specific tabbing
|
||||
-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
|
||||
@@ -0,0 +1,279 @@
|
||||
-- IMPORTANT NOTE : This is default config, so dont change anything here.
|
||||
-- use custom/chadrc.lua instead
|
||||
|
||||
local M = {}
|
||||
|
||||
M.options = {
|
||||
-- custom = {}
|
||||
-- general nvim/vim options , check :h optionname to know more about an option
|
||||
|
||||
clipboard = "unnamedplus",
|
||||
cmdheight = 1,
|
||||
ruler = false,
|
||||
hidden = true,
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
mapleader = " ",
|
||||
mouse = "a",
|
||||
number = true,
|
||||
numberwidth = 2,
|
||||
relativenumber = false,
|
||||
expandtab = true,
|
||||
shiftwidth = 2,
|
||||
smartindent = true,
|
||||
tabstop = 8,
|
||||
timeoutlen = 400,
|
||||
updatetime = 250,
|
||||
undofile = true,
|
||||
fillchars = { eob = " " },
|
||||
shadafile = vim.opt.shadafile,
|
||||
|
||||
-- NvChad options
|
||||
nvChad = {
|
||||
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
|
||||
copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
|
||||
insert_nav = true, -- navigation in insertmode
|
||||
window_nav = true,
|
||||
terminal_numbers = false,
|
||||
|
||||
-- updater
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "main",
|
||||
},
|
||||
terminal = {
|
||||
behavior = {
|
||||
close_on_exit = true,
|
||||
},
|
||||
window = {
|
||||
vsplit_ratio = 0.5,
|
||||
split_ratio = 0.4,
|
||||
},
|
||||
location = {
|
||||
horizontal = "rightbelow",
|
||||
vertical = "rightbelow",
|
||||
float = {
|
||||
relative = 'editor',
|
||||
row = 0.3,
|
||||
col = 0.25,
|
||||
width = 0.5,
|
||||
height = 0.4,
|
||||
border = "single",
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
---- UI -----
|
||||
|
||||
M.ui = {
|
||||
hl_override = "", -- path of your file that contains highlights
|
||||
colors = "", -- path of your file that contains colors
|
||||
italic_comments = false,
|
||||
theme = "onedark", -- default theme
|
||||
|
||||
-- Change terminal bg to nvim theme's bg color so it'll match well
|
||||
-- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
|
||||
transparency = false,
|
||||
}
|
||||
|
||||
---- PLUGIN OPTIONS ----
|
||||
|
||||
M.plugins = {
|
||||
|
||||
-- builtin nvim plugins are disabled
|
||||
builtins = {
|
||||
"2html_plugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
},
|
||||
|
||||
-- enable/disable plugins (false for disable)
|
||||
status = {
|
||||
blankline = true, -- indentline stuff
|
||||
bufferline = true, -- manage and preview opened buffers
|
||||
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
|
||||
comment = true, -- easily (un)comment code, language aware
|
||||
alpha = false, -- dashboard
|
||||
better_escape = true, -- map to <ESC> with no lag
|
||||
feline = true, -- statusline
|
||||
gitsigns = true,
|
||||
lspsignature = true, -- lsp enhancements
|
||||
vim_matchup = true, -- improved matchit
|
||||
cmp = true,
|
||||
nvimtree = true,
|
||||
autopairs = true,
|
||||
},
|
||||
options = {
|
||||
packer = {
|
||||
init_file = "plugins.packerInit",
|
||||
},
|
||||
autopairs = { loadAfter = "nvim-cmp" },
|
||||
cmp = {
|
||||
lazy_load = true,
|
||||
},
|
||||
lspconfig = {
|
||||
setup_lspconf = "", -- path of file containing setups of different lsps
|
||||
},
|
||||
nvimtree = {
|
||||
-- packerCompile required after changing lazy_load
|
||||
lazy_load = true,
|
||||
},
|
||||
luasnip = {
|
||||
snippet_path = {},
|
||||
},
|
||||
statusline = {
|
||||
hide_disable = false,
|
||||
-- hide, show on specific filetypes
|
||||
hidden = {
|
||||
"help",
|
||||
"NvimTree",
|
||||
"terminal",
|
||||
"alpha",
|
||||
},
|
||||
shown = {},
|
||||
|
||||
-- truncate statusline on small screens
|
||||
shortline = true,
|
||||
style = "default", -- default, round , slant , block , arrow
|
||||
},
|
||||
esc_insertmode_timeout = 300,
|
||||
},
|
||||
default_plugin_config_replace = {},
|
||||
default_plugin_remove = {},
|
||||
install = nil,
|
||||
}
|
||||
|
||||
-- Don't use a single keymap twice
|
||||
|
||||
--- MAPPINGS ----
|
||||
|
||||
-- non plugin
|
||||
M.mappings = {
|
||||
-- custom = {}, -- custom user mappings
|
||||
|
||||
misc = {
|
||||
cheatsheet = "<leader>ch",
|
||||
close_buffer = "<leader>x",
|
||||
cp_whole_file = "<C-c>", -- copy all contents of current buffer
|
||||
lineNR_toggle = "<leader>n", -- toggle line number
|
||||
lineNR_rel_toggle = "<leader>rn",
|
||||
update_nvchad = "<leader>uu",
|
||||
new_buffer = "<S-t>",
|
||||
new_tab = "<C-t>b",
|
||||
save_file = "<C-s>", -- save file using :w
|
||||
},
|
||||
|
||||
-- navigation in insert mode, only if enabled in options
|
||||
|
||||
insert_nav = {
|
||||
backward = "<C-h>",
|
||||
end_of_line = "<C-e>",
|
||||
forward = "<C-l>",
|
||||
next_line = "<C-j>",
|
||||
prev_line = "<C-k>",
|
||||
beginning_of_line = "<C-a>",
|
||||
},
|
||||
|
||||
-- better window movement
|
||||
window_nav = {
|
||||
moveLeft = "<C-h>",
|
||||
moveRight = "<C-l>",
|
||||
moveUp = "<C-k>",
|
||||
moveDown = "<C-j>",
|
||||
},
|
||||
|
||||
-- terminal related mappings
|
||||
terminal = {
|
||||
-- multiple mappings can be given for esc_termmode, esc_hide_termmode
|
||||
|
||||
-- get out of terminal mode
|
||||
esc_termmode = { "jk" },
|
||||
|
||||
-- get out of terminal mode and hide it
|
||||
esc_hide_termmode = { "JK" },
|
||||
-- show & recover hidden terminal buffers in a telescope picker
|
||||
pick_term = "<leader>W",
|
||||
|
||||
-- spawn a single terminal and toggle it
|
||||
-- this just works like toggleterm kinda
|
||||
new_horizontal = "<leader>h",
|
||||
new_vertical = "<leader>v",
|
||||
new_float = "<A-i>",
|
||||
|
||||
-- spawn new terminals
|
||||
spawn_horizontal = "<A-h>",
|
||||
spawn_vertical = "<A-v>",
|
||||
spawn_window = "<leader>w",
|
||||
},
|
||||
}
|
||||
|
||||
-- plugins related mappings
|
||||
-- To disable a mapping, equate the variable to "" or false or nil in chadrc
|
||||
M.mappings.plugins = {
|
||||
bufferline = {
|
||||
next_buffer = "<TAB>",
|
||||
prev_buffer = "<S-Tab>",
|
||||
},
|
||||
comment = {
|
||||
toggle = "<leader>/",
|
||||
},
|
||||
|
||||
-- map to <ESC> with no lag
|
||||
better_escape = { -- <ESC> will still work
|
||||
esc_insertmode = { "jk" }, -- multiple mappings allowed
|
||||
},
|
||||
|
||||
lspconfig = {
|
||||
declaration = "gD",
|
||||
definition = "gd",
|
||||
hover = "K",
|
||||
implementation = "gi",
|
||||
signature_help = "gk",
|
||||
add_workspace_folder = "<leader>wa",
|
||||
remove_workspace_folder = "<leader>wr",
|
||||
list_workspace_folders = "<leader>wl",
|
||||
type_definition = "<leader>D",
|
||||
rename = "<leader>ra",
|
||||
code_action = "<leader>ca",
|
||||
references = "gr",
|
||||
float_diagnostics = "ge",
|
||||
goto_prev = "[d",
|
||||
goto_next = "]d",
|
||||
set_loclist = "<leader>q",
|
||||
formatting = "<leader>fm",
|
||||
},
|
||||
|
||||
nvimtree = {
|
||||
toggle = "<C-n>",
|
||||
focus = "<leader>e",
|
||||
},
|
||||
|
||||
telescope = {
|
||||
buffers = "<leader>fb",
|
||||
find_files = "<leader>ff",
|
||||
find_hiddenfiles = "<leader>fa",
|
||||
git_commits = "<leader>cm",
|
||||
git_status = "<leader>gt",
|
||||
help_tags = "<leader>fh",
|
||||
live_grep = "<leader>fw",
|
||||
oldfiles = "<leader>fo",
|
||||
themes = "<leader>th", -- NvChad theme picker
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,207 @@
|
||||
local utils = require "core.utils"
|
||||
|
||||
local config = utils.load_config()
|
||||
local map_wrapper = utils.map
|
||||
|
||||
local maps = config.mappings
|
||||
local plugin_maps = maps.plugins
|
||||
local nvChad_options = config.options.nvChad
|
||||
local terminal_options = config.options.terminal
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- This is a wrapper function made to disable a plugin mapping from chadrc
|
||||
-- If keys are nil, false or empty string, then the mapping will be not applied
|
||||
-- Useful when one wants to use that keymap for any other purpose
|
||||
local map = function(...)
|
||||
local keys = select(2, ...)
|
||||
if not keys or keys == "" then
|
||||
return
|
||||
end
|
||||
map_wrapper(...)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
-- these mappings will only be called during initialization
|
||||
M.misc = function()
|
||||
local function non_config_mappings()
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
map_wrapper("v", "p", "p:let @+=@0<CR>")
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using :map
|
||||
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
||||
map_wrapper({ "n", "x", "o" }, "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||
map_wrapper({ "n", "x", "o" }, "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||
map_wrapper("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||
map_wrapper("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||
|
||||
-- use ESC to turn off search highlighting
|
||||
map_wrapper("n", "<Esc>", ":noh <CR>")
|
||||
|
||||
-- center cursor when moving (goto_definition)
|
||||
end
|
||||
|
||||
local function optional_mappings()
|
||||
-- don't yank text on cut ( x )
|
||||
if not nvChad_options.copy_cut then
|
||||
map_wrapper({ "n", "v" }, "x", '"_x')
|
||||
end
|
||||
|
||||
-- don't yank text on delete ( dd )
|
||||
if not nvChad_options.copy_del then
|
||||
map_wrapper({ "n", "v" }, "d", '"_d')
|
||||
end
|
||||
|
||||
-- navigation within insert mode
|
||||
if nvChad_options.insert_nav then
|
||||
local inav = maps.insert_nav
|
||||
|
||||
map("i", inav.backward, "<Left>")
|
||||
map("i", inav.end_of_line, "<End>")
|
||||
map("i", inav.forward, "<Right>")
|
||||
map("i", inav.next_line, "<Down>")
|
||||
map("i", inav.prev_line, "<Up>")
|
||||
map("i", inav.beginning_of_line, "<ESC>^i")
|
||||
end
|
||||
|
||||
-- easier navigation between windows
|
||||
if nvChad_options.window_nav then
|
||||
local wnav = maps.window_nav
|
||||
|
||||
map("n", wnav.moveLeft, "<C-w>h")
|
||||
map("n", wnav.moveRight, "<C-w>l")
|
||||
map("n", wnav.moveUp, "<C-w>k")
|
||||
map("n", wnav.moveDown, "<C-w>j")
|
||||
end
|
||||
end
|
||||
|
||||
local function required_mappings()
|
||||
map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() <CR>") -- show keybinds
|
||||
map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
|
||||
map("n", maps.misc.cp_whole_file, ":%y+ <CR>") -- copy whole file content
|
||||
map("n", maps.misc.new_buffer, ":enew <CR>") -- new buffer
|
||||
map("n", maps.misc.new_tab, ":tabnew <CR>") -- new tabs
|
||||
map("n", maps.misc.lineNR_toggle, ":set nu! <CR>")
|
||||
map("n", maps.misc.lineNR_rel_toggle, ":set rnu! <CR>") -- relative line numbers
|
||||
map("n", maps.misc.save_file, ":w <CR>") -- ctrl + s to save file
|
||||
|
||||
-- terminal mappings --
|
||||
local term_maps = maps.terminal
|
||||
-- get out of terminal mode
|
||||
map("t", term_maps.esc_termmode, "<C-\\><C-n>")
|
||||
-- hide a term from within terminal mode
|
||||
map("t", term_maps.esc_hide_termmode, "<CMD>lua require('nvchad.terminal').hide() <CR>")
|
||||
-- pick a hidden term
|
||||
map("n", term_maps.pick_term, ":Telescope terms <CR>")
|
||||
-- Open terminals
|
||||
-- TODO this opens on top of an existing vert/hori term, fixme
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_horizontal,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('horizontal', "
|
||||
.. tostring(terminal_options.window.split_height)
|
||||
.. ")<CR>"
|
||||
)
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_vertical,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('vertical', "
|
||||
.. tostring(terminal_options.window.vsplit_width)
|
||||
.. ")<CR>"
|
||||
)
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_float,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('float')<CR>"
|
||||
)
|
||||
|
||||
-- spawns terminals
|
||||
map(
|
||||
"n",
|
||||
term_maps.spawn_horizontal,
|
||||
":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>"
|
||||
)
|
||||
map("n", term_maps.spawn_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>")
|
||||
map("n", term_maps.spawn_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>")
|
||||
|
||||
-- terminal mappings end --
|
||||
|
||||
-- Add Packer commands because we are not loading it at startup
|
||||
cmd "silent! command PackerClean lua require 'plugins' require('packer').clean()"
|
||||
cmd "silent! command PackerCompile lua require 'plugins' require('packer').compile()"
|
||||
cmd "silent! command PackerInstall lua require 'plugins' require('packer').install()"
|
||||
cmd "silent! command PackerStatus lua require 'plugins' require('packer').status()"
|
||||
cmd "silent! command PackerSync lua require 'plugins' require('packer').sync()"
|
||||
cmd "silent! command PackerUpdate lua require 'plugins' require('packer').update()"
|
||||
|
||||
-- add NvChadUpdate command and mapping
|
||||
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
||||
map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
|
||||
end
|
||||
|
||||
non_config_mappings()
|
||||
optional_mappings()
|
||||
required_mappings()
|
||||
end
|
||||
|
||||
-- below are all plugin related mappings
|
||||
|
||||
M.bufferline = function()
|
||||
local m = plugin_maps.bufferline
|
||||
|
||||
map("n", m.next_buffer, ":BufferLineCycleNext <CR>")
|
||||
map("n", m.prev_buffer, ":BufferLineCyclePrev <CR>")
|
||||
end
|
||||
|
||||
M.comment = function()
|
||||
local m = plugin_maps.comment.toggle
|
||||
map("n", m, ":lua require('Comment.api').toggle_current_linewise()<CR>")
|
||||
map("v", m, ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>")
|
||||
end
|
||||
|
||||
M.lspconfig = function()
|
||||
local m = plugin_maps.lspconfig
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
map("n", m.declaration, "<cmd>lua vim.lsp.buf.declaration()<CR>")
|
||||
map("n", m.definition, "<cmd>lua vim.lsp.buf.definition()<CR>")
|
||||
map("n", m.hover, "<cmd>lua vim.lsp.buf.hover()<CR>")
|
||||
map("n", m.implementation, "<cmd>lua vim.lsp.buf.implementation()<CR>")
|
||||
map("n", m.signature_help, "<cmd>lua vim.lsp.buf.signature_help()<CR>")
|
||||
map("n", m.add_workspace_folder, "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
||||
map("n", m.remove_workspace_folder, "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
|
||||
map("n", m.list_workspace_folders, "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
|
||||
map("n", m.type_definition, "<cmd>lua vim.lsp.buf.type_definition()<CR>")
|
||||
map("n", m.rename, "<cmd>lua vim.lsp.buf.rename()<CR>")
|
||||
map("n", m.code_action, "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||
map("n", m.references, "<cmd>lua vim.lsp.buf.references()<CR>")
|
||||
map("n", m.float_diagnostics, "<cmd>lua vim.diagnostic.open_float()<CR>")
|
||||
map("n", m.goto_prev, "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
||||
map("n", m.goto_next, "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
||||
map("n", m.set_loclist, "<cmd>lua vim.diagnostic.setloclist()<CR>")
|
||||
map("n", m.formatting, "<cmd>lua vim.lsp.buf.formatting()<CR>")
|
||||
end
|
||||
|
||||
M.nvimtree = function()
|
||||
map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle <CR>")
|
||||
map("n", plugin_maps.nvimtree.focus, ":NvimTreeFocus <CR>")
|
||||
end
|
||||
|
||||
M.telescope = function()
|
||||
local m = plugin_maps.telescope
|
||||
|
||||
map("n", m.buffers, ":Telescope buffers <CR>")
|
||||
map("n", m.find_files, ":Telescope find_files <CR>")
|
||||
map("n", m.find_hiddenfiles, ":Telescope find_files follow=true no_ignore=true hidden=true <CR>")
|
||||
map("n", m.git_commits, ":Telescope git_commits <CR>")
|
||||
map("n", m.git_status, ":Telescope git_status <CR>")
|
||||
map("n", m.help_tags, ":Telescope help_tags <CR>")
|
||||
map("n", m.live_grep, ":Telescope live_grep <CR>")
|
||||
map("n", m.oldfiles, ":Telescope oldfiles <CR>")
|
||||
map("n", m.themes, ":Telescope themes <CR>")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,63 @@
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
local options = require("core.utils").load_config().options
|
||||
|
||||
opt.title = true
|
||||
opt.clipboard = options.clipboard
|
||||
opt.cmdheight = options.cmdheight
|
||||
opt.cul = true -- cursor line
|
||||
|
||||
-- Indentline
|
||||
opt.expandtab = options.expandtab
|
||||
opt.shiftwidth = options.shiftwidth
|
||||
opt.smartindent = options.smartindent
|
||||
|
||||
-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758
|
||||
opt.fillchars = options.fillchars
|
||||
|
||||
opt.hidden = options.hidden
|
||||
opt.ignorecase = options.ignorecase
|
||||
opt.smartcase = options.smartcase
|
||||
opt.mouse = options.mouse
|
||||
|
||||
-- Numbers
|
||||
opt.number = options.number
|
||||
opt.numberwidth = options.numberwidth
|
||||
opt.relativenumber = options.relativenumber
|
||||
opt.ruler = options.ruler
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.tabstop = options.tabstop
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = options.timeoutlen
|
||||
opt.undofile = options.undofile
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = options.updatetime
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = options.mapleader
|
||||
|
||||
-- disable some builtin vim plugins
|
||||
local disabled_built_ins = require("core.utils").load_config().plugins.builtins
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
--Defer loading shada until after startup_
|
||||
vim.opt.shadafile = "NONE"
|
||||
|
||||
vim.schedule(function()
|
||||
vim.opt.shadafile = require("core.utils").load_config().options.shadafile
|
||||
vim.cmd [[ silent! rsh ]]
|
||||
end)
|
||||
@@ -0,0 +1,321 @@
|
||||
local M = {}
|
||||
|
||||
local cmd = vim.cmd
|
||||
M.close_buffer = function(force)
|
||||
-- This is a modification of a NeoVim plugin from
|
||||
-- Author: ojroques - Olivier Roques
|
||||
-- Src: https://github.com/ojroques/nvim-bufdel
|
||||
-- (Author has okayed copy-paste)
|
||||
|
||||
-- Options
|
||||
local opts = {
|
||||
next = "cycle", -- how to retrieve the next buffer
|
||||
quit = false, -- exit when last buffer is deleted
|
||||
--TODO make this a chadrc flag/option
|
||||
}
|
||||
|
||||
-- ----------------
|
||||
-- Helper functions
|
||||
-- ----------------
|
||||
|
||||
-- Switch to buffer 'buf' on each window from list 'windows'
|
||||
local function switch_buffer(windows, buf)
|
||||
local cur_win = vim.fn.winnr()
|
||||
for _, winid in ipairs(windows) do
|
||||
winid = tonumber(winid) or 0
|
||||
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
|
||||
vim.cmd(string.format("buffer %d", buf))
|
||||
end
|
||||
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
|
||||
end
|
||||
|
||||
-- Select the first buffer with a number greater than given buffer
|
||||
local function get_next_buf(buf)
|
||||
local next = vim.fn.bufnr "#"
|
||||
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
for i = 0, vim.fn.bufnr "$" - 1 do
|
||||
next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
|
||||
if vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ----------------
|
||||
-- End helper functions
|
||||
-- ----------------
|
||||
|
||||
local buf = vim.fn.bufnr()
|
||||
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
|
||||
vim.cmd "close"
|
||||
return
|
||||
end
|
||||
|
||||
if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
|
||||
if opts.quit then
|
||||
-- exit when there is only one buffer left
|
||||
if force then
|
||||
vim.cmd "qall!"
|
||||
else
|
||||
vim.cmd "confirm qall"
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local chad_term, _ = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
if chad_term then
|
||||
-- Must be a window type
|
||||
vim.cmd(string.format("setlocal nobl", buf))
|
||||
vim.cmd "enew"
|
||||
return
|
||||
end
|
||||
-- don't exit and create a new empty buffer
|
||||
vim.cmd "enew"
|
||||
vim.cmd "bp"
|
||||
end
|
||||
|
||||
local next_buf = get_next_buf(buf)
|
||||
local windows = vim.fn.getbufinfo(buf)[1].windows
|
||||
|
||||
-- force deletion of terminal buffers to avoid the prompt
|
||||
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
|
||||
local chad_term, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
-- TODO this scope is error prone, make resilient
|
||||
if chad_term then
|
||||
if type == "wind" then
|
||||
-- hide from bufferline
|
||||
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
|
||||
-- switch to another buff
|
||||
-- TODO switch to next buffer, this works too
|
||||
vim.cmd "BufferLineCycleNext"
|
||||
else
|
||||
local cur_win = vim.fn.winnr()
|
||||
-- we can close this window
|
||||
vim.cmd(string.format("%d wincmd c", cur_win))
|
||||
return
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("bd! %d", buf))
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("silent! confirm bd %d", buf))
|
||||
end
|
||||
-- revert buffer switches if user has canceled deletion
|
||||
if vim.fn.buflisted(buf) == 1 then
|
||||
switch_buffer(windows, buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- hide statusline
|
||||
-- tables fetched from load_config function
|
||||
M.hide_statusline = function()
|
||||
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
|
||||
local shown = require("core.utils").load_config().plugins.options.statusline.shown
|
||||
local api = vim.api
|
||||
local buftype = api.nvim_buf_get_option(0, "ft")
|
||||
|
||||
-- shown table from config has the highest priority
|
||||
if vim.tbl_contains(shown, buftype) then
|
||||
api.nvim_set_option("laststatus", 2)
|
||||
return
|
||||
end
|
||||
|
||||
if vim.tbl_contains(hidden, buftype) then
|
||||
api.nvim_set_option("laststatus", 0)
|
||||
return
|
||||
end
|
||||
|
||||
api.nvim_set_option("laststatus", 2)
|
||||
end
|
||||
|
||||
M.load_config = function()
|
||||
local conf = require "core.default_config"
|
||||
|
||||
-- attempt to load and merge a user config
|
||||
local chadrc_exists = vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/chadrc.lua") == 1
|
||||
if chadrc_exists then
|
||||
-- merge user config if it exists and is a table; otherwise display an error
|
||||
local user_config = require "custom.chadrc"
|
||||
if type(user_config) == 'table' then
|
||||
conf = vim.tbl_deep_extend("force", conf, user_config)
|
||||
else
|
||||
error("User config (chadrc.lua) *must* return a table!")
|
||||
end
|
||||
end
|
||||
|
||||
return conf
|
||||
end
|
||||
|
||||
M.map = function(mode, keys, command, opt)
|
||||
local options = { noremap = true, silent = true }
|
||||
if opt then
|
||||
options = vim.tbl_extend("force", options, opt)
|
||||
end
|
||||
|
||||
-- all valid modes allowed for mappings
|
||||
-- :h map-modes
|
||||
local valid_modes = {
|
||||
[""] = true,
|
||||
["n"] = true,
|
||||
["v"] = true,
|
||||
["s"] = true,
|
||||
["x"] = true,
|
||||
["o"] = true,
|
||||
["!"] = true,
|
||||
["i"] = true,
|
||||
["l"] = true,
|
||||
["c"] = true,
|
||||
["t"] = true,
|
||||
}
|
||||
|
||||
-- helper function for M.map
|
||||
-- can gives multiple modes and keys
|
||||
local function map_wrapper(sub_mode, lhs, rhs, sub_options)
|
||||
if type(lhs) == "table" then
|
||||
for _, key in ipairs(lhs) do
|
||||
map_wrapper(sub_mode, key, rhs, sub_options)
|
||||
end
|
||||
else
|
||||
if type(sub_mode) == "table" then
|
||||
for _, m in ipairs(sub_mode) do
|
||||
map_wrapper(m, lhs, rhs, sub_options)
|
||||
end
|
||||
else
|
||||
if valid_modes[sub_mode] and lhs and rhs then
|
||||
vim.api.nvim_set_keymap(sub_mode, lhs, rhs, sub_options)
|
||||
else
|
||||
sub_mode, lhs, rhs = sub_mode or "", lhs or "", rhs or ""
|
||||
print(
|
||||
"Cannot set mapping [ mode = '" .. sub_mode .. "' | key = '" .. lhs .. "' | cmd = '" .. rhs .. "' ]"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map_wrapper(mode, keys, command, options)
|
||||
end
|
||||
|
||||
-- load plugin after entering vim ui
|
||||
M.packer_lazy_load = function(plugin, timer)
|
||||
if plugin then
|
||||
timer = timer or 0
|
||||
vim.defer_fn(function()
|
||||
require("packer").loader(plugin)
|
||||
end, timer)
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlights functions
|
||||
|
||||
-- Define bg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
|
||||
M.bg = function(group, col)
|
||||
cmd("hi " .. group .. " guibg=" .. col)
|
||||
end
|
||||
|
||||
-- Define fg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
M.fg = function(group, col)
|
||||
cmd("hi " .. group .. " guifg=" .. col)
|
||||
end
|
||||
|
||||
-- Define bg and fg color
|
||||
-- @param group Group
|
||||
-- @param fgcol Fg Color
|
||||
-- @param bgcol Bg Color
|
||||
M.fg_bg = function(group, fgcol, bgcol)
|
||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||
end
|
||||
|
||||
-- Override default config of a plugin based on the path provided in the chadrc
|
||||
-- Arguments:
|
||||
-- 1st - name of plugin
|
||||
-- 2nd - default config path
|
||||
-- 3rd - optional function name which will called from default_config path
|
||||
-- e.g: if given args - "telescope", "plugins.configs.telescope", "setup"
|
||||
-- then return "require('plugins.configs.telescope').setup()"
|
||||
-- if 3rd arg not given, then return "require('plugins.configs.telescope')"
|
||||
-- if override is a table, mark set the override flag for the default config to true
|
||||
-- override flag being true tells the plugin to call tbl_override_req as part of configuration
|
||||
|
||||
M.override_req = function(name, default_config, config_function)
|
||||
local override, apply_table_override =
|
||||
require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false"
|
||||
local result = default_config
|
||||
if type(override) == "string" and override ~= "" then
|
||||
return "require('" .. override .. "')"
|
||||
elseif type(override) == "table" then
|
||||
apply_table_override = "true"
|
||||
elseif type(override) == "function" then
|
||||
return override
|
||||
end
|
||||
|
||||
result = "('" .. result .. "')"
|
||||
if type(config_function) == "string" and config_function ~= "" then
|
||||
-- add the . to call the functions and concatenate true or false as argument
|
||||
result = result .. "." .. config_function .. "(" .. apply_table_override .. ")"
|
||||
end
|
||||
|
||||
return "require" .. result
|
||||
end
|
||||
|
||||
-- Override parts of default config of a plugin based on the table provided in the chadrc
|
||||
|
||||
-- FUNCTION: tbl_override_req, use `chadrc` plugin config override to modify default config if present
|
||||
-- name = name inside `default_config` / `chadrc`
|
||||
-- default_table = the default configuration table of the plugin
|
||||
-- returns the modified configuration table
|
||||
M.tbl_override_req = function(name, default_table)
|
||||
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] or {}
|
||||
return vim.tbl_deep_extend("force", default_table, override)
|
||||
end
|
||||
|
||||
--provide labels to plugins instead of integers
|
||||
M.label_plugins = function(plugins)
|
||||
local plugins_labeled = {}
|
||||
for _, plugin in ipairs(plugins) do
|
||||
plugins_labeled[plugin[1]] = plugin
|
||||
end
|
||||
return plugins_labeled
|
||||
end
|
||||
|
||||
-- remove plugins specified by user from the plugins table
|
||||
M.remove_default_plugins = function(plugins)
|
||||
local removals = require("core.utils").load_config().plugins.default_plugin_remove or {}
|
||||
if not vim.tbl_isempty(removals) then
|
||||
for _, plugin in pairs(removals) do
|
||||
plugins[plugin] = nil
|
||||
end
|
||||
end
|
||||
return plugins
|
||||
end
|
||||
|
||||
-- append user plugins to default plugins
|
||||
M.add_user_plugins = function(plugins)
|
||||
local user_Plugins = require("core.utils").load_config().plugins.install or {}
|
||||
if type(user_Plugins) == "string"
|
||||
then user_Plugins=require(user_Plugins)
|
||||
end
|
||||
if not vim.tbl_isempty(user_Plugins) then
|
||||
for _, v in pairs(user_Plugins) do
|
||||
plugins[v[1]] = v
|
||||
end
|
||||
end
|
||||
return plugins
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,159 +0,0 @@
|
||||
-- IMPORTANT NOTE : This is default config, so dont change anything here. (check chadrc.lua instead)
|
||||
|
||||
local M = {}
|
||||
|
||||
M.ui = {
|
||||
theme = "onedark",
|
||||
|
||||
-- theme toggle
|
||||
theme_toggler = false,
|
||||
fav_themes = {
|
||||
"onedark",
|
||||
"gruvchad",
|
||||
},
|
||||
italic_comments = false,
|
||||
|
||||
-- Enable this only if your terminal has the colorscheme set which nvchad uses
|
||||
-- For Ex : if you have onedark set in nvchad , set onedark's bg color on your terminal
|
||||
transparency = false,
|
||||
|
||||
hidden_statusline = {
|
||||
-- these are filetypes, not pattern matched
|
||||
"NvimTree",
|
||||
"terminal",
|
||||
},
|
||||
statusline_style = "default", -- default, round , slant , block , arrow
|
||||
}
|
||||
|
||||
M.options = {
|
||||
permanent_undo = true,
|
||||
ruler = false,
|
||||
hidden = true,
|
||||
ignorecase = true,
|
||||
mouse = "a",
|
||||
cmdheight = 1,
|
||||
updatetime = 250,
|
||||
timeoutlen = 400,
|
||||
clipboard = "unnamedplus",
|
||||
number = true,
|
||||
relativenumber = false,
|
||||
numberwidth = 2,
|
||||
expandtab = true,
|
||||
shiftwidth = 2,
|
||||
smartindent = true,
|
||||
mapleader = " ",
|
||||
autosave = false,
|
||||
enable_insertNav = true, -- navigation in insertmode
|
||||
-- used for updater
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "main",
|
||||
}
|
||||
|
||||
-- enable and disable plugins (false for disable)
|
||||
M.plugin_status = {
|
||||
-- UI
|
||||
nvim_bufferline = true,
|
||||
galaxyline = true,
|
||||
nvim_colorizer = true,
|
||||
dashboard_nvim = true,
|
||||
blankline = true,
|
||||
truezen_nvim = true,
|
||||
better_esc = true,
|
||||
-- lsp stuff
|
||||
lspkind = true,
|
||||
lspsignature = true,
|
||||
-- git stuff
|
||||
gitsigns = true,
|
||||
vim_fugitive = true,
|
||||
-- misc
|
||||
neoformat = true,
|
||||
vim_matchup = true,
|
||||
autosave_nvim = true,
|
||||
nvim_comment = true,
|
||||
neoscroll_nvim = true,
|
||||
telescope_media = true,
|
||||
cheatsheet = true,
|
||||
}
|
||||
|
||||
-- make sure you dont use same keys twice
|
||||
M.mappings = {
|
||||
-- plugin specific
|
||||
truezen = {
|
||||
ataraxisMode = "<leader>zz",
|
||||
minimalisticmode = "<leader>zm",
|
||||
focusmode = "<leader>zf",
|
||||
},
|
||||
comment_nvim = {
|
||||
comment_toggle = "<leader>/",
|
||||
},
|
||||
nvimtree = {
|
||||
treetoggle = "<C-n>", -- file manager
|
||||
},
|
||||
neoformat = {
|
||||
format = "<leader>fm",
|
||||
},
|
||||
dashboard = {
|
||||
open = "<leader>db",
|
||||
newfile = "<leader>fn",
|
||||
bookmarks = "<leader>bm",
|
||||
sessionload = "<leader>l",
|
||||
sessionsave = "<leader>s",
|
||||
},
|
||||
telescope = {
|
||||
live_grep = "<leader>fw",
|
||||
git_status = "<leader>gt",
|
||||
git_commits = "<leader>cm",
|
||||
find_files = "<leader>ff",
|
||||
buffers = "<leader>fb",
|
||||
help_tags = "<leader>fh",
|
||||
oldfiles = "<leader>fo",
|
||||
themes = "<leader>th",
|
||||
},
|
||||
telescope_media = {
|
||||
media_files = "<leader>fp",
|
||||
},
|
||||
chadsheet = {
|
||||
default_keys = "<leader>dk",
|
||||
user_keys = "<leader>uk",
|
||||
},
|
||||
bufferline = {
|
||||
new_buffer = "<S-t>",
|
||||
newtab = "<C-t>b",
|
||||
close = "<S-x>", -- close a buffer with custom func in utils.lua
|
||||
cycleNext = "<TAB>", -- next buffer
|
||||
cyclePrev = "<S-Tab>", -- previous buffer
|
||||
},
|
||||
fugitive = {
|
||||
Git = "<leader>gs",
|
||||
diffget_2 = "<leader>gh",
|
||||
diffget_3 = "<leader>gl",
|
||||
git_blame = "<leader>gb",
|
||||
},
|
||||
terms = { -- below are NvChad mappings, not plugin mappings
|
||||
esc_termmode = "jk",
|
||||
esc_hide_termmode = "JK",
|
||||
pick_term = "<leader>W", -- note: this is a telescope extension
|
||||
new_wind = "<leader>w",
|
||||
new_vert = "<leader>v",
|
||||
new_hori = "<leader>h",
|
||||
}, -- navigation in insert mode
|
||||
insert_nav = {
|
||||
forward = "<C-l>",
|
||||
backward = "<C-h>",
|
||||
top_of_line = "<C-a>",
|
||||
end_of_line = "<C-e>",
|
||||
prev_line = "<C-j>",
|
||||
next_line = "<C-k>",
|
||||
},
|
||||
-- non plugin
|
||||
misc = {
|
||||
esc_Termmode = "jk", -- get out of terminal mode
|
||||
close_buffer = "<S-x>", -- close current focused buffer
|
||||
copywhole_file = "<C-a>",
|
||||
toggle_linenr = "<leader>n", -- show or hide line number
|
||||
theme_toggle = "<leader>x",
|
||||
update_nvchad = "<leader>uu",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -1,135 +0,0 @@
|
||||
local cmd = vim.cmd
|
||||
|
||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
local white = colors.white
|
||||
local darker_black = colors.darker_black
|
||||
local black = colors.black
|
||||
local black2 = colors.black2
|
||||
local one_bg = colors.one_bg
|
||||
local one_bg2 = colors.one_bg2
|
||||
local grey = colors.grey
|
||||
local grey_fg = colors.grey_fg
|
||||
local red = colors.red
|
||||
local line = colors.line
|
||||
local green = colors.green
|
||||
local nord_blue = colors.nord_blue
|
||||
local blue = colors.blue
|
||||
local yellow = colors.yellow
|
||||
local purple = colors.purple
|
||||
local pmenu_bg = colors.pmenu_bg
|
||||
local folder_bg = colors.folder_bg
|
||||
|
||||
-- for guifg , bg
|
||||
|
||||
local function fg(group, color)
|
||||
cmd("hi " .. group .. " guifg=" .. color)
|
||||
end
|
||||
|
||||
local function bg(group, color)
|
||||
cmd("hi " .. group .. " guibg=" .. color)
|
||||
end
|
||||
|
||||
local function fg_bg(group, fgcol, bgcol)
|
||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||
end
|
||||
|
||||
-- blankline
|
||||
|
||||
fg("IndentBlanklineChar", line)
|
||||
|
||||
-- misc --
|
||||
fg("LineNr", grey)
|
||||
|
||||
-- Comments
|
||||
local ui = require("utils").load_config().ui
|
||||
|
||||
if ui.italic_comments then
|
||||
cmd("hi Comment gui=italic guifg=" .. grey_fg)
|
||||
else
|
||||
fg("Comment", grey_fg)
|
||||
end
|
||||
|
||||
fg("NvimInternalError", red)
|
||||
fg("VertSplit", line)
|
||||
fg("EndOfBuffer", black)
|
||||
-- fg_bg("Visual",light_grey, colors.lightbg)
|
||||
|
||||
-- Pmenu
|
||||
bg("Pmenu", one_bg)
|
||||
bg("PmenuSbar", one_bg2)
|
||||
bg("PmenuSel", pmenu_bg)
|
||||
bg("PmenuThumb", nord_blue)
|
||||
|
||||
-- inactive statuslines as thin splitlines
|
||||
cmd("hi! StatusLineNC gui=underline guifg=" .. line)
|
||||
|
||||
-- line n.o
|
||||
cmd "hi clear CursorLine"
|
||||
fg("cursorlinenr", white)
|
||||
|
||||
-- git signs ---
|
||||
fg_bg("DiffAdd", nord_blue, "none")
|
||||
fg_bg("DiffChange", grey_fg, "none")
|
||||
fg_bg("DiffModified", nord_blue, "none")
|
||||
|
||||
-- NvimTree
|
||||
fg("NvimTreeFolderIcon", folder_bg)
|
||||
fg("NvimTreeFolderName", folder_bg)
|
||||
fg("NvimTreeGitDirty", red)
|
||||
fg("NvimTreeOpenedFolderName", blue)
|
||||
fg("NvimTreeEmptyFolderName", blue)
|
||||
fg("NvimTreeIndentMarker", one_bg2)
|
||||
fg("NvimTreeVertSplit", darker_black)
|
||||
bg("NvimTreeVertSplit", darker_black)
|
||||
fg("NvimTreeEndOfBuffer", darker_black)
|
||||
|
||||
cmd("hi NvimTreeRootFolder gui=underline guifg=" .. red)
|
||||
bg("NvimTreeNormal", darker_black)
|
||||
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
|
||||
fg_bg("NvimTreeWindowPicker", red, black2)
|
||||
|
||||
-- telescope
|
||||
fg("TelescopeBorder", line)
|
||||
fg("TelescopePromptBorder", line)
|
||||
fg("TelescopeResultsBorder", line)
|
||||
fg("TelescopePreviewBorder", grey)
|
||||
|
||||
-- LspDiagnostics ---
|
||||
|
||||
-- error / warnings
|
||||
fg("LspDiagnosticsSignError", red)
|
||||
fg("LspDiagnosticsVirtualTextError", red)
|
||||
fg("LspDiagnosticsSignWarning", yellow)
|
||||
fg("LspDiagnosticsVirtualTextWarning", yellow)
|
||||
|
||||
-- info
|
||||
fg("LspDiagnosticsSignInformation", green)
|
||||
fg("LspDiagnosticsVirtualTextInformation", green)
|
||||
|
||||
-- hint
|
||||
fg("LspDiagnosticsSignHint", purple)
|
||||
fg("LspDiagnosticsVirtualTextHint", purple)
|
||||
|
||||
-- dashboard
|
||||
|
||||
fg("DashboardHeader", grey_fg)
|
||||
fg("DashboardCenter", grey_fg)
|
||||
fg("DashboardShortcut", grey_fg)
|
||||
fg("DashboardFooter", grey_fg)
|
||||
|
||||
if require("utils").load_config().ui.transparency then
|
||||
bg("Normal", "NONE")
|
||||
bg("Folded", "NONE")
|
||||
fg("Folded", "NONE")
|
||||
bg("NvimTreeNormal", "NONE")
|
||||
bg("NvimTreeVertSplit", "NONE")
|
||||
fg("NvimTreeVertSplit", grey)
|
||||
bg("NvimTreeStatusLineNC", "NONE")
|
||||
fg("Comment", grey)
|
||||
end
|
||||
|
||||
-- For floating windows
|
||||
bg("NormalFloat", one_bg)
|
||||
fg("FloatBorder", blue)
|
||||
@@ -1,188 +0,0 @@
|
||||
local user_map = require("utils").load_config().mappings
|
||||
local miscMap = user_map.misc
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true, silent = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
local opt = {}
|
||||
|
||||
-- these mappings will only be called during initialization
|
||||
M.misc = function()
|
||||
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them
|
||||
-- map("n", "dd", [=[ "_dd ]=], opt)
|
||||
-- map("v", "dd", [=[ "_dd ]=], opt)
|
||||
-- map("v", "x", [=[ "_x ]=], opt)
|
||||
-- todo: this should be configurable via chadrc
|
||||
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
map("v", "p", '"_dP', opt)
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using :map
|
||||
map("", "j", 'v:count ? "j" : "gj"', { expr = true })
|
||||
map("", "k", 'v:count ? "k" : "gk"', { expr = true })
|
||||
map("", "<Down>", 'v:count ? "j" : "gj"', { expr = true })
|
||||
map("", "<Up>", 'v:count ? "k" : "gk"', { expr = true })
|
||||
|
||||
-- copy whole file content
|
||||
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
|
||||
|
||||
-- toggle numbers
|
||||
map("n", miscMap.toggle_linenr, ":set nu!<CR>", opt)
|
||||
|
||||
-- terminals
|
||||
local function terms()
|
||||
local m = user_map.terms
|
||||
|
||||
-- get out of terminal mode
|
||||
map("t", m.esc_termmode, "<C-\\><C-n>", opt)
|
||||
-- hide a term from within terminal mode
|
||||
map("t", m.esc_hide_termmode, "<C-\\><C-n> :lua require('utils').close_buffer() <CR>", opt)
|
||||
-- pick a hidden term
|
||||
map("n", m.pick_term, ":Telescope terms <CR>", opt)
|
||||
|
||||
-- Open terminals
|
||||
-- TODO this opens on top of an existing vert/hori term, fixme
|
||||
map("n", m.new_wind, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>", opt)
|
||||
map("n", m.new_vert, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>", opt)
|
||||
map("n", m.new_hori, ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>", opt)
|
||||
end
|
||||
terms()
|
||||
|
||||
-- ctrl + s to save file
|
||||
map("n", "<C-s>", ":w <CR>", opt)
|
||||
|
||||
-- use ESC to turn off search highlighting
|
||||
map("n", "<Esc>", ":noh<CR>", opt)
|
||||
|
||||
-- navigation within insert mode
|
||||
local check_insertNav = require("utils").load_config().options.enable_insertNav
|
||||
|
||||
if check_insertNav == true then
|
||||
local m = user_map.insert_nav
|
||||
|
||||
map("i", m.forward, "<Right>", opt)
|
||||
map("i", m.backward, "<Left>", opt)
|
||||
map("i", m.top_of_line, "<ESC>^i", opt)
|
||||
map("i", m.end_of_line, "<End>", opt)
|
||||
map("i", m.next_line, "<Up>", opt)
|
||||
map("i", m.prev_line, "<Down>", opt)
|
||||
end
|
||||
|
||||
-- check the theme toggler
|
||||
local theme_toggler = require("utils").load_config().ui.theme_toggler
|
||||
if theme_toggler == true then
|
||||
local m = user_map.misc.theme_toggle
|
||||
|
||||
map("n", m, ":lua require('utils').toggle_theme(require('utils').load_config().ui.fav_themes)<CR>", opt)
|
||||
end
|
||||
|
||||
-- Packer commands till because we are not loading it at startup
|
||||
cmd "silent! command PackerCompile lua require 'pluginList' require('packer').compile()"
|
||||
cmd "silent! command PackerInstall lua require 'pluginList' require('packer').install()"
|
||||
cmd "silent! command PackerStatus lua require 'pluginList' require('packer').status()"
|
||||
cmd "silent! command PackerSync lua require 'pluginList' require('packer').sync()"
|
||||
cmd "silent! command PackerUpdate lua require 'pluginList' require('packer').update()"
|
||||
|
||||
-- add NvChadUpdate command and mapping
|
||||
cmd "silent! command! NvChadUpdate lua require('utils').update_nvchad()"
|
||||
map("n", user_map.misc.update_nvchad, ":NvChadUpdate<CR>", opt)
|
||||
end
|
||||
|
||||
M.bufferline = function()
|
||||
local m = user_map.bufferline
|
||||
|
||||
map("n", m.new_buffer, ":enew<CR>", opt) -- new buffer
|
||||
map("n", m.newtab, ":tabnew<CR>", opt) -- new tab
|
||||
map("n", m.close, ":lua require('utils').close_buffer() <CR>", opt) -- close buffer
|
||||
|
||||
-- move between tabs
|
||||
|
||||
map("n", m.cycleNext, ":BufferLineCycleNext<CR>", opt)
|
||||
map("n", m.cyclePrev, ":BufferLineCyclePrev<CR>", opt)
|
||||
end
|
||||
|
||||
M.chadsheet = function()
|
||||
local m = user_map.chadsheet
|
||||
|
||||
map("n", m.default_keys, ":lua require('cheatsheet').show_cheatsheet_telescope()<CR>", opt)
|
||||
map(
|
||||
"n",
|
||||
m.user_keys,
|
||||
":lua require('cheatsheet').show_cheatsheet_telescope{bundled_cheatsheets = false, bundled_plugin_cheatsheets = false }<CR>",
|
||||
opt
|
||||
)
|
||||
end
|
||||
|
||||
M.comment_nvim = function()
|
||||
local m = user_map.comment_nvim.comment_toggle
|
||||
map("n", m, ":CommentToggle<CR>", opt)
|
||||
map("v", m, ":CommentToggle<CR>", opt)
|
||||
end
|
||||
|
||||
M.dashboard = function()
|
||||
local m = user_map.dashboard
|
||||
|
||||
map("n", m.open, ":Dashboard<CR>", opt)
|
||||
map("n", m.newfile, ":DashboardNewFile<CR>", opt)
|
||||
map("n", m.bookmarks, ":DashboardJumpMarks<CR>", opt)
|
||||
map("n", m.sessionload, ":SessionLoad<CR>", opt)
|
||||
map("n", m.sessionsave, ":SessionSave<CR>", opt)
|
||||
end
|
||||
|
||||
M.fugitive = function()
|
||||
local m = user_map.fugitive
|
||||
|
||||
map("n", m.Git, ":Git<CR>", opt)
|
||||
map("n", m.diffget_2, ":diffget //2<CR>", opt)
|
||||
map("n", m.diffget_3, ":diffget //3<CR>", opt)
|
||||
map("n", m.git_blame, ":Git blame<CR>", opt)
|
||||
end
|
||||
|
||||
M.nvimtree = function()
|
||||
local m = user_map.nvimtree.treetoggle
|
||||
|
||||
map("n", m, ":NvimTreeToggle<CR>", opt)
|
||||
end
|
||||
|
||||
M.neoformat = function()
|
||||
local m = user_map.neoformat.format
|
||||
map("n", m, ":Neoformat<CR>", opt)
|
||||
end
|
||||
|
||||
M.truezen = function()
|
||||
local m = user_map.truezen
|
||||
|
||||
map("n", m.ataraxisMode, ":TZAtaraxis<CR>", opt)
|
||||
map("n", m.minimalisticmode, ":TZMinimalist<CR>", opt)
|
||||
map("n", m.focusmode, ":TZFocus<CR>", opt)
|
||||
end
|
||||
|
||||
M.telescope = function()
|
||||
local m = user_map.telescope
|
||||
|
||||
map("n", m.live_grep, ":Telescope live_grep<CR>", opt)
|
||||
map("n", m.git_status, ":Telescope git_status <CR>", opt)
|
||||
map("n", m.git_commits, ":Telescope git_commits <CR>", opt)
|
||||
map("n", m.find_files, ":Telescope find_files <CR>", opt)
|
||||
map("n", m.buffers, ":Telescope buffers<CR>", opt)
|
||||
map("n", m.help_tags, ":Telescope help_tags<CR>", opt)
|
||||
map("n", m.oldfiles, ":Telescope oldfiles<CR>", opt)
|
||||
map("n", m.themes, ":Telescope themes<CR>", opt)
|
||||
end
|
||||
|
||||
M.telescope_media = function()
|
||||
local m = user_map.telescope_media
|
||||
map("n", m.media_files, ":Telescope media_files <CR>", opt)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,88 +0,0 @@
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
-- export user config as a global varibale
|
||||
g.nvchad_user_config = "chadrc"
|
||||
|
||||
local options = require("utils").load_config().options
|
||||
|
||||
opt.completeopt = { "menuone", "noselect" }
|
||||
opt.undofile = options.permanent_undo
|
||||
opt.ruler = options.ruler
|
||||
opt.hidden = options.hidden
|
||||
opt.ignorecase = options.ignorecase
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.cul = true
|
||||
opt.mouse = options.mouse
|
||||
opt.signcolumn = "yes"
|
||||
opt.cmdheight = options.cmdheight
|
||||
opt.updatetime = options.updatetime -- update interval for gitsigns
|
||||
opt.timeoutlen = options.timeoutlen
|
||||
opt.clipboard = options.clipboard
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
-- disable tilde on end of buffer: https://github.com/ neovim/neovim/pull/8546#issuecomment-643643758
|
||||
opt.fillchars = { eob = " " }
|
||||
|
||||
-- Numbers
|
||||
opt.number = options.number
|
||||
opt.numberwidth = options.numberwidth
|
||||
opt.relativenumber = options.relativenumber
|
||||
|
||||
-- Indenline
|
||||
opt.expandtab = options.expandtab
|
||||
opt.shiftwidth = options.shiftwidth
|
||||
opt.smartindent = options.smartindent
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>hl"
|
||||
|
||||
g.mapleader = options.mapleader
|
||||
g.auto_save = options.autosave
|
||||
|
||||
-- disable builtin vim plugins
|
||||
local disabled_built_ins = {
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"gzip",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"2html_plugin",
|
||||
"logipat",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"matchit",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
|
||||
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
|
||||
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
|
||||
|
||||
-- Don't show any numbers inside terminals
|
||||
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber ]]
|
||||
|
||||
-- Don't show status line on certain windows
|
||||
vim.cmd [[ au TermOpen term://* setfiletype terminal ]]
|
||||
vim.cmd [[ let hidden_statusline = luaeval('require("utils").load_config().ui.hidden_statusline') | autocmd BufEnter,BufWinEnter,WinEnter,CmdwinEnter,TermEnter * nested if index(hidden_statusline, &ft) >= 0 | set laststatus=0 | else | set laststatus=2 | endif ]]
|
||||
|
||||
-- Open a file from its last left off position
|
||||
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
|
||||
-- File extension specific tabbing
|
||||
-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
|
||||
@@ -1,317 +0,0 @@
|
||||
local plugin_status = require("utils").load_config().plugin_status
|
||||
|
||||
local present, _ = pcall(require, "packerInit")
|
||||
local packer
|
||||
|
||||
if present then
|
||||
packer = require "packer"
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
local use = packer.use
|
||||
|
||||
return packer.startup(function()
|
||||
use {
|
||||
"wbthomason/packer.nvim",
|
||||
event = "VimEnter",
|
||||
}
|
||||
|
||||
use {
|
||||
"jdhao/better-escape.vim",
|
||||
disable = not plugin_status.better_esc,
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("plugins.others").escape()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"glepnir/galaxyline.nvim",
|
||||
disable = not plugin_status.galaxyline,
|
||||
after = "nvim-web-devicons",
|
||||
config = function()
|
||||
require "plugins.statusline"
|
||||
end,
|
||||
}
|
||||
use {
|
||||
"akinsho/nvim-bufferline.lua",
|
||||
disable = not plugin_status.nvim_bufferline,
|
||||
after = "galaxyline.nvim",
|
||||
config = function()
|
||||
require "plugins.bufferline"
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").bufferline()
|
||||
end,
|
||||
}
|
||||
|
||||
-- color related stuff
|
||||
use {
|
||||
"NvChad/nvim-base16.lua",
|
||||
after = "packer.nvim",
|
||||
config = function()
|
||||
require "theme"
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
disable = not plugin_status.nvim_colorizer,
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("plugins.others").colorizer()
|
||||
end,
|
||||
}
|
||||
|
||||
-- lsp stuff
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require "plugins.treesitter"
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"kabouzeid/nvim-lspinstall",
|
||||
event = "BufRead",
|
||||
}
|
||||
|
||||
use {
|
||||
"neovim/nvim-lspconfig",
|
||||
after = "nvim-lspinstall",
|
||||
config = function()
|
||||
require "plugins.lspconfig"
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"onsails/lspkind-nvim",
|
||||
disable = not plugin_status.lspkind,
|
||||
event = "BufEnter",
|
||||
config = function()
|
||||
require("plugins.others").lspkind()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
disable = not plugin_status.lspsignature,
|
||||
after = "nvim-lspconfig",
|
||||
config = function()
|
||||
require("plugins.others").signature()
|
||||
end,
|
||||
}
|
||||
|
||||
-- load compe in insert mode only
|
||||
use {
|
||||
"hrsh7th/nvim-compe",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require "plugins.compe"
|
||||
end,
|
||||
wants = "LuaSnip",
|
||||
requires = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
wants = "friendly-snippets",
|
||||
event = "InsertCharPre",
|
||||
config = function()
|
||||
require "plugins.luasnip"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
event = "InsertCharPre",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
use {
|
||||
"sbdchd/neoformat",
|
||||
disable = not plugin_status.neoformat,
|
||||
cmd = "Neoformat",
|
||||
setup = function()
|
||||
require("mappings").neoformat()
|
||||
end,
|
||||
}
|
||||
|
||||
-- file managing , picker etc
|
||||
use {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
config = function()
|
||||
require "plugins.nvimtree"
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").nvimtree()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
after = "nvim-base16.lua",
|
||||
config = function()
|
||||
require "plugins.icons"
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-lua/plenary.nvim",
|
||||
after = "nvim-bufferline.lua",
|
||||
}
|
||||
use {
|
||||
"nvim-lua/popup.nvim",
|
||||
after = "plenary.nvim",
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
after = "plenary.nvim",
|
||||
requires = {
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
run = "make",
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-media-files.nvim",
|
||||
disable = not plugin_status.telescope_media,
|
||||
setup = function()
|
||||
require("mappings").telescope_media()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"sudormrfbin/cheatsheet.nvim",
|
||||
disable = not plugin_status.cheatsheet,
|
||||
event = "VimEnter",
|
||||
after = "telescope.nvim",
|
||||
config = function()
|
||||
require "plugins.chadsheet"
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").chadsheet()
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require "plugins.telescope"
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").telescope()
|
||||
end,
|
||||
}
|
||||
|
||||
-- git stuff
|
||||
use {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
disable = not plugin_status.gitsigns,
|
||||
after = "plenary.nvim",
|
||||
config = function()
|
||||
require "plugins.gitsigns"
|
||||
end,
|
||||
}
|
||||
|
||||
-- misc plugins
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
after = "nvim-compe",
|
||||
config = function()
|
||||
require "plugins.autopairs"
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"andymass/vim-matchup",
|
||||
disable = not plugin_status.vim_matchup,
|
||||
event = "CursorMoved",
|
||||
}
|
||||
|
||||
use {
|
||||
"terrortylor/nvim-comment",
|
||||
disable = not plugin_status.nvim_comment,
|
||||
cmd = "CommentToggle",
|
||||
config = function()
|
||||
require("plugins.others").comment()
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").comment_nvim()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"glepnir/dashboard-nvim",
|
||||
disable = not plugin_status.dashboard_nvim,
|
||||
cmd = {
|
||||
"Dashboard",
|
||||
"DashboardNewFile",
|
||||
"DashboardJumpMarks",
|
||||
"SessionLoad",
|
||||
"SessionSave",
|
||||
},
|
||||
setup = function()
|
||||
require "plugins.dashboard"
|
||||
require("mappings").dashboard()
|
||||
end,
|
||||
}
|
||||
|
||||
-- load autosave only if its globally enabled
|
||||
use {
|
||||
disable = not plugin_status.autosave_nvim,
|
||||
"Pocco81/AutoSave.nvim",
|
||||
config = function()
|
||||
require "plugins.autosave"
|
||||
end,
|
||||
cond = function()
|
||||
return vim.g.auto_save == true
|
||||
end,
|
||||
}
|
||||
|
||||
-- smooth scroll
|
||||
use {
|
||||
"karb94/neoscroll.nvim",
|
||||
disable = not plugin_status.neoscroll_nvim,
|
||||
event = "WinScrolled",
|
||||
config = function()
|
||||
require("plugins.others").neoscroll()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"Pocco81/TrueZen.nvim",
|
||||
disable = not plugin_status.truezen_nvim,
|
||||
cmd = {
|
||||
"TZAtaraxis",
|
||||
"TZMinimalist",
|
||||
"TZFocus",
|
||||
},
|
||||
config = function()
|
||||
require "plugins.zenmode"
|
||||
end,
|
||||
setup = function()
|
||||
require("mappings").truezen()
|
||||
end,
|
||||
}
|
||||
|
||||
-- use "alvan/vim-closetag" -- for html autoclosing tag
|
||||
|
||||
use {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
disable = not plugin_status.blankline,
|
||||
event = "BufRead",
|
||||
setup = function()
|
||||
require("plugins.others").blankline()
|
||||
end,
|
||||
}
|
||||
|
||||
use {
|
||||
"tpope/vim-fugitive",
|
||||
disable = not plugin_status.vim_fugitive,
|
||||
cmd = {
|
||||
"Git",
|
||||
},
|
||||
setup = function()
|
||||
require("mappings").fugitive()
|
||||
end,
|
||||
}
|
||||
end)
|
||||
@@ -1,12 +0,0 @@
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
|
||||
|
||||
if not (present1 or present2) then
|
||||
return
|
||||
end
|
||||
|
||||
autopairs.setup()
|
||||
autopairs_completion.setup {
|
||||
map_cr = true,
|
||||
map_complete = true, -- insert () func completion
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
-- autosave.nvim plugin disabled by default
|
||||
local present, autosave = pcall(require, "autosave")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
autosave.setup {
|
||||
enabled = vim.g.auto_save, -- takes boolean value from init.lua
|
||||
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
|
||||
events = { "InsertLeave", "TextChanged" },
|
||||
conditions = {
|
||||
exists = true,
|
||||
filetype_is_not = {},
|
||||
modifiable = true,
|
||||
},
|
||||
write_all_buffers = false,
|
||||
on_off_commands = true,
|
||||
clean_command_line_interval = 2500,
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
local present, bufferline = pcall(require, "bufferline")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
bufferline.setup {
|
||||
options = {
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 14,
|
||||
max_prefix_length = 13,
|
||||
tab_size = 20,
|
||||
show_tab_indicators = true,
|
||||
enforce_regular_tabs = false,
|
||||
view = "multiwindow",
|
||||
show_buffer_close_icons = true,
|
||||
separator_style = "thin",
|
||||
mappings = true,
|
||||
always_show_bufferline = true,
|
||||
custom_filter = function(buf_number)
|
||||
-- Func to filter out our managed/persistent split terms
|
||||
local present_type, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf_number, "term_type")
|
||||
end)
|
||||
|
||||
if present_type then
|
||||
if type == "vert" then
|
||||
return false
|
||||
elseif type == "hori" then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
else
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
highlights = {
|
||||
fill = {
|
||||
guifg = colors.grey_fg,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
background = {
|
||||
guifg = colors.grey_fg,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
-- buffers
|
||||
buffer_visible = {
|
||||
guifg = colors.light_grey,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
buffer_selected = {
|
||||
guifg = colors.white,
|
||||
guibg = colors.black,
|
||||
gui = "bold",
|
||||
},
|
||||
-- tabs
|
||||
tab = {
|
||||
guifg = colors.light_grey,
|
||||
guibg = colors.one_bg3,
|
||||
},
|
||||
tab_selected = {
|
||||
guifg = colors.black2,
|
||||
guibg = colors.nord_blue,
|
||||
},
|
||||
tab_close = {
|
||||
guifg = colors.red,
|
||||
guibg = colors.black,
|
||||
},
|
||||
indicator_selected = {
|
||||
guifg = colors.black,
|
||||
guibg = colors.black,
|
||||
},
|
||||
-- separators
|
||||
separator = {
|
||||
guifg = colors.black2,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
separator_visible = {
|
||||
guifg = colors.black2,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = colors.black2,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
-- modified
|
||||
modified = {
|
||||
guifg = colors.red,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
modified_visible = {
|
||||
guifg = colors.red,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
modified_selected = {
|
||||
guifg = colors.green,
|
||||
guibg = colors.black,
|
||||
},
|
||||
-- close buttons
|
||||
|
||||
close_button = {
|
||||
guifg = colors.light_grey,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
close_button_visible = {
|
||||
guifg = colors.light_grey,
|
||||
guibg = colors.black2,
|
||||
},
|
||||
close_button_selected = {
|
||||
guifg = colors.red,
|
||||
guibg = colors.black,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
local present, chadsheet = pcall(require, "cheatsheet")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local mappings = require("utils").load_config().mappings
|
||||
|
||||
-- add user mappings to the cheetsheet
|
||||
for section, data in pairs(mappings) do
|
||||
for description, keymap in pairs(data) do
|
||||
chadsheet.add_cheat(description, keymap, section)
|
||||
end
|
||||
end
|
||||
|
||||
require("cheatsheet").setup {
|
||||
|
||||
bundled_cheatsheets = {
|
||||
enabled = { "default" },
|
||||
disabled = { "unicode", "nerd-fonts" },
|
||||
},
|
||||
|
||||
bundled_plugin_cheatsheets = false,
|
||||
include_only_installed_plugins = true,
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
local present, compe = pcall(require, "compe")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
compe.setup {
|
||||
enabled = true,
|
||||
autocomplete = true,
|
||||
debug = false,
|
||||
min_length = 1,
|
||||
preselect = "enable",
|
||||
throttle_time = 80,
|
||||
source_timeout = 200,
|
||||
incomplete_delay = 400,
|
||||
max_abbr_width = 100,
|
||||
max_kind_width = 100,
|
||||
max_menu_width = 100,
|
||||
documentation = true,
|
||||
source = {
|
||||
buffer = { kind = "", true },
|
||||
luasnip = { kind = "", true },
|
||||
nvim_lsp = true,
|
||||
nvim_lua = true,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
local present, alpha = pcall(require, "alpha")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local function button(sc, txt, keybind)
|
||||
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
|
||||
|
||||
local opts = {
|
||||
position = "center",
|
||||
text = txt,
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 36,
|
||||
align_shortcut = "right",
|
||||
hl = "AlphaButtons",
|
||||
}
|
||||
|
||||
if keybind then
|
||||
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
|
||||
end
|
||||
|
||||
return {
|
||||
type = "button",
|
||||
val = txt,
|
||||
on_press = function()
|
||||
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "normal", false)
|
||||
end,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
local default = {}
|
||||
|
||||
default.ascii = {
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
}
|
||||
|
||||
default.header = {
|
||||
type = "text",
|
||||
val = default.ascii,
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "AlphaHeader",
|
||||
},
|
||||
}
|
||||
|
||||
default.buttons = {
|
||||
type = "group",
|
||||
val = {
|
||||
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
|
||||
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
|
||||
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
|
||||
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
|
||||
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
|
||||
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
|
||||
},
|
||||
opts = {
|
||||
spacing = 1,
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("alpha", default)
|
||||
end
|
||||
alpha.setup {
|
||||
layout = {
|
||||
{ type = "padding", val = 9 },
|
||||
default.header,
|
||||
{ type = "padding", val = 2 },
|
||||
default.buttons,
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,148 @@
|
||||
local present, bufferline = pcall(require, "bufferline")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
}
|
||||
default = {
|
||||
options = {
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "",
|
||||
close_icon = "",
|
||||
show_close_icon = true,
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 14,
|
||||
max_prefix_length = 13,
|
||||
tab_size = 20,
|
||||
show_tab_indicators = true,
|
||||
enforce_regular_tabs = false,
|
||||
view = "multiwindow",
|
||||
show_buffer_close_icons = true,
|
||||
separator_style = "thin",
|
||||
always_show_bufferline = true,
|
||||
diagnostics = false,
|
||||
custom_filter = function(buf_number)
|
||||
-- Func to filter out our managed/persistent split terms
|
||||
local present_type, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf_number, "term_type")
|
||||
end)
|
||||
|
||||
if present_type then
|
||||
if type == "vert" then
|
||||
return false
|
||||
elseif type == "hori" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
},
|
||||
|
||||
highlights = {
|
||||
background = {
|
||||
guifg = default.colors.grey_fg,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- buffers
|
||||
buffer_selected = {
|
||||
guifg = default.colors.white,
|
||||
guibg = default.colors.black,
|
||||
gui = "bold",
|
||||
},
|
||||
buffer_visible = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- for diagnostics = "nvim_lsp"
|
||||
error = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
error_diagnostic = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- close buttons
|
||||
close_button = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
close_button_visible = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
close_button_selected = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
fill = {
|
||||
guifg = default.colors.grey_fg,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
indicator_selected = {
|
||||
guifg = default.colors.black,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
|
||||
-- modified
|
||||
modified = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
modified_visible = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
modified_selected = {
|
||||
guifg = default.colors.green,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
|
||||
-- separators
|
||||
separator = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
separator_visible = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- tabs
|
||||
tab = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.one_bg3,
|
||||
},
|
||||
tab_selected = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.nord_blue,
|
||||
},
|
||||
tab_close = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("bufferline", default)
|
||||
end
|
||||
bufferline.setup(default)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,76 @@
|
||||
local present, cmp = pcall(require, "cmp")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local default = {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local icons = require "plugins.configs.lspkind_icons"
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
buffer = "[BUF]",
|
||||
})[entry.source.name]
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_cmp", default)
|
||||
end
|
||||
cmp.setup(default)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,158 @@
|
||||
local present, icons = pcall(require, "nvim-web-devicons")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
}
|
||||
|
||||
default = {
|
||||
override = {
|
||||
c = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "c",
|
||||
},
|
||||
css = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "css",
|
||||
},
|
||||
deb = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "deb",
|
||||
},
|
||||
Dockerfile = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "Dockerfile",
|
||||
},
|
||||
html = {
|
||||
icon = "",
|
||||
color = default.colors.baby_pink,
|
||||
name = "html",
|
||||
},
|
||||
jpeg = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "jpeg",
|
||||
},
|
||||
jpg = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "jpg",
|
||||
},
|
||||
js = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "js",
|
||||
},
|
||||
kt = {
|
||||
icon = "",
|
||||
color = default.colors.orange,
|
||||
name = "kt",
|
||||
},
|
||||
lock = {
|
||||
icon = "",
|
||||
color = default.colors.red,
|
||||
name = "lock",
|
||||
},
|
||||
lua = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "lua",
|
||||
},
|
||||
mp3 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "mp3",
|
||||
},
|
||||
mp4 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "mp4",
|
||||
},
|
||||
out = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "out",
|
||||
},
|
||||
png = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "png",
|
||||
},
|
||||
py = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "py",
|
||||
},
|
||||
["robots.txt"] = {
|
||||
icon = "ﮧ",
|
||||
color = default.colors.red,
|
||||
name = "robots",
|
||||
},
|
||||
toml = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "toml",
|
||||
},
|
||||
ts = {
|
||||
icon = "ﯤ",
|
||||
color = default.colors.teal,
|
||||
name = "ts",
|
||||
},
|
||||
ttf = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "TrueTypeFont",
|
||||
},
|
||||
rb = {
|
||||
icon = "",
|
||||
color = default.colors.pink,
|
||||
name = "rb",
|
||||
},
|
||||
rpm = {
|
||||
icon = "",
|
||||
color = default.colors.orange,
|
||||
name = "rpm",
|
||||
},
|
||||
vue = {
|
||||
icon = "﵂",
|
||||
color = default.colors.vibrant_green,
|
||||
name = "vue",
|
||||
},
|
||||
woff = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "WebOpenFontFormat",
|
||||
},
|
||||
woff2 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "WebOpenFontFormat2",
|
||||
},
|
||||
xz = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "xz",
|
||||
},
|
||||
zip = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "zip",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_web_devicons", default)
|
||||
end
|
||||
icons.setup(default)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,41 @@
|
||||
local M = {}
|
||||
require("plugins.configs.others").lsp_handlers()
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_range_formatting = false
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
require("core.mappings").lspconfig()
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
}
|
||||
|
||||
-- requires a file containing user's lspconfigs
|
||||
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
||||
|
||||
if #addlsp_confs ~= 0 then
|
||||
require(addlsp_confs).setup_lsp(M.on_attach, capabilities)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,29 @@
|
||||
local icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "ﰠ",
|
||||
Variable = "",
|
||||
Class = "ﴯ",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "ﰠ",
|
||||
Unit = "塞",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "פּ",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
|
||||
return icons
|
||||
@@ -0,0 +1,90 @@
|
||||
-- globals must be set prior to requiring nvim-tree to function
|
||||
local g = vim.g
|
||||
|
||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||
g.nvim_tree_git_hl = 0
|
||||
g.nvim_tree_highlight_opened_files = 0
|
||||
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
||||
|
||||
g.nvim_tree_show_icons = {
|
||||
folders = 1,
|
||||
files = 1,
|
||||
git = 1,
|
||||
}
|
||||
|
||||
g.nvim_tree_icons = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
deleted = "",
|
||||
ignored = "◌",
|
||||
renamed = "➜",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
unstaged = "✗",
|
||||
untracked = "★",
|
||||
},
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
},
|
||||
}
|
||||
|
||||
local present, nvimtree = pcall(require, "nvim-tree")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
ignore_ft_on_setup = { "dashboard" },
|
||||
auto_close = false,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
update_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = false,
|
||||
},
|
||||
view = {
|
||||
allow_resize = true,
|
||||
side = "left",
|
||||
width = 25,
|
||||
hide_root_folder = true,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
ignore = false,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_tree", default)
|
||||
end
|
||||
nvimtree.setup(default)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,196 @@
|
||||
local M = {}
|
||||
|
||||
local chadrc_config = require("core.utils").load_config()
|
||||
|
||||
M.autopairs = function(override_flag)
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
|
||||
if present1 and present2 then
|
||||
local default = { fast_wrap = {} }
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_autopairs", default)
|
||||
end
|
||||
autopairs.setup(default)
|
||||
|
||||
local cmp = require "cmp"
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end
|
||||
end
|
||||
|
||||
M.better_escape = function()
|
||||
require("better_escape").setup {
|
||||
mapping = chadrc_config.mappings.plugins.better_escape.esc_insertmode,
|
||||
timeout = chadrc_config.plugins.options.esc_insertmode_timeout,
|
||||
}
|
||||
end
|
||||
|
||||
M.blankline = function(override_flag)
|
||||
local default = {
|
||||
indentLine_enabled = 1,
|
||||
char = "▏",
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"alpha",
|
||||
"packer",
|
||||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"nvchad_cheatsheet",
|
||||
"lsp-installer",
|
||||
"",
|
||||
},
|
||||
buftype_exclude = { "terminal" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = false,
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("indent_blankline", default)
|
||||
end
|
||||
require("indent_blankline").setup(default)
|
||||
end
|
||||
|
||||
M.colorizer = function(override_flag)
|
||||
local present, colorizer = pcall(require, "colorizer")
|
||||
if present then
|
||||
local default = {
|
||||
filetypes = {
|
||||
"*",
|
||||
},
|
||||
user_default_options = {
|
||||
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
|
||||
|
||||
-- Available modes: foreground, background
|
||||
mode = "background", -- Set the display mode.
|
||||
},
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_colorizer", default)
|
||||
end
|
||||
colorizer.setup(default["filetypes"], default["user_default_options"])
|
||||
vim.cmd "ColorizerReloadAllBuffers"
|
||||
end
|
||||
end
|
||||
|
||||
M.comment = function(override_flag)
|
||||
local present, nvim_comment = pcall(require, "Comment")
|
||||
if present then
|
||||
local default = {}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_comment", default)
|
||||
end
|
||||
nvim_comment.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
M.luasnip = function(override_flag)
|
||||
local present, luasnip = pcall(require, "luasnip")
|
||||
if present then
|
||||
local default = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("luasnip", default)
|
||||
end
|
||||
luasnip.config.set_config(default)
|
||||
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
end
|
||||
end
|
||||
|
||||
M.signature = function(override_flag)
|
||||
local present, lspsignature = pcall(require, "lsp_signature")
|
||||
if present then
|
||||
local default = {
|
||||
bind = true,
|
||||
doc_lines = 0,
|
||||
floating_window = true,
|
||||
fix_pos = true,
|
||||
hint_enable = true,
|
||||
hint_prefix = " ",
|
||||
hint_scheme = "String",
|
||||
hi_parameter = "Search",
|
||||
max_height = 22,
|
||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
handler_opts = {
|
||||
border = "single", -- double, single, shadow, none
|
||||
},
|
||||
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
|
||||
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("signature", default)
|
||||
end
|
||||
lspsignature.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
M.lsp_handlers = function()
|
||||
local function lspSymbol(name, icon)
|
||||
local hl = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
|
||||
end
|
||||
|
||||
lspSymbol("Error", "")
|
||||
lspSymbol("Info", "")
|
||||
lspSymbol("Hint", "")
|
||||
lspSymbol("Warn", "")
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = {
|
||||
prefix = "",
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
}
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
})
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
})
|
||||
|
||||
-- suppress error messages from lang servers
|
||||
vim.notify = function(msg, log_level)
|
||||
if msg:match "exit code" then
|
||||
return
|
||||
end
|
||||
if log_level == vim.log.levels.ERROR then
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
else
|
||||
vim.api.nvim_echo({ { msg } }, true, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.gitsigns = function(override_flag)
|
||||
local present, gitsigns = pcall(require, "gitsigns")
|
||||
if present then
|
||||
local default = {
|
||||
signs = {
|
||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("gitsigns", default)
|
||||
end
|
||||
gitsigns.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,438 @@
|
||||
local present, feline = pcall(require, "feline")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
lsp = require "feline.providers.lsp",
|
||||
lsp_severity = vim.diagnostic.severity,
|
||||
config = require("core.utils").load_config().plugins.options.statusline,
|
||||
}
|
||||
|
||||
default.icon_styles = {
|
||||
default = {
|
||||
left = "",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
arrow = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
block = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
round = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
slant = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
-- statusline style
|
||||
default.statusline_style = default.icon_styles[default.config.style]
|
||||
|
||||
-- show short statusline on small screens
|
||||
default.shortline = default.config.shortline == false and true
|
||||
|
||||
-- Initialize the components table
|
||||
default.components = {
|
||||
active = {},
|
||||
}
|
||||
|
||||
default.main_icon = {
|
||||
provider = default.statusline_style.main_icon,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.statusline_bg,
|
||||
bg = default.colors.nord_blue,
|
||||
},
|
||||
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hl = {
|
||||
fg = default.colors.nord_blue,
|
||||
bg = default.colors.lightbg,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
default.file_name = {
|
||||
provider = function()
|
||||
local filename = vim.fn.expand "%:t"
|
||||
local extension = vim.fn.expand "%:e"
|
||||
local icon = require("nvim-web-devicons").get_icon(filename, extension)
|
||||
if icon == nil then
|
||||
icon = " "
|
||||
return icon
|
||||
end
|
||||
return " " .. icon .. " " .. filename .. " "
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.white,
|
||||
bg = default.colors.lightbg,
|
||||
},
|
||||
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
|
||||
},
|
||||
}
|
||||
|
||||
default.dir_name = {
|
||||
provider = function()
|
||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||
return " " .. dir_name .. " "
|
||||
end,
|
||||
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||
end,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.lightbg2,
|
||||
},
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hi = {
|
||||
fg = default.colors.lightbg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
default.diff = {
|
||||
add = {
|
||||
provider = "git_diff_added",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
change = {
|
||||
provider = "git_diff_changed",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
remove = {
|
||||
provider = "git_diff_removed",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
default.git_branch = {
|
||||
provider = "git_branch",
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
}
|
||||
|
||||
default.diagnostic = {
|
||||
error = {
|
||||
provider = "diagnostic_errors",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
|
||||
end,
|
||||
|
||||
hl = { fg = default.colors.red },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
warning = {
|
||||
provider = "diagnostic_warnings",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
|
||||
end,
|
||||
hl = { fg = default.colors.yellow },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
hint = {
|
||||
provider = "diagnostic_hints",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
|
||||
end,
|
||||
hl = { fg = default.colors.grey_fg2 },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
info = {
|
||||
provider = "diagnostic_info",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
|
||||
end,
|
||||
hl = { fg = default.colors.green },
|
||||
icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
default.lsp_progress = {
|
||||
provider = function()
|
||||
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
||||
|
||||
if Lsp then
|
||||
local msg = Lsp.message or ""
|
||||
local percentage = Lsp.percentage or 0
|
||||
local title = Lsp.title or ""
|
||||
local spinners = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
local success_icon = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
local ms = vim.loop.hrtime() / 1000000
|
||||
local frame = math.floor(ms / 120) % #spinners
|
||||
|
||||
if percentage >= 70 then
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return ""
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||
end,
|
||||
hl = { fg = default.colors.green },
|
||||
}
|
||||
|
||||
default.lsp_icon = {
|
||||
provider = function()
|
||||
if next(vim.lsp.buf_get_clients()) ~= nil then
|
||||
return " LSP"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
|
||||
}
|
||||
|
||||
default.mode_colors = {
|
||||
["n"] = { "NORMAL", default.colors.red },
|
||||
["no"] = { "N-PENDING", default.colors.red },
|
||||
["i"] = { "INSERT", default.colors.dark_purple },
|
||||
["ic"] = { "INSERT", default.colors.dark_purple },
|
||||
["t"] = { "TERMINAL", default.colors.green },
|
||||
["v"] = { "VISUAL", default.colors.cyan },
|
||||
["V"] = { "V-LINE", default.colors.cyan },
|
||||
[""] = { "V-BLOCK", default.colors.cyan },
|
||||
["R"] = { "REPLACE", default.colors.orange },
|
||||
["Rv"] = { "V-REPLACE", default.colors.orange },
|
||||
["s"] = { "SELECT", default.colors.nord_blue },
|
||||
["S"] = { "S-LINE", default.colors.nord_blue },
|
||||
[""] = { "S-BLOCK", default.colors.nord_blue },
|
||||
["c"] = { "COMMAND", default.colors.pink },
|
||||
["cv"] = { "COMMAND", default.colors.pink },
|
||||
["ce"] = { "COMMAND", default.colors.pink },
|
||||
["r"] = { "PROMPT", default.colors.teal },
|
||||
["rm"] = { "MORE", default.colors.teal },
|
||||
["r?"] = { "CONFIRM", default.colors.teal },
|
||||
["!"] = { "SHELL", default.colors.green },
|
||||
}
|
||||
|
||||
default.chad_mode_hl = function()
|
||||
return {
|
||||
fg = default.mode_colors[vim.fn.mode()][2],
|
||||
bg = default.colors.one_bg,
|
||||
}
|
||||
end
|
||||
|
||||
default.empty_space = {
|
||||
provider = " " .. default.statusline_style.left,
|
||||
hl = {
|
||||
fg = default.colors.one_bg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
}
|
||||
|
||||
-- this matches the vi mode color
|
||||
default.empty_spaceColored = {
|
||||
provider = default.statusline_style.left,
|
||||
hl = function()
|
||||
return {
|
||||
fg = default.mode_colors[vim.fn.mode()][2],
|
||||
bg = default.colors.one_bg2,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
default.mode_icon = {
|
||||
provider = default.statusline_style.vi_mode_icon,
|
||||
hl = function()
|
||||
return {
|
||||
fg = default.colors.statusline_bg,
|
||||
bg = default.mode_colors[vim.fn.mode()][2],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
default.empty_space2 = {
|
||||
provider = function()
|
||||
return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
|
||||
end,
|
||||
hl = default.chad_mode_hl,
|
||||
}
|
||||
|
||||
default.separator_right = {
|
||||
provider = default.statusline_style.left,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.grey,
|
||||
bg = default.colors.one_bg,
|
||||
},
|
||||
}
|
||||
|
||||
default.separator_right2 = {
|
||||
provider = default.statusline_style.left,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.green,
|
||||
bg = default.colors.grey,
|
||||
},
|
||||
}
|
||||
|
||||
default.position_icon = {
|
||||
provider = default.statusline_style.position_icon,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.black,
|
||||
bg = default.colors.green,
|
||||
},
|
||||
}
|
||||
|
||||
default.current_line = {
|
||||
provider = function()
|
||||
local current_line = vim.fn.line "."
|
||||
local total_line = vim.fn.line "$"
|
||||
|
||||
if current_line == 1 then
|
||||
return " Top "
|
||||
elseif current_line == vim.fn.line "$" then
|
||||
return " Bot "
|
||||
end
|
||||
local result, _ = math.modf((current_line / total_line) * 100)
|
||||
return " " .. result .. "%% "
|
||||
end,
|
||||
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.green,
|
||||
bg = default.colors.one_bg,
|
||||
},
|
||||
}
|
||||
|
||||
local function add_table(a, b)
|
||||
table.insert(a, b)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("feline", default)
|
||||
end
|
||||
-- components are divided in 3 sections
|
||||
default.left = {}
|
||||
default.middle = {}
|
||||
default.right = {}
|
||||
|
||||
-- left
|
||||
add_table(default.left, default.main_icon)
|
||||
add_table(default.left, default.file_name)
|
||||
add_table(default.left, default.dir_name)
|
||||
add_table(default.left, default.diff.add)
|
||||
add_table(default.left, default.diff.change)
|
||||
add_table(default.left, default.diff.remove)
|
||||
add_table(default.left, default.diagnostic.error)
|
||||
add_table(default.left, default.diagnostic.warning)
|
||||
add_table(default.left, default.diagnostic.hint)
|
||||
add_table(default.left, default.diagnostic.info)
|
||||
|
||||
add_table(default.middle, default.lsp_progress)
|
||||
|
||||
-- right
|
||||
add_table(default.right, default.lsp_icon)
|
||||
add_table(default.right, default.git_branch)
|
||||
add_table(default.right, default.empty_space)
|
||||
add_table(default.right, default.empty_spaceColored)
|
||||
add_table(default.right, default.mode_icon)
|
||||
add_table(default.right, default.empty_space2)
|
||||
add_table(default.right, default.separator_right)
|
||||
add_table(default.right, default.separator_right2)
|
||||
add_table(default.right, default.position_icon)
|
||||
add_table(default.right, default.current_line)
|
||||
|
||||
default.components.active[1] = default.left
|
||||
default.components.active[2] = default.middle
|
||||
default.components.active[3] = default.right
|
||||
|
||||
feline.setup {
|
||||
theme = {
|
||||
bg = default.colors.statusline_bg,
|
||||
fg = default.colors.fg,
|
||||
},
|
||||
components = default.components,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,9 +1,10 @@
|
||||
local present, telescope = pcall(require, "telescope")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
telescope.setup {
|
||||
local default = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
@@ -19,7 +20,7 @@ telescope.setup {
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
@@ -35,9 +36,9 @@ telescope.setup {
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = {},
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "absolute" },
|
||||
path_display = { "truncate" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
@@ -50,36 +51,23 @@ telescope.setup {
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = false, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
media_files = {
|
||||
filetypes = { "png", "webp", "jpg", "jpeg" },
|
||||
find_cmd = "rg", -- find command (defaults to `fd`)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- NvChad pickers
|
||||
-- load the theme_switcher extension
|
||||
require("telescope").load_extension "themes"
|
||||
-- load the term_picker extension
|
||||
require("telescope").load_extension "terms"
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("telescope", default)
|
||||
end
|
||||
|
||||
if not pcall(function()
|
||||
telescope.load_extension "fzf"
|
||||
telescope.load_extension "media_files"
|
||||
end) then
|
||||
-- This should only trigger when in need of PackerSync, so better do it
|
||||
print "After completion of PackerCompile, restart neovim."
|
||||
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
|
||||
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
|
||||
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
|
||||
require "pluginList"
|
||||
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
|
||||
telescope.setup(default)
|
||||
|
||||
local extensions = { "themes", "terms" }
|
||||
|
||||
pcall(function()
|
||||
for _, ext in ipairs(extensions) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,26 @@
|
||||
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"vim",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_treesitter", default)
|
||||
end
|
||||
ts_config.setup(default)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,40 +0,0 @@
|
||||
local g = vim.g
|
||||
local fn = vim.fn
|
||||
|
||||
local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
|
||||
|
||||
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
|
||||
g.dashboard_disable_statusline = 1
|
||||
g.dashboard_default_executive = "telescope"
|
||||
g.dashboard_custom_header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
" ",
|
||||
}
|
||||
|
||||
g.dashboard_custom_section = {
|
||||
a = { description = { " Find File SPC f f" }, command = "Telescope find_files" },
|
||||
b = { description = { " Recents SPC f o" }, command = "Telescope oldfiles" },
|
||||
c = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" },
|
||||
d = { description = { "洛 New File SPC f n" }, command = "DashboardNewFile" },
|
||||
e = { description = { " Bookmarks SPC b m" }, command = "Telescope marks" },
|
||||
f = { description = { " Load Last Session SPC s l" }, command = "SessionLoad" },
|
||||
}
|
||||
|
||||
g.dashboard_custom_footer = {
|
||||
" ",
|
||||
-- "NvChad Loaded " .. plugins_count .. " plugins",
|
||||
"NvChad v0.5",
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
local present, gitsigns = pcall(require, "gitsigns")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
gitsigns.setup {
|
||||
signs = {
|
||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
numhl = false,
|
||||
keymaps = {
|
||||
-- Default keymap options
|
||||
noremap = true,
|
||||
buffer = true,
|
||||
["n ]c"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
|
||||
["n [c"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },
|
||||
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
||||
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
||||
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
||||
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
||||
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
|
||||
},
|
||||
watch_index = {
|
||||
interval = 100,
|
||||
},
|
||||
sign_priority = 5,
|
||||
status_formatter = nil, -- Use default
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
local present, icons = pcall(require, "nvim-web-devicons")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
icons.setup {
|
||||
override = {
|
||||
html = {
|
||||
icon = "",
|
||||
color = colors.baby_pink,
|
||||
name = "html",
|
||||
},
|
||||
css = {
|
||||
icon = "",
|
||||
color = colors.blue,
|
||||
name = "css",
|
||||
},
|
||||
js = {
|
||||
icon = "",
|
||||
color = colors.sun,
|
||||
name = "js",
|
||||
},
|
||||
ts = {
|
||||
icon = "ﯤ",
|
||||
color = colors.teal,
|
||||
name = "ts",
|
||||
},
|
||||
kt = {
|
||||
icon = "",
|
||||
color = colors.orange,
|
||||
name = "kt",
|
||||
},
|
||||
png = {
|
||||
icon = "",
|
||||
color = colors.dark_purple,
|
||||
name = "png",
|
||||
},
|
||||
jpg = {
|
||||
icon = "",
|
||||
color = colors.dark_purple,
|
||||
name = "jpg",
|
||||
},
|
||||
jpeg = {
|
||||
icon = "",
|
||||
color = colors.dark_purple,
|
||||
name = "jpeg",
|
||||
},
|
||||
mp3 = {
|
||||
icon = "",
|
||||
color = colors.white,
|
||||
name = "mp3",
|
||||
},
|
||||
mp4 = {
|
||||
icon = "",
|
||||
color = colors.white,
|
||||
name = "mp4",
|
||||
},
|
||||
out = {
|
||||
icon = "",
|
||||
color = colors.white,
|
||||
name = "out",
|
||||
},
|
||||
Dockerfile = {
|
||||
icon = "",
|
||||
color = colors.cyan,
|
||||
name = "Dockerfile",
|
||||
},
|
||||
rb = {
|
||||
icon = "",
|
||||
color = colors.pink,
|
||||
name = "rb",
|
||||
},
|
||||
vue = {
|
||||
icon = "﵂",
|
||||
color = colors.vibrant_green,
|
||||
name = "vue",
|
||||
},
|
||||
py = {
|
||||
icon = "",
|
||||
color = colors.cyan,
|
||||
name = "py",
|
||||
},
|
||||
toml = {
|
||||
icon = "",
|
||||
color = colors.blue,
|
||||
name = "toml",
|
||||
},
|
||||
lock = {
|
||||
icon = "",
|
||||
color = colors.red,
|
||||
name = "lock",
|
||||
},
|
||||
zip = {
|
||||
icon = "",
|
||||
color = colors.sun,
|
||||
name = "zip",
|
||||
},
|
||||
xz = {
|
||||
icon = "",
|
||||
color = colors.sun,
|
||||
name = "xz",
|
||||
},
|
||||
deb = {
|
||||
icon = "",
|
||||
color = colors.cyan,
|
||||
name = "deb",
|
||||
},
|
||||
rpm = {
|
||||
icon = "",
|
||||
color = colors.orange,
|
||||
name = "rpm",
|
||||
},
|
||||
lua = {
|
||||
icon = "",
|
||||
color = colors.blue,
|
||||
name = "lua",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
local plugin_settings = require("core.utils").load_config().plugins
|
||||
local present, packer = pcall(require, plugin_settings.options.packer.init_file)
|
||||
|
||||
if not present then
|
||||
return false
|
||||
end
|
||||
|
||||
local override_req = require("core.utils").override_req
|
||||
|
||||
local plugins = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "lewis6991/impatient.nvim" },
|
||||
{ "nathom/filetype.nvim" },
|
||||
|
||||
{
|
||||
"wbthomason/packer.nvim",
|
||||
event = "VimEnter",
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/extensions",
|
||||
config = function ()
|
||||
vim.schedule_wrap(require("nvchad.terminal").init())
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-base16.lua",
|
||||
after = "packer.nvim",
|
||||
config = function()
|
||||
require("colors").init()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
after = "nvim-base16.lua",
|
||||
config = override_req("nvim_web_devicons", "plugins.configs.icons", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"feline-nvim/feline.nvim",
|
||||
disable = not plugin_settings.status.feline,
|
||||
after = "nvim-web-devicons",
|
||||
config = override_req("feline", "plugins.configs.statusline", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
branch = "main",
|
||||
disable = not plugin_settings.status.bufferline,
|
||||
after = "nvim-web-devicons",
|
||||
config = override_req("bufferline", "plugins.configs.bufferline", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").bufferline()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
disable = not plugin_settings.status.blankline,
|
||||
event = "BufRead",
|
||||
config = override_req("indent_blankline", "plugins.configs.others", "blankline"),
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
disable = not plugin_settings.status.colorizer,
|
||||
event = "BufRead",
|
||||
config = override_req("nvim_colorizer", "plugins.configs.others", "colorizer"),
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
config = override_req("nvim_treesitter", "plugins.configs.treesitter", "setup"),
|
||||
run = ":TSUpdate",
|
||||
},
|
||||
|
||||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
disable = not plugin_settings.status.gitsigns,
|
||||
opt = true,
|
||||
config = override_req("gitsigns", "plugins.configs.others", "gitsigns"),
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "gitsigns.nvim"
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp stuff
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
module = "lspconfig",
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "nvim-lspconfig"
|
||||
-- reload the current file so lsp actually starts for it
|
||||
vim.defer_fn(function()
|
||||
vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %'
|
||||
end, 0)
|
||||
end,
|
||||
config = override_req("lspconfig", "plugins.configs.lspconfig"),
|
||||
},
|
||||
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
disable = not plugin_settings.status.lspsignature,
|
||||
after = "nvim-lspconfig",
|
||||
config = override_req("signature", "plugins.configs.others", "signature"),
|
||||
},
|
||||
|
||||
{
|
||||
"andymass/vim-matchup",
|
||||
disable = not plugin_settings.status.vim_matchup,
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "vim-matchup"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
disable = not plugin_settings.status.better_escape,
|
||||
event = "InsertCharPre",
|
||||
config = override_req("better_escape", "plugins.configs.others", "better_escape"),
|
||||
},
|
||||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
module = "cmp_nvim_lsp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
event = "InsertEnter",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "friendly-snippets",
|
||||
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
wants = "friendly-snippets",
|
||||
after = "nvim-cmp",
|
||||
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
|
||||
},
|
||||
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp_luasnip",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-nvim-lua",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-buffer",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-nvim-lsp",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-path",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-buffer",
|
||||
},
|
||||
|
||||
-- misc plugins
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
disable = not plugin_settings.status.autopairs,
|
||||
after = plugin_settings.options.autopairs.loadAfter,
|
||||
config = override_req("nvim_autopairs", "plugins.configs.others", "autopairs"),
|
||||
},
|
||||
|
||||
{
|
||||
disable = not plugin_settings.status.alpha,
|
||||
"goolord/alpha-nvim",
|
||||
config = override_req("alpha", "plugins.configs.alpha", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
disable = not plugin_settings.status.comment,
|
||||
module = "Comment",
|
||||
keys = { "gcc" },
|
||||
config = override_req("nvim_comment", "plugins.configs.others", "comment"),
|
||||
setup = function()
|
||||
require("core.mappings").comment()
|
||||
end,
|
||||
},
|
||||
|
||||
-- file managing , picker etc
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
disable = not plugin_settings.status.nvimtree,
|
||||
-- only set "after" if lazy load is disabled and vice versa for "cmd"
|
||||
after = not plugin_settings.options.nvimtree.lazy_load and "nvim-web-devicons",
|
||||
cmd = plugin_settings.options.nvimtree.lazy_load and { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
config = override_req("nvim_tree", "plugins.configs.nvimtree", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").nvimtree()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
module = "telescope",
|
||||
cmd = "Telescope",
|
||||
config = override_req("telescope", "plugins.configs.telescope", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").telescope()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
--label plugins for operational assistance
|
||||
plugins = require("core.utils").label_plugins(plugins)
|
||||
--remove plugins specified in chadrc
|
||||
plugins = require("core.utils").remove_default_plugins(plugins)
|
||||
--add plugins specified in chadrc
|
||||
plugins = require("core.utils").add_user_plugins(plugins)
|
||||
|
||||
return packer.startup(function(use)
|
||||
for _, v in pairs(plugins) do
|
||||
use(v)
|
||||
end
|
||||
end)
|
||||
@@ -1,123 +0,0 @@
|
||||
local present1, lspconfig = pcall(require, "lspconfig")
|
||||
local present2, lspinstall = pcall(require, "lspinstall")
|
||||
if not (present1 or present2) then
|
||||
return
|
||||
end
|
||||
|
||||
local function on_attach(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
-- Mappings.
|
||||
|
||||
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- lspInstall + lspconfig stuff
|
||||
|
||||
local function setup_servers()
|
||||
lspinstall.setup()
|
||||
local servers = lspinstall.installed_servers()
|
||||
|
||||
for _, lang in pairs(servers) do
|
||||
if lang ~= "lua" then
|
||||
lspconfig[lang].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = vim.loop.cwd,
|
||||
}
|
||||
elseif lang == "lua" then
|
||||
lspconfig[lang].setup {
|
||||
root_dir = vim.loop.cwd,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
setup_servers()
|
||||
|
||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||
lspinstall.post_install_hook = function()
|
||||
setup_servers() -- reload installed servers
|
||||
vim.cmd "bufdo e"
|
||||
end
|
||||
|
||||
-- replace the default lsp diagnostic symbols
|
||||
function lspSymbol(name, icon)
|
||||
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefaul" .. name })
|
||||
end
|
||||
|
||||
lspSymbol("Error", "")
|
||||
lspSymbol("Warning", "")
|
||||
lspSymbol("Information", "")
|
||||
lspSymbol("Hint", "")
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = {
|
||||
prefix = "",
|
||||
spacing = 0,
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
-- set this to true if you want diagnostics to show in insert mode
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
-- suppress error messages from lang servers
|
||||
vim.notify = function(msg, log_level, _opts)
|
||||
if msg:match "exit code" then
|
||||
return
|
||||
end
|
||||
if log_level == vim.log.levels.ERROR then
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
else
|
||||
vim.api.nvim_echo({ { msg } }, true, {})
|
||||
end
|
||||
end
|
||||
@@ -1,66 +0,0 @@
|
||||
local present, luasnip = pcall(require, "luasnip")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
local check_back_space = function()
|
||||
local col = vim.fn.col "." - 1
|
||||
if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
_G.tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-n>"
|
||||
elseif luasnip and luasnip.expand_or_jumpable() then
|
||||
return t "<Plug>luasnip-expand-or-jump"
|
||||
elseif check_back_space() then
|
||||
return t "<Tab>"
|
||||
else
|
||||
return vim.fn["compe#complete"]()
|
||||
end
|
||||
end
|
||||
_G.s_tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-p>"
|
||||
elseif luasnip and luasnip.jumpable(-1) then
|
||||
return t "<Plug>luasnip-jump-prev"
|
||||
else
|
||||
return t "<S-Tab>"
|
||||
end
|
||||
end
|
||||
|
||||
_G.completions = function()
|
||||
local npairs
|
||||
if not pcall(function()
|
||||
npairs = require "nvim-autopairs"
|
||||
end) then
|
||||
return
|
||||
end
|
||||
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
if vim.fn.complete_info()["selected"] ~= -1 then
|
||||
return vim.fn["compe#confirm"] "<CR>"
|
||||
end
|
||||
end
|
||||
return npairs.check_break_line_char()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true })
|
||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true })
|
||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
|
||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
|
||||
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", { expr = true })
|
||||
|
||||
luasnip.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
@@ -1,95 +0,0 @@
|
||||
local present, tree_c = pcall(require, "nvim-tree.config")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local tree_cb = tree_c.nvim_tree_callback
|
||||
local g = vim.g
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
g.nvim_tree_side = "left"
|
||||
g.nvim_tree_width = 25
|
||||
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
|
||||
g.nvim_tree_gitignore = 1
|
||||
g.nvim_tree_auto_ignore_ft = { "dashboard" } -- don't open tree on specific fiypes.
|
||||
g.nvim_tree_auto_open = 0
|
||||
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
|
||||
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
|
||||
g.nvim_tree_follow = 1
|
||||
g.nvim_tree_indent_markers = 1
|
||||
g.nvim_tree_hide_dotfiles = 1
|
||||
g.nvim_tree_git_hl = 1
|
||||
g.nvim_tree_highlight_opened_files = 0
|
||||
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
||||
g.nvim_tree_tab_open = 0
|
||||
g.nvim_tree_allow_resize = 1
|
||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||
g.nvim_tree_disable_netrw = 1
|
||||
g.nvim_tree_hijack_netrw = 0
|
||||
g.nvim_tree_update_cwd = 1
|
||||
|
||||
g.nvim_tree_show_icons = {
|
||||
git = 1,
|
||||
folders = 1,
|
||||
files = 1,
|
||||
-- folder_arrows= 1
|
||||
}
|
||||
g.nvim_tree_icons = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
ignored = "◌",
|
||||
},
|
||||
folder = {
|
||||
-- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below!
|
||||
-- arrow_open = "",
|
||||
-- arrow_closed = "",
|
||||
default = "",
|
||||
open = "",
|
||||
empty = "", --
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
},
|
||||
}
|
||||
|
||||
g.nvim_tree_bindings = {
|
||||
{ key = { "<CR>", "o", "<2-LeftMouse>" }, cb = tree_cb "edit" },
|
||||
{ key = { "<2-RightMouse>", "<C-]>" }, cb = tree_cb "cd" },
|
||||
{ key = "<C-v>", cb = tree_cb "vsplit" },
|
||||
{ key = "<C-x>", cb = tree_cb "split" },
|
||||
{ key = "<C-t>", cb = tree_cb "tabnew" },
|
||||
{ key = "<", cb = tree_cb "prev_sibling" },
|
||||
{ key = ">", cb = tree_cb "next_sibling" },
|
||||
{ key = "P", cb = tree_cb "parent_node" },
|
||||
{ key = "<BS>", cb = tree_cb "close_node" },
|
||||
{ key = "<S-CR>", cb = tree_cb "close_node" },
|
||||
{ key = "<Tab>", cb = tree_cb "preview" },
|
||||
{ key = "K", cb = tree_cb "first_sibling" },
|
||||
{ key = "J", cb = tree_cb "last_sibling" },
|
||||
{ key = "I", cb = tree_cb "toggle_ignored" },
|
||||
{ key = "H", cb = tree_cb "toggle_dotfiles" },
|
||||
{ key = "R", cb = tree_cb "refresh" },
|
||||
{ key = "a", cb = tree_cb "create" },
|
||||
{ key = "d", cb = tree_cb "remove" },
|
||||
{ key = "r", cb = tree_cb "rename" },
|
||||
{ key = "<C->", cb = tree_cb "full_rename" },
|
||||
{ key = "x", cb = tree_cb "cut" },
|
||||
{ key = "c", cb = tree_cb "copy" },
|
||||
{ key = "p", cb = tree_cb "paste" },
|
||||
{ key = "y", cb = tree_cb "copy_name" },
|
||||
{ key = "Y", cb = tree_cb "copy_path" },
|
||||
{ key = "gy", cb = tree_cb "copy_absolute_path" },
|
||||
{ key = "[c", cb = tree_cb "prev_git_item" },
|
||||
{ key = "}c", cb = tree_cb "next_git_item" },
|
||||
{ key = "-", cb = tree_cb "dir_up" },
|
||||
{ key = "q", cb = tree_cb "close" },
|
||||
{ key = "g?", cb = tree_cb "toggle_help" },
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
M.colorizer = function()
|
||||
local present, colorizer = pcall(require, "colorizer")
|
||||
if present then
|
||||
colorizer.setup()
|
||||
vim.cmd "ColorizerReloadAllBuffers"
|
||||
end
|
||||
end
|
||||
|
||||
M.comment = function()
|
||||
local present, nvim_comment = pcall(require, "nvim_comment")
|
||||
if present then
|
||||
nvim_comment.setup()
|
||||
end
|
||||
end
|
||||
|
||||
M.escape = function()
|
||||
vim.g.better_escape_interval = 300
|
||||
vim.g.better_escape_shortcut = { "jk" }
|
||||
end
|
||||
|
||||
M.lspkind = function()
|
||||
local present, lspkind = pcall(require, "lspkind")
|
||||
if present then
|
||||
lspkind.init()
|
||||
end
|
||||
end
|
||||
|
||||
M.neoscroll = function()
|
||||
pcall(function()
|
||||
require("neoscroll").setup()
|
||||
end)
|
||||
end
|
||||
|
||||
M.blankline = function()
|
||||
vim.g.indentLine_enabled = 1
|
||||
vim.g.indent_blankline_char = "▏"
|
||||
|
||||
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
|
||||
vim.g.indent_blankline_buftype_exclude = { "terminal" }
|
||||
|
||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||
vim.g.indent_blankline_show_first_indent_level = false
|
||||
end
|
||||
|
||||
M.signature = function()
|
||||
local present, lspsignature = pcall(require, "lsp_signature")
|
||||
if present then
|
||||
lspsignature.setup {
|
||||
bind = true,
|
||||
doc_lines = 2,
|
||||
floating_window = true,
|
||||
fix_pos = true,
|
||||
hint_enable = true,
|
||||
hint_prefix = " ",
|
||||
hint_scheme = "String",
|
||||
use_lspsaga = false,
|
||||
hi_parameter = "Search",
|
||||
max_height = 22,
|
||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
handler_opts = {
|
||||
border = "single", -- double, single, shadow, none
|
||||
},
|
||||
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
|
||||
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,6 +1,4 @@
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "packadd packer.nvim"
|
||||
vim.cmd "packadd packer.nvim"
|
||||
|
||||
local present, packer = pcall(require, "packer")
|
||||
|
||||
@@ -19,17 +17,17 @@ if not present then
|
||||
packer_path,
|
||||
}
|
||||
|
||||
cmd "packadd packer.nvim"
|
||||
vim.cmd "packadd packer.nvim"
|
||||
present, packer = pcall(require, "packer")
|
||||
|
||||
if present then
|
||||
print "Packer cloned successfully."
|
||||
else
|
||||
error("Couldn't clone packer !\nPacker path: " .. packer_path)
|
||||
error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer)
|
||||
end
|
||||
end
|
||||
|
||||
return packer.init {
|
||||
packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "single" }
|
||||
@@ -37,9 +35,10 @@ return packer.init {
|
||||
prompt_border = "single",
|
||||
},
|
||||
git = {
|
||||
clone_timeout = 600, -- Timeout, in seconds, for git clones
|
||||
clone_timeout = 6000, -- seconds
|
||||
},
|
||||
auto_clean = true,
|
||||
compile_on_sync = true,
|
||||
-- auto_reload_compiled = true
|
||||
}
|
||||
|
||||
return packer
|
||||
@@ -1,309 +0,0 @@
|
||||
local global_theme = "themes/" .. require("utils").load_config().ui.theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
local present1, gl = pcall(require, "galaxyline")
|
||||
local present2, condition = pcall(require, "galaxyline.condition")
|
||||
if not (present1 or present2) then
|
||||
return
|
||||
end
|
||||
|
||||
local gls = gl.section
|
||||
|
||||
gl.short_line_list = { " " }
|
||||
|
||||
local icon_styles = {
|
||||
default = {
|
||||
left = "",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
round = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
slant = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
block = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
arrow = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
local user_statusline_style = require("utils").load_config().ui.statusline_style
|
||||
local statusline_style = icon_styles[user_statusline_style]
|
||||
|
||||
local left_separator = statusline_style.left
|
||||
local right_separator = statusline_style.right
|
||||
|
||||
gls.left[1] = {
|
||||
FirstElement = {
|
||||
provider = function()
|
||||
return "▋"
|
||||
end,
|
||||
highlight = { colors.nord_blue, colors.nord_blue },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[2] = {
|
||||
statusIcon = {
|
||||
provider = function()
|
||||
return statusline_style.main_icon
|
||||
end,
|
||||
highlight = { colors.statusline_bg, colors.nord_blue },
|
||||
separator = right_separator,
|
||||
separator_highlight = { colors.nord_blue, colors.one_bg2 },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[3] = {
|
||||
left_arow2 = {
|
||||
provider = function() end,
|
||||
separator = right_separator .. " ",
|
||||
separator_highlight = { colors.one_bg2, colors.lightbg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[4] = {
|
||||
FileIcon = {
|
||||
provider = "FileIcon",
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { colors.white, colors.lightbg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[5] = {
|
||||
FileName = {
|
||||
provider = function()
|
||||
local fileinfo = require "galaxyline.provider_fileinfo"
|
||||
|
||||
if vim.api.nvim_buf_get_name(0):len() == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
return fileinfo.get_current_file_name("", "")
|
||||
end,
|
||||
highlight = { colors.white, colors.lightbg },
|
||||
separator = right_separator,
|
||||
separator_highlight = { colors.lightbg, colors.lightbg2 },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[6] = {
|
||||
current_dir = {
|
||||
provider = function()
|
||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||
return " " .. dir_name .. " "
|
||||
end,
|
||||
highlight = { colors.grey_fg2, colors.lightbg2 },
|
||||
separator = right_separator,
|
||||
separator_highlight = { colors.lightbg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
local checkwidth = function()
|
||||
local squeeze_width = vim.fn.winwidth(0) / 2
|
||||
if squeeze_width > 30 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
gls.left[7] = {
|
||||
DiffAdd = {
|
||||
provider = "DiffAdd",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = { colors.white, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[8] = {
|
||||
DiffModified = {
|
||||
provider = "DiffModified",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[9] = {
|
||||
DiffRemove = {
|
||||
provider = "DiffRemove",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[10] = {
|
||||
DiagnosticError = {
|
||||
provider = "DiagnosticError",
|
||||
icon = " ",
|
||||
highlight = { colors.red, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[11] = {
|
||||
DiagnosticWarn = {
|
||||
provider = "DiagnosticWarn",
|
||||
icon = " ",
|
||||
highlight = { colors.yellow, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[1] = {
|
||||
lsp_status = {
|
||||
provider = function()
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) ~= nil then
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return " " .. " " .. " LSP"
|
||||
end
|
||||
end
|
||||
return ""
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end,
|
||||
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[2] = {
|
||||
GitIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
condition = require("galaxyline.condition").check_git_workspace,
|
||||
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||
separator = " ",
|
||||
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[3] = {
|
||||
GitBranch = {
|
||||
provider = "GitBranch",
|
||||
condition = require("galaxyline.condition").check_git_workspace,
|
||||
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
local mode_colors = {
|
||||
[110] = { "NORMAL", colors.red },
|
||||
[105] = { "INSERT", colors.dark_purple },
|
||||
[99] = { "COMMAND", colors.pink },
|
||||
[116] = { "TERMINAL", colors.green },
|
||||
[118] = { "VISUAL", colors.cyan },
|
||||
[22] = { "V-BLOCK", colors.cyan },
|
||||
[86] = { "V_LINE", colors.cyan },
|
||||
[82] = { "REPLACE", colors.orange },
|
||||
[115] = { "SELECT", colors.nord_blue },
|
||||
[83] = { "S-LINE", colors.nord_blue },
|
||||
}
|
||||
|
||||
local mode = function(n)
|
||||
return mode_colors[vim.fn.mode():byte()][n]
|
||||
end
|
||||
|
||||
gls.right[4] = {
|
||||
left_arrow = {
|
||||
provider = function() end,
|
||||
separator = " " .. left_separator,
|
||||
separator_highlight = { colors.one_bg2, colors.statusline_bg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[5] = {
|
||||
left_round = {
|
||||
provider = function()
|
||||
vim.cmd("hi Galaxyleft_round guifg=" .. mode(2))
|
||||
return left_separator
|
||||
end,
|
||||
highlight = { "GalaxyViMode", colors.one_bg2 },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[6] = {
|
||||
viMode_icon = {
|
||||
provider = function()
|
||||
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
|
||||
return statusline_style.vi_mode_icon
|
||||
end,
|
||||
highlight = { colors.statusline_bg, colors.red },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[7] = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
|
||||
return " " .. mode(1) .. " "
|
||||
end,
|
||||
highlight = { "GalaxyViMode", colors.lightbg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[8] = {
|
||||
left_arrow2 = {
|
||||
provider = function() end,
|
||||
separator = left_separator,
|
||||
separator_highlight = { colors.grey, colors.lightbg },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[9] = {
|
||||
some_RoundIcon = {
|
||||
provider = function()
|
||||
return statusline_style.position_icon
|
||||
end,
|
||||
separator = left_separator,
|
||||
separator_highlight = { colors.green, colors.grey },
|
||||
highlight = { colors.lightbg, colors.green },
|
||||
},
|
||||
}
|
||||
|
||||
gls.right[10] = {
|
||||
line_percentage = {
|
||||
provider = function()
|
||||
local current_line = vim.fn.line "."
|
||||
local total_line = vim.fn.line "$"
|
||||
|
||||
if current_line == 1 then
|
||||
return " Top "
|
||||
elseif current_line == vim.fn.line "$" then
|
||||
return " Bot "
|
||||
end
|
||||
local result, _ = math.modf((current_line / total_line) * 100)
|
||||
return " " .. result .. "% "
|
||||
end,
|
||||
highlight = { colors.green, colors.lightbg },
|
||||
},
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
ts_config.setup {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"lua",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
local present, true_zen = pcall(require, "true-zen")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
true_zen.setup {
|
||||
ui = {
|
||||
bottom = {
|
||||
laststatus = 0,
|
||||
ruler = false,
|
||||
showmode = false,
|
||||
showcmd = false,
|
||||
cmdheight = 1,
|
||||
},
|
||||
top = {
|
||||
showtabline = 0,
|
||||
},
|
||||
left = {
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "no",
|
||||
},
|
||||
},
|
||||
modes = {
|
||||
ataraxis = {
|
||||
left_padding = 32,
|
||||
right_padding = 32,
|
||||
top_padding = 1,
|
||||
bottom_padding = 1,
|
||||
ideal_writing_area_width = { 0 },
|
||||
auto_padding = true,
|
||||
keep_default_fold_fillchars = true,
|
||||
custome_bg = "",
|
||||
bg_configuration = true,
|
||||
affected_higroups = {
|
||||
NonText = {},
|
||||
FoldColumn = {},
|
||||
ColorColumn = {},
|
||||
VertSplit = {},
|
||||
StatusLine = {},
|
||||
StatusLineNC = {},
|
||||
SignColumn = {},
|
||||
},
|
||||
},
|
||||
focus = {
|
||||
margin_of_error = 5,
|
||||
focus_method = "experimental",
|
||||
},
|
||||
},
|
||||
integrations = {
|
||||
vim_gitgutter = false,
|
||||
galaxyline = true,
|
||||
tmux = false,
|
||||
gitsigns = false,
|
||||
nvim_bufferline = true,
|
||||
limelight = false,
|
||||
vim_airline = false,
|
||||
vim_powerline = false,
|
||||
vim_signify = false,
|
||||
express_line = false,
|
||||
lualine = false,
|
||||
},
|
||||
misc = {
|
||||
on_off_commands = false,
|
||||
ui_elements_commands = false,
|
||||
cursor_by_mode = false,
|
||||
},
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
-- This file can be loaded as a telescope extension
|
||||
local M = {}
|
||||
|
||||
-- Custom theme picker
|
||||
-- Most of the code is copied from telescope buffer builtin
|
||||
-- Src: https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/internal.lua
|
||||
M.term_picker = function(opts)
|
||||
local pickers, finders, previewers, make_entry, actions, action_state, utils, conf
|
||||
if pcall(require, "telescope") then
|
||||
pickers = require "telescope.pickers"
|
||||
finders = require "telescope.finders"
|
||||
previewers = require "telescope.previewers"
|
||||
|
||||
make_entry = require "telescope.make_entry"
|
||||
actions = require "telescope.actions"
|
||||
action_state = require "telescope.actions.state"
|
||||
utils = require "telescope.utils"
|
||||
conf = require("telescope.config").values
|
||||
else
|
||||
error "Cannot find telescope!"
|
||||
end
|
||||
|
||||
local filter = vim.tbl_filter
|
||||
|
||||
local local_utils = require "utils"
|
||||
|
||||
-- buffer number and name
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
|
||||
local bufnrs = filter(function(b)
|
||||
local present_type, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(b, "term_type")
|
||||
end)
|
||||
|
||||
if not present_type then
|
||||
-- let's only terms that we created
|
||||
return false
|
||||
end
|
||||
|
||||
-- if 1 ~= vim.fn.buflisted(b) then
|
||||
-- return false
|
||||
-- end
|
||||
-- only hide unloaded buffers if opts.show_all_buffers is false, keep them listed if true or nil
|
||||
if opts.show_all_buffers == false and not vim.api.nvim_buf_is_loaded(b) then
|
||||
return false
|
||||
end
|
||||
if opts.ignore_current_buffer and b == vim.api.nvim_get_current_buf() then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end, vim.api.nvim_list_bufs())
|
||||
if not next(bufnrs) then
|
||||
return
|
||||
end
|
||||
if opts.sort_mru then
|
||||
table.sort(bufnrs, function(a, b)
|
||||
return vim.fn.getbufinfo(a)[1].lastused > vim.fn.getbufinfo(b)[1].lastused
|
||||
end)
|
||||
end
|
||||
|
||||
local buffers = {}
|
||||
local default_selection_idx = 1
|
||||
for _, bufnr in ipairs(bufnrs) do
|
||||
local flag = bufnr == vim.fn.bufnr "" and "%" or (bufnr == vim.fn.bufnr "#" and "#" or " ")
|
||||
|
||||
if opts.sort_lastused and not opts.ignore_current_buffer and flag == "#" then
|
||||
default_selection_idx = 2
|
||||
end
|
||||
|
||||
local element = {
|
||||
bufnr = bufnr,
|
||||
flag = flag,
|
||||
info = vim.fn.getbufinfo(bufnr)[1],
|
||||
}
|
||||
|
||||
if opts.sort_lastused and (flag == "#" or flag == "%") then
|
||||
local idx = ((buffers[1] ~= nil and buffers[1].flag == "%") and 2 or 1)
|
||||
table.insert(buffers, idx, element)
|
||||
else
|
||||
table.insert(buffers, element)
|
||||
end
|
||||
end
|
||||
|
||||
if not opts.bufnr_width then
|
||||
local max_bufnr = math.max(unpack(bufnrs))
|
||||
opts.bufnr_width = #tostring(max_bufnr)
|
||||
end
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt_title = "Terminal buffers",
|
||||
finder = finders.new_table {
|
||||
results = buffers,
|
||||
entry_maker = opts.entry_maker or make_entry.gen_from_buffer(opts),
|
||||
},
|
||||
previewer = conf.grep_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
default_selection_index = default_selection_idx,
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
local entry = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
local buf = entry.bufnr
|
||||
|
||||
local chad_term, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
-- TODO buffer checks/error detection (make sure we do get a buf)
|
||||
|
||||
if chad_term then
|
||||
if type == "wind" then
|
||||
-- swtich to term buff & show in bufferline
|
||||
vim.cmd(string.format("b %d | setlocal bl", buf))
|
||||
-- vim.cmd('startinsert') TODO fix this
|
||||
elseif type == "vert" then
|
||||
vim.cmd(string.format("vsp #%d", buf))
|
||||
-- vim.cmd('startinsert') TODO fix this
|
||||
elseif type == "hori" then
|
||||
-- TODO change 15 to a chad config var number
|
||||
vim.cmd(string.format("15 sp #%d ", buf))
|
||||
-- vim.cmd('startinsert') TODO fix this
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
end
|
||||
|
||||
-- register term picker as terms to telescope
|
||||
local present, telescope = pcall(require, "telescope")
|
||||
if present then
|
||||
return telescope.register_extension {
|
||||
exports = {
|
||||
terms = M.term_picker,
|
||||
},
|
||||
}
|
||||
else
|
||||
error "Cannot find telescope!"
|
||||
end
|
||||
@@ -1,142 +0,0 @@
|
||||
-- This file can be loaded as a telescope extension
|
||||
local M = {}
|
||||
|
||||
-- Custom theme picker
|
||||
-- Most of the code is copied from telescope colorscheme plugin, mostly for preview creation
|
||||
M.theme_switcher = function(opts)
|
||||
local pickers, finders, previewers, actions, action_state, utils, conf
|
||||
if pcall(require, "telescope") then
|
||||
pickers = require "telescope.pickers"
|
||||
finders = require "telescope.finders"
|
||||
previewers = require "telescope.previewers"
|
||||
|
||||
actions = require "telescope.actions"
|
||||
action_state = require "telescope.actions.state"
|
||||
utils = require "telescope.utils"
|
||||
conf = require("telescope.config").values
|
||||
else
|
||||
error "Cannot find telescope!"
|
||||
end
|
||||
|
||||
local local_utils = require "utils"
|
||||
local reload_theme = local_utils.reload_theme
|
||||
|
||||
-- get a table of available themes
|
||||
local themes = local_utils.list_themes()
|
||||
if next(themes) ~= nil then
|
||||
-- save this to use it for later to restore if theme not changed
|
||||
local current_theme = vim.g.nvchad_theme
|
||||
local new_theme = ""
|
||||
local change = false
|
||||
|
||||
-- buffer number and name
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
|
||||
local previewer
|
||||
|
||||
-- in case its not a normal buffer
|
||||
if vim.fn.buflisted(bufnr) ~= 1 then
|
||||
local deleted = false
|
||||
local function del_win(win_id)
|
||||
if win_id and vim.api.nvim_win_is_valid(win_id) then
|
||||
utils.buf_delete(vim.api.nvim_win_get_buf(win_id))
|
||||
pcall(vim.api.nvim_win_close, win_id, true)
|
||||
end
|
||||
end
|
||||
|
||||
previewer = previewers.new {
|
||||
preview_fn = function(_, entry, status)
|
||||
if not deleted then
|
||||
deleted = true
|
||||
del_win(status.preview_win)
|
||||
del_win(status.preview_border_win)
|
||||
end
|
||||
reload_theme(entry.value)
|
||||
end,
|
||||
}
|
||||
else
|
||||
-- show current buffer content in previewer
|
||||
previewer = previewers.new_buffer_previewer {
|
||||
get_buffer_by_name = function()
|
||||
return bufname
|
||||
end,
|
||||
define_preview = function(self, entry)
|
||||
if vim.loop.fs_stat(bufname) then
|
||||
conf.buffer_previewer_maker(bufname, self.state.bufnr, { bufname = self.state.bufname })
|
||||
else
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||
end
|
||||
reload_theme(entry.value)
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
local picker = pickers.new {
|
||||
prompt_title = "Set NvChad color",
|
||||
finder = finders.new_table(themes),
|
||||
previewer = previewer,
|
||||
sorter = conf.generic_sorter(opts),
|
||||
attach_mappings = function()
|
||||
actions.select_default:replace(
|
||||
-- if a entry is selected, change current_theme to that
|
||||
function(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
new_theme = selection.value
|
||||
change = true
|
||||
actions.close(prompt_bufnr)
|
||||
end
|
||||
)
|
||||
return true
|
||||
end,
|
||||
}
|
||||
|
||||
-- rewrite picker.close_windows
|
||||
local close_windows = picker.close_windows
|
||||
picker.close_windows = function(status)
|
||||
close_windows(status)
|
||||
-- now apply the theme, if success, then ask for default theme change
|
||||
local final_theme
|
||||
if change then
|
||||
final_theme = new_theme
|
||||
else
|
||||
final_theme = current_theme
|
||||
end
|
||||
|
||||
if reload_theme(final_theme) then
|
||||
if change then
|
||||
-- ask for confirmation to set as default theme
|
||||
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
|
||||
local_utils.clear_cmdline()
|
||||
if ans then
|
||||
local_utils.change_theme(current_theme, final_theme)
|
||||
else
|
||||
-- will be used in restoring nvchad theme var
|
||||
final_theme = current_theme
|
||||
end
|
||||
end
|
||||
else
|
||||
final_theme = current_theme
|
||||
end
|
||||
-- set nvchad_theme global var
|
||||
vim.g.nvchad_theme = final_theme
|
||||
end
|
||||
-- launch the telescope picker
|
||||
picker:find()
|
||||
else
|
||||
print("No themes found in " .. vim.fn.stdpath "config" .. "/lua/themes")
|
||||
end
|
||||
end
|
||||
|
||||
-- register theme swticher as themes to telescope
|
||||
local present, telescope = pcall(require, "telescope")
|
||||
if present then
|
||||
return telescope.register_extension {
|
||||
exports = {
|
||||
themes = M.theme_switcher,
|
||||
},
|
||||
}
|
||||
else
|
||||
error "Cannot find telescope!"
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
local chad_theme = require("utils").load_config().ui.theme
|
||||
vim.g.nvchad_theme = chad_theme
|
||||
|
||||
local present, base16 = pcall(require, "base16")
|
||||
|
||||
if present then
|
||||
base16(base16.themes(chad_theme), true)
|
||||
require "highlights"
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#F8F8F2",
|
||||
darker_black = "#232531",
|
||||
black = "#282A36", -- nvim bg
|
||||
black2 = "#303341",
|
||||
one_bg = "#373844", -- real bg of onedark
|
||||
one_bg2 = "#44475a",
|
||||
one_bg3 = "#565761",
|
||||
grey = "#41434f",
|
||||
grey_fg = "#5a5c68",
|
||||
grey_fg2 = "#5a5c68",
|
||||
light_grey = "#636571",
|
||||
red = "#E95678",
|
||||
baby_pink = "#DE8C92",
|
||||
pink = "#FF79C6",
|
||||
line = "#373844", -- for lines like vertsplit
|
||||
green = "#69ff94",
|
||||
vibrant_green = "#69FF94",
|
||||
nord_blue = "#b389ef",
|
||||
blue = "#BD93F9",
|
||||
yellow = "#F1FA8C",
|
||||
sun = "#FFFFA5",
|
||||
purple = "#BD93F9",
|
||||
dark_purple = "#BD93F9",
|
||||
teal = "#0088cc",
|
||||
orange = "#FFB86C",
|
||||
cyan = "#8BE9FD",
|
||||
statusline_bg = "#2b2d39",
|
||||
lightbg = "#343642",
|
||||
lightbg2 = "#2f313d",
|
||||
pmenu_bg = "#b389ef",
|
||||
folder_bg = "#BD93F9",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#fff9e8",
|
||||
darker_black = "#272f35",
|
||||
black = "#2b3339", -- nvim bg
|
||||
black2 = "#323a40",
|
||||
one_bg = "#333b41",
|
||||
one_bg2 = "#363e44",
|
||||
one_bg3 = "#3a4248",
|
||||
grey = "#4a5258",
|
||||
grey_fg = "#50585e",
|
||||
grey_fg2 = "#545c62",
|
||||
light_grey = "#586066",
|
||||
red = "#e67e80",
|
||||
baby_pink = "#ce8196",
|
||||
pink = "#ff75a0",
|
||||
line = "#3a4248", -- for lines like vertsplit
|
||||
green = "#83c092",
|
||||
vibrant_green = "#a7c080",
|
||||
nord_blue = "#78b4ac",
|
||||
blue = "#7fbbb3",
|
||||
yellow = "#dbbc7f",
|
||||
sun = "#d1b171",
|
||||
purple = "#b4bbc8",
|
||||
dark_purple = "#d699b6",
|
||||
teal = "#69a59d",
|
||||
orange = "#e69875",
|
||||
cyan = "#95d1c9",
|
||||
statusline_bg = "#2e363c",
|
||||
lightbg = "#3d454b",
|
||||
lightbg2 = "#333b41",
|
||||
pmenu_bg = "#83c092",
|
||||
folder_bg = "#7fbbb3",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#c7b89d",
|
||||
darker_black = "#1e2122",
|
||||
black = "#222526", -- nvim bg
|
||||
black2 = "#26292a",
|
||||
one_bg = "#2b2e2f",
|
||||
one_bg2 = "#2f3233",
|
||||
one_bg3 = "#313435",
|
||||
grey = "#46494a",
|
||||
grey_fg = "#5d6061",
|
||||
grey_fg2 = "#5b5e5f",
|
||||
light_grey = "#585b5c",
|
||||
red = "#ec6b64",
|
||||
baby_pink = "#ce8196",
|
||||
pink = "#ff75a0",
|
||||
line = "#2c2f30", -- for lines like vertsplit
|
||||
green = "#89b482",
|
||||
vibrant_green = "#a9b665",
|
||||
nord_blue = "#6f8faf",
|
||||
blue = "#6d8dad",
|
||||
yellow = "#d6b676",
|
||||
sun = "#d1b171",
|
||||
purple = "#b4bbc8",
|
||||
dark_purple = "#cc7f94",
|
||||
teal = "#749689",
|
||||
orange = "#e78a4e",
|
||||
cyan = "#82b3a8",
|
||||
statusline_bg = "#252829",
|
||||
lightbg = "#2d3139",
|
||||
lightbg2 = "#262a32",
|
||||
pmenu_bg = "#89b482",
|
||||
folder_bg = "#6d8dad",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#b5bcc9",
|
||||
darker_black = "#10171e",
|
||||
black = "#131a21", -- nvim bg
|
||||
black2 = "#1a2128",
|
||||
one_bg = "#1e252c",
|
||||
one_bg2 = "#272e35",
|
||||
one_bg3 = "#2a3138",
|
||||
grey = "#363d44",
|
||||
grey_fg = "#4e555c",
|
||||
grey_fg2 = "#51585f",
|
||||
light_grey = "#545b62",
|
||||
red = "#ef8891",
|
||||
baby_pink = "#fca2aa",
|
||||
pink = "#fca2af",
|
||||
line = "#20272e", -- for lines like vertsplit
|
||||
green = "#9ce5c0",
|
||||
vibrant_green = "#a5d4af",
|
||||
blue = "#99aee5",
|
||||
nord_blue = "#9aa8cf",
|
||||
yellow = "#fbdf90",
|
||||
sun = "#fbdf9a",
|
||||
purple = "#d7c1ed",
|
||||
dark_purple = "#ccaced",
|
||||
teal = "#92dbb6",
|
||||
orange = "#EDA685",
|
||||
cyan = "#b5c3ea",
|
||||
statusline_bg = "#181f26",
|
||||
lightbg = "#222930",
|
||||
lightbg2 = "#1d242b",
|
||||
pmenu_bg = "#ef8891",
|
||||
folder_bg = "#99aee5",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#b0b0b0",
|
||||
darker_black = "#171d23",
|
||||
black = "#1a2026", -- nvim bg
|
||||
black2 = "#20262c",
|
||||
one_bg = "#242a30",
|
||||
one_bg2 = "#292f35",
|
||||
one_bg3 = "#2e343a",
|
||||
grey = "#42484e",
|
||||
grey_fg = "#474d53",
|
||||
grey_fg2 = "#50565c",
|
||||
light_grey = "#565c62",
|
||||
red = "#ac8a8c",
|
||||
baby_pink = "#de878f",
|
||||
pink = "#e89199",
|
||||
line = "#2d3339", -- for lines like vertsplit
|
||||
green = "#8aac8b",
|
||||
vibrant_green = "#9ec49f",
|
||||
blue = "#6b8bab",
|
||||
nord_blue = "#7797b7",
|
||||
yellow = "#c4c19e",
|
||||
sun = "#aca98a",
|
||||
purple = "#a39ec4",
|
||||
dark_purple = "#8f8aac",
|
||||
teal = "#7c9cbc",
|
||||
orange = "#e39a83",
|
||||
cyan = "#9aafe6",
|
||||
statusline_bg = "#1e242a",
|
||||
lightbg = "#2d3339",
|
||||
lightbg2 = "#252b31",
|
||||
pmenu_bg = "#8aac8b",
|
||||
folder_bg = "#6b8bab",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#abb2bf",
|
||||
darker_black = "#2a303c",
|
||||
black = "#2E3440", -- nvim bg
|
||||
black2 = "#343a46",
|
||||
one_bg = "#373d49",
|
||||
one_bg2 = "#464c58",
|
||||
one_bg3 = "#494f5b",
|
||||
grey = "#4b515d",
|
||||
grey_fg = "#565c68",
|
||||
grey_fg2 = "#606672",
|
||||
light_grey = "#646a76",
|
||||
red = "#BF616A",
|
||||
baby_pink = "#de878f",
|
||||
pink = "#d57780",
|
||||
line = "#3a404c", -- for lines like vertsplit
|
||||
green = "#A3BE8C",
|
||||
vibrant_green = "#afca98",
|
||||
blue = "#7797b7",
|
||||
nord_blue = "#81A1C1",
|
||||
yellow = "#EBCB8B",
|
||||
sun = "#e1c181",
|
||||
purple = "#aab1be",
|
||||
dark_purple = "#B48EAD",
|
||||
teal = "#6484a4",
|
||||
orange = "#e39a83",
|
||||
cyan = "#9aafe6",
|
||||
statusline_bg = "#333945",
|
||||
lightbg = "#3f4551",
|
||||
lightbg2 = "#393f4b",
|
||||
pmenu_bg = "#A3BE8C",
|
||||
folder_bg = "#7797b7",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#54555b",
|
||||
darker_black = "#f5f5f5",
|
||||
black = "#fafafa", -- nvim bg
|
||||
black2 = "#f1f1f1",
|
||||
one_bg = "#f0f0f0", -- real bg of onedark
|
||||
one_bg2 = "#ececec",
|
||||
one_bg3 = "#e7e7e7",
|
||||
grey = "#cbcbcb",
|
||||
grey_fg = "#c6c6c6",
|
||||
grey_fg2 = "#b7b7b7",
|
||||
light_grey = "#b7b7b7",
|
||||
red = "#e6676e",
|
||||
baby_pink = "#F07178",
|
||||
pink = "#ff75a0",
|
||||
line = "#e9e9e9", -- for lines like vertsplit
|
||||
green = "#7b90c7",
|
||||
vibrant_green = "#7eca9c",
|
||||
nord_blue = "#5e5f65",
|
||||
blue = "#28a2f4",
|
||||
yellow = "#7e7e7e",
|
||||
sun = "#dea95f",
|
||||
purple = "#a28dcd",
|
||||
dark_purple = "#8e79b9",
|
||||
teal = "#519ABA",
|
||||
orange = "#FF6A00",
|
||||
cyan = "#a3b8ef",
|
||||
statusline_bg = "#f0f0f0",
|
||||
lightbg = "#d6d6d6",
|
||||
lightbg2 = "#5e5f65",
|
||||
pmenu_bg = "#5e5f65",
|
||||
folder_bg = "#6C6C6C",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#abb2bf",
|
||||
darker_black = "#1b1f27",
|
||||
black = "#1e222a", -- nvim bg
|
||||
black2 = "#252931",
|
||||
one_bg = "#282c34", -- real bg of onedark
|
||||
one_bg2 = "#353b45",
|
||||
one_bg3 = "#30343c",
|
||||
grey = "#42464e",
|
||||
grey_fg = "#565c64",
|
||||
grey_fg2 = "#6f737b",
|
||||
light_grey = "#6f737b",
|
||||
red = "#d47d85",
|
||||
baby_pink = "#DE8C92",
|
||||
pink = "#ff75a0",
|
||||
line = "#2a2e36", -- for lines like vertsplit
|
||||
green = "#A3BE8C",
|
||||
vibrant_green = "#7eca9c",
|
||||
nord_blue = "#81A1C1",
|
||||
blue = "#61afef",
|
||||
yellow = "#e7c787",
|
||||
sun = "#EBCB8B",
|
||||
purple = "#b4bbc8",
|
||||
dark_purple = "#c882e7",
|
||||
teal = "#519ABA",
|
||||
orange = "#fca2aa",
|
||||
cyan = "#a3b8ef",
|
||||
statusline_bg = "#22262e",
|
||||
lightbg = "#2d3139",
|
||||
lightbg2 = "#262a32",
|
||||
pmenu_bg = "#A3BE8C",
|
||||
folder_bg = "#61afef",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#c0caf5",
|
||||
darker_black = "#151621",
|
||||
black = "#171823", -- nvim bg
|
||||
black2 = "#20212c",
|
||||
one_bg = "#242530",
|
||||
one_bg2 = "#292a35",
|
||||
one_bg3 = "#353b45",
|
||||
grey = "#40486a",
|
||||
grey_fg = "#4a5274",
|
||||
grey_fg2 = "#4f5779",
|
||||
light_grey = "#545c7e",
|
||||
red = "#f7768e",
|
||||
baby_pink = "#DE8C92",
|
||||
pink = "#ff75a0",
|
||||
line = "#242530", -- for lines like vertsplit
|
||||
green = "#9ece6a",
|
||||
vibrant_green = "#73daca",
|
||||
nord_blue = "#80a8fd",
|
||||
blue = "#7aa2f7",
|
||||
yellow = "#e7c787",
|
||||
sun = "#EBCB8B",
|
||||
purple = "#bb9af7",
|
||||
dark_purple = "#9d7cd8",
|
||||
teal = "#0db9d7",
|
||||
orange = "#ff9e64",
|
||||
cyan = "#7dcfff",
|
||||
statusline_bg = "#1d1e29",
|
||||
lightbg = "#252631",
|
||||
lightbg2 = "#22232e",
|
||||
pmenu_bg = "#7aa2f7",
|
||||
folder_bg = "#7aa2f7",
|
||||
}
|
||||
|
||||
return colors
|
||||
@@ -1,35 +0,0 @@
|
||||
local colors = {
|
||||
white = "#C5C8C2",
|
||||
darker_black = "#191b1d",
|
||||
black = "#1d1f21", -- nvim bg
|
||||
black2 = "#232527",
|
||||
one_bg = "#363a41",
|
||||
one_bg2 = "#353b45",
|
||||
one_bg3 = "#30343c",
|
||||
grey = "#434547",
|
||||
grey_fg = "#545B68",
|
||||
grey_fg2 = "#616875",
|
||||
light_grey = "#676e7b",
|
||||
red = "#cc6666",
|
||||
baby_pink = "#FF6E79",
|
||||
pink = "#ff9ca3",
|
||||
line = "#27292b", -- for lines like vertsplit
|
||||
green = "#a4b595",
|
||||
vibrant_green = "#a3b991",
|
||||
nord_blue = "#728da8",
|
||||
blue = "#6f8dab",
|
||||
yellow = "#d7bd8d",
|
||||
sun = "#e4c180",
|
||||
purple = "#b4bbc8",
|
||||
dark_purple = "#b290ac",
|
||||
teal = "#8abdb6",
|
||||
orange = "#DE935F",
|
||||
cyan = "#70c0b1",
|
||||
statusline_bg = "#212326",
|
||||
lightbg = "#373B41",
|
||||
lightbg2 = "#2D3035",
|
||||
pmenu_bg = "#a4b595",
|
||||
folder_bg = "#6f8dab",
|
||||
}
|
||||
|
||||
return colors
|
||||
-500
@@ -1,500 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
-- 1st arg as current theme, 2nd as new theme
|
||||
M.change_theme = function(current_theme, new_theme)
|
||||
if current_theme == nil or new_theme == nil then
|
||||
print "Error: Provide current and new theme name"
|
||||
return false
|
||||
end
|
||||
if current_theme == new_theme then
|
||||
return
|
||||
end
|
||||
|
||||
local user_config = vim.g.nvchad_user_config
|
||||
local file = vim.fn.stdpath "config" .. "/lua/" .. user_config .. ".lua"
|
||||
-- store in data variable
|
||||
local data = assert(M.file("r", file))
|
||||
-- escape characters which can be parsed as magic chars
|
||||
current_theme = current_theme:gsub("%p", "%%%0")
|
||||
new_theme = new_theme:gsub("%p", "%%%0")
|
||||
local find = "theme = .?" .. current_theme .. ".?"
|
||||
local replace = 'theme = "' .. new_theme .. '"'
|
||||
local content = string.gsub(data, find, replace)
|
||||
-- see if the find string exists in file
|
||||
if content == data then
|
||||
print("Error: Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
|
||||
return false
|
||||
else
|
||||
assert(M.file("w", file, content))
|
||||
end
|
||||
end
|
||||
|
||||
M.clear_cmdline = function()
|
||||
vim.defer_fn(function()
|
||||
vim.cmd "echo"
|
||||
end, 0)
|
||||
end
|
||||
|
||||
M.close_buffer = function(bufexpr, force)
|
||||
-- This is a modification of a NeoVim plugin from
|
||||
-- Author: ojroques - Olivier Roques
|
||||
-- Src: https://github.com/ojroques/nvim-bufdel
|
||||
-- (Author has okayed copy-paste)
|
||||
|
||||
-- Options
|
||||
local opts = {
|
||||
next = "cycle", -- how to retrieve the next buffer
|
||||
quit = false, -- exit when last buffer is deleted
|
||||
--TODO make this a chadrc flag/option
|
||||
}
|
||||
|
||||
-- ----------------
|
||||
-- Helper functions
|
||||
-- ----------------
|
||||
|
||||
-- Switch to buffer 'buf' on each window from list 'windows'
|
||||
local function switch_buffer(windows, buf)
|
||||
local cur_win = vim.fn.winnr()
|
||||
for _, winid in ipairs(windows) do
|
||||
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
|
||||
vim.cmd(string.format("buffer %d", buf))
|
||||
end
|
||||
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
|
||||
end
|
||||
|
||||
-- Select the first buffer with a number greater than given buffer
|
||||
local function get_next_buf(buf)
|
||||
local next = vim.fn.bufnr "#"
|
||||
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
for i = 0, vim.fn.bufnr "$" - 1 do
|
||||
next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
|
||||
if vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ----------------
|
||||
-- End helper functions
|
||||
-- ----------------
|
||||
|
||||
local buf = vim.fn.bufnr()
|
||||
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
|
||||
return
|
||||
end
|
||||
|
||||
if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
|
||||
if opts.quit then
|
||||
-- exit when there is only one buffer left
|
||||
if force then
|
||||
vim.cmd "qall!"
|
||||
else
|
||||
vim.cmd "confirm qall"
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local chad_term, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
if chad_term then
|
||||
-- Must be a window type
|
||||
vim.cmd(string.format("setlocal nobl", buf))
|
||||
vim.cmd "enew"
|
||||
return
|
||||
end
|
||||
-- don't exit and create a new empty buffer
|
||||
vim.cmd "enew"
|
||||
vim.cmd "bp"
|
||||
end
|
||||
|
||||
local next_buf = get_next_buf(buf)
|
||||
local windows = vim.fn.getbufinfo(buf)[1].windows
|
||||
|
||||
-- force deletion of terminal buffers to avoid the prompt
|
||||
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
|
||||
local chad_term, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
-- TODO this scope is error prone, make resilient
|
||||
if chad_term then
|
||||
if type == "wind" then
|
||||
-- hide from bufferline
|
||||
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
|
||||
-- swtich to another buff
|
||||
-- TODO switch to next bufffer, this works too
|
||||
vim.cmd "BufferLineCycleNext"
|
||||
else
|
||||
local cur_win = vim.fn.winnr()
|
||||
-- we can close this window
|
||||
vim.cmd(string.format("%d wincmd c", cur_win))
|
||||
return
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("bd! %d", buf))
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("silent! confirm bd %d", buf))
|
||||
end
|
||||
-- revert buffer switches if user has canceled deletion
|
||||
if vim.fn.buflisted(buf) == 1 then
|
||||
switch_buffer(windows, buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- wrapper to use vim.api.nvim_echo
|
||||
-- table of {string, highlight}
|
||||
-- e.g echo({{"Hello", "Title"}, {"World"}})
|
||||
M.echo = function(opts)
|
||||
if opts == nil or type(opts) ~= "table" then
|
||||
return
|
||||
end
|
||||
vim.api.nvim_echo(opts, false, {})
|
||||
end
|
||||
|
||||
-- 1st arg - r or w
|
||||
-- 2nd arg - file path
|
||||
-- 3rd arg - content if 1st arg is w
|
||||
-- return file data on read, nothing on write
|
||||
M.file = function(mode, filepath, content)
|
||||
local data
|
||||
local fd = assert(vim.loop.fs_open(filepath, mode, 438))
|
||||
local stat = assert(vim.loop.fs_fstat(fd))
|
||||
if stat.type ~= "file" then
|
||||
data = false
|
||||
else
|
||||
if mode == "r" then
|
||||
data = assert(vim.loop.fs_read(fd, stat.size, 0))
|
||||
else
|
||||
assert(vim.loop.fs_write(fd, content, 0))
|
||||
data = true
|
||||
end
|
||||
end
|
||||
assert(vim.loop.fs_close(fd))
|
||||
return data
|
||||
end
|
||||
|
||||
-- return a table of available themes
|
||||
M.list_themes = function(return_type)
|
||||
local themes = {}
|
||||
-- folder where theme files are stored
|
||||
local themes_folder = vim.fn.stdpath "config" .. "/lua/themes"
|
||||
-- list all the contents of the folder and filter out files with .lua extension, then append to themes table
|
||||
local fd = vim.loop.fs_scandir(themes_folder)
|
||||
if fd then
|
||||
while true do
|
||||
local name, typ = vim.loop.fs_scandir_next(fd)
|
||||
if name == nil then
|
||||
break
|
||||
end
|
||||
if typ ~= "directory" and string.find(name, ".lua") then
|
||||
-- return the table values as keys if specified
|
||||
if return_type == "keys_as_value" then
|
||||
themes[vim.fn.fnamemodify(name, ":r")] = true
|
||||
else
|
||||
table.insert(themes, vim.fn.fnamemodify(name, ":r"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return themes
|
||||
end
|
||||
|
||||
-- Base code: https://gist.github.com/revolucas/184aec7998a6be5d2f61b984fac1d7f7
|
||||
-- Changes over it: preserving table 1 contents and also update with table b, without duplicating
|
||||
-- 1st arg - base table, 2nd arg - table to merge
|
||||
M.merge_table = function(into, from)
|
||||
-- make sure both are table
|
||||
if type(into) ~= "table" or type(from) ~= "table" then
|
||||
return into
|
||||
end
|
||||
local stack, seen = {}, {}
|
||||
local table1, table2 = into, from
|
||||
while true do
|
||||
for k, v in pairs(table2) do
|
||||
if type(v) == "table" and type(table1[k]) == "table" then
|
||||
table.insert(stack, { table1[k], table2[k] })
|
||||
else
|
||||
local present = seen[v] or false
|
||||
if not present then
|
||||
if type(k) == "number" then
|
||||
-- add the value to seen table until value is found
|
||||
-- only do when key is number we just want to append to subtables
|
||||
-- todo: maybe improve this
|
||||
|
||||
for _, value in pairs(table1) do
|
||||
if value == v then
|
||||
present = true
|
||||
break
|
||||
end
|
||||
end
|
||||
seen[v] = true
|
||||
if not present then
|
||||
table1[#table1 + 1] = v
|
||||
end
|
||||
else
|
||||
table1[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if #stack > 0 then
|
||||
local t = stack[#stack]
|
||||
table1, table2 = t[1], t[2]
|
||||
stack[#stack] = nil
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
return into
|
||||
end
|
||||
|
||||
-- load config
|
||||
-- 1st arg = boolean - whether to force reload
|
||||
-- Modifies _G._NVCHAD_CONFIG global variable
|
||||
M.load_config = function(reload)
|
||||
-- only do the stuff below one time, otherwise just return the set config
|
||||
if _G._NVCHAD_CONFIG_CONTENTS ~= nil and not (reload or false) then
|
||||
return _G._NVCHAD_CONFIG_CONTENTS
|
||||
end
|
||||
|
||||
-- don't enclose in pcall, it better break when default config is faulty
|
||||
_G._NVCHAD_CONFIG_CONTENTS = require "default_config"
|
||||
|
||||
-- user config is not required to run nvchad but a optional
|
||||
-- Make sure the config doesn't break the whole system if user config is not present or in bad state or not a table
|
||||
-- print warning texts if user config file is present
|
||||
local config_name = vim.g.nvchad_user_config or "chadrc"
|
||||
local config_file = vim.fn.stdpath "config" .. "/lua/" .. config_name .. ".lua"
|
||||
-- check if the user config is present
|
||||
if vim.fn.empty(vim.fn.glob(config_file)) < 1 then
|
||||
local present, config = pcall(require, config_name)
|
||||
if present then
|
||||
-- make sure the returned value is table
|
||||
if type(config) == "table" then
|
||||
-- data = require(config_name)
|
||||
_G._NVCHAD_CONFIG_CONTENTS = require("utils").merge_table(_G._NVCHAD_CONFIG_CONTENTS, config)
|
||||
else
|
||||
print("Warning: " .. config_name .. " sourced successfully but did not return a lua table.")
|
||||
end
|
||||
else
|
||||
print("Warning: " .. config_file .. " is present but sourcing failed.")
|
||||
end
|
||||
end
|
||||
return _G._NVCHAD_CONFIG_CONTENTS
|
||||
end
|
||||
|
||||
-- reload a plugin ( will try to load even if not loaded)
|
||||
-- can take a string or list ( table )
|
||||
-- return true or false
|
||||
M.reload_plugin = function(plugins)
|
||||
local status = true
|
||||
local function _reload_plugin(plugin)
|
||||
local loaded = package.loaded[plugin]
|
||||
if loaded then
|
||||
package.loaded[plugin] = nil
|
||||
end
|
||||
if not pcall(require, plugin) then
|
||||
print("Error: Cannot load " .. plugin .. " plugin!")
|
||||
status = false
|
||||
end
|
||||
end
|
||||
|
||||
if type(plugins) == "string" then
|
||||
_reload_plugin(plugins)
|
||||
elseif type(plugins) == "table" then
|
||||
for _, plugin in ipairs(plugins) do
|
||||
_reload_plugin(plugin)
|
||||
end
|
||||
end
|
||||
return status
|
||||
end
|
||||
|
||||
-- reload themes without restarting vim
|
||||
-- if no theme name given then reload the current theme
|
||||
M.reload_theme = function(theme_name)
|
||||
local reload_plugin = require("utils").reload_plugin
|
||||
|
||||
-- if theme name is empty or nil, then reload the current theme
|
||||
if theme_name == nil or theme_name == "" then
|
||||
theme_name = vim.g.nvchad_theme
|
||||
end
|
||||
|
||||
if not pcall(require, "themes/" .. theme_name) then
|
||||
print("No such theme ( " .. theme_name .. " )")
|
||||
return false
|
||||
end
|
||||
|
||||
vim.g.nvchad_theme = theme_name
|
||||
|
||||
-- reload the base16 theme
|
||||
local ok, base16 = pcall(require, "base16")
|
||||
if not ok then
|
||||
print "Error: Cannot load base16 plugin!"
|
||||
return false
|
||||
end
|
||||
base16(base16.themes(theme_name), true)
|
||||
|
||||
if
|
||||
not reload_plugin {
|
||||
"highlights",
|
||||
"plugins.bufferline",
|
||||
"galaxyline",
|
||||
"plugins.statusline",
|
||||
}
|
||||
then
|
||||
print "Error: Not able to reload all plugins."
|
||||
return false
|
||||
end
|
||||
|
||||
-- yes, this is very hacky, but due to new_async in
|
||||
-- https://github.com/glepnir/galaxyline.nvim/blob/main/lua/galaxyline/provider.lua#L5-L36
|
||||
-- it doesn't work properly and some statusline stuff dissapears
|
||||
local vcs = require "galaxyline.provider_vcs"
|
||||
local fileinfo = require "galaxyline.provider_fileinfo"
|
||||
local buffer = require "galaxyline.provider_buffer"
|
||||
local extension = require "galaxyline.provider_extensions"
|
||||
local whitespace = require "galaxyline.provider_whitespace"
|
||||
local lspclient = require "galaxyline.provider_lsp"
|
||||
_G.galaxyline_providers = {
|
||||
BufferIcon = buffer.get_buffer_type_icon,
|
||||
BufferNumber = buffer.get_buffer_number,
|
||||
FileTypeName = buffer.get_buffer_filetype,
|
||||
GitBranch = vcs.get_git_branch,
|
||||
DiffAdd = vcs.diff_add,
|
||||
DiffModified = vcs.diff_modified,
|
||||
DiffRemove = vcs.diff_remove,
|
||||
LineColumn = fileinfo.line_column,
|
||||
FileFormat = fileinfo.get_file_format,
|
||||
FileEncode = fileinfo.get_file_encode,
|
||||
FileSize = fileinfo.get_file_size,
|
||||
FileIcon = fileinfo.get_file_icon,
|
||||
FileName = fileinfo.get_current_file_name,
|
||||
SFileName = fileinfo.filename_in_special_buffer,
|
||||
LinePercent = fileinfo.current_line_percent,
|
||||
ScrollBar = extension.scrollbar_instance,
|
||||
VistaPlugin = extension.vista_nearest,
|
||||
WhiteSpace = whitespace.get_item,
|
||||
GetLspClient = lspclient.get_lsp_client,
|
||||
}
|
||||
local diagnostic = require "galaxyline.provider_diagnostic"
|
||||
_G.galaxyline_providers.DiagnosticError = diagnostic.get_diagnostic_error
|
||||
_G.galaxyline_providers.DiagnosticWarn = diagnostic.get_diagnostic_warn
|
||||
_G.galaxyline_providers.DiagnosticHint = diagnostic.get_diagnostic_hint
|
||||
_G.galaxyline_providers.DiagnosticInfo = diagnostic.get_diagnostic_info
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- toggle between 2 themes
|
||||
-- argument should be a table with 2 theme names
|
||||
M.toggle_theme = function(themes)
|
||||
local current_theme = vim.g.current_nvchad_theme or vim.g.nvchad_theme
|
||||
for _, name in ipairs(themes) do
|
||||
if name ~= current_theme then
|
||||
if require("utils").reload_theme(name) then
|
||||
-- open a buffer and close it to reload the statusline
|
||||
vim.cmd "new|bwipeout"
|
||||
vim.g.current_nvchad_theme = name
|
||||
if M.change_theme(vim.g.nvchad_theme, name) then
|
||||
vim.g.nvchad_theme = name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- update nvchad
|
||||
M.update_nvchad = function()
|
||||
-- in all the comments below, config means user config
|
||||
local config_path = vim.fn.stdpath "config"
|
||||
local config_name = vim.g.nvchad_user_config or "chadrc"
|
||||
local config_file = config_path .. "/lua/" .. config_name .. ".lua"
|
||||
-- generate a random file name
|
||||
local config_file_backup = config_path .. "/" .. config_name .. ".lua.bak." .. math.random()
|
||||
local utils = require "utils"
|
||||
local echo = utils.echo
|
||||
local current_config = utils.load_config()
|
||||
local update_url = current_config.options.update_url or "https://github.com/NvChad/NvChad"
|
||||
local update_branch = current_config.options.update_branch or "main"
|
||||
|
||||
-- ask the user for confirmation to update because we are going to run git reset --hard
|
||||
echo { { "Url: ", "Title" }, { update_url } }
|
||||
echo { { "Branch: ", "Title" }, { update_branch } }
|
||||
echo {
|
||||
{ "\nUpdater will run", "WarningMsg" },
|
||||
{ " git reset --hard " },
|
||||
{
|
||||
"in config folder, so changes to existing repo files except ",
|
||||
"WarningMsg",
|
||||
},
|
||||
|
||||
{ config_name },
|
||||
{ " will be lost!\n\nUpdate NvChad ? [y/N]", "WarningMsg" },
|
||||
}
|
||||
|
||||
local ans = string.lower(vim.fn.input "-> ") == "y"
|
||||
utils.clear_cmdline()
|
||||
if not ans then
|
||||
echo { { "Update cancelled!", "Title" } }
|
||||
return
|
||||
end
|
||||
|
||||
-- first try to fetch contents of config, this will make sure it is readable and taking backup of its contents
|
||||
local config_contents = utils.file("r", config_file)
|
||||
-- also make a local backup in ~/.config/nvim, will be removed when config is succesfully restored
|
||||
utils.file("w", config_file_backup, config_contents)
|
||||
-- write original config file with its contents, will make sure charc is writable, this maybe overkill but a little precaution always helps
|
||||
utils.file("w", config_file, config_contents)
|
||||
|
||||
-- function that will executed when git commands are done
|
||||
local function update_exit(_, code)
|
||||
-- restore config file irrespective of whether git commands were succesfull or not
|
||||
if pcall(function()
|
||||
utils.file("w", config_file, config_contents)
|
||||
end) then
|
||||
-- config restored succesfully, remove backup file that was created
|
||||
if not pcall(os.remove, config_file_backup) then
|
||||
echo { { "Warning: Failed to remove backup chadrc, remove manually.", "WarningMsg" } }
|
||||
echo { { "Path: ", "WarningMsg" }, { config_file_backup } }
|
||||
end
|
||||
else
|
||||
echo { { "Error: Restoring " .. config_name .. " failed.\n", "ErrorMsg" } }
|
||||
echo { { "Backed up " .. config_name .. " path: " .. config_file_backup .. "\n\n", "None" } }
|
||||
end
|
||||
|
||||
-- close the terminal buffer only if update was success, as in case of error, we need the error message
|
||||
if code == 0 then
|
||||
vim.cmd "bd!"
|
||||
echo { { "NvChad succesfully updated.\n", "String" } }
|
||||
else
|
||||
echo { { "Error: NvChad Update failed.\n", "ErrorMsg" } }
|
||||
end
|
||||
end
|
||||
|
||||
-- git commands that will executed, reset in case config was modfied
|
||||
-- use --ff-only to not mess up if the local repo is outdated
|
||||
local update_script = table.concat({
|
||||
"git reset --hard && git pull --set-upstream",
|
||||
update_url,
|
||||
update_branch,
|
||||
"--ff-only",
|
||||
}, " ")
|
||||
|
||||
-- open a new buffer
|
||||
vim.cmd "new"
|
||||
-- finally open the pseudo terminal buffer
|
||||
vim.fn.termopen(update_script, {
|
||||
-- change dir to config path so we don't need to move in script
|
||||
cwd = config_path,
|
||||
on_exit = update_exit,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in new issue
Block a user