Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06c324a1a7 | ||
|
|
2c0a094442 | ||
|
|
b97d9a8f85 | ||
|
|
3ec8c80abe | ||
|
|
9b719a6db6 | ||
|
|
6bfd2043e8 | ||
|
|
df00e8ba51 | ||
|
|
47ab9c28a1 | ||
|
|
a49f62d3c6 | ||
|
|
112d3866a5 | ||
|
|
5ae6fba20d | ||
|
|
7244492b36 | ||
|
|
224873b937 | ||
|
|
114d699fc5 | ||
|
|
e75fbed322 | ||
|
|
f10fb47637 | ||
|
|
880d4dc312 | ||
|
|
4801ec86f1 | ||
|
|
7753e03b9e | ||
|
|
02f0122ab4 | ||
|
|
e3f0429a72 | ||
|
|
6224ed6283 | ||
|
|
32a6fd8d29 | ||
|
|
aa8df57cae | ||
|
|
36cb57ecce | ||
|
|
623a2a0d1a | ||
|
|
88ff5595ad | ||
|
|
1d78add91e | ||
|
|
fdb2fa115d | ||
|
|
f82b390aba | ||
|
|
1fac41047d | ||
|
|
fa965c9797 | ||
|
|
e663122638 | ||
|
|
575dc10ddc | ||
|
|
51760c21f5 | ||
|
|
056fcb51f5 | ||
|
|
b571fd9d40 | ||
|
|
0d35b9ddac | ||
|
|
98086892a7 | ||
|
|
29f3259c42 | ||
|
|
9cee2c0921 | ||
|
|
e25f30899d | ||
|
|
9c3f9adb22 | ||
|
|
cf4e0a2c53 | ||
|
|
00e76c72ec | ||
|
|
c62e94923a | ||
|
|
eaaefc236d | ||
|
|
86903ab982 | ||
|
|
4abf43aa99 | ||
|
|
9c134872fb | ||
|
|
aabc3e692f | ||
|
|
c251f88567 | ||
|
|
7b796294a4 | ||
|
|
27031acd08 | ||
|
|
49120177ce | ||
|
|
154ba7d419 | ||
|
|
ea0a221230 | ||
|
|
ebdcd4cae1 | ||
|
|
05e587cfc0 | ||
|
|
e0feea9407 | ||
|
|
c656d6a3bd | ||
|
|
e80a6935d6 | ||
|
|
c80d79a7cc | ||
|
|
59359943eb | ||
|
|
fd2aa6095f | ||
|
|
2b331e7fa1 | ||
|
|
f805cb1cbd | ||
|
|
91c8736146 | ||
|
|
3f44f0761a | ||
|
|
c7fdd68072 | ||
|
|
f832195a81 | ||
|
|
f884caa606 | ||
|
|
2884254afe | ||
|
|
0df87e4e72 | ||
|
|
a21ef38dc5 | ||
|
|
0efa21c9c9 | ||
|
|
d5c64d335e | ||
|
|
ae30324ed4 | ||
|
|
0423da189c | ||
|
|
f22366eac9 | ||
|
|
62841e3dc2 | ||
|
|
98e2957234 | ||
|
|
605cbdf585 | ||
|
|
b16e2bf29c | ||
|
|
2795ed4fb3 | ||
|
|
ea992308f1 | ||
|
|
d390966b4d | ||
|
|
d4193727bd | ||
|
|
232bb5fd7c | ||
|
|
ef16aa7f1c | ||
|
|
ccca491acd | ||
|
|
9e7bec1198 | ||
|
|
45bf74bc03 | ||
|
|
c5fd109a2d | ||
|
|
af1aa860da | ||
|
|
a49c54fc41 | ||
|
|
acceccda87 | ||
|
|
bbbd73fc56 | ||
|
|
3ed108b4ea | ||
|
|
927bde7187 | ||
|
|
a25f4fca70 | ||
|
|
e0f1cb3687 | ||
|
|
668f1d5623 | ||
|
|
6468de54c1 | ||
|
|
0ea1bcb6f1 | ||
|
|
f172cc8362 | ||
|
|
021cf9c6f4 | ||
|
|
af783670e4 | ||
|
|
a6ab121d12 | ||
|
|
7affb8cbfb | ||
|
|
12085f495c | ||
|
|
5236893e5e | ||
|
|
8ac85a03af | ||
|
|
e9aa4b5234 | ||
|
|
bcbde0e1a2 | ||
|
|
29f04fcc9d | ||
|
|
202c62a2d3 | ||
|
|
5d1156ddb2 | ||
|
|
9ba08bf788 | ||
|
|
dcf5d64437 | ||
|
|
9089232ec7 | ||
|
|
d9c7a1b504 | ||
|
|
87f3415f6f | ||
|
|
f27f7b1502 | ||
|
|
f4d24e35ae | ||
|
|
462a20d66a | ||
|
|
7f34fee4a4 | ||
|
|
e197049a59 | ||
|
|
b49ba0a254 | ||
|
|
3f1e9cf37a | ||
|
|
22ea576682 | ||
|
|
3b05354337 | ||
|
|
268c37e52f | ||
|
|
11d75cf597 | ||
|
|
33422b0f3a | ||
|
|
cf46fc09a5 | ||
|
|
edbd88fdb7 | ||
|
|
9157cafb61 | ||
|
|
a31d8fb228 | ||
|
|
bdd63eeedc | ||
|
|
c98334ae08 | ||
|
|
17b5336254 | ||
|
|
021b5c07f5 | ||
|
|
b0adf7a565 | ||
|
|
472278f2e3 | ||
|
|
92eb5ca740 | ||
|
|
6b4435caef | ||
|
|
936f368036 | ||
|
|
e01aafeea5 | ||
|
|
559acbd135 | ||
|
|
bb04ba07cb | ||
|
|
fcfb814594 | ||
|
|
3fc587b54d | ||
|
|
766d52db12 | ||
|
|
f8727f1659 | ||
|
|
756713b9c3 | ||
|
|
0d69a528a8 | ||
|
|
652f703767 | ||
|
|
020daec5fc | ||
|
|
845ac0e615 | ||
|
|
b54c4ca5de | ||
|
|
fec301504f | ||
|
|
c1544dd020 | ||
|
|
08dfe17678 | ||
|
|
f72c36f4ab | ||
|
|
5531edf8e4 | ||
|
|
355178a7bb | ||
|
|
1e2d299bf9 | ||
|
|
f35aa3c604 | ||
|
|
15f20e8437 | ||
|
|
a6ea40d7ba | ||
|
|
ff14ba61f9 | ||
|
|
665fa24783 | ||
|
|
2e1d53971e | ||
|
|
2567ebaee4 | ||
|
|
3669af3517 | ||
|
|
1e658562f0 | ||
|
|
6b507c3368 | ||
|
|
0023233eef | ||
|
|
05d57bba29 | ||
|
|
d257c4dd85 | ||
|
|
4ff7208c66 | ||
|
|
9f1dc90269 | ||
|
|
18a050d54f | ||
|
|
036fb6cd66 | ||
|
|
2a9d24b4a8 | ||
|
|
3be058da26 | ||
|
|
79f8c39dd2 | ||
|
|
18f3b8b93e | ||
|
|
6d98a11dfe | ||
|
|
cb3f7538e8 | ||
|
|
1bedbbe5c4 | ||
|
|
cf8b2ce1cb | ||
|
|
9c1a3ad2a2 | ||
|
|
1d7602e3e4 | ||
|
|
dbc4979ebd | ||
|
|
72b9fa5018 | ||
|
|
8be8d36474 | ||
|
|
2c74abe936 | ||
|
|
82f07879f3 | ||
|
|
5f7f2df2b7 | ||
|
|
c6857e2a72 | ||
|
|
f0b491cd94 | ||
|
|
5bb85b8176 | ||
|
|
75aa73762f | ||
|
|
2952f4d5c7 | ||
|
|
6f2b358d3a | ||
|
|
35b210b46a | ||
|
|
d1f23d1bc3 | ||
|
|
643d1bd7d8 | ||
|
|
3e83ec5314 | ||
|
|
d16ffabcfd | ||
|
|
0d7345bc44 | ||
|
|
42bf581337 | ||
|
|
4a934e9a82 | ||
|
|
c4a8ecf47f | ||
|
|
7658c3d978 | ||
|
|
6d0150ab0b | ||
|
|
e6ae79127f | ||
|
|
10ddd491c1 | ||
|
|
605c9e0458 | ||
|
|
c38c4ec0cf | ||
|
|
484751c422 | ||
|
|
734562cc36 | ||
|
|
5ff50c63e9 | ||
|
|
df4ff8dc6f | ||
|
|
4dbb1a71e2 | ||
|
|
9627b5e6b4 | ||
|
|
f6ace73656 | ||
|
|
0bbb88f6db | ||
|
|
1aef7e9a97 | ||
|
|
3a209318bb | ||
|
|
2988a22eb8 | ||
|
|
e71b9bbece | ||
|
|
a75d59a2bf | ||
|
|
61778b20f1 | ||
|
|
0a55de407e | ||
|
|
a5bd221680 | ||
|
|
9f8ce72e55 | ||
|
|
c6084220de | ||
|
|
e219b04e82 | ||
|
|
b16c5a2f70 | ||
|
|
8b4118605b | ||
|
|
7db1fb75b9 | ||
|
|
3ee8f9876c | ||
|
|
02b4194e1e | ||
|
|
45f940f3fb | ||
|
|
20c3eca0b6 | ||
|
|
07d3192f6f | ||
|
|
1399a0c762 | ||
|
|
1aed70921e | ||
|
|
c5703f2d03 | ||
|
|
0914c33ab8 | ||
|
|
8355a055d1 | ||
|
|
ac069fd543 | ||
|
|
6d864a62bf | ||
|
|
7f6cf1bc4b | ||
|
|
d7729017c1 | ||
|
|
0e6f3c81b9 | ||
|
|
4730350ca8 | ||
|
|
30e7c8cefe | ||
|
|
27e3cf69bc | ||
|
|
1f89919d27 | ||
|
|
a3df1f4cc4 | ||
|
|
e8574170f5 | ||
|
|
6881fdfefb | ||
|
|
327c067fd2 | ||
|
|
57f9d0dbd3 | ||
|
|
d50d11435d | ||
|
|
f3f3e51d0f | ||
|
|
c721db661f | ||
|
|
0d9ae5f497 | ||
|
|
135249e19e | ||
|
|
50b00f4737 | ||
|
|
82eb17d95b | ||
|
|
81ce6877ae | ||
|
|
da0b4df3c5 | ||
|
|
48ad79cd93 | ||
|
|
4005cbc854 | ||
|
|
8ddf78a9af | ||
|
|
c2f857cb9e | ||
|
|
4647da671b | ||
|
|
45a9c806a2 | ||
|
|
0b842db789 | ||
|
|
76cdd5a29b | ||
|
|
dfe707d6db | ||
|
|
9dbc9e6880 | ||
|
|
eacc481b08 | ||
|
|
1895d1f771 | ||
|
|
10d7b892c9 | ||
|
|
0ecde48940 | ||
|
|
113c9b5a6d | ||
|
|
a1645954aa | ||
|
|
dbb87a304d | ||
|
|
1f3a5fd233 | ||
|
|
799f2e0b6f | ||
|
|
940f344e0e | ||
|
|
3b1d43fcc4 | ||
|
|
ea3b090566 | ||
|
|
311a01da44 | ||
|
|
6e5d2940d7 | ||
|
|
9d7c11e6bd | ||
|
|
f1662951d1 | ||
|
|
9b2d36b767 | ||
|
|
2d4172fd98 | ||
|
|
d073e01117 | ||
|
|
67a8d2b9df | ||
|
|
7e69cb8ac9 | ||
|
|
8e389776dc | ||
|
|
a465ea7239 | ||
|
|
602835d637 | ||
|
|
168054cd05 | ||
|
|
4631fbcf4c | ||
|
|
97370f36ca | ||
|
|
4159c5370f | ||
|
|
69e790eeb3 | ||
|
|
2b628f1729 | ||
|
|
e9e2dd3f14 | ||
|
|
4dde80f315 | ||
|
|
bd6014d60d | ||
|
|
087e4e8acc | ||
|
|
50321ad4a0 | ||
|
|
da50d99462 | ||
|
|
ca29b38478 | ||
|
|
7d23b8c24e | ||
|
|
89ab7f7be9 | ||
|
|
6d4d73c7f7 | ||
|
|
9da869feee | ||
|
|
ae2461a46f | ||
|
|
3523eb277b | ||
|
|
aa1a1af099 | ||
|
|
c671acb112 | ||
|
|
45afa83629 | ||
|
|
36aa25ba49 | ||
|
|
a6d2ccbb22 | ||
|
|
3e1cf53fd6 | ||
|
|
c5f5709f10 | ||
|
|
fc76cb3f52 | ||
|
|
7758c086e2 | ||
|
|
40a63f67c8 | ||
|
|
685044335b | ||
|
|
47e062eb73 | ||
|
|
900fb9e8f1 | ||
|
|
0e9b3832ae | ||
|
|
2f238742d2 | ||
|
|
193a852335 | ||
|
|
f900ecaed3 | ||
|
|
247e6e06c5 | ||
|
|
4c96c28c2d | ||
|
|
b42f4778f9 | ||
|
|
dcc04837d4 | ||
|
|
e2717401fe | ||
|
|
5f676ffbdb | ||
|
|
4e23587ca3 | ||
|
|
922089fc07 | ||
|
|
7464358bbf | ||
|
|
e771a32ab8 | ||
|
|
bbadee53ad | ||
|
|
7c0b6bac22 | ||
|
|
8f6780f09f | ||
|
|
18ff27d6b1 | ||
|
|
36474baab2 | ||
|
|
c995595509 | ||
|
|
ffa008f148 | ||
|
|
671ed7d090 | ||
|
|
6c272e7313 | ||
|
|
a9816eed42 | ||
|
|
74a97956bb | ||
|
|
fdd32cfcab | ||
|
|
35343e8b96 | ||
|
|
a80de385f2 | ||
|
|
fe0fc44f77 | ||
|
|
20cc14e584 | ||
|
|
9d35626a56 | ||
|
|
c3a447a471 | ||
|
|
61022dd971 | ||
|
|
9bbd2b5d69 | ||
|
|
9aea4d08e5 | ||
|
|
62f4ce0912 | ||
|
|
f87772e559 | ||
|
|
19763665e6 | ||
|
|
e31e74e0da | ||
|
|
c0369c7130 | ||
|
|
0350571803 | ||
|
|
e48da3491d | ||
|
|
3879718cea | ||
|
|
3552dcffb9 |
No files matched your search
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- Operating System
|
||||
- Terminal
|
||||
- Version of Neovim
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Wiki
|
||||
url: https://github.com/siduck76/NvChad/wiki
|
||||
about: "Walks you through how to use and Configure NvChad."
|
||||
- name: Visit our gitter chat
|
||||
url: https://gitter.im/neovim-dotfiles/community
|
||||
about: "A place where we dicuss NvChad related stuff."
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem was.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
**Screenshot**
|
||||
Maybe a screenshot of the feature
|
||||
@@ -0,0 +1 @@
|
||||
plugin
|
||||
@@ -0,0 +1,6 @@
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 3
|
||||
quote_style = "AutoPreferDouble"
|
||||
no_call_parentheses = true
|
||||
@@ -1,103 +1,161 @@
|
||||
[](https://github.com/siduck76/NvChad/actions/workflows/superLinter.yml)
|
||||
<h1 align="center">NvChad</h1>
|
||||
|
||||
An attempt to make neovim (cli version) as functional as an IDE while being very eyecandy.
|
||||
<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>
|
||||
|
||||
# Screenshots -
|
||||
<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>
|
||||
<kbd><img src ="https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/nvimRice2.png"></kbd><hr>
|
||||
|
||||
# Very Useful lua plugins used in my config -
|
||||
# Very Very Useful lua plugins used in my config
|
||||
|
||||
#### lspkind-nvim
|
||||
#### Lspkind-nvim
|
||||
|
||||
This tiny plugin adds vscode-like pictograms to neovim built-in lsp completion items :
|
||||
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
|
||||
#### Nvim-tree.lua
|
||||
|
||||
fast file tree :
|
||||
fast file tree:
|
||||
|
||||
<kbd><img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/nvimtree.png"></kbd><hr>
|
||||
|
||||
### telescope-nvim -
|
||||
### 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 -
|
||||
### Indent-blankline.nvim
|
||||
|
||||
adds indentline :
|
||||
adds indentline:
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/blanklineNvim.png"></kbd>
|
||||
|
||||
### galaxyline -
|
||||
### 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>
|
||||
|
||||
<hr>
|
||||
### Nvim-bufferline.lua
|
||||
|
||||
### nvim-bufferline.lua -
|
||||
|
||||
As a top bufferline like thing which lets me handle tabs like switching, closing tabs.
|
||||
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>
|
||||
|
||||
<hr>
|
||||
|
||||
### 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><hr>
|
||||
|
||||
### nvim-treesitter
|
||||
Better syntax highlighting for programming languages ( my config just has html,css,js support for now ).
|
||||
### Nvim-web-devicons
|
||||
|
||||
without / with Treesitter :
|
||||
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
|
||||
- mouse works
|
||||
- managing tabs with bufferline
|
||||
- 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)
|
||||
- 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)
|
||||
- using nvim-lsp
|
||||
- nvim-lspconfig for nvim-lps configuration
|
||||
- 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)
|
||||
- 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
|
||||
- nvim-autopairs for autolosing braces and stuffs
|
||||
- neoformat for prettifying/formatting code
|
||||
- packer.nvim as package manager
|
||||
- indent-blankline.Nvim for indentlines
|
||||
- smooth scrolling
|
||||
- Snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
|
||||
- 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
|
||||
|
||||
# Requirements
|
||||
# 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.
|
||||
|
||||
- neovim 0.5
|
||||
- A terminal that supports [nerdfonts](https://github.com/ryanoasis/nerd-fonts)
|
||||
- Set terminal's inner padding to 0.
|
||||
|
||||
# Wiki
|
||||
|
||||
- [config-structure](https://github.com/siduck76/NvChad/wiki#config-structure)
|
||||
- [Install](https://github.com/siduck76/NvChad/wiki#clone-my-setup)
|
||||
- [mappings](https://github.com/siduck76/NvChad/wiki/mappings)
|
||||
<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.
|
||||
- Add a theme switcher
|
||||
|
||||
# Contact -
|
||||
# Chad contributors
|
||||
|
||||
- My linux / unix related ricing community: https://t.me/DE_WM (telegram)
|
||||
- Me: @siduck (telegram)
|
||||
<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! 😠
|
||||
@@ -1,59 +1,12 @@
|
||||
-- load all plugins
|
||||
require "pluginList"
|
||||
require "misc-utils"
|
||||
local chad_modules = {
|
||||
"options",
|
||||
"mappings",
|
||||
}
|
||||
|
||||
require "top-bufferline"
|
||||
require "statusline"
|
||||
for i = 1, #chad_modules, 1 do
|
||||
if not pcall(require, chad_modules[i]) then
|
||||
error("Error loading " .. chad_modules[i] .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
require("colorizer").setup()
|
||||
require("neoscroll").setup() -- smooth scroll
|
||||
|
||||
-- lsp stuff
|
||||
require "nvim-lspconfig"
|
||||
require "compe-completion"
|
||||
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
g.mapleader = " "
|
||||
g.auto_save = 0
|
||||
|
||||
-- colorscheme related stuff
|
||||
cmd "syntax on"
|
||||
|
||||
local base16 = require "base16"
|
||||
base16(base16.themes["onedark"], true)
|
||||
|
||||
require "highlights"
|
||||
|
||||
-- blankline
|
||||
|
||||
g.indentLine_enabled = 1
|
||||
g.indent_blankline_char = "▏"
|
||||
|
||||
g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"}
|
||||
g.indent_blankline_buftype_exclude = {"terminal"}
|
||||
|
||||
g.indent_blankline_show_trailing_blankline_indent = false
|
||||
g.indent_blankline_show_first_indent_level = false
|
||||
|
||||
require "treesitter-nvim"
|
||||
require "mappings"
|
||||
|
||||
require "telescope-nvim"
|
||||
require "nvimTree" -- file tree stuff
|
||||
require "file-icons"
|
||||
|
||||
-- git signs , lsp symbols etc
|
||||
require "gitsigns-nvim"
|
||||
require("nvim-autopairs").setup()
|
||||
require("lspkind").init()
|
||||
|
||||
-- hide line numbers in terminal windows
|
||||
vim.api.nvim_exec([[
|
||||
au BufEnter term://* setlocal nonumber
|
||||
]], false)
|
||||
|
||||
require "zenmode"
|
||||
require "whichkey"
|
||||
require "dashboard"
|
||||
require("mappings").misc()
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
get_platform() {
|
||||
case "$(uname -s)" in
|
||||
Linux*) platform=Linux ;;
|
||||
Darwin*) platform=Mac ;;
|
||||
CYGWIN*) platform=Cygwin ;;
|
||||
MINGW*) platform=MinGw ;;
|
||||
*) platform="UNKNOWN:${unameOut}" ;;
|
||||
esac
|
||||
echo $platform
|
||||
}
|
||||
|
||||
echo "installing packer"
|
||||
|
||||
if [ ! -d ~/.local/share/nvim/site/pack/packer ]; then
|
||||
echo "Installing packer"
|
||||
git clone https://github.com/wbthomason/packer.nvim \
|
||||
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||
echo
|
||||
echo "packer installed!"
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "Linking config"
|
||||
echo "old nvim config will be deleted so watchout! :0"
|
||||
echo
|
||||
|
||||
# copying config
|
||||
|
||||
rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim
|
||||
cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
|
||||
|
||||
# change shell in nvim config
|
||||
read -p "which shell do you use?: " shellname
|
||||
echo "$shellname"
|
||||
|
||||
if [ "$(get_platform)" = "Mac" ]; then
|
||||
gsed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings.lua
|
||||
else
|
||||
sed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings.lua
|
||||
fi
|
||||
|
||||
echo "shell changed to $shellname on nvim successfully!"
|
||||
echo
|
||||
echo "neovim will open with some errors , just press enter" && sleep 1
|
||||
|
||||
# install all plugins
|
||||
nvim +PackerInstall
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
-- 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
|
||||
@@ -1,74 +0,0 @@
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
require "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},
|
||||
vsnip = {kind = ""}, --replace to what sign you prefer
|
||||
nvim_lsp = true
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
-- tab completion
|
||||
|
||||
_G.tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-n>"
|
||||
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 vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||
return t "<Plug>(vsnip-jump-prev)"
|
||||
else
|
||||
return t "<S-Tab>"
|
||||
end
|
||||
end
|
||||
|
||||
-- mappings
|
||||
|
||||
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})
|
||||
|
||||
function _G.completions()
|
||||
local npairs = require("nvim-autopairs")
|
||||
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", "<CR>", "v:lua.completions()", {expr = true})
|
||||
@@ -1,28 +0,0 @@
|
||||
local g = vim.g
|
||||
|
||||
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 f b"}, command = "Telescope marks"},
|
||||
f = {description = {" Load Last Session SPC f s"}, command = "SessionLoad"}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
-- 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,111 +0,0 @@
|
||||
local colors = require "themes/onedark"
|
||||
|
||||
require "nvim-web-devicons".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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
require("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
|
||||
}
|
||||
+44
-46
@@ -1,6 +1,7 @@
|
||||
local cmd = vim.cmd
|
||||
|
||||
local colors = require "themes/onedark"
|
||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||
local colors = require(global_theme)
|
||||
|
||||
local white = colors.white
|
||||
local darker_black = colors.darker_black
|
||||
@@ -8,8 +9,6 @@ local black = colors.black
|
||||
local black2 = colors.black2
|
||||
local one_bg = colors.one_bg
|
||||
local one_bg2 = colors.one_bg2
|
||||
local one_bg3 = colors.one_bg3
|
||||
local light_grey = colors.light_grey
|
||||
local grey = colors.grey
|
||||
local grey_fg = colors.grey_fg
|
||||
local red = colors.red
|
||||
@@ -19,19 +18,21 @@ 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)
|
||||
cmd("hi " .. group .. " guifg=" .. color)
|
||||
end
|
||||
|
||||
local function bg(group, color)
|
||||
cmd("hi " .. group .. " guibg=" .. color)
|
||||
cmd("hi " .. group .. " guibg=" .. color)
|
||||
end
|
||||
|
||||
local function fg_bg(group, fgcol, bgcol)
|
||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||
end
|
||||
|
||||
-- blankline
|
||||
@@ -40,15 +41,25 @@ fg("IndentBlanklineChar", line)
|
||||
|
||||
-- misc --
|
||||
fg("LineNr", grey)
|
||||
fg("Comment", 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", green)
|
||||
bg("PmenuSel", pmenu_bg)
|
||||
bg("PmenuThumb", nord_blue)
|
||||
|
||||
-- inactive statuslines as thin splitlines
|
||||
@@ -60,19 +71,24 @@ fg("cursorlinenr", white)
|
||||
|
||||
-- git signs ---
|
||||
fg_bg("DiffAdd", nord_blue, "none")
|
||||
fg_bg("DiffChange", one_bg2, "none")
|
||||
fg_bg("DiffChange", grey_fg, "none")
|
||||
fg_bg("DiffModified", nord_blue, "none")
|
||||
|
||||
-- NvimTree
|
||||
fg("NvimTreeFolderIcon", blue)
|
||||
fg("NvimTreeFolderName", blue)
|
||||
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)
|
||||
|
||||
fg("NvimTreeRootFolder", 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)
|
||||
@@ -96,42 +112,24 @@ fg("LspDiagnosticsVirtualTextInformation", green)
|
||||
fg("LspDiagnosticsSignHint", purple)
|
||||
fg("LspDiagnosticsVirtualTextHint", purple)
|
||||
|
||||
-- bufferline
|
||||
|
||||
fg_bg("BufferLineFill", grey_fg, black2)
|
||||
fg_bg("BufferLineBackground", light_grey, black2)
|
||||
|
||||
fg_bg("BufferLineBufferVisible", light_grey, black2)
|
||||
fg_bg("BufferLineBufferSelected", white, black)
|
||||
|
||||
cmd "hi BufferLineBufferSelected gui=bold"
|
||||
|
||||
-- tabs
|
||||
fg_bg("BufferLineTab", light_grey, one_bg3)
|
||||
fg_bg("BufferLineTabSelected", black2, nord_blue)
|
||||
fg_bg("BufferLineTabClose", red, black)
|
||||
|
||||
fg_bg("BufferLineIndicator", black2, black2)
|
||||
fg_bg("BufferLineIndicatorSelected", black, black)
|
||||
|
||||
-- separators
|
||||
fg_bg("BufferLineSeparator", line, black2)
|
||||
fg_bg("BufferLineSeparatorVisible", line, black2)
|
||||
fg_bg("BufferLineSeparatorSelected", black, black2)
|
||||
|
||||
-- modified buffers
|
||||
fg_bg("BufferLineModified", red, black2)
|
||||
fg_bg("BufferLineModifiedVisible", red, black2)
|
||||
fg_bg("BufferLineModifiedSelected", green, black)
|
||||
|
||||
-- close buttons
|
||||
fg_bg("BufferLineCLoseButtonVisible", light_grey, black2)
|
||||
fg_bg("BufferLineCLoseButton", light_grey, black2)
|
||||
fg_bg("BufferLineCLoseButtonSelected", red, black)
|
||||
|
||||
-- dashboard
|
||||
|
||||
fg("DashboardHeader", grey_fg)
|
||||
fg("DashboardCenter", grey_fg)
|
||||
fg("DashboardShortcut", grey_fg)
|
||||
fg("DashboardFooter", black)
|
||||
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)
|
||||
+178
-25
@@ -1,35 +1,188 @@
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = {noremap = true}
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
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 = {}
|
||||
|
||||
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them!
|
||||
--[[ remove this line
|
||||
-- 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
|
||||
|
||||
map("n", "dd", [=[ "_dd ]=], opt)
|
||||
map("v", "dd", [=[ "_dd ]=], opt)
|
||||
map("v", "x", [=[ "_x ]=], opt)
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
map("v", "p", '"_dP', opt)
|
||||
|
||||
this line too ]]
|
||||
-- OPEN TERMINALS --
|
||||
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- term over right
|
||||
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- term bottom
|
||||
map("n", "<C-t>t", [[<Cmd> tabnew | term <CR>]], opt) -- term newtab
|
||||
-- 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 EVERYTHING --
|
||||
map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
|
||||
-- copy whole file content
|
||||
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
|
||||
|
||||
-- toggle numbers ---
|
||||
map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
|
||||
-- toggle numbers
|
||||
map("n", miscMap.toggle_linenr, ":set nu!<CR>", opt)
|
||||
|
||||
-- toggle truezen.nvim's ataraxis and minimalist mode
|
||||
map("n", "<leader>z", [[ <Cmd> TZAtaraxis<CR>]], opt)
|
||||
map("n", "<leader>m", [[ <Cmd> TZMinimalist<CR>]], opt)
|
||||
-- terminals
|
||||
local function terms()
|
||||
local m = user_map.terms
|
||||
|
||||
map("n", "<C-s>", [[ <Cmd> w <CR>]], opt)
|
||||
-- vim.cmd("inoremap jh <Esc>")
|
||||
-- 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,45 +0,0 @@
|
||||
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
|
||||
|
||||
local function opt(scope, key, value)
|
||||
scopes[scope][key] = value
|
||||
if scope ~= "o" then
|
||||
scopes["o"][key] = value
|
||||
end
|
||||
end
|
||||
|
||||
opt("o", "hidden", true)
|
||||
opt("o", "ignorecase", true)
|
||||
opt("o", "splitbelow", true)
|
||||
opt("o", "splitright", true)
|
||||
opt("o", "termguicolors", true)
|
||||
opt("w", "number", true)
|
||||
opt("o", "numberwidth", 2)
|
||||
opt("w", "cul", true)
|
||||
|
||||
opt("o", "mouse", "a")
|
||||
|
||||
opt("w", "signcolumn", "yes")
|
||||
opt("o", "cmdheight", 1)
|
||||
|
||||
opt("o", "updatetime", 250) -- update interval for gitsigns
|
||||
opt("o", "clipboard", "unnamedplus")
|
||||
opt("o", "timeoutlen", 500)
|
||||
|
||||
-- for indenline
|
||||
opt("b", "expandtab", true)
|
||||
opt("b", "shiftwidth", 2)
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.is_buffer_empty()
|
||||
-- Check whether the current buffer is empty
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) == 1
|
||||
end
|
||||
|
||||
function M.has_width_gt(cols)
|
||||
-- Check if the windows width is greater than a given number of columns
|
||||
return vim.fn.winwidth(0) / 2 > cols
|
||||
end
|
||||
-- file extension specific tabbing
|
||||
vim.cmd([[autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4]])
|
||||
return M
|
||||
@@ -1,90 +0,0 @@
|
||||
function on_attach(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = {noremap = true, silent = true}
|
||||
|
||||
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
|
||||
|
||||
-- lspInstall + lspconfig stuff
|
||||
|
||||
local function setup_servers()
|
||||
require "lspinstall".setup()
|
||||
|
||||
local lspconf = require("lspconfig")
|
||||
local servers = require "lspinstall".installed_servers()
|
||||
|
||||
for _, lang in pairs(servers) do
|
||||
if lang ~= "lua" then
|
||||
lspconf[lang].setup {
|
||||
on_attach = on_attach,
|
||||
root_dir = vim.loop.cwd
|
||||
}
|
||||
elseif lang == "lua" then
|
||||
lspconf[lang].setup {
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = {"vim"}
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
||||
}
|
||||
},
|
||||
telemetry = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
setup_servers()
|
||||
|
||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||
require "lspinstall".post_install_hook = function()
|
||||
setup_servers() -- reload installed servers
|
||||
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
end
|
||||
|
||||
-- replace the default lsp diagnostic letters with prettier symbols
|
||||
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
|
||||
@@ -1,93 +0,0 @@
|
||||
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_auto_open = 0
|
||||
g.nvim_tree_auto_close = 0
|
||||
g.nvim_tree_quit_on_open = 0
|
||||
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_root_folder_modifier = ":t"
|
||||
g.nvim_tree_tab_open = 0
|
||||
g.nvim_tree_allow_resize = 1
|
||||
|
||||
g.nvim_tree_show_icons = {
|
||||
git = 1,
|
||||
folders = 1,
|
||||
files = 1
|
||||
}
|
||||
|
||||
g.nvim_tree_icons = {
|
||||
default = " ",
|
||||
symlink = " ",
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
ignored = "◌"
|
||||
},
|
||||
folder = {
|
||||
default = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink_open = ""
|
||||
}
|
||||
}
|
||||
-- Mappings for nvimtree
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<C-n>",
|
||||
":NvimTreeToggle<CR>",
|
||||
{
|
||||
noremap = true,
|
||||
silent = true
|
||||
}
|
||||
)
|
||||
|
||||
local tree_cb = require "nvim-tree.config".nvim_tree_callback
|
||||
|
||||
g.nvim_tree_bindings = {
|
||||
["u"] = ":lua require'some_module'.some_function()<cr>",
|
||||
-- default mappings
|
||||
["<CR>"] = tree_cb("edit"),
|
||||
["o"] = tree_cb("edit"),
|
||||
["<2-LeftMouse>"] = tree_cb("edit"),
|
||||
["<2-RightMouse>"] = tree_cb("cd"),
|
||||
["<C-]>"] = tree_cb("cd"),
|
||||
["<C-v>"] = tree_cb("vsplit"),
|
||||
["<C-x>"] = tree_cb("split"),
|
||||
["<C-t>"] = tree_cb("tabnew"),
|
||||
["<"] = tree_cb("prev_sibling"),
|
||||
[">"] = tree_cb("next_sibling"),
|
||||
["<BS>"] = tree_cb("close_node"),
|
||||
["<S-CR>"] = tree_cb("close_node"),
|
||||
["<Tab>"] = tree_cb("preview"),
|
||||
["I"] = tree_cb("toggle_ignored"),
|
||||
["H"] = tree_cb("toggle_dotfiles"),
|
||||
["R"] = tree_cb("refresh"),
|
||||
["a"] = tree_cb("create"),
|
||||
["d"] = tree_cb("remove"),
|
||||
["r"] = tree_cb("rename"),
|
||||
["<C-r>"] = tree_cb("full_rename"),
|
||||
["x"] = tree_cb("cut"),
|
||||
["c"] = tree_cb("copy"),
|
||||
["p"] = tree_cb("paste"),
|
||||
["y"] = tree_cb("copy_name"),
|
||||
["Y"] = tree_cb("copy_path"),
|
||||
["gy"] = tree_cb("copy_absolute_path"),
|
||||
["[c"] = tree_cb("prev_git_item"),
|
||||
["]c"] = tree_cb("next_git_item"),
|
||||
["-"] = tree_cb("dir_up"),
|
||||
["q"] = tree_cb("close")
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
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 ]]
|
||||
@@ -0,0 +1,45 @@
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "packadd packer.nvim"
|
||||
|
||||
local present, packer = pcall(require, "packer")
|
||||
|
||||
if not present then
|
||||
local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
|
||||
|
||||
print "Cloning packer.."
|
||||
-- remove the dir before cloning
|
||||
vim.fn.delete(packer_path, "rf")
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
"--depth",
|
||||
"20",
|
||||
packer_path,
|
||||
}
|
||||
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
return packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "single" }
|
||||
end,
|
||||
prompt_border = "single",
|
||||
},
|
||||
git = {
|
||||
clone_timeout = 600, -- Timeout, in seconds, for git clones
|
||||
},
|
||||
auto_clean = true,
|
||||
compile_on_sync = true,
|
||||
-- auto_reload_compiled = true
|
||||
}
|
||||
+309
-46
@@ -1,54 +1,317 @@
|
||||
local packer = require("packer")
|
||||
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
|
||||
|
||||
-- using { } for using different branch , loading plugin with certain commands etc
|
||||
return packer.startup(
|
||||
function()
|
||||
use "wbthomason/packer.nvim"
|
||||
return packer.startup(function()
|
||||
use {
|
||||
"wbthomason/packer.nvim",
|
||||
event = "VimEnter",
|
||||
}
|
||||
|
||||
-- color related stuff
|
||||
use "siduck76/nvim-base16.lua"
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
use {
|
||||
"jdhao/better-escape.vim",
|
||||
disable = not plugin_status.better_esc,
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("plugins.others").escape()
|
||||
end,
|
||||
}
|
||||
|
||||
-- lang stuff
|
||||
use "nvim-treesitter/nvim-treesitter"
|
||||
use "neovim/nvim-lspconfig"
|
||||
use "hrsh7th/nvim-compe"
|
||||
use "onsails/lspkind-nvim"
|
||||
use "sbdchd/neoformat"
|
||||
use "nvim-lua/plenary.nvim"
|
||||
use "kabouzeid/nvim-lspinstall"
|
||||
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,
|
||||
}
|
||||
|
||||
use "lewis6991/gitsigns.nvim"
|
||||
use "akinsho/nvim-bufferline.lua"
|
||||
use "glepnir/galaxyline.nvim"
|
||||
use "windwp/nvim-autopairs"
|
||||
use "alvan/vim-closetag"
|
||||
-- color related stuff
|
||||
use {
|
||||
"NvChad/nvim-base16.lua",
|
||||
after = "packer.nvim",
|
||||
config = function()
|
||||
require "theme"
|
||||
end,
|
||||
}
|
||||
|
||||
-- snippet support
|
||||
use "hrsh7th/vim-vsnip"
|
||||
use "rafamadriz/friendly-snippets"
|
||||
use {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
disable = not plugin_status.nvim_colorizer,
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("plugins.others").colorizer()
|
||||
end,
|
||||
}
|
||||
|
||||
-- file managing , picker etc
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "ryanoasis/vim-devicons"
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
use "nvim-telescope/telescope-media-files.nvim"
|
||||
use "nvim-lua/popup.nvim"
|
||||
-- lsp stuff
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require "plugins.treesitter"
|
||||
end,
|
||||
}
|
||||
|
||||
-- misc
|
||||
use "glepnir/dashboard-nvim"
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "907th/vim-auto-save"
|
||||
use "karb94/neoscroll.nvim"
|
||||
use "kdav5758/TrueZen.nvim"
|
||||
use "folke/which-key.nvim"
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
|
||||
end,
|
||||
{
|
||||
display = {
|
||||
border = {"┌", "─", "┐", "│", "┘", "─", "└", "│"}
|
||||
}
|
||||
}
|
||||
)
|
||||
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)
|
||||
@@ -0,0 +1,12 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
-- 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,
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
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,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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,
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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,40 @@
|
||||
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",
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
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,123 @@
|
||||
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
|
||||
@@ -0,0 +1,66 @@
|
||||
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()
|
||||
@@ -0,0 +1,95 @@
|
||||
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" },
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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
|
||||
@@ -0,0 +1,309 @@
|
||||
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 },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
local present, telescope = pcall(require, "telescope")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = {},
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "absolute" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
-- 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"
|
||||
|
||||
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")
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
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,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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,204 +0,0 @@
|
||||
local gl = require("galaxyline")
|
||||
local gls = gl.section
|
||||
local condition = require("galaxyline.condition")
|
||||
|
||||
gl.short_line_list = {" "}
|
||||
|
||||
local colors = require "themes/onedark"
|
||||
|
||||
gls.left[1] = {
|
||||
FirstElement = {
|
||||
provider = function() return '▋' end,
|
||||
highlight = { colors.nord_blue, colors.nord_blue }
|
||||
},
|
||||
}
|
||||
|
||||
gls.left[2] = {
|
||||
statusIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.statusline_bg, colors.nord_blue},
|
||||
separator = " ",
|
||||
separator_highlight = {colors.nord_blue, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[3] = {
|
||||
FileIcon = {
|
||||
provider = "FileIcon",
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = {colors.white, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[4] = {
|
||||
FileName = {
|
||||
provider = {"FileName"},
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = {colors.white, colors.lightbg},
|
||||
separator = " ",
|
||||
separator_highlight = {colors.lightbg, colors.lightbg2}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[5] = {
|
||||
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 = " ",
|
||||
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[6] = {
|
||||
DiffAdd = {
|
||||
provider = "DiffAdd",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.white, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[7] = {
|
||||
DiffModified = {
|
||||
provider = "DiffModified",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[8] = {
|
||||
DiffRemove = {
|
||||
provider = "DiffRemove",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[9] = {
|
||||
DiagnosticError = {
|
||||
provider = "DiagnosticError",
|
||||
icon = " ",
|
||||
highlight = {colors.red, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[10] = {
|
||||
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
|
||||
return " " .. " " .. " LSP "
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end,
|
||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[2] = {
|
||||
GitIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
||||
highlight = {colors.grey_fg2, colors.lightbg},
|
||||
separator = "",
|
||||
separator_highlight = {colors.lightbg, colors.statusline_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[3] = {
|
||||
GitBranch = {
|
||||
provider = "GitBranch",
|
||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
||||
highlight = {colors.grey_fg2, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[4] = {
|
||||
viMode_icon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.statusline_bg, colors.red},
|
||||
separator = " ",
|
||||
separator_highlight = {colors.red, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[5] = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
local alias = {
|
||||
n = "Normal",
|
||||
i = "Insert",
|
||||
c = "Command",
|
||||
V = "Visual",
|
||||
[""] = "Visual",
|
||||
v = "Visual",
|
||||
R = "Replace"
|
||||
}
|
||||
local current_Mode = alias[vim.fn.mode()]
|
||||
|
||||
if current_Mode == nil then
|
||||
return " Terminal "
|
||||
else
|
||||
return " " .. current_Mode .. " "
|
||||
end
|
||||
end,
|
||||
highlight = {colors.red, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[6] = {
|
||||
some_icon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = "",
|
||||
separator_highlight = {colors.green, colors.lightbg},
|
||||
highlight = {colors.lightbg, colors.green}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[7] = {
|
||||
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,82 +0,0 @@
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case"
|
||||
},
|
||||
prompt_position = "bottom",
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_defaults = {
|
||||
horizontal = {
|
||||
mirror = false,
|
||||
preview_width = 0.5
|
||||
},
|
||||
vertical = {
|
||||
mirror = false
|
||||
}
|
||||
},
|
||||
file_sorter = require "telescope.sorters".get_fuzzy_file,
|
||||
file_ignore_patterns = {},
|
||||
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter,
|
||||
shorten_path = true,
|
||||
winblend = 0,
|
||||
width = 0.75,
|
||||
preview_cutoff = 120,
|
||||
results_height = 1,
|
||||
results_width = 0.8,
|
||||
border = {},
|
||||
borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
|
||||
file_previewer = require "telescope.previewers".vim_buffer_cat.new,
|
||||
grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new,
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker
|
||||
},
|
||||
extensions = {
|
||||
media_files = {
|
||||
filetypes = {"png", "webp", "jpg", "jpeg"},
|
||||
find_cmd = "rg" -- find command (defaults to `fd`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require("telescope").load_extension("media_files")
|
||||
|
||||
local opt = {noremap = true, silent = true}
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- mappings
|
||||
vim.api.nvim_set_keymap("n", "<Leader>ff", [[<Cmd>lua require('telescope.builtin').find_files()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<Leader>fp",
|
||||
[[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]],
|
||||
opt
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
|
||||
|
||||
-- dashboard stuff
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fw", [[<Cmd> Telescope live_grep<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fn", [[<Cmd> DashboardNewFile<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd> DashboardJumpMarks<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fl", [[<Cmd> SessionLoad<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fs", [[<Cmd> SessionSave<CR>]], opt)
|
||||
@@ -0,0 +1,143 @@
|
||||
-- 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
|
||||
@@ -0,0 +1,142 @@
|
||||
-- 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
|
||||
@@ -0,0 +1,12 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
+31
-29
@@ -1,33 +1,35 @@
|
||||
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"
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
@@ -1,31 +0,0 @@
|
||||
require "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"
|
||||
}
|
||||
}
|
||||
|
||||
local opt = {silent = true}
|
||||
local map = vim.api.nvim_set_keymap
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- MAPPINGS
|
||||
map("n", "<S-t>", [[<Cmd>tabnew<CR>]], opt) -- new tab
|
||||
map("n", "<S-x>", [[<Cmd>bdelete<CR>]], opt) -- close tab
|
||||
|
||||
-- move between tabs
|
||||
map("n", "<TAB>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
|
||||
map("n", "<S-TAB>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)
|
||||
@@ -1,17 +0,0 @@
|
||||
local ts_config = require("nvim-treesitter.configs")
|
||||
|
||||
ts_config.setup {
|
||||
ensure_installed = {
|
||||
"javascript",
|
||||
"html",
|
||||
"css",
|
||||
"bash",
|
||||
"lua",
|
||||
"json",
|
||||
"python"
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true
|
||||
}
|
||||
}
|
||||
+500
@@ -0,0 +1,500 @@
|
||||
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
|
||||
@@ -1,45 +0,0 @@
|
||||
require("which-key").setup {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
spelling = {
|
||||
enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||
suggestions = 20 -- how many suggestions should be shown in the list?
|
||||
},
|
||||
presets = {
|
||||
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
|
||||
motions = true, -- adds help for motions
|
||||
text_objects = true, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true -- bindings for prefixed with g
|
||||
}
|
||||
},
|
||||
-- add operators that will trigger motion and text object completion
|
||||
-- to enable all native operators, set the preset / operators plugin above
|
||||
operators = {gc = "Comments"},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+" -- symbol prepended to a group
|
||||
},
|
||||
window = {
|
||||
border = "none", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = {1, 0, 1, 0}, -- extra window margin [top, right, bottom, left]
|
||||
padding = {2, 2, 2, 2} -- extra window padding [top, right, bottom, left]
|
||||
},
|
||||
layout = {
|
||||
height = {min = 4, max = 25}, -- min and max height of the columns
|
||||
width = {min = 20, max = 50}, -- min and max width of the columns
|
||||
spacing = 3 -- spacing between columns
|
||||
},
|
||||
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
|
||||
hidden = {"<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
triggers = "auto" -- automatically setup triggers
|
||||
-- triggers = {"<leader>"} -- or specifiy a list manually
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
local true_zen = require("true-zen")
|
||||
|
||||
true_zen.setup(
|
||||
{
|
||||
true_false_commands = false,
|
||||
cursor_by_mode = false,
|
||||
before_minimalist_mode_shown = true,
|
||||
before_minimalist_mode_hidden = true,
|
||||
after_minimalist_mode_shown = true,
|
||||
after_minimalist_mode_hidden = true,
|
||||
bottom = {
|
||||
hidden_laststatus = 0,
|
||||
hidden_ruler = false,
|
||||
hidden_showmode = false,
|
||||
hidden_showcmd = false,
|
||||
hidden_cmdheight = 1,
|
||||
shown_laststatus = 2,
|
||||
shown_ruler = true,
|
||||
shown_showmode = false,
|
||||
shown_showcmd = false,
|
||||
shown_cmdheight = 1
|
||||
},
|
||||
top = {
|
||||
hidden_showtabline = 0,
|
||||
shown_showtabline = 2
|
||||
},
|
||||
left = {
|
||||
hidden_number = false,
|
||||
hidden_relativenumber = false,
|
||||
hidden_signcolumn = "no",
|
||||
shown_number = true,
|
||||
shown_relativenumber = false,
|
||||
shown_signcolumn = "yes"
|
||||
},
|
||||
ataraxis = {
|
||||
just_do_it_for_me = false,
|
||||
left_padding = 37,
|
||||
right_padding = 37,
|
||||
top_padding = 2,
|
||||
bottom_padding = 2,
|
||||
custome_bg = "#1e222a"
|
||||
},
|
||||
integrations = {
|
||||
integration_galaxyline = true
|
||||
}
|
||||
}
|
||||
)
|
||||
Reference in new issue
Block a user