├── .gitignore
├── LICENSE
├── README.md
├── ftdetect
└── zon.lua
├── ftplugin
├── gitcommit.lua
├── help.lua
├── lua
│ └── mapping.lua
├── python.lua
├── zig.lua
└── zsh.lua
├── init.lua
├── lua
├── config
│ ├── autocmds.lua
│ ├── defaults.lua
│ ├── init.lua
│ ├── keymaps
│ │ ├── editor.lua
│ │ ├── init.lua
│ │ └── lsp.lua
│ ├── lazy.lua
│ ├── options.lua
│ ├── syntax.lua
│ └── utils.lua
└── plugins
│ ├── colorscheme.lua
│ ├── completions.lua
│ ├── dap.lua
│ ├── dashboard.lua
│ ├── editor.lua
│ ├── gitsigns.lua
│ ├── lsp.lua
│ ├── neorg.lua
│ ├── statusbar.lua
│ ├── telescope.lua
│ ├── tree.lua
│ ├── treesitter.lua
│ └── ui.lua
├── luajit.yml
├── selene.toml
└── stylua.toml
/.gitignore:
--------------------------------------------------------------------------------
1 | lazy-lock.json
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Awesome Neovim Configuration
2 |
3 | This repo it to make setting up of [neovim][nvim] >= 0.9 a breeze.
4 | The setup is powered and managed by [💤 lazy.nvim][lazy-nvim] plugin manager
5 |
6 | >If you like [_**helix**_](https://github.com/helix-editor/helix), which I am drifting to gradually, check out my [_**helix config**_][awesome-helix]
7 |
8 | ## ✨ Features Supported
9 | - ⚡ zig, C , C++, lua and all other language compilers
10 | - 📦 linters and static analysis through null-ls
11 | - 🥂 lsp servers configured with nvim-lspconfig
12 | - 🧹 autocompletion, formatters and all other features supported by neovim's builtin lsp
13 | - 🦸 Any build system
14 | - ✴️ Treesitter syntax highlighting
15 | - 🔥 Transform your Neovim editor into a full-fledged IDE
16 | - 💤 Easily customize and extend config
17 | - 🚀 Blazingly fast using 💤 [lazy.nvim][lazy-nvim] and the new lua-loader that byte-compiles and caches lua files
18 |
19 |
20 | ## 😍 Screenshots
21 |
22 | ### C++
23 | 
24 | 
25 |
26 | ### ⚡ Zig
27 | 
28 | 
29 |
30 | ### Lua
31 | 
32 | 
33 |
34 | ### 🚀 Startup Time
35 | 
36 |
37 | ## ⚡️ Requirement
38 | - Neovim >= **0.9.0** (needs to be built with **LuaJIT**)
39 | - git >= **2.40.0** (gitsigns ...)
40 | - tree-sitter >= **0.20.8** (to enable automatically installing missing parsers when entering buffers)
41 | - a [Nerd Font](https://www.nerdfonts.com/) **_(optional, for nvim-tree, lualine, bufferline)_**
42 |
43 |
44 | >__NOTE__ the languages supported out of the box are
45 | > zig, c++, c, lua, bash/zsh, glsl, json
46 | > __But__ support for other languages like(js, ts, html5+, css3+, vue, markdown, nix) can easily be add by using
47 | > its required [lsp server configuration](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md)
48 | and installing the server and other accompanying tools for development like linters, static analysers, formatter
49 |
50 |
51 | ## 📂 Directory structure
52 | ```
53 | 📂 ~/.config/nvim
54 | ├── 📂 ftplugin
55 | │ └── 📂 lua
56 | │ │ └── mapping.lua
57 | │ ├── gitcommit.lua
58 | │ ├── help.lua
59 | │ └── zsh.lua
60 | ├── 📂 lua
61 | │ └── 📂 config
62 | │ │ ├── autocmds.lua
63 | │ │ ├── defaults.lua
64 | │ │ ├── init.lua
65 | │ │ ├── keymaps.lua
66 | │ │ ├── lazy.lua
67 | │ │ ├── options.lua
68 | │ │ ├── syntax.lua
69 | │ │ └── utils.lua
70 | │ └── 📂 plugins
71 | │ ├── cmp.lua
72 | │ ├── colorscheme.lua
73 | │ ├── editor.lua
74 | │ ├── gitsigns.lua
75 | │ ├── lsp.lua
76 | │ ├── neorg.lua
77 | │ ├── snip.lua
78 | │ ├── telescope.lua
79 | │ ├── tree.lua
80 | │ ├── treesitter.lua
81 | │ └── ui.lua
82 | ├── init.lua
83 | ├── lazy-lock.json
84 | ├── LICENSE
85 | └── README.md
86 | ```
87 |
88 | `ftplugin` directory contains files for setting `options` or `mappings` specific to filetypes
89 |
90 | `lua/config` directory contains editor `autocmds`, `keymaps`, `options`, `defaults`, `syntax files`, `utils fn's` and
91 | `lazy.nvim` configuration
92 |
93 | `lua/plugins` directory contains all `plugins` configurations and their `mappings`
94 |
95 | `init` initializing/start point for nvim editor
96 |
97 |
98 | ---
99 |
100 |
101 | ## 🚀 Getting Started
102 |
103 | You can find **awesome-neovim** [here][awesome-nvim]
104 |
105 | Follow the steps below to use awesome-neovim
106 |
107 | - fork this repo into your account
108 |
109 | GitHub [how to fork a repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
110 |
111 |
112 | - Make a backup of your current Neovim files at `$XDG_CONFIG_HOME/nvim` and `$XDG_DATA_HOME/nvim`:
113 |
114 | ```sh
115 | mv ~/.config/nvim ~/.config/nvim.bak
116 | mv ~/.local/share/nvim ~/.local/share/nvim.bak
117 | ```
118 |
119 | - Clone the repo into `$XDG_CONFIG_HOME/nvim` or `$HOME/.config/nvim`
120 |
121 | ```sh
122 | git clone https://github.com/${YOUR-USERNAME}/awesome-neovim $XDG_CONFIG_HOME/nvim
123 |
124 | ```
125 |
126 | - Start Neovim!
127 |
128 | ```sh
129 | nvim
130 | ```
131 |
132 |
133 |
134 | ---
135 |
136 |
137 | ## ⚙️ For information on how to use [lazy.nvim][lazy-nvim]
138 |
139 | You can thoroughly go through awesome-neovim configuration and if
140 | more clarification is required read [lazy's][lazy-nvim] README
141 |
142 | **for help using the various plugins and extensions**
143 |
144 | ```zsh
145 | :help local-addtions
146 | ```
147 |
148 | To view the help pages and instruction manual on the various extensions
149 |
150 |
151 | [awesome-nvim]: https://github.com/Ultra-Code/awesome-neovim
152 | [lazy-nvim]: https://github.com/folke/lazy.nvim
153 | [nvim]: https://github.com/neovim/neovim/
154 | [awesome-helix]: https://github.com/Ultra-Code/awesome-helix
155 |
156 | ## 👏 Credit
157 | - *Huge credit to* [_@folke_](https://github.com/folke), *I learnt a lot from his lazy config* [repo](https://github.com/LazyVim/LazyVim)
158 | - *Big Shout Out to the creators of the various plugins which make nvim terrific*
159 | - *Another to all the creators of the various neovim extensions.*
160 |
161 | >And Last but not the least __God Bless The Vim && Neovim Community for this hyperextensible and hackable text editor__
162 |
--------------------------------------------------------------------------------
/ftdetect/zon.lua:
--------------------------------------------------------------------------------
1 | --add zon as a zig file
2 | vim.filetype.add({
3 | extension = {
4 | zon = "zig",
5 | },
6 | filename = {
7 | ["build.zig.zon"] = "zig",
8 | },
9 | pattern = {
10 | [".*%.zig.zon$"] = "zig",
11 | },
12 | })
13 |
--------------------------------------------------------------------------------
/ftplugin/gitcommit.lua:
--------------------------------------------------------------------------------
1 | vim.opt_local.textwidth = 72
2 |
--------------------------------------------------------------------------------
/ftplugin/help.lua:
--------------------------------------------------------------------------------
1 | vim.treesitter.start()
2 |
--------------------------------------------------------------------------------
/ftplugin/lua/mapping.lua:
--------------------------------------------------------------------------------
1 | local utils = require("config.utils")
2 | local map = vim.keymap.set
3 |
4 | -- reload/source current file
5 | map("n", ".", function()
6 | vim.cmd([[luafile %]])
7 | vim.notify("reloaded " .. vim.fn.expand("%"))
8 | end, { buffer = true, desc = "reload current lua file" })
9 |
10 | -- reload a particular module
11 | map("n", "rm", function()
12 | vim.ui.input({
13 | prompt = "Enter the name of the module you want to reload:",
14 | default = nil,
15 | completion = "file",
16 | }, function(module_name)
17 | if module_name == "" then
18 | return
19 | else
20 | utils.reload_one(module_name)
21 | vim.notify(
22 | "!Reloaded Nvim Module " .. module_name .. ".lua!",
23 | vim.log.levels.INFO
24 | )
25 | end
26 | end)
27 | end, { buffer = true, desc = "reload a particular lua module" })
28 |
29 | -- reload all nvim configuration modules
30 | -- map("n", "ra", function()
31 | -- utils.reload_all()
32 | -- vim.notify("!Reloaded All Nvim Modules!", vim.log.levels.INFO)
33 | -- end, { buffer = true, desc = "reload all modules" })
34 |
--------------------------------------------------------------------------------
/ftplugin/python.lua:
--------------------------------------------------------------------------------
1 | -- match textwidth with black
2 | vim.opt_local.textwidth = 99
3 |
--------------------------------------------------------------------------------
/ftplugin/zig.lua:
--------------------------------------------------------------------------------
1 | -- h ftplugin |Disabling|
2 | -- vim.b.did_ftplugin = 1
3 | -- disable auto fomart with ast check
4 | vim.g.zig_fmt_autosave = 0
5 |
--------------------------------------------------------------------------------
/ftplugin/zsh.lua:
--------------------------------------------------------------------------------
1 | vim.opt_local.filetype = "zsh"
2 |
--------------------------------------------------------------------------------
/init.lua:
--------------------------------------------------------------------------------
1 | --Enable the new |lua-loader| that byte-compiles and caches lua files.
2 | vim.loader.enable()
3 |
4 | -- setup editor options -> syntax -> autocmds -> mappings
5 | require("config")
6 |
7 | -- bootstrap lazy.nvim
8 | require("config.lazy")
9 |
--------------------------------------------------------------------------------
/lua/config/autocmds.lua:
--------------------------------------------------------------------------------
1 | local autocmd = vim.api.nvim_create_autocmd -- create autocmd
2 | local utils = require("config.utils")
3 | local map = utils.map
4 | local augroup = utils.augroup
5 |
6 | -- define autocmd in a group so that you can clear it easily
7 | autocmd({ "TermOpen" }, {
8 | group = augroup("Terminal"),
9 | pattern = { "*" },
10 | callback = function()
11 | vim.wo.number = false
12 | vim.wo.relativenumber = false
13 | vim.api.nvim_command("startinsert")
14 | end,
15 | })
16 |
17 | -- Highlight on yank
18 | autocmd("TextYankPost", {
19 | group = augroup("highlight_yank"),
20 | callback = function()
21 | vim.highlight.on_yank()
22 | end,
23 | })
24 |
25 | -- resize splits if window got resized
26 | autocmd({ "VimResized" }, {
27 | group = augroup("resize_splits"),
28 | callback = function()
29 | vim.cmd("wincmd =")
30 | vim.cmd("tabdo wincmd =")
31 | end,
32 | })
33 |
34 | -- go to the last known loc/position when opening a file/buffer
35 | -- :h restore-position and :h restore-cursor
36 | autocmd("BufReadPost", {
37 | group = augroup("restore cursor"),
38 | pattern = { "*" },
39 | callback = function()
40 | local mark = vim.api.nvim_buf_get_mark(0, '"')
41 | local lcount = vim.api.nvim_buf_line_count(0)
42 | if mark[1] >= 1 and mark[1] <= lcount then
43 | pcall(vim.api.nvim_win_set_cursor, 0, mark)
44 | end
45 | end,
46 | })
47 |
48 | -- close some filetypes with
49 | autocmd("FileType", {
50 | group = augroup("close_with_q"),
51 | pattern = {
52 | "PlenaryTestPopup",
53 | "help",
54 | "lspinfo",
55 | "man",
56 | "notify",
57 | "qf",
58 | "query", -- :InspectTree
59 | "spectre_panel",
60 | "startuptime",
61 | "tsplayground",
62 | },
63 | callback = function(event)
64 | -- :help api-autocmd
65 | -- nvim_create_autocmd's callback receives a table argument with fields
66 | -- event = {id,event,group?,match,buf,file,data(arbituary data)}
67 | vim.bo[event.buf].buflisted = false
68 | map(
69 | "n",
70 | "q",
71 | "close",
72 | { buffer = event.buf, silent = true },
73 | "close some filetype windows with "
74 | )
75 | end,
76 | })
77 |
78 | -- wrap and check for spell in text filetypes
79 | autocmd("FileType", {
80 | group = augroup("wrap_spell"),
81 | pattern = { "gitcommit", "markdown", "norg" },
82 | callback = function()
83 | vim.opt_local.wrap = true
84 | vim.opt_local.spell = true
85 | end,
86 | })
87 |
88 | local diagnostics_options = require("config.defaults").diagnostics_options
89 | -- automatically show diagnostics on current line
90 | autocmd({ "CursorHold" }, {
91 | callback = function()
92 | vim.diagnostic.open_float(nil, diagnostics_options.float)
93 | end,
94 | })
95 |
96 | -- Remove Trailing whitespaces in all files
97 | autocmd({ "BufWritePre" }, { pattern = { "*" }, command = [[%s/\s\+$//e]] })
98 |
99 | -- Remove Trailing windows carriage return in all files
100 | if vim.fn.has("win64") == 1 or vim.fn.has("wsl") == 1 then
101 | autocmd({ "BufWritePre" }, { pattern = { "*" }, command = [[%s/\r$//e]] })
102 | end
103 |
104 | -- Enable auto formating at textwidth
105 | autocmd({ "FileType" }, {
106 | group = augroup("FormatOptions"),
107 | pattern = { "*" },
108 | -- INFO: https://stackoverflow.com/questions/16030639/vim-formatoptions-or/16035812#16035812
109 | -- https://stackoverflow.com/questions/76259118/neovim-vim-optremove-doesnt-actually-change-the-option
110 | callback = function()
111 | vim.opt.formatoptions = {
112 | t = true,
113 | c = true,
114 | r = true,
115 | o = true,
116 | q = true,
117 | ["]"] = true,
118 | j = true,
119 | }
120 | end,
121 | })
122 |
--------------------------------------------------------------------------------
/lua/config/defaults.lua:
--------------------------------------------------------------------------------
1 | return {
2 | -- icons used by other plugins
3 | icons = {
4 | diagnostics = {
5 | Error = " ", --🅴," "" "
6 | Warn = " ", --🆆," "
7 | Hint = "", --🅸," " " "
8 | Info = " ", --🅷," "," "
9 | },
10 | debugger = {
11 | DapBreakpoint = " ", --▶️breakpoints
12 | DapBreakpointCondition = " ", --conditional breakpoints
13 | DapLogPoint = " ", --log points
14 | DapStopped = " ", --🟥indicate where the debugee is stopped
15 | DapBreakpointRejected = " ", --indicate breakpoints rejected by the debug
16 | },
17 | git = {
18 | add = { text = "│" }, --" ","▎"
19 | change = { text = "!" }, --" ",
20 | delete = { text = "_" }, --" ",""
21 | topdelete = { text = "‾" },
22 | changedelete = { text = "~" },
23 | untracked = { text = "┆" },
24 | },
25 | kinds = {
26 | Array = " ",
27 | Boolean = " ",
28 | Class = " ", --" ",
29 | Color = " ", --" ", " "
30 | Constant = " ",
31 | Constructor = "",
32 | Copilot = " ",
33 | Enum = " ",
34 | EnumMember = "",
35 | Event = " ", --"",
36 | Field = " ", --" "," "
37 | File = "", --
38 | Folder = " ", --
39 | Function = "", --" "
40 | Interface = " ", --"",
41 | Keyword = " ", --""
42 | Method = " ",
43 | Module = " ",
44 | Namespace = " ",
45 | Null = " ",
46 | Number = " ",
47 | Object = " ",
48 | Operator = " ", --"",
49 | Package = " ",
50 | Property = " ", --" ",
51 | Reference = " ", --"",
52 | Snippet = " ",
53 | String = " ",
54 | Struct = " ", --" ",
55 | Text = " ", --" ",
56 | TypeParameter = " ",
57 | Unit = " ", --"",
58 | Value = "",
59 | Variable = " ",
60 | },
61 | },
62 | -- options from nvim_open_win()| vim.diagnostic.open_float()
63 | -- | vim.lsp.util.open_floating_preview()| vim.diagnostic.config()
64 | ---@type table
65 | diagnostics_options = {
66 | virtual_text = false,
67 | -- virtual_text = {
68 | -- severity = { min = vim.diagnostic.severity.WARN, max = vim.diagnostic.severity.ERROR },
69 | -- source = "if_many",
70 | -- spacing = 0,
71 | -- prefix = "●",
72 | -- },
73 | float = {
74 | --nvim_open_win() options
75 | relative = "cursor",
76 | -- "single": A single line box.
77 | -- "double": A double line box.
78 | -- "rounded": Like "single", but with rounded corners "╭"
79 | -- "solid": Adds padding by a single whitespace cell.
80 | -- "shadow": A drop shadow effect by blending with the
81 | -- "none": No border (default).
82 | border = "shadow",
83 | -- vim.lsp.util.open_floating_preview()
84 | max_width = math.floor(vim.o.columns * 0.84),
85 | max_height = math.floor(vim.o.lines * 0.6),
86 | close_events = {
87 | "BufLeave",
88 | "CursorMoved",
89 | "InsertEnter",
90 | "FocusLost",
91 | },
92 | focusable = false,
93 | zindex = 3,
94 | focus = false,
95 | -- vim.diagnostic.open_float()
96 | source = "if_many",
97 | severity_sort = true,
98 | },
99 | update_in_insert = false,
100 | -- This affects the order in which signs and virtual text are displayed
101 | severity_sort = true,
102 | },
103 | }
104 |
--------------------------------------------------------------------------------
/lua/config/init.lua:
--------------------------------------------------------------------------------
1 | -- Load editor options
2 | require("config.options")
3 |
4 | local utils = require("config.utils")
5 | -- Load editor syntax, autocmds and keymaps
6 | utils.lazy_load({ "config.syntax", "config.autocmds", "config.keymaps" })
7 |
8 | local diagnostics_options = require("config.defaults").diagnostics_options
9 | -- configure floating window
10 | vim.diagnostic.config(diagnostics_options)
11 |
12 | -- setup borders for handlers
13 | vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
14 | border = diagnostics_options.float.border,
15 | })
16 | --
17 | vim.lsp.handlers["textDocument/signatureHelp"] =
18 | vim.lsp.with(vim.lsp.handlers.signature_help, {
19 | border = diagnostics_options.float.border,
20 | })
21 |
22 | -- configure diagnostics signs
23 | for name, icon in pairs(require("config.defaults").icons.diagnostics) do
24 | name = "DiagnosticSign" .. name
25 | vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
26 | end
27 |
28 | -- configure debugger diagnostics signs
29 | for name, icon in pairs(require("config.defaults").icons.debugger) do
30 | vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
31 | end
32 |
--------------------------------------------------------------------------------
/lua/config/keymaps/editor.lua:
--------------------------------------------------------------------------------
1 | local utils = require("config.utils")
2 | local map = utils.map
3 |
4 | local opt = { remap = true }
5 |
6 | vim.cmd([[ cabbrev ht tab help]]) --map("c","h","tab help")
7 |
8 | map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" })
9 | map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
10 |
11 | -- search visually selected region on current line
12 | map("v", "//", [[y/\V=escape(@",'/\')]], opt)
13 |
14 | -- Map jk to ESC
15 | map({ "i", "v" }, "jk", "", { remap = false, nowait = true })
16 |
17 | map("n", "B", "m`0i``i", opt) -- J(join) B(BackJoin): move text after cursor to next line
18 |
19 | -- keep pasting over the same thing, ie. delete content and paste something in it place
20 | map("n", "p", [[m`0"_DP``]], opt, "keep pasting overwriting text")
21 | map("v", "p", [[m`"_dP``]], opt, "keep pasting over the same thing")
22 |
23 | -- delete content without clobbering registers
24 | map(
25 | { "n", "v" },
26 | "d",
27 | [["_d]],
28 | { remap = false },
29 | "delete content without clobbering registers"
30 | )
31 |
32 | -- Switch CWD to the directory of the open buffer
33 | map(
34 | { "n", "v", "o" },
35 | "cd",
36 | "cd %:p:h:pwd",
37 | opt,
38 | "switch to cwd"
39 | )
40 |
41 | -- === Moving around, tabs, windows and buffers === --
42 | -- To use `ALT+{h,j,k,l}` to navigate windows from any mode
43 | map({ "t", "i" }, "", [[h]])
44 | map({ "t", "i" }, "", [[j]])
45 | map({ "t", "i" }, "", [[k]])
46 | map({ "t", "i" }, "", [[l]])
47 | -- Move to window using the hjkl keys
48 | map("n", "", "h", { desc = "Go to left window" })
49 | map("n", "", "j", { desc = "Go to lower window" })
50 | map("n", "", "k", { desc = "Go to upper window" })
51 | map("n", "", "l", { desc = "Go to right window" })
52 |
53 | local mode = { "n", "v", "o" }
54 |
55 | -- buffers
56 | if utils.has("bufferline.nvim") then
57 | map("n", "", "BufferLineCyclePrev", { desc = "Prev buffer" })
58 | map("n", "", "BufferLineCycleNext", { desc = "Next buffer" })
59 | map("n", "[b", "BufferLineCyclePrev", { desc = "Prev buffer" })
60 | map("n", "]b", "BufferLineCycleNext", { desc = "Next buffer" })
61 | else
62 | map("n", "", "bprevious", { desc = "Prev buffer" })
63 | map("n", "", "bnext", { desc = "Next buffer" })
64 | -- move back to the previous buffer in the buffer list
65 | map("n", "[b", "bprevious", { desc = "Prev buffer" })
66 | -- move forward to the next buffer in the buffer list
67 | map("n", "]b", "bnext", { desc = "Next buffer" })
68 | end
69 | map("n", "bb", "b#", { desc = "Switch to Previous Buffer" })
70 | map("n", "`", "b#", { desc = "Switch to Previous Buffer" })
71 | -- move to the first buffer in the buffer list
72 | map("n", "b1", "bfirst", opt, "goto first buffer")
73 | -- move to the last buffer in the buffer list
74 | map("n", "b9", "blast", opt, "goto last buffer")
75 | -- Close the current buffer
76 | map("n", "bd", "bdelete", opt, "delete current buffer")
77 | -- Close all buffers except current
78 | map("n", "bo", "%bdeleteedit#bdelete#", opt)
79 | -- Edit new file
80 | map("n", "bn", "enew", { desc = "New File" })
81 | -- Useful mappings for managing tabs
82 | map(mode, "t1", "tabfirst", opt, "goto first tab")
83 | map(mode, "t9", "tablast", opt, "goto last tab")
84 | map(mode, "td", "tabclose", opt, "close tab")
85 | map(mode, "tn", "tabnew", opt, "new tab")
86 | map(
87 | mode,
88 | "to",
89 | "tabonly",
90 | opt,
91 | "close all tabs except current"
92 | )
93 | --TODO: tabmove should take an input
94 | map(mode, "tm", "tabmove", opt, "move tab")
95 | map(mode, "]t", "tabnext", opt, "goto next tab")
96 | map(mode, "[t", "tabprevious", opt, "goto previous tab")
97 |
98 | -- tabs
99 | map("n", "l", "tablast", { desc = "Last Tab" })
100 | map("n", "f", "tabfirst", { desc = "First Tab" })
101 | map("n", "", "tabnew", { desc = "New Tab" })
102 | map("n", "]", "tabnext", { desc = "Next Tab" })
103 | map("n", "d", "tabclose", { desc = "Close Tab" })
104 | map("n", "[", "tabprevious", { desc = "Previous Tab" })
105 |
106 | -- Resize window using arrow keys
107 | map("n", "", "resize +2", { desc = "Increase window height" })
108 | map("n", "", "resize -2", { desc = "Decrease window height" })
109 | map(
110 | "n",
111 | "",
112 | "vertical resize -2",
113 | { desc = "Decrease window width" }
114 | )
115 | map(
116 | "n",
117 | "",
118 | "vertical resize +2",
119 | { desc = "Increase window width" }
120 | )
121 |
122 | -- windows
123 | map("n", "ww", "p", { desc = "Other window" })
124 | map("n", "wd", "c", { desc = "Delete window" })
125 | map("n", "w-", "s", { desc = "Split window below" })
126 | map("n", "w|", "v", { desc = "Split window right" })
127 | map("n", "-", "s", { desc = "Split window below" })
128 | map("n", "|", "v", { desc = "Split window right" })
129 | map("n", "=", "=", { desc = "resize and make windows equal" })
130 |
131 | -- Move Lines
132 | map("n", "", "m .+1==", { desc = "Move down" })
133 | map("n", "", "m .-2==", { desc = "Move up" })
134 | map("i", "", "m .+1==gi", { desc = "Move down" })
135 | map("i", "", "m .-2==gi", { desc = "Move up" })
136 | map("v", "", ":m '>+1gv=gv", { desc = "Move down" })
137 | map("v", "", ":m '<-2gv=gv", { desc = "Move up" })
138 |
139 | -- save file
140 | map({ "i", "v", "n", "s" }, "", function()
141 | vim.cmd([[w]])
142 | end, { desc = "Save file" })
143 |
144 | -- quit
145 | map("n", "", function()
146 | vim.cmd([[qall]])
147 | end, { desc = "Quit all" })
148 |
149 | -- === Terminal === "
150 | -- Mapping to open terminal emulator in nvim
151 | -- open terminal on alt+t
152 | map({ "n", "t" }, "", function()
153 | vim.cmd.split({ "term://" .. vim.env.SHELL })
154 | vim.cmd.resize({ 15 })
155 | end)
156 | -- mapping to close terminal emulator
157 | map("t", "", [[:bd!]])
158 |
159 | -- better up/down
160 | map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
161 | map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
162 |
163 | -- Clear search with
164 | map(
165 | { "i", "n" },
166 | "",
167 | "noh",
168 | { desc = "Escape and clear hlsearch" }
169 | )
170 |
171 | -- lazy
172 | map("n", "l", ":Lazy", { desc = "Lazy" })
173 |
174 | -- toggle options
175 | -- === Spell checking === "
176 | --vim.cmd [[set spell!]] also works
177 | map("n", "us", function()
178 | utils.toggle("spell")
179 | end, { desc = "Toggle Spelling" })
180 |
181 | map("n", "uw", function()
182 | utils.toggle("wrap")
183 | end, { desc = "Toggle Word Wrap" })
184 |
185 | map("n", "ul", function()
186 | utils.toggle("relativenumber")
187 | utils.toggle("number")
188 | end, { desc = "Toggle Line Numbers" })
189 |
190 | map("n", "uc", function()
191 | local disable_conceal = 0
192 | local enable_conceal = 3
193 | local conceallevel = vim.o.conceallevel > 0 and disable_conceal
194 | or enable_conceal
195 |
196 | local filetype = vim.filetype.match({ buf = 0 })
197 |
198 | if filetype == "norg" and utils.has("neorg") then
199 | utils.toggle("conceallevel", nil, { 0, conceallevel })
200 | vim.cmd([[Neorg toggle-concealer]])
201 | else
202 | utils.toggle("conceallevel", nil, { 0, conceallevel })
203 | end
204 | end, { desc = "Toggle Conceal" })
205 |
206 | map("n", "ue", function()
207 | utils.toggle("listchars", nil, {
208 | { tab = [[→→]], trail = "•", extends = "»", precedes = "«" },
209 | {
210 | tab = [[→→]],
211 | trail = "•",
212 | extends = "»",
213 | precedes = "«",
214 | eol = "↴",
215 | },
216 | })
217 | end, { desc = "Toggle EOL" })
218 |
--------------------------------------------------------------------------------
/lua/config/keymaps/init.lua:
--------------------------------------------------------------------------------
1 | require("config.keymaps.editor")
2 | require("config.keymaps.lsp")
3 |
--------------------------------------------------------------------------------
/lua/config/keymaps/lsp.lua:
--------------------------------------------------------------------------------
1 | local autocmd = vim.api.nvim_create_autocmd -- create autocmd
2 | local utils = require("config.utils")
3 | local map = utils.map
4 | local augroup = utils.augroup
5 |
6 | -- map the following keys after the language server attaches to a buffer
7 | -- See `:help vim.lsp.*` for doc mentation on any of the below functions
8 | -- :lua =vim.lsp.get_active_clients()[1].server_capabilities to get capabilities of lsp attached to buffer
9 | utils.on_attach(function(client, bufnr)
10 | local opts = { buffer = bufnr }
11 |
12 | if
13 | vim.version.gt(vim.version(), { 0, 9, 0 })
14 | and client.server_capabilities.inlayHintProvider
15 | then
16 | vim.lsp.inlay_hint.enable(true)
17 | end
18 | if client.server_capabilities.hoverProvider then
19 | map("n", "K", function()
20 | vim.lsp.buf.hover()
21 | end, opts, "get hover info")
22 | end
23 | if client.server_capabilities.semanticTokensProvider then
24 | map("n", "us", function()
25 | utils.toggle("enable_semantic_tokens", { global = true }, nil)
26 | if vim.g["enable_semantic_tokens"] then
27 | vim.lsp.semantic_tokens.start(bufnr, client.id)
28 | else
29 | vim.lsp.semantic_tokens.stop(bufnr, client.id)
30 | end
31 | end, opts, "toggle semantic token highlighting")
32 | end
33 | if client.server_capabilities.signatureHelpProvider then
34 | map(
35 | "n",
36 | "k",
37 | vim.lsp.buf.signature_help,
38 | opts,
39 | "get fn signature help"
40 | )
41 | end
42 | if client.server_capabilities.declarationProvider then
43 | map(
44 | "n",
45 | "gD",
46 | vim.lsp.buf.declaration,
47 | opts,
48 | "goto declaration"
49 | )
50 | end
51 | if client.server_capabilities.completionProvider then
52 | vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
53 | end
54 | if client.server_capabilities.definitionProvider then
55 | vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc"
56 | map("n", "gd", function()
57 | if utils.has("lspsaga.nvim") then
58 | vim.cmd([[Lspsaga goto_definition]])
59 | else
60 | vim.lsp.buf.definition()
61 | end
62 | end, opts, "goto definition")
63 |
64 | if utils.has("lspsaga.nvim") then
65 | map("n", "pd", function()
66 | vim.cmd([[Lspsaga peek_definition]])
67 | end, opts, "peek definition")
68 | end
69 | end
70 | if client.server_capabilities.typeDefinitionProvider then
71 | map("n", "gt", function()
72 | if utils.has("lspsaga.nvim") then
73 | vim.cmd([[Lspsaga goto_type_definition]])
74 | else
75 | vim.lsp.buf.type_definition()
76 | end
77 | end, opts, "goto type definition")
78 |
79 | if utils.has("lspsaga.nvim") then
80 | map("n", "pt", function()
81 | vim.cmd([[Lspsaga peek_type_definition]])
82 | end, opts, "peek type definition")
83 | end
84 | end
85 | if client.server_capabilities.implementationProvider then
86 | map("n", "gi", function()
87 | if utils.has("lspsaga.nvim") then
88 | vim.cmd([[Lspsaga finder imp+def]])
89 | else
90 | vim.lsp.buf.implementation()
91 | end
92 | end, opts, "goto type implementation")
93 | end
94 | if client.server_capabilities.referencesProvider then
95 | map("n", "gr", function()
96 | if utils.has("lspsaga.nvim") then
97 | vim.cmd([[Lspsaga finder ref]])
98 | else
99 | vim.lsp.buf.references({})
100 | end
101 | end, opts, "goto type references")
102 | end
103 | if client.server_capabilities.documentHighlightProvider then
104 | vim.api.nvim_set_hl(0, "LspReferenceRead", {
105 | link = "DiffText",
106 | })
107 | vim.api.nvim_set_hl(0, "LspReferenceText", {
108 | link = "IncSearch",
109 | })
110 | vim.api.nvim_set_hl(0, "LspRefDiffTexterenceWrite", {
111 | link = "WildMenu",
112 | })
113 | local doc_highlight = augroup("lsp_document_highlight")
114 | local enable_highlight = function()
115 | autocmd({ "CursorHold", "CursorHoldI" }, {
116 | group = doc_highlight,
117 | buffer = bufnr,
118 | callback = vim.lsp.buf.document_highlight,
119 | })
120 | autocmd("CursorMoved", {
121 | group = doc_highlight,
122 | buffer = bufnr,
123 | callback = vim.lsp.buf.clear_references,
124 | })
125 | end
126 | local disable_highlight = function()
127 | vim.lsp.buf.clear_references()
128 | vim.api.nvim_clear_autocmds({
129 | buffer = bufnr,
130 | group = doc_highlight,
131 | })
132 | end
133 | map("n", "uh", function()
134 | utils.toggle(
135 | "highlight",
136 | {},
137 | { enable_highlight, disable_highlight }
138 | )
139 | vim.b[vim.fn.bufnr()]["highlight"]()
140 | end, opts, "toggle document highlight")
141 | end
142 | if client.server_capabilities.documentSymbolProvider then
143 | map(
144 | "n",
145 | "ds",
146 | vim.lsp.buf.document_symbol,
147 | opts,
148 | "document symbols"
149 | )
150 | end
151 | if client.server_capabilities.codeActionProvider then
152 | map({ "n", "v" }, "ca", function()
153 | if utils.has("lspsaga.nvim") then
154 | vim.cmd([[Lspsaga code_action]])
155 | else
156 | vim.lsp.buf.code_action()
157 | end
158 | end, opts, "code action")
159 | end
160 | if client.server_capabilities.documentFormattingProvider then
161 | map("n", "uf", function()
162 | utils.toggle("autoformat", { global = true })
163 | autocmd("BufWritePre", {
164 | group = augroup("LspFormat"),
165 | callback = function()
166 | if vim.g["autoformat"] then
167 | vim.lsp.buf.format({ async = true })
168 | end
169 | end,
170 | })
171 | end, opts, "toggle autoformat")
172 |
173 | map("n", "f", function()
174 | vim.lsp.buf.format({ async = true })
175 | end, opts, "range format buffer")
176 | end
177 | if client.server_capabilities.documentRangeFormattingProvider then
178 | map("v", "f", function()
179 | vim.lsp.buf.format({ async = true })
180 | end, opts, "range format buffer")
181 | end
182 | if client.server_capabilities.renameProvider then
183 | map("n", "rn", function()
184 | vim.lsp.buf.rename()
185 | end, opts, "rename symbol")
186 |
187 | if utils.has("lspsaga.nvim") then
188 | map("n", "rnw", function()
189 | vim.cmd([[Lspsaga project_replace]])
190 | end, opts, "rename across workspace")
191 | end
192 | end
193 | if client.server_capabilities.callHierarchyProvider then
194 | map("n", "ci", function()
195 | if utils.has("lspsaga.nvim") then
196 | vim.cmd([[Lspsaga incoming_calls]])
197 | else
198 | vim.lsp.buf.incoming_calls()
199 | end
200 | end, opts, "incoming calls")
201 | map("n", "co", function()
202 | if utils.has("lspsaga.nvim") then
203 | vim.cmd([[Lspsaga outgoing_calls]])
204 | else
205 | vim.lsp.buf.outgoing_calls()
206 | end
207 | end, opts, "outgoing calls")
208 | end
209 | if client.server_capabilities.workspaceSymbolProvider then
210 | map(
211 | "n",
212 | "ws",
213 | vim.lsp.buf.workspace_symbol,
214 | opts,
215 | "list workspace symbols"
216 | )
217 | end
218 |
219 | map("n", "[d", function()
220 | if utils.has("lspsaga.nvim") then
221 | vim.cmd([[Lspsaga diagnostic_jump_prev]])
222 | else
223 | vim.diagnostic.goto_prev()
224 | end
225 | end, opts, "goto previous diagnostics")
226 | map("n", "]d", function()
227 | if utils.has("lspsaga.nvim") then
228 | vim.cmd([[Lspsaga diagnostic_jump_next]])
229 | else
230 | vim.diagnostic.goto_next()
231 | end
232 | end, opts, "goto next diagnostics")
233 |
234 | if utils.has("lspsaga.nvim") then
235 | map("n", "wd", function()
236 | vim.cmd([[Lspsaga show_workspace_diagnostics]]) --can use ++normal to show in loclist
237 | end, opts, "workspace diagnostics")
238 | map("n", "bd", function()
239 | vim.cmd([[Lspsaga show_buf_diagnostics]])
240 | end, opts, "workspace diagnostics")
241 | map("n", "wo", function()
242 | vim.cmd([[Lspsaga outline]])
243 | end, opts, "workspace outline")
244 | end
245 | map("n", "sl", vim.diagnostic.setloclist, opts, "set loclist")
246 | map("n", "of", vim.diagnostic.open_float, opts, "open float")
247 |
248 | map("n", "wf", function()
249 | vim.print(vim.lsp.buf.list_workspace_folders())
250 | end, opts, "list workspace folders")
251 | map("n", "rd", function()
252 | print(
253 | "Language server "
254 | .. (vim.lsp.buf.server_ready() and "is ready" or "is not ready")
255 | )
256 | end, opts, "check if lsp is ready")
257 | end)
258 |
--------------------------------------------------------------------------------
/lua/config/lazy.lua:
--------------------------------------------------------------------------------
1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
2 |
3 | if not vim.loop.fs_stat(lazypath) then
4 | vim.fn.system({
5 | "git",
6 | "clone",
7 | "--filter=blob:none",
8 | "https://github.com/folke/lazy.nvim.git",
9 | "--branch=stable",
10 | lazypath,
11 | })
12 | end
13 | vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
14 |
15 | require("lazy").setup({
16 | spec = {
17 | { import = "plugins" },
18 | },
19 | defaults = {
20 | lazy = false,
21 | },
22 | -- automatically check for plugin updates
23 | checker = { enabled = false },
24 | change_detection = {
25 | -- automatically check for config file changes and reload the ui
26 | enabled = true,
27 | -- get a notification when changes are found
28 | notify = false,
29 | },
30 | performance = {
31 | cache = {
32 | enabled = true,
33 | },
34 | rtp = {
35 | -- disable some rtp plugins
36 | disabled_plugins = {
37 | -- Vim plugin for editing compressed files.
38 | "gzip",
39 | -- tarPlugin.vim -- a Vim plugin for browsing tarfiles
40 | "tarPlugin",
41 | -- Vim plugin for converting a syntax highlighted file to HTML.
42 | "tohtml",
43 | -- zipPlugin.vim: Handles browsing zipfiles
44 | "zipPlugin",
45 | -- netrwPlugin.vim: Handles file transfer and remote directory listing across a network
46 | -- support of plugins written in other languages
47 | "netrwPlugin",
48 | "rplugin",
49 | -- Vim plugin for downloading spell files
50 | -- "spellfile",
51 | -- matchit.vim: (global plugin) Extended "%" matching
52 | -- "matchit",
53 | -- Vim plugin for showing matching parens
54 | -- "matchparen",
55 | -- "tutor",
56 | -- "man",
57 | -- "shada",
58 | -- "health",
59 | -- "editorconfig",
60 | -- "nvim",
61 | },
62 | },
63 | },
64 | })
65 |
--------------------------------------------------------------------------------
/lua/config/options.lua:
--------------------------------------------------------------------------------
1 | local opt = vim.opt
2 | local opt_global = vim.opt_global
3 | local fn = vim.fn -- invoke vim-functions in lua
4 |
5 | vim.g.editorconfig = false
6 | vim.g.mapleader = [[ ]]
7 | vim.g.maplocalleader = [[\]]
8 |
9 | -- Set clipboard to the + registers only
10 | -- if you want to use the * also add ,unnamed
11 | -- Also enable clipboard for WSL
12 | if fn.has("wsl") == 1 then
13 | vim.g.clipboard = {
14 | name = "WslClipboard",
15 | copy = {
16 | ["+"] = "/mnt/c/WINDOWS/system32/clip.exe",
17 | ["*"] = "/mnt/c/WINDOWS/system32/clip.exe",
18 | },
19 | paste = {
20 | ["+"] = '/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
21 | ["*"] = '/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
22 | },
23 | cache_enabled = 0,
24 | }
25 | opt.clipboard:append({ "unnamedplus" })
26 | else
27 | opt.clipboard:append({ "unnamedplus" })
28 | end
29 |
30 | opt.termguicolors = true
31 |
32 | -- Show line numbers
33 | opt.number = true
34 |
35 | -- open new split panes to right and below
36 | opt.splitright = true
37 | opt.splitbelow = true
38 |
39 | -- Show the line number relative to the line with the cursor in front of each line.
40 | opt.relativenumber = true
41 |
42 | --Make a backup before overwriting a file. The backup is removed after the file was successfully written
43 | -- unless the 'backup' option is also on.
44 | opt.writebackup = true
45 |
46 | --Make a backup before overwriting a file. Leave it around after the file has been successfully written.
47 | --this make sure you alway have a backup of a file around,meaning in cases where there is no swapfile
48 | --to recover from you can use the backup file directly
49 | opt.backup = true
50 |
51 | --List of directories for the backup file
52 | opt_global.backupdir = { "/tmp//" }
53 |
54 | -- tells neovim how backups are done
55 | opt.backupcopy = "auto"
56 |
57 | -- The extension to be used for vim backup files
58 | opt.backupext = ".vimbak"
59 |
60 | -- enable saving unsaved/unwritten files in a *.swp file
61 | opt.swapfile = true
62 |
63 | -- saves undo history to an undo file when writing a buffer to a file, and restores undo
64 | -- history from the same file on buffer read.
65 | opt.undofile = true
66 |
67 | -- Maximum number of changes that can be undone.
68 | opt.undolevels = 30000
69 |
70 | -- You will have bad experience for diagnostic messages when it's default 4000.
71 | opt.updatetime = 100
72 |
73 | -- Time in milliseconds to wait for a mapped sequence to complete.
74 | opt.timeoutlen = 500
75 |
76 | -- don't give |ins-completion-menu| messages.
77 | opt.shortmess:append({ c = true, W = true, I = true })
78 |
79 | -- always merge sign column and number column into one
80 | opt.signcolumn = "yes"
81 |
82 | -- Don't let autocomplete affect usual typing habits
83 | opt_global.completeopt = { "menu", "menuone", "noselect" }
84 |
85 | opt.conceallevel = 3 -- Hide * markup for bold and italic
86 | opt.concealcursor = "nc" --Sets the modes in which text in the cursor line can also be concealed.
87 |
88 | opt.cursorline = true -- Enable highlighting of the current line
89 |
90 | opt.pumblend = 10 -- Popup blend
91 | opt.pumheight = 10 -- Maximum number of entries in a popup
92 |
93 | -- This option allows you to switch between multiple buffers
94 | -- without saving a changed buffer
95 | opt.hidden = false
96 |
97 | -- Automatically enable mouse usage
98 | opt.mouse = "a"
99 |
100 | -- enable mouse move event
101 | opt.mousemoveevent = false
102 |
103 | -- enable line wrap
104 | opt.wrap = true
105 |
106 | -- Wrap-broken line prefix
107 | opt.showbreak = [[↪ ]]
108 |
109 | -- wrap long lines at a character in `breakat`
110 | opt.linebreak = true
111 |
112 | --wrapped line will continue visually indented
113 | opt.breakindent = true
114 |
115 | -- Maximum width (number of cols) of text that is being inserted
116 | opt.textwidth = 80
117 |
118 | -- set to +1 to highlight column after textwidth
119 | -- opt.colorcolumn = "+1"
120 |
121 | -- Highlight matching brace
122 | opt.showmatch = true
123 |
124 | -- TODO: improve completions by using k{dict} and s{tsr} .:h 'complete'
125 | -- text complete with CTRL-N or CTRL-P
126 | opt.complete = "kspell"
127 |
128 | -- Enable spell checking for español y ingles--
129 | opt.spelllang = { "en" } --"en,es"
130 |
131 | -- Show best nine spell checking candidates at most
132 | opt_global.spellsuggest = { "best", "9" }
133 |
134 | -- When a word is CamelCased, assume "Cased" is a separate word: every upper-case character
135 | -- in a word that comes after a lower case character indicates the start of a new word.
136 | opt.spelloptions = "camel"
137 |
138 | -- make diff mode always open in vertical split
139 | opt_global.diffopt:append({ "vertical" })
140 |
141 | -- Use visual bell (no beeping)
142 | opt.visualbell = true
143 |
144 | -- Always case-insensitive
145 | opt.ignorecase = true
146 |
147 | -- Enable smart-case search
148 | opt.smartcase = true
149 |
150 | -- case insensitive auto completion
151 | opt.wildignorecase = true
152 |
153 | --Set 'tabstop' and 'shiftwidth' to whatever you prefer and use 'expandtab'.
154 | --This way you will always insert spaces. The formatting will never be messed up when 'tabstop' is changed.
155 | --Number of spaces that a in the file counts for
156 | opt.tabstop = 4
157 |
158 | -- Number of auto-indent spaces
159 | opt.shiftwidth = 4
160 |
161 | -- Number of spaces per Tab
162 | -- When 'softtabstop' is negative, the value of 'shiftwidth' is used.
163 | opt.softtabstop = -1
164 |
165 | -- always expands tab to spaces. It is good when peers use different editor.
166 | opt.expandtab = true
167 |
168 | -- Prompt confirmation dialogs
169 | opt.confirm = true
170 |
171 | -- Command line height
172 | opt.cmdheight = 0
173 |
174 | -- Auto-write all file changes
175 | opt.autowriteall = true
176 |
177 | --When this option is set, the screen will not be redrawn while executing
178 | --macros, registers and other commands that have not been typed
179 | opt.lazyredraw = false
180 |
181 | -- Display unprintable characters f12 - switches
182 | opt.list = true
183 |
184 | -- Unprintable chars mapping
185 | -- {tab = "••"|">~",eol = "↴"|"¶"|"$", nbsp = "␣"|"%", space = "_" }
186 | opt.listchars =
187 | { tab = [[→→]], trail = "•", extends = "»", precedes = "«" }
188 |
189 | -- Enable folding
190 | opt.foldmethod = "expr"
191 |
192 | opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
193 |
194 | -- diable folding at startup
195 | opt.foldenable = false
196 |
197 | -- set the number of screen lines above which a fold is displayed closed
198 | opt.foldminlines = 5
199 |
--------------------------------------------------------------------------------
/lua/config/syntax.lua:
--------------------------------------------------------------------------------
1 | -- :h highlight-args and :h cterm-colors
2 | vim.api.nvim_set_hl(0, "Search", {
3 | ctermfg = 0,
4 | ctermbg = 11,
5 | cterm = { bold = true },
6 | bg = "Blue",
7 | fg = "Magenta",
8 | standout = true,
9 | underdotted = true,
10 | })
11 |
--------------------------------------------------------------------------------
/lua/config/utils.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | function _G.dump(...)
4 | vim.print(...)
5 | end
6 |
7 | function M.reload_all()
8 | for name, _ in pairs(package.loaded) do
9 | if name:match("^config") or name:match("^plugins") then
10 | package.loaded[name] = nil
11 | end
12 | end
13 | -- Reload after/ directory
14 | local glob = vim.fn.stdpath("config") .. "/ftplugin/**/*.lua"
15 | local ftplugin_lua_filepaths = vim.fn.glob(glob, true, true)
16 |
17 | for _, filepath in ipairs(ftplugin_lua_filepaths) do
18 | dofile(filepath)
19 | end
20 |
21 | dofile(vim.env.MYVIMRC)
22 | end
23 |
24 | function M.reload_one(module)
25 | for name, _ in pairs(package.loaded) do
26 | if name:match("^" .. module) then
27 | package.loaded[name] = nil
28 | require(name)
29 | return
30 | end
31 | end
32 | end
33 |
34 | --{ "git", "rg", { "fd", "fdfind" }, "lazygit" }
35 | M.check_if_cmd_exist = function(cmds)
36 | local result = {}
37 | for _, cmd in ipairs(cmds) do
38 | local name = type(cmd) == "string" and cmd or vim.inspect(cmd)
39 | local commands = type(cmd) == "string" and { cmd } or cmd
40 | ---@cast commands string[]
41 | local found = false
42 | for _, c in ipairs(commands) do
43 | if vim.fn.executable(c) == 1 then
44 | name = c
45 | found = true
46 | end
47 | result[name] = { found }
48 | end
49 | end
50 | return result
51 | end
52 |
53 | ---@param editor_variable? {global: boolean}
54 | ---@param values? {[1]:any, [2]:any}
55 | ---@param option string
56 | function M.toggle(option, editor_variable, values)
57 | if values then
58 | if not editor_variable then
59 | if vim.deep_equal(vim.opt_local[option]:get(), values[1]) then
60 | vim.opt_local[option] = values[2]
61 | else
62 | vim.opt_local[option] = values[1]
63 | end
64 | vim.notify(
65 | "set editor option "
66 | .. option
67 | .. " to "
68 | .. tostring(vim.opt_local[option]:get()),
69 | vim.log.levels.INFO,
70 | { title = "toggle editor option" }
71 | )
72 | else
73 | if not editor_variable.global then
74 | local bufnr = vim.api.nvim_get_current_buf()
75 | if vim.b[bufnr][option] == values[1] then
76 | vim.b[bufnr][option] = values[2]
77 | else
78 | --if option is unset or nil
79 | vim.b[bufnr][option] = values[1]
80 | end
81 | --:h debug.getinfo() or lua_getinfo() to get information about a function
82 | vim.notify(
83 | "set option "
84 | .. option
85 | .. " to "
86 | .. tostring(vim.b[bufnr][option]),
87 | vim.log.levels.INFO,
88 | {
89 | title = "toggle local option",
90 | }
91 | )
92 | else
93 | if vim.g[option] == values[1] then
94 | vim.g[option] = values[2]
95 | else
96 | --if option is unset or nil
97 | vim.g[option] = values[1]
98 | end
99 | vim.notify(
100 | "set global option "
101 | .. option
102 | .. " to "
103 | .. tostring(vim.g[option]),
104 | vim.log.levels.INFO,
105 | {
106 | title = "toggle global option",
107 | }
108 | )
109 | end
110 | end
111 | else
112 | if not editor_variable then
113 | vim.opt_local[option] = not vim.opt_local[option]:get()
114 | vim.notify(
115 | "set editor option "
116 | .. option
117 | .. " to "
118 | .. tostring(vim.opt_local[option]:get()),
119 | vim.log.levels.INFO,
120 | {
121 | title = "toggle editor option",
122 | }
123 | )
124 | else
125 | if not editor_variable.global then
126 | local bufnr = vim.api.nvim_get_current_buf()
127 | vim.b[bufnr][option] = not vim.b[bufnr][option] and true
128 | or false
129 | vim.notify(
130 | "set option "
131 | .. option
132 | .. " to "
133 | .. tostring(vim.b[bufnr][option]),
134 | vim.log.levels.INFO,
135 | {
136 | title = "toggle local option",
137 | }
138 | )
139 | else
140 | vim.g[option] = not vim.g[option]
141 | vim.notify(
142 | "set global option "
143 | .. option
144 | .. " to "
145 | .. tostring(vim.g[option]),
146 | vim.log.levels.INFO,
147 | {
148 | title = "toggle global option",
149 | }
150 | )
151 | end
152 | end
153 | end
154 | end
155 |
156 | ---@param fn fun()
157 | function M.on_very_lazy(fn)
158 | vim.api.nvim_create_autocmd("User", {
159 | group = vim.api.nvim_create_augroup("Lazy", { clear = true }),
160 | pattern = "VeryLazy",
161 | callback = function()
162 | fn()
163 | end,
164 | })
165 | end
166 |
167 | ---@param modules string[]
168 | --modules like "autocmds" | "options" | "keymaps"
169 | M.lazy_load = function(modules)
170 | -- when no file is opened at startup
171 | if vim.fn.argc(-1) == 0 then
172 | -- autocmds and keymaps can wait to load
173 | -- always load lazyvim, then user file
174 | M.on_very_lazy(function()
175 | for i = 1, #modules do
176 | require(modules[i])
177 | end
178 | end)
179 | else
180 | -- load them now so they affect the opened buffers
181 | for i = 1, #modules do
182 | require(modules[i])
183 | end
184 | end
185 | end
186 |
187 | ---@param on_attach fun(client, bufnr)
188 | function M.on_attach(on_attach)
189 | vim.api.nvim_create_autocmd("LspAttach", {
190 | callback = function(args)
191 | local bufnr = args.buf
192 | local client = vim.lsp.get_client_by_id(args.data.client_id)
193 | on_attach(client, bufnr)
194 | end,
195 | })
196 | end
197 |
198 | ---@param plugin string
199 | function M.has(plugin)
200 | if package.loaded["lazy"] then
201 | return require("lazy.core.config").plugins[plugin] ~= nil
202 | else
203 | local plugin_name =
204 | vim.split(plugin, ".", { plain = true, trimempty = true })
205 | return package.loaded[plugin_name[1]] ~= nil
206 | end
207 | end
208 |
209 | ---@param description? string
210 | ---@param opt table
211 | local function mdesc(opt, description)
212 | return vim.tbl_extend("force", opt, { desc = description })
213 | end
214 |
215 | ---@param mode string|table
216 | ---@param lhs string
217 | ---@param rhs string|function
218 | ---@param opts? table
219 | ---@param desc? string
220 | M.map = function(mode, lhs, rhs, opts, desc)
221 | opts = opts and opts or {}
222 | opts = mdesc(opts, desc)
223 | vim.keymap.set(mode, lhs, rhs, opts)
224 | end
225 |
226 | M.augroup = function(name)
227 | return vim.api.nvim_create_augroup(name, { clear = true })
228 | end
229 |
230 | return M
231 |
--------------------------------------------------------------------------------
/lua/plugins/colorscheme.lua:
--------------------------------------------------------------------------------
1 | return {
2 | -- catppuccin
3 | {
4 | "catppuccin/nvim",
5 | name = "catppuccin",
6 | lazy = true,
7 | -- event = {"BufReadPre","BufNewFile"},
8 | opts = {
9 | flavour = "macchiato", -- latte, frappe, macchiato, mocha
10 | background = {
11 | -- :h background
12 | light = "latte",
13 | dark = "mocha",
14 | },
15 | transparent_background = false,
16 | show_end_of_buffer = false, -- show the '~' characters after the end of buffers
17 | term_colors = true,
18 | dim_inactive = {
19 | enabled = true,
20 | shade = "dark",
21 | percentage = 0.15,
22 | },
23 | no_italic = false, -- Force no italic
24 | no_bold = false, -- Force no bold
25 | styles = {
26 | comments = { "italic" },
27 | conditionals = { "italic" },
28 | loops = {},
29 | functions = {},
30 | keywords = {},
31 | strings = {},
32 | variables = {},
33 | numbers = {},
34 | booleans = {},
35 | properties = {},
36 | types = {},
37 | operators = {},
38 | },
39 | color_overrides = {},
40 | -- custom_highlights = function(colors) -- Global highlight, will be replaced with custom_highlights if exists
41 | -- return {
42 | -- -- Comment = { fg = colors.peach, style = { "italic" } },
43 | -- -- ["@field"] = { fg = colors.blue },
44 | -- }
45 | -- end,
46 | -- For more plugins integrations (https://github.com/catppuccin/nvim#integrations)
47 | integrations = {
48 | cmp = true,
49 | gitsigns = true,
50 | nvimtree = true,
51 | telescope = true,
52 | notify = true,
53 | hop = true,
54 | markdown = true,
55 | noice = true,
56 | treesitter = true,
57 | symbols_outline = true,
58 | lsp_trouble = true,
59 | which_key = true,
60 | native_lsp = {
61 | enabled = true,
62 | virtual_text = {
63 | errors = { "italic" },
64 | hints = { "italic" },
65 | warnings = { "italic" },
66 | information = { "italic" },
67 | },
68 | underlines = {
69 | errors = { "underline" },
70 | hints = { "underline" },
71 | warnings = { "underline" },
72 | information = { "underline" },
73 | },
74 | },
75 | },
76 | },
77 | config = function(_, opts)
78 | require("catppuccin").setup(opts)
79 | vim.cmd.colorscheme("catppuccin")
80 | end,
81 | },
82 | -- Onedark colorscheme
83 | {
84 | "navarasu/onedark.nvim",
85 | event = { "BufReadPre", "BufNewFile" },
86 | config = function(_, opts)
87 | require("onedark").setup(opts)
88 | require("onedark").load()
89 | end,
90 | opts = {
91 | -- Main options --
92 | style = "darker", -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
93 | transparent = false, -- Show/hide background
94 | term_colors = true, -- Change terminal color as per the selected theme style
95 | ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
96 | cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
97 | -- toggle theme style ---
98 | toggle_style_key = "ts", -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts"
99 | -- List of styles to toggle between
100 | toggle_style_list = {
101 | "dark",
102 | "darker",
103 | "cool",
104 | "deep",
105 | "warm",
106 | "warmer",
107 | "light",
108 | },
109 | -- Change code style ---
110 | -- Options are italic, bold, underline, none
111 | -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold'
112 | code_style = {
113 | comments = "italic",
114 | keywords = "none",
115 | functions = "none",
116 | strings = "none",
117 | variables = "none",
118 | },
119 | -- Lualine options --
120 | lualine = {
121 | transparent = false, -- lualine center bar transparency
122 | },
123 | -- Custom Highlights --
124 | colors = {}, -- Override default colors
125 | highlights = {}, -- Override highlight groups
126 | -- Plugins Config --
127 | diagnostics = {
128 | darker = true, -- darker colors for diagnostic
129 | undercurl = true, -- use undercurl instead of underline for diagnostics
130 | background = true, -- use background color for virtual text
131 | },
132 | },
133 | },
134 | }
135 |
--------------------------------------------------------------------------------
/lua/plugins/completions.lua:
--------------------------------------------------------------------------------
1 | return {
2 | -- snippets
3 | {
4 | "L3MON4D3/LuaSnip",
5 | lazy = true,
6 | dependencies = {
7 | { "saadparwaiz1/cmp_luasnip", lazy = true }, -- luasnip completion source for nvim-cmp
8 | {
9 | "rafamadriz/friendly-snippets",
10 | lazy = true,
11 | config = function()
12 | require("luasnip.loaders.from_vscode").lazy_load()
13 | end,
14 | },
15 | },
16 | },
17 | -- completion engine
18 | {
19 | "hrsh7th/nvim-cmp",
20 | event = "InsertEnter", -- load cmp on InsertEnter
21 | -- these dependencies will only be loaded when cmp loads
22 | -- dependencies are always lazy-loaded unless specified otherwise
23 | dependencies = {
24 | -- Autocompletion plugin
25 | -- Completion Sources --
26 | { "hrsh7th/cmp-nvim-lsp", lazy = true }, -- nvim-cmp source for neovim builtin LSP client
27 | { "hrsh7th/cmp-path", lazy = true }, -- nvim-cmp source for path
28 | { "hrsh7th/cmp-buffer", lazy = true }, -- nvim-cmp source for buffer words
29 | { "hrsh7th/cmp-nvim-lua", lazy = true }, -- nvim-cmp source for nvim lua
30 | { "hrsh7th/cmp-emoji", lazy = true }, -- nvim-cmp source for emoji
31 | { "hrsh7th/cmp-cmdline", lazy = true }, --nvim-cmp source for vim's cmdline.
32 | },
33 | opts = function()
34 | local has_words_before = function()
35 | local line, col = unpack(vim.api.nvim_win_get_cursor(0))
36 | return col ~= 0
37 | and vim.api
38 | .nvim_buf_get_lines(0, line - 1, line, true)[1]
39 | :sub(col, col)
40 | :match("%s")
41 | == nil
42 | end
43 |
44 | local cmp = require("cmp")
45 | local luasnip = require("luasnip")
46 | -- local diagnostics_options = require("config.defaults").diagnostics_options
47 |
48 | return {
49 | snippet = {
50 | expand = function(args)
51 | -- For `luasnip` user.
52 | luasnip.lsp_expand(args.body)
53 | end,
54 | },
55 | -- window = {
56 | -- completion = { border = diagnostics_options.float.border },
57 | -- documentation = { border = diagnostics_options.float.border },
58 | -- },
59 | formatting = {
60 | format = function(entry, vim_item)
61 | local icons = require("config.defaults").icons.kinds
62 | -- Kind icons
63 | -- This concatonates the icons with the name of the item kind
64 | vim_item.kind = string.format(
65 | "%s",
66 | icons[vim_item.kind],
67 | vim_item.kind
68 | )
69 | -- Source
70 | vim_item.menu = ({
71 | buffer = "[Buffer]",
72 | nvim_lsp = "[LSP]",
73 | luasnip = "[LuaSnip]",
74 | nvim_lua = "[Lua]",
75 | path = "[Path]",
76 | emoji = "[Emoji]",
77 | neorg = "[Neorg]",
78 | spell = "[Spell]",
79 | })[entry.source.name]
80 | return vim_item
81 | end,
82 | },
83 | mapping = cmp.mapping.preset.insert({
84 | [""] = cmp.mapping.scroll_docs(-4),
85 | [""] = cmp.mapping.scroll_docs(4),
86 | [""] = cmp.mapping.complete({
87 | TriggerOnly = "triggerOnly",
88 | }),
89 | [""] = cmp.mapping.select_next_item(),
90 | [""] = cmp.mapping.select_prev_item(),
91 | [""] = cmp.mapping({
92 | i = cmp.mapping.abort(),
93 | c = cmp.mapping.close(),
94 | }),
95 | [""] = cmp.mapping.confirm({ select = false }),
96 | [""] = cmp.mapping(function(fallback)
97 | if cmp.visible() then
98 | cmp.select_next_item()
99 | elseif luasnip.expand_or_jumpable() then
100 | luasnip.expand_or_jump()
101 | elseif has_words_before() then
102 | cmp.complete()
103 | else
104 | -- The fallback function sends a already mapped key. In this case, it's probably ``.
105 | fallback()
106 | end
107 | end, { "i", "s" }),
108 | [""] = cmp.mapping(function(fallback)
109 | if cmp.visible() then
110 | cmp.select_prev_item()
111 | elseif luasnip.jumpable(-1) then
112 | luasnip.jump(-1)
113 | else
114 | fallback()
115 | end
116 | end, { "i", "s" }),
117 | }),
118 | sources = cmp.config.sources({
119 | { name = "nvim_lsp" },
120 | { name = "buffer" },
121 | { name = "luasnip" },
122 | { name = "path" },
123 | { name = "nvim_lua" },
124 | { name = "emoji" },
125 | { name = "neorg" },
126 | }),
127 | }
128 | end,
129 | config = function(_, opts)
130 | local cmp = require("cmp")
131 | cmp.setup(opts)
132 |
133 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
134 | cmp.setup.cmdline({ "/", "?" }, {
135 | mapping = cmp.mapping.preset.cmdline(),
136 | sources = {
137 | { name = "buffer" },
138 | },
139 | })
140 |
141 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
142 | cmp.setup.cmdline(":", {
143 | mapping = cmp.mapping.preset.cmdline(),
144 | sources = {
145 | { name = "path" },
146 | { name = "cmdline" },
147 | },
148 | })
149 | end,
150 | },
151 | }
152 |
--------------------------------------------------------------------------------
/lua/plugins/dap.lua:
--------------------------------------------------------------------------------
1 | return {
2 | {
3 | "mfussenegger/nvim-dap",
4 | keys = {
5 | {
6 | "dR",
7 | function()
8 | require("dap").run_to_cursor()
9 | end,
10 | desc = "Run to Cursor",
11 | },
12 | {
13 | "dE",
14 | function()
15 | require("dapui").eval(vim.fn.input("[Expression] > "))
16 | end,
17 | desc = "Evaluate Input",
18 | },
19 | {
20 | "de",
21 | function()
22 | require("dapui").eval()
23 | end,
24 | mode = { "n", "v" },
25 | desc = "Evaluate",
26 | },
27 | {
28 | "dC",
29 | function()
30 | require("dap").set_breakpoint(
31 | vim.fn.input("[Condition] > ")
32 | )
33 | end,
34 | desc = "Conditional Breakpoint",
35 | },
36 | {
37 | "dL",
38 | function()
39 | require("dap").set_breakpoint(
40 | nil,
41 | nil,
42 | vim.fn.input("Log point message: ")
43 | )
44 | end,
45 | silent = true,
46 | desc = "Set Breakpoint",
47 | },
48 | {
49 | "