unfuck
This commit is contained in:
parent
df684cc700
commit
0bd393476c
6
config/nvim/.stylua.toml
Normal file
6
config/nvim/.stylua.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 3
|
||||
quote_style = "AutoPreferDouble"
|
||||
no_call_parentheses = true
|
674
config/nvim/LICENSE
Normal file
674
config/nvim/LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
12
config/nvim/examples/chadrc.lua
Normal file
12
config/nvim/examples/chadrc.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- Just an example, supposed to be placed in /lua/custom/
|
||||
|
||||
local M = {}
|
||||
|
||||
-- make sure you maintain the structure of `core/default_config.lua` here,
|
||||
-- example of changing theme:
|
||||
|
||||
M.ui = {
|
||||
theme = "gruvchad",
|
||||
}
|
||||
|
||||
return M
|
11
config/nvim/examples/init.lua
Normal file
11
config/nvim/examples/init.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- Please check NvChad docs if you're totally new to nvchad + dont know lua!!
|
||||
-- This is an example init file in /lua/custom/
|
||||
-- this init.lua can load stuffs etc too so treat it like your ~/.config/nvim/
|
||||
|
||||
-- MAPPINGS
|
||||
local map = require("core.utils").map
|
||||
|
||||
map("n", "<leader>cc", ":Telescope <CR>")
|
||||
map("n", "<leader>q", ":q <CR>")
|
||||
|
||||
-- NOTE: the 4th argument in the map function is be a table i.e options but its most likely un-needed so dont worry about it
|
31
config/nvim/init.lua
Normal file
31
config/nvim/init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local present, impatient = pcall(require, "impatient")
|
||||
|
||||
if present then
|
||||
impatient.enable_profile()
|
||||
end
|
||||
|
||||
local core_modules = {
|
||||
"core.options",
|
||||
"core.autocmds",
|
||||
"core.mappings",
|
||||
}
|
||||
|
||||
for _, module in ipairs(core_modules) do
|
||||
local ok, err = pcall(require, module)
|
||||
if not ok then
|
||||
error("Error loading " .. module .. "\n\n" .. err)
|
||||
end
|
||||
end
|
||||
|
||||
-- non plugin mappings
|
||||
require("core.mappings").misc()
|
||||
|
||||
-- check if custom init.lua file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/init.lua") == 1 then
|
||||
-- try to call custom init, if not successful, show error
|
||||
local ok, err = pcall(require, "custom")
|
||||
if not ok then
|
||||
vim.notify("Error loading custom/init.lua\n\n" .. err)
|
||||
end
|
||||
return
|
||||
end
|
168
config/nvim/lua/colors/highlights.lua
Normal file
168
config/nvim/lua/colors/highlights.lua
Normal file
|
@ -0,0 +1,168 @@
|
|||
local cmd = vim.cmd
|
||||
|
||||
local colors = require("colors").get()
|
||||
local ui = require("core.utils").load_config().ui
|
||||
|
||||
local black = colors.black
|
||||
local black2 = colors.black2
|
||||
local blue = colors.blue
|
||||
local darker_black = colors.darker_black
|
||||
local folder_bg = colors.folder_bg
|
||||
local green = colors.green
|
||||
local grey = colors.grey
|
||||
local grey_fg = colors.grey_fg
|
||||
local light_grey = colors.light_grey
|
||||
local line = colors.line
|
||||
local nord_blue = colors.nord_blue
|
||||
local one_bg = colors.one_bg
|
||||
local one_bg2 = colors.one_bg2
|
||||
local pmenu_bg = colors.pmenu_bg
|
||||
local purple = colors.purple
|
||||
local red = colors.red
|
||||
local white = colors.white
|
||||
local yellow = colors.yellow
|
||||
local orange = colors.orange
|
||||
local one_bg3 = colors.one_bg3
|
||||
|
||||
-- functions for setting highlights
|
||||
local fg = require("core.utils").fg
|
||||
local fg_bg = require("core.utils").fg_bg
|
||||
local bg = require("core.utils").bg
|
||||
|
||||
-- Comments
|
||||
if ui.italic_comments then
|
||||
fg("Comment", grey_fg .. " gui=italic")
|
||||
else
|
||||
fg("Comment", grey_fg)
|
||||
end
|
||||
|
||||
-- Disable cursor line
|
||||
cmd "hi clear CursorLine"
|
||||
-- Line number
|
||||
fg("cursorlinenr", white)
|
||||
|
||||
-- same it bg, so it doesn't appear
|
||||
fg("EndOfBuffer", black)
|
||||
|
||||
-- For floating windows
|
||||
fg("FloatBorder", blue)
|
||||
bg("NormalFloat", darker_black)
|
||||
|
||||
-- Pmenu
|
||||
bg("Pmenu", one_bg)
|
||||
bg("PmenuSbar", one_bg2)
|
||||
bg("PmenuSel", pmenu_bg)
|
||||
bg("PmenuThumb", nord_blue)
|
||||
fg("CmpItemAbbr", white)
|
||||
fg("CmpItemAbbrMatch", white)
|
||||
fg("CmpItemKind", white)
|
||||
fg("CmpItemMenu", white)
|
||||
|
||||
-- misc
|
||||
|
||||
-- inactive statuslines as thin lines
|
||||
fg("StatusLineNC", one_bg3 .. " gui=underline")
|
||||
|
||||
fg("LineNr", grey)
|
||||
fg("NvimInternalError", red)
|
||||
fg("VertSplit", one_bg2)
|
||||
|
||||
if ui.transparency then
|
||||
bg("Normal", "NONE")
|
||||
bg("Folded", "NONE")
|
||||
fg("Folded", "NONE")
|
||||
fg("Comment", grey)
|
||||
end
|
||||
|
||||
-- [[ Plugin Highlights
|
||||
|
||||
-- Dashboard
|
||||
fg("AlphaHeader", grey_fg)
|
||||
fg("AlphaButtons", light_grey)
|
||||
|
||||
-- Git signs
|
||||
fg_bg("DiffAdd", blue, "NONE")
|
||||
fg_bg("DiffChange", grey_fg, "NONE")
|
||||
fg_bg("DiffChangeDelete", red, "NONE")
|
||||
fg_bg("DiffModified", red, "NONE")
|
||||
fg_bg("DiffDelete", red, "NONE")
|
||||
|
||||
-- Indent blankline plugin
|
||||
fg("IndentBlanklineChar", line)
|
||||
fg("IndentBlanklineSpaceChar", line)
|
||||
|
||||
-- Lsp diagnostics
|
||||
|
||||
fg("DiagnosticHint", purple)
|
||||
fg("DiagnosticError", red)
|
||||
fg("DiagnosticWarn", yellow)
|
||||
fg("DiagnosticInformation", green)
|
||||
|
||||
-- NvimTree
|
||||
fg("NvimTreeEmptyFolderName", folder_bg)
|
||||
fg("NvimTreeEndOfBuffer", darker_black)
|
||||
fg("NvimTreeFolderIcon", folder_bg)
|
||||
fg("NvimTreeFolderName", folder_bg)
|
||||
fg("NvimTreeGitDirty", red)
|
||||
fg("NvimTreeIndentMarker", one_bg2)
|
||||
bg("NvimTreeNormal", darker_black)
|
||||
bg("NvimTreeNormalNC", darker_black)
|
||||
fg("NvimTreeOpenedFolderName", folder_bg)
|
||||
fg("NvimTreeRootFolder", red .. " gui=underline") -- enable underline for root folder in nvim tree
|
||||
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
|
||||
fg_bg("NvimTreeVertSplit", darker_black, darker_black)
|
||||
fg_bg("NvimTreeWindowPicker", red, black2)
|
||||
|
||||
-- Telescope
|
||||
fg_bg("TelescopeBorder", darker_black, darker_black)
|
||||
fg_bg("TelescopePromptBorder", black2, black2)
|
||||
|
||||
fg_bg("TelescopePromptNormal", white, black2)
|
||||
fg_bg("TelescopePromptPrefix", red, black2)
|
||||
|
||||
bg("TelescopeNormal", darker_black)
|
||||
|
||||
fg_bg("TelescopePreviewTitle", black, green)
|
||||
fg_bg("TelescopePromptTitle", black, red)
|
||||
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
|
||||
|
||||
bg("TelescopeSelection", black2)
|
||||
|
||||
-- keybinds cheatsheet
|
||||
|
||||
fg_bg("CheatsheetBorder", black, black)
|
||||
bg("CheatsheetSectionContent", black)
|
||||
fg("CheatsheetHeading", white)
|
||||
|
||||
local section_title_colors = {
|
||||
white,
|
||||
blue,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
purple,
|
||||
orange,
|
||||
}
|
||||
for i, color in ipairs(section_title_colors) do
|
||||
vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black)
|
||||
end
|
||||
|
||||
-- Disable some highlight in nvim tree if transparency enabled
|
||||
if ui.transparency then
|
||||
bg("NormalFloat", "NONE")
|
||||
bg("NvimTreeNormal", "NONE")
|
||||
bg("NvimTreeNormalNC", "NONE")
|
||||
bg("NvimTreeStatusLineNC", "NONE")
|
||||
fg_bg("NvimTreeVertSplit", grey, "NONE")
|
||||
|
||||
-- telescope
|
||||
bg("TelescopeBorder", "NONE")
|
||||
bg("TelescopePrompt", "NONE")
|
||||
bg("TelescopeResults", "NONE")
|
||||
bg("TelescopePromptBorder", "NONE")
|
||||
bg("TelescopePromptNormal", "NONE")
|
||||
bg("TelescopeNormal", "NONE")
|
||||
bg("TelescopePromptPrefix", "NONE")
|
||||
fg("TelescopeBorder", one_bg)
|
||||
fg_bg("TelescopeResultsTitle", black, blue)
|
||||
end
|
52
config/nvim/lua/colors/init.lua
Normal file
52
config/nvim/lua/colors/init.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
local colors = require("core.utils").load_config().ui.colors
|
||||
local override = require("core.utils").load_config().ui.hl_override
|
||||
|
||||
local M = {}
|
||||
|
||||
-- if theme given, load given theme if given, otherwise nvchad_theme
|
||||
M.init = function(theme)
|
||||
if not theme then
|
||||
theme = require("core.utils").load_config().ui.theme
|
||||
end
|
||||
|
||||
-- set the global theme, used at various places like theme switcher, highlights
|
||||
vim.g.nvchad_theme = theme
|
||||
|
||||
local present, base16 = pcall(require, "base16")
|
||||
|
||||
if present then
|
||||
-- first load the base16 theme
|
||||
local ok, array = pcall(base16.themes, theme)
|
||||
|
||||
if ok then
|
||||
base16(array, true)
|
||||
-- unload to force reload
|
||||
package.loaded["colors.highlights" or false] = nil
|
||||
-- then load the highlights
|
||||
require "colors.highlights"
|
||||
else
|
||||
pcall(vim.cmd, "colo " .. theme)
|
||||
end
|
||||
else
|
||||
pcall(vim.cmd, "colo " .. theme)
|
||||
end
|
||||
|
||||
if #override ~= 0 then
|
||||
package.loaded[override] = nil
|
||||
require(override)
|
||||
end
|
||||
end
|
||||
|
||||
-- returns a table of colors for given or current theme
|
||||
M.get = function(theme)
|
||||
if #colors ~= 0 then
|
||||
return require(colors)
|
||||
else
|
||||
if not theme then
|
||||
theme = vim.g.nvchad_theme
|
||||
end
|
||||
return require("hl_themes." .. theme)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
22
config/nvim/lua/core/autocmds.lua
Normal file
22
config/nvim/lua/core/autocmds.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
local settings=require("core.utils").load_config().options.nvChad
|
||||
-- uncomment this if you want to open nvim with a dir
|
||||
-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]]
|
||||
|
||||
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
|
||||
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
|
||||
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
|
||||
|
||||
-- Don't show any numbers inside terminals
|
||||
if not settings.terminal_numbers then
|
||||
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]]
|
||||
end
|
||||
|
||||
-- Don't show status line on certain windows
|
||||
if not require("core.utils").load_config().plugins.options.statusline.hide_disable then
|
||||
vim.cmd [[ autocmd BufEnter,BufRead,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]]
|
||||
end
|
||||
|
||||
-- Open a file from its last left off position
|
||||
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
|
||||
-- File extension specific tabbing
|
||||
-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
|
279
config/nvim/lua/core/default_config.lua
Normal file
279
config/nvim/lua/core/default_config.lua
Normal file
|
@ -0,0 +1,279 @@
|
|||
-- IMPORTANT NOTE : This is default config, so dont change anything here.
|
||||
-- use custom/chadrc.lua instead
|
||||
|
||||
local M = {}
|
||||
|
||||
M.options = {
|
||||
-- custom = {}
|
||||
-- general nvim/vim options , check :h optionname to know more about an option
|
||||
|
||||
clipboard = "unnamedplus",
|
||||
cmdheight = 1,
|
||||
ruler = false,
|
||||
hidden = true,
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
mapleader = " ",
|
||||
mouse = "a",
|
||||
number = true,
|
||||
numberwidth = 2,
|
||||
relativenumber = false,
|
||||
expandtab = true,
|
||||
shiftwidth = 2,
|
||||
smartindent = true,
|
||||
tabstop = 8,
|
||||
timeoutlen = 400,
|
||||
updatetime = 250,
|
||||
undofile = true,
|
||||
fillchars = { eob = " " },
|
||||
shadafile = vim.opt.shadafile,
|
||||
|
||||
-- NvChad options
|
||||
nvChad = {
|
||||
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
|
||||
copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
|
||||
insert_nav = true, -- navigation in insertmode
|
||||
window_nav = true,
|
||||
terminal_numbers = false,
|
||||
|
||||
-- updater
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "main",
|
||||
},
|
||||
terminal = {
|
||||
behavior = {
|
||||
close_on_exit = true,
|
||||
},
|
||||
window = {
|
||||
vsplit_ratio = 0.5,
|
||||
split_ratio = 0.4,
|
||||
},
|
||||
location = {
|
||||
horizontal = "rightbelow",
|
||||
vertical = "rightbelow",
|
||||
float = {
|
||||
relative = 'editor',
|
||||
row = 0.3,
|
||||
col = 0.25,
|
||||
width = 0.5,
|
||||
height = 0.4,
|
||||
border = "single",
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
---- UI -----
|
||||
|
||||
M.ui = {
|
||||
hl_override = "", -- path of your file that contains highlights
|
||||
colors = "", -- path of your file that contains colors
|
||||
italic_comments = false,
|
||||
theme = "onedark", -- default theme
|
||||
|
||||
-- Change terminal bg to nvim theme's bg color so it'll match well
|
||||
-- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
|
||||
transparency = false,
|
||||
}
|
||||
|
||||
---- PLUGIN OPTIONS ----
|
||||
|
||||
M.plugins = {
|
||||
|
||||
-- builtin nvim plugins are disabled
|
||||
builtins = {
|
||||
"2html_plugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
},
|
||||
|
||||
-- enable/disable plugins (false for disable)
|
||||
status = {
|
||||
blankline = true, -- indentline stuff
|
||||
bufferline = true, -- manage and preview opened buffers
|
||||
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
|
||||
comment = true, -- easily (un)comment code, language aware
|
||||
alpha = false, -- dashboard
|
||||
better_escape = true, -- map to <ESC> with no lag
|
||||
feline = true, -- statusline
|
||||
gitsigns = true,
|
||||
lspsignature = true, -- lsp enhancements
|
||||
vim_matchup = true, -- improved matchit
|
||||
cmp = true,
|
||||
nvimtree = true,
|
||||
autopairs = true,
|
||||
},
|
||||
options = {
|
||||
packer = {
|
||||
init_file = "plugins.packerInit",
|
||||
},
|
||||
autopairs = { loadAfter = "nvim-cmp" },
|
||||
cmp = {
|
||||
lazy_load = true,
|
||||
},
|
||||
lspconfig = {
|
||||
setup_lspconf = "", -- path of file containing setups of different lsps
|
||||
},
|
||||
nvimtree = {
|
||||
-- packerCompile required after changing lazy_load
|
||||
lazy_load = true,
|
||||
},
|
||||
luasnip = {
|
||||
snippet_path = {},
|
||||
},
|
||||
statusline = {
|
||||
hide_disable = false,
|
||||
-- hide, show on specific filetypes
|
||||
hidden = {
|
||||
"help",
|
||||
"NvimTree",
|
||||
"terminal",
|
||||
"alpha",
|
||||
},
|
||||
shown = {},
|
||||
|
||||
-- truncate statusline on small screens
|
||||
shortline = true,
|
||||
style = "default", -- default, round , slant , block , arrow
|
||||
},
|
||||
esc_insertmode_timeout = 300,
|
||||
},
|
||||
default_plugin_config_replace = {},
|
||||
default_plugin_remove = {},
|
||||
install = nil,
|
||||
}
|
||||
|
||||
-- Don't use a single keymap twice
|
||||
|
||||
--- MAPPINGS ----
|
||||
|
||||
-- non plugin
|
||||
M.mappings = {
|
||||
-- custom = {}, -- custom user mappings
|
||||
|
||||
misc = {
|
||||
cheatsheet = "<leader>ch",
|
||||
close_buffer = "<leader>x",
|
||||
cp_whole_file = "<C-c>", -- copy all contents of current buffer
|
||||
lineNR_toggle = "<leader>n", -- toggle line number
|
||||
lineNR_rel_toggle = "<leader>rn",
|
||||
update_nvchad = "<leader>uu",
|
||||
new_buffer = "<S-t>",
|
||||
new_tab = "<C-t>b",
|
||||
save_file = "<C-s>", -- save file using :w
|
||||
},
|
||||
|
||||
-- navigation in insert mode, only if enabled in options
|
||||
|
||||
insert_nav = {
|
||||
backward = "<C-h>",
|
||||
end_of_line = "<C-e>",
|
||||
forward = "<C-l>",
|
||||
next_line = "<C-j>",
|
||||
prev_line = "<C-k>",
|
||||
beginning_of_line = "<C-a>",
|
||||
},
|
||||
|
||||
-- better window movement
|
||||
window_nav = {
|
||||
moveLeft = "<C-h>",
|
||||
moveRight = "<C-l>",
|
||||
moveUp = "<C-k>",
|
||||
moveDown = "<C-j>",
|
||||
},
|
||||
|
||||
-- terminal related mappings
|
||||
terminal = {
|
||||
-- multiple mappings can be given for esc_termmode, esc_hide_termmode
|
||||
|
||||
-- get out of terminal mode
|
||||
esc_termmode = { "jk" },
|
||||
|
||||
-- get out of terminal mode and hide it
|
||||
esc_hide_termmode = { "JK" },
|
||||
-- show & recover hidden terminal buffers in a telescope picker
|
||||
pick_term = "<leader>W",
|
||||
|
||||
-- spawn a single terminal and toggle it
|
||||
-- this just works like toggleterm kinda
|
||||
new_horizontal = "<leader>h",
|
||||
new_vertical = "<leader>v",
|
||||
new_float = "<A-i>",
|
||||
|
||||
-- spawn new terminals
|
||||
spawn_horizontal = "<A-h>",
|
||||
spawn_vertical = "<A-v>",
|
||||
spawn_window = "<leader>w",
|
||||
},
|
||||
}
|
||||
|
||||
-- plugins related mappings
|
||||
-- To disable a mapping, equate the variable to "" or false or nil in chadrc
|
||||
M.mappings.plugins = {
|
||||
bufferline = {
|
||||
next_buffer = "<TAB>",
|
||||
prev_buffer = "<S-Tab>",
|
||||
},
|
||||
comment = {
|
||||
toggle = "<leader>/",
|
||||
},
|
||||
|
||||
-- map to <ESC> with no lag
|
||||
better_escape = { -- <ESC> will still work
|
||||
esc_insertmode = { "jk" }, -- multiple mappings allowed
|
||||
},
|
||||
|
||||
lspconfig = {
|
||||
declaration = "gD",
|
||||
definition = "gd",
|
||||
hover = "K",
|
||||
implementation = "gi",
|
||||
signature_help = "gk",
|
||||
add_workspace_folder = "<leader>wa",
|
||||
remove_workspace_folder = "<leader>wr",
|
||||
list_workspace_folders = "<leader>wl",
|
||||
type_definition = "<leader>D",
|
||||
rename = "<leader>ra",
|
||||
code_action = "<leader>ca",
|
||||
references = "gr",
|
||||
float_diagnostics = "ge",
|
||||
goto_prev = "[d",
|
||||
goto_next = "]d",
|
||||
set_loclist = "<leader>q",
|
||||
formatting = "<leader>fm",
|
||||
},
|
||||
|
||||
nvimtree = {
|
||||
toggle = "<C-n>",
|
||||
focus = "<leader>e",
|
||||
},
|
||||
|
||||
telescope = {
|
||||
buffers = "<leader>fb",
|
||||
find_files = "<leader>ff",
|
||||
find_hiddenfiles = "<leader>fa",
|
||||
git_commits = "<leader>cm",
|
||||
git_status = "<leader>gt",
|
||||
help_tags = "<leader>fh",
|
||||
live_grep = "<leader>fw",
|
||||
oldfiles = "<leader>fo",
|
||||
themes = "<leader>th", -- NvChad theme picker
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
207
config/nvim/lua/core/mappings.lua
Normal file
207
config/nvim/lua/core/mappings.lua
Normal file
|
@ -0,0 +1,207 @@
|
|||
local utils = require "core.utils"
|
||||
|
||||
local config = utils.load_config()
|
||||
local map_wrapper = utils.map
|
||||
|
||||
local maps = config.mappings
|
||||
local plugin_maps = maps.plugins
|
||||
local nvChad_options = config.options.nvChad
|
||||
local terminal_options = config.options.terminal
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- This is a wrapper function made to disable a plugin mapping from chadrc
|
||||
-- If keys are nil, false or empty string, then the mapping will be not applied
|
||||
-- Useful when one wants to use that keymap for any other purpose
|
||||
local map = function(...)
|
||||
local keys = select(2, ...)
|
||||
if not keys or keys == "" then
|
||||
return
|
||||
end
|
||||
map_wrapper(...)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
-- these mappings will only be called during initialization
|
||||
M.misc = function()
|
||||
local function non_config_mappings()
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
map_wrapper("v", "p", "p:let @+=@0<CR>")
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using :map
|
||||
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
||||
map_wrapper({ "n", "x", "o" }, "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||
map_wrapper({ "n", "x", "o" }, "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||
map_wrapper("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||
map_wrapper("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||
|
||||
-- use ESC to turn off search highlighting
|
||||
map_wrapper("n", "<Esc>", ":noh <CR>")
|
||||
|
||||
-- center cursor when moving (goto_definition)
|
||||
end
|
||||
|
||||
local function optional_mappings()
|
||||
-- don't yank text on cut ( x )
|
||||
if not nvChad_options.copy_cut then
|
||||
map_wrapper({ "n", "v" }, "x", '"_x')
|
||||
end
|
||||
|
||||
-- don't yank text on delete ( dd )
|
||||
if not nvChad_options.copy_del then
|
||||
map_wrapper({ "n", "v" }, "d", '"_d')
|
||||
end
|
||||
|
||||
-- navigation within insert mode
|
||||
if nvChad_options.insert_nav then
|
||||
local inav = maps.insert_nav
|
||||
|
||||
map("i", inav.backward, "<Left>")
|
||||
map("i", inav.end_of_line, "<End>")
|
||||
map("i", inav.forward, "<Right>")
|
||||
map("i", inav.next_line, "<Down>")
|
||||
map("i", inav.prev_line, "<Up>")
|
||||
map("i", inav.beginning_of_line, "<ESC>^i")
|
||||
end
|
||||
|
||||
-- easier navigation between windows
|
||||
if nvChad_options.window_nav then
|
||||
local wnav = maps.window_nav
|
||||
|
||||
map("n", wnav.moveLeft, "<C-w>h")
|
||||
map("n", wnav.moveRight, "<C-w>l")
|
||||
map("n", wnav.moveUp, "<C-w>k")
|
||||
map("n", wnav.moveDown, "<C-w>j")
|
||||
end
|
||||
end
|
||||
|
||||
local function required_mappings()
|
||||
map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() <CR>") -- show keybinds
|
||||
map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
|
||||
map("n", maps.misc.cp_whole_file, ":%y+ <CR>") -- copy whole file content
|
||||
map("n", maps.misc.new_buffer, ":enew <CR>") -- new buffer
|
||||
map("n", maps.misc.new_tab, ":tabnew <CR>") -- new tabs
|
||||
map("n", maps.misc.lineNR_toggle, ":set nu! <CR>")
|
||||
map("n", maps.misc.lineNR_rel_toggle, ":set rnu! <CR>") -- relative line numbers
|
||||
map("n", maps.misc.save_file, ":w <CR>") -- ctrl + s to save file
|
||||
|
||||
-- terminal mappings --
|
||||
local term_maps = maps.terminal
|
||||
-- get out of terminal mode
|
||||
map("t", term_maps.esc_termmode, "<C-\\><C-n>")
|
||||
-- hide a term from within terminal mode
|
||||
map("t", term_maps.esc_hide_termmode, "<CMD>lua require('nvchad.terminal').hide() <CR>")
|
||||
-- pick a hidden term
|
||||
map("n", term_maps.pick_term, ":Telescope terms <CR>")
|
||||
-- Open terminals
|
||||
-- TODO this opens on top of an existing vert/hori term, fixme
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_horizontal,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('horizontal', "
|
||||
.. tostring(terminal_options.window.split_height)
|
||||
.. ")<CR>"
|
||||
)
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_vertical,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('vertical', "
|
||||
.. tostring(terminal_options.window.vsplit_width)
|
||||
.. ")<CR>"
|
||||
)
|
||||
map(
|
||||
{ "n", "t" },
|
||||
term_maps.new_float,
|
||||
"<CMD>lua require('nvchad.terminal').new_or_toggle('float')<CR>"
|
||||
)
|
||||
|
||||
-- spawns terminals
|
||||
map(
|
||||
"n",
|
||||
term_maps.spawn_horizontal,
|
||||
":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>"
|
||||
)
|
||||
map("n", term_maps.spawn_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>")
|
||||
map("n", term_maps.spawn_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>")
|
||||
|
||||
-- terminal mappings end --
|
||||
|
||||
-- Add Packer commands because we are not loading it at startup
|
||||
cmd "silent! command PackerClean lua require 'plugins' require('packer').clean()"
|
||||
cmd "silent! command PackerCompile lua require 'plugins' require('packer').compile()"
|
||||
cmd "silent! command PackerInstall lua require 'plugins' require('packer').install()"
|
||||
cmd "silent! command PackerStatus lua require 'plugins' require('packer').status()"
|
||||
cmd "silent! command PackerSync lua require 'plugins' require('packer').sync()"
|
||||
cmd "silent! command PackerUpdate lua require 'plugins' require('packer').update()"
|
||||
|
||||
-- add NvChadUpdate command and mapping
|
||||
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
||||
map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
|
||||
end
|
||||
|
||||
non_config_mappings()
|
||||
optional_mappings()
|
||||
required_mappings()
|
||||
end
|
||||
|
||||
-- below are all plugin related mappings
|
||||
|
||||
M.bufferline = function()
|
||||
local m = plugin_maps.bufferline
|
||||
|
||||
map("n", m.next_buffer, ":BufferLineCycleNext <CR>")
|
||||
map("n", m.prev_buffer, ":BufferLineCyclePrev <CR>")
|
||||
end
|
||||
|
||||
M.comment = function()
|
||||
local m = plugin_maps.comment.toggle
|
||||
map("n", m, ":lua require('Comment.api').toggle_current_linewise()<CR>")
|
||||
map("v", m, ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>")
|
||||
end
|
||||
|
||||
M.lspconfig = function()
|
||||
local m = plugin_maps.lspconfig
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
map("n", m.declaration, "<cmd>lua vim.lsp.buf.declaration()<CR>")
|
||||
map("n", m.definition, "<cmd>lua vim.lsp.buf.definition()<CR>")
|
||||
map("n", m.hover, "<cmd>lua vim.lsp.buf.hover()<CR>")
|
||||
map("n", m.implementation, "<cmd>lua vim.lsp.buf.implementation()<CR>")
|
||||
map("n", m.signature_help, "<cmd>lua vim.lsp.buf.signature_help()<CR>")
|
||||
map("n", m.add_workspace_folder, "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
|
||||
map("n", m.remove_workspace_folder, "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
|
||||
map("n", m.list_workspace_folders, "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
|
||||
map("n", m.type_definition, "<cmd>lua vim.lsp.buf.type_definition()<CR>")
|
||||
map("n", m.rename, "<cmd>lua vim.lsp.buf.rename()<CR>")
|
||||
map("n", m.code_action, "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||
map("n", m.references, "<cmd>lua vim.lsp.buf.references()<CR>")
|
||||
map("n", m.float_diagnostics, "<cmd>lua vim.diagnostic.open_float()<CR>")
|
||||
map("n", m.goto_prev, "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
||||
map("n", m.goto_next, "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
||||
map("n", m.set_loclist, "<cmd>lua vim.diagnostic.setloclist()<CR>")
|
||||
map("n", m.formatting, "<cmd>lua vim.lsp.buf.formatting()<CR>")
|
||||
end
|
||||
|
||||
M.nvimtree = function()
|
||||
map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle <CR>")
|
||||
map("n", plugin_maps.nvimtree.focus, ":NvimTreeFocus <CR>")
|
||||
end
|
||||
|
||||
M.telescope = function()
|
||||
local m = plugin_maps.telescope
|
||||
|
||||
map("n", m.buffers, ":Telescope buffers <CR>")
|
||||
map("n", m.find_files, ":Telescope find_files <CR>")
|
||||
map("n", m.find_hiddenfiles, ":Telescope find_files follow=true no_ignore=true hidden=true <CR>")
|
||||
map("n", m.git_commits, ":Telescope git_commits <CR>")
|
||||
map("n", m.git_status, ":Telescope git_status <CR>")
|
||||
map("n", m.help_tags, ":Telescope help_tags <CR>")
|
||||
map("n", m.live_grep, ":Telescope live_grep <CR>")
|
||||
map("n", m.oldfiles, ":Telescope oldfiles <CR>")
|
||||
map("n", m.themes, ":Telescope themes <CR>")
|
||||
end
|
||||
|
||||
return M
|
63
config/nvim/lua/core/options.lua
Normal file
63
config/nvim/lua/core/options.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
local options = require("core.utils").load_config().options
|
||||
|
||||
opt.title = true
|
||||
opt.clipboard = options.clipboard
|
||||
opt.cmdheight = options.cmdheight
|
||||
opt.cul = true -- cursor line
|
||||
|
||||
-- Indentline
|
||||
opt.expandtab = options.expandtab
|
||||
opt.shiftwidth = options.shiftwidth
|
||||
opt.smartindent = options.smartindent
|
||||
|
||||
-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758
|
||||
opt.fillchars = options.fillchars
|
||||
|
||||
opt.hidden = options.hidden
|
||||
opt.ignorecase = options.ignorecase
|
||||
opt.smartcase = options.smartcase
|
||||
opt.mouse = options.mouse
|
||||
|
||||
-- Numbers
|
||||
opt.number = options.number
|
||||
opt.numberwidth = options.numberwidth
|
||||
opt.relativenumber = options.relativenumber
|
||||
opt.ruler = options.ruler
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.tabstop = options.tabstop
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = options.timeoutlen
|
||||
opt.undofile = options.undofile
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = options.updatetime
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = options.mapleader
|
||||
|
||||
-- disable some builtin vim plugins
|
||||
local disabled_built_ins = require("core.utils").load_config().plugins.builtins
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
--Defer loading shada until after startup_
|
||||
vim.opt.shadafile = "NONE"
|
||||
|
||||
vim.schedule(function()
|
||||
vim.opt.shadafile = require("core.utils").load_config().options.shadafile
|
||||
vim.cmd [[ silent! rsh ]]
|
||||
end)
|
321
config/nvim/lua/core/utils.lua
Normal file
321
config/nvim/lua/core/utils.lua
Normal file
|
@ -0,0 +1,321 @@
|
|||
local M = {}
|
||||
|
||||
local cmd = vim.cmd
|
||||
M.close_buffer = function(force)
|
||||
-- This is a modification of a NeoVim plugin from
|
||||
-- Author: ojroques - Olivier Roques
|
||||
-- Src: https://github.com/ojroques/nvim-bufdel
|
||||
-- (Author has okayed copy-paste)
|
||||
|
||||
-- Options
|
||||
local opts = {
|
||||
next = "cycle", -- how to retrieve the next buffer
|
||||
quit = false, -- exit when last buffer is deleted
|
||||
--TODO make this a chadrc flag/option
|
||||
}
|
||||
|
||||
-- ----------------
|
||||
-- Helper functions
|
||||
-- ----------------
|
||||
|
||||
-- Switch to buffer 'buf' on each window from list 'windows'
|
||||
local function switch_buffer(windows, buf)
|
||||
local cur_win = vim.fn.winnr()
|
||||
for _, winid in ipairs(windows) do
|
||||
winid = tonumber(winid) or 0
|
||||
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
|
||||
vim.cmd(string.format("buffer %d", buf))
|
||||
end
|
||||
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
|
||||
end
|
||||
|
||||
-- Select the first buffer with a number greater than given buffer
|
||||
local function get_next_buf(buf)
|
||||
local next = vim.fn.bufnr "#"
|
||||
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
for i = 0, vim.fn.bufnr "$" - 1 do
|
||||
next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
|
||||
if vim.fn.buflisted(next) == 1 then
|
||||
return next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ----------------
|
||||
-- End helper functions
|
||||
-- ----------------
|
||||
|
||||
local buf = vim.fn.bufnr()
|
||||
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
|
||||
vim.cmd "close"
|
||||
return
|
||||
end
|
||||
|
||||
if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
|
||||
if opts.quit then
|
||||
-- exit when there is only one buffer left
|
||||
if force then
|
||||
vim.cmd "qall!"
|
||||
else
|
||||
vim.cmd "confirm qall"
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local chad_term, _ = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
if chad_term then
|
||||
-- Must be a window type
|
||||
vim.cmd(string.format("setlocal nobl", buf))
|
||||
vim.cmd "enew"
|
||||
return
|
||||
end
|
||||
-- don't exit and create a new empty buffer
|
||||
vim.cmd "enew"
|
||||
vim.cmd "bp"
|
||||
end
|
||||
|
||||
local next_buf = get_next_buf(buf)
|
||||
local windows = vim.fn.getbufinfo(buf)[1].windows
|
||||
|
||||
-- force deletion of terminal buffers to avoid the prompt
|
||||
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
|
||||
local chad_term, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf, "term_type")
|
||||
end)
|
||||
|
||||
-- TODO this scope is error prone, make resilient
|
||||
if chad_term then
|
||||
if type == "wind" then
|
||||
-- hide from bufferline
|
||||
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
|
||||
-- switch to another buff
|
||||
-- TODO switch to next buffer, this works too
|
||||
vim.cmd "BufferLineCycleNext"
|
||||
else
|
||||
local cur_win = vim.fn.winnr()
|
||||
-- we can close this window
|
||||
vim.cmd(string.format("%d wincmd c", cur_win))
|
||||
return
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("bd! %d", buf))
|
||||
end
|
||||
else
|
||||
switch_buffer(windows, next_buf)
|
||||
vim.cmd(string.format("silent! confirm bd %d", buf))
|
||||
end
|
||||
-- revert buffer switches if user has canceled deletion
|
||||
if vim.fn.buflisted(buf) == 1 then
|
||||
switch_buffer(windows, buf)
|
||||
end
|
||||
end
|
||||
|
||||
-- hide statusline
|
||||
-- tables fetched from load_config function
|
||||
M.hide_statusline = function()
|
||||
local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
|
||||
local shown = require("core.utils").load_config().plugins.options.statusline.shown
|
||||
local api = vim.api
|
||||
local buftype = api.nvim_buf_get_option(0, "ft")
|
||||
|
||||
-- shown table from config has the highest priority
|
||||
if vim.tbl_contains(shown, buftype) then
|
||||
api.nvim_set_option("laststatus", 2)
|
||||
return
|
||||
end
|
||||
|
||||
if vim.tbl_contains(hidden, buftype) then
|
||||
api.nvim_set_option("laststatus", 0)
|
||||
return
|
||||
end
|
||||
|
||||
api.nvim_set_option("laststatus", 2)
|
||||
end
|
||||
|
||||
M.load_config = function()
|
||||
local conf = require "core.default_config"
|
||||
|
||||
-- attempt to load and merge a user config
|
||||
local chadrc_exists = vim.fn.filereadable(vim.fn.stdpath "config" .. "/lua/custom/chadrc.lua") == 1
|
||||
if chadrc_exists then
|
||||
-- merge user config if it exists and is a table; otherwise display an error
|
||||
local user_config = require "custom.chadrc"
|
||||
if type(user_config) == 'table' then
|
||||
conf = vim.tbl_deep_extend("force", conf, user_config)
|
||||
else
|
||||
error("User config (chadrc.lua) *must* return a table!")
|
||||
end
|
||||
end
|
||||
|
||||
return conf
|
||||
end
|
||||
|
||||
M.map = function(mode, keys, command, opt)
|
||||
local options = { noremap = true, silent = true }
|
||||
if opt then
|
||||
options = vim.tbl_extend("force", options, opt)
|
||||
end
|
||||
|
||||
-- all valid modes allowed for mappings
|
||||
-- :h map-modes
|
||||
local valid_modes = {
|
||||
[""] = true,
|
||||
["n"] = true,
|
||||
["v"] = true,
|
||||
["s"] = true,
|
||||
["x"] = true,
|
||||
["o"] = true,
|
||||
["!"] = true,
|
||||
["i"] = true,
|
||||
["l"] = true,
|
||||
["c"] = true,
|
||||
["t"] = true,
|
||||
}
|
||||
|
||||
-- helper function for M.map
|
||||
-- can gives multiple modes and keys
|
||||
local function map_wrapper(sub_mode, lhs, rhs, sub_options)
|
||||
if type(lhs) == "table" then
|
||||
for _, key in ipairs(lhs) do
|
||||
map_wrapper(sub_mode, key, rhs, sub_options)
|
||||
end
|
||||
else
|
||||
if type(sub_mode) == "table" then
|
||||
for _, m in ipairs(sub_mode) do
|
||||
map_wrapper(m, lhs, rhs, sub_options)
|
||||
end
|
||||
else
|
||||
if valid_modes[sub_mode] and lhs and rhs then
|
||||
vim.api.nvim_set_keymap(sub_mode, lhs, rhs, sub_options)
|
||||
else
|
||||
sub_mode, lhs, rhs = sub_mode or "", lhs or "", rhs or ""
|
||||
print(
|
||||
"Cannot set mapping [ mode = '" .. sub_mode .. "' | key = '" .. lhs .. "' | cmd = '" .. rhs .. "' ]"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map_wrapper(mode, keys, command, options)
|
||||
end
|
||||
|
||||
-- load plugin after entering vim ui
|
||||
M.packer_lazy_load = function(plugin, timer)
|
||||
if plugin then
|
||||
timer = timer or 0
|
||||
vim.defer_fn(function()
|
||||
require("packer").loader(plugin)
|
||||
end, timer)
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlights functions
|
||||
|
||||
-- Define bg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
|
||||
M.bg = function(group, col)
|
||||
cmd("hi " .. group .. " guibg=" .. col)
|
||||
end
|
||||
|
||||
-- Define fg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
M.fg = function(group, col)
|
||||
cmd("hi " .. group .. " guifg=" .. col)
|
||||
end
|
||||
|
||||
-- Define bg and fg color
|
||||
-- @param group Group
|
||||
-- @param fgcol Fg Color
|
||||
-- @param bgcol Bg Color
|
||||
M.fg_bg = function(group, fgcol, bgcol)
|
||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||
end
|
||||
|
||||
-- Override default config of a plugin based on the path provided in the chadrc
|
||||
-- Arguments:
|
||||
-- 1st - name of plugin
|
||||
-- 2nd - default config path
|
||||
-- 3rd - optional function name which will called from default_config path
|
||||
-- e.g: if given args - "telescope", "plugins.configs.telescope", "setup"
|
||||
-- then return "require('plugins.configs.telescope').setup()"
|
||||
-- if 3rd arg not given, then return "require('plugins.configs.telescope')"
|
||||
-- if override is a table, mark set the override flag for the default config to true
|
||||
-- override flag being true tells the plugin to call tbl_override_req as part of configuration
|
||||
|
||||
M.override_req = function(name, default_config, config_function)
|
||||
local override, apply_table_override =
|
||||
require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false"
|
||||
local result = default_config
|
||||
if type(override) == "string" and override ~= "" then
|
||||
return "require('" .. override .. "')"
|
||||
elseif type(override) == "table" then
|
||||
apply_table_override = "true"
|
||||
elseif type(override) == "function" then
|
||||
return override
|
||||
end
|
||||
|
||||
result = "('" .. result .. "')"
|
||||
if type(config_function) == "string" and config_function ~= "" then
|
||||
-- add the . to call the functions and concatenate true or false as argument
|
||||
result = result .. "." .. config_function .. "(" .. apply_table_override .. ")"
|
||||
end
|
||||
|
||||
return "require" .. result
|
||||
end
|
||||
|
||||
-- Override parts of default config of a plugin based on the table provided in the chadrc
|
||||
|
||||
-- FUNCTION: tbl_override_req, use `chadrc` plugin config override to modify default config if present
|
||||
-- name = name inside `default_config` / `chadrc`
|
||||
-- default_table = the default configuration table of the plugin
|
||||
-- returns the modified configuration table
|
||||
M.tbl_override_req = function(name, default_table)
|
||||
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] or {}
|
||||
return vim.tbl_deep_extend("force", default_table, override)
|
||||
end
|
||||
|
||||
--provide labels to plugins instead of integers
|
||||
M.label_plugins = function(plugins)
|
||||
local plugins_labeled = {}
|
||||
for _, plugin in ipairs(plugins) do
|
||||
plugins_labeled[plugin[1]] = plugin
|
||||
end
|
||||
return plugins_labeled
|
||||
end
|
||||
|
||||
-- remove plugins specified by user from the plugins table
|
||||
M.remove_default_plugins = function(plugins)
|
||||
local removals = require("core.utils").load_config().plugins.default_plugin_remove or {}
|
||||
if not vim.tbl_isempty(removals) then
|
||||
for _, plugin in pairs(removals) do
|
||||
plugins[plugin] = nil
|
||||
end
|
||||
end
|
||||
return plugins
|
||||
end
|
||||
|
||||
-- append user plugins to default plugins
|
||||
M.add_user_plugins = function(plugins)
|
||||
local user_Plugins = require("core.utils").load_config().plugins.install or {}
|
||||
if type(user_Plugins) == "string"
|
||||
then user_Plugins=require(user_Plugins)
|
||||
end
|
||||
if not vim.tbl_isempty(user_Plugins) then
|
||||
for _, v in pairs(user_Plugins) do
|
||||
plugins[v[1]] = v
|
||||
end
|
||||
end
|
||||
return plugins
|
||||
end
|
||||
|
||||
return M
|
17
config/nvim/lua/custom/chadrc.lua
Normal file
17
config/nvim/lua/custom/chadrc.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
-- Just an example, supposed to be placed in /lua/custom/
|
||||
|
||||
local M = {}
|
||||
|
||||
local userPlugins = require "custom.plugins"
|
||||
-- make sure you maintain the structure of `core/default_config.lua` here,
|
||||
-- example of changing theme:
|
||||
|
||||
M.ui = {
|
||||
theme = "tokyonight",
|
||||
}
|
||||
-- /lua/custom/chadrc.lualocal userPlugins = require "custom.plugins" -- path to table
|
||||
M.plugins = {
|
||||
install = userPlugins
|
||||
}
|
||||
|
||||
return M
|
11
config/nvim/lua/custom/init.lua
Normal file
11
config/nvim/lua/custom/init.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- Please check NvChad docs if you're totally new to nvchad + dont know lua!!
|
||||
-- This is an example init file in /lua/custom/
|
||||
-- this init.lua can load stuffs etc too so treat it like your ~/.config/nvim/
|
||||
|
||||
-- MAPPINGS
|
||||
local map = require("core.utils").map
|
||||
|
||||
map("n", "<leader>cc", ":Telescope <CR>")
|
||||
map("n", "<leader>q", ":q <CR>")
|
||||
|
||||
-- NOTE: the 4th argument in the map function is be a table i.e options but its most likely un-needed so dont worry about it
|
18
config/nvim/lua/custom/plugins/init.lua
Normal file
18
config/nvim/lua/custom/plugins/init.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("which-key").setup {
|
||||
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"tribela/vim-transparent",
|
||||
},
|
||||
|
||||
{
|
||||
"timonv/vim-cargo",
|
||||
},
|
||||
}
|
92
config/nvim/lua/plugins/configs/alpha.lua
Normal file
92
config/nvim/lua/plugins/configs/alpha.lua
Normal file
|
@ -0,0 +1,92 @@
|
|||
local present, alpha = pcall(require, "alpha")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local function button(sc, txt, keybind)
|
||||
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
|
||||
|
||||
local opts = {
|
||||
position = "center",
|
||||
text = txt,
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 36,
|
||||
align_shortcut = "right",
|
||||
hl = "AlphaButtons",
|
||||
}
|
||||
|
||||
if keybind then
|
||||
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
|
||||
end
|
||||
|
||||
return {
|
||||
type = "button",
|
||||
val = txt,
|
||||
on_press = function()
|
||||
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "normal", false)
|
||||
end,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
local default = {}
|
||||
|
||||
default.ascii = {
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
}
|
||||
|
||||
default.header = {
|
||||
type = "text",
|
||||
val = default.ascii,
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "AlphaHeader",
|
||||
},
|
||||
}
|
||||
|
||||
default.buttons = {
|
||||
type = "group",
|
||||
val = {
|
||||
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
|
||||
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
|
||||
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
|
||||
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
|
||||
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
|
||||
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
|
||||
},
|
||||
opts = {
|
||||
spacing = 1,
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("alpha", default)
|
||||
end
|
||||
alpha.setup {
|
||||
layout = {
|
||||
{ type = "padding", val = 9 },
|
||||
default.header,
|
||||
{ type = "padding", val = 2 },
|
||||
default.buttons,
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
148
config/nvim/lua/plugins/configs/bufferline.lua
Normal file
148
config/nvim/lua/plugins/configs/bufferline.lua
Normal file
|
@ -0,0 +1,148 @@
|
|||
local present, bufferline = pcall(require, "bufferline")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
}
|
||||
default = {
|
||||
options = {
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "",
|
||||
close_icon = "",
|
||||
show_close_icon = true,
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 14,
|
||||
max_prefix_length = 13,
|
||||
tab_size = 20,
|
||||
show_tab_indicators = true,
|
||||
enforce_regular_tabs = false,
|
||||
view = "multiwindow",
|
||||
show_buffer_close_icons = true,
|
||||
separator_style = "thin",
|
||||
always_show_bufferline = true,
|
||||
diagnostics = false,
|
||||
custom_filter = function(buf_number)
|
||||
-- Func to filter out our managed/persistent split terms
|
||||
local present_type, type = pcall(function()
|
||||
return vim.api.nvim_buf_get_var(buf_number, "term_type")
|
||||
end)
|
||||
|
||||
if present_type then
|
||||
if type == "vert" then
|
||||
return false
|
||||
elseif type == "hori" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
},
|
||||
|
||||
highlights = {
|
||||
background = {
|
||||
guifg = default.colors.grey_fg,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- buffers
|
||||
buffer_selected = {
|
||||
guifg = default.colors.white,
|
||||
guibg = default.colors.black,
|
||||
gui = "bold",
|
||||
},
|
||||
buffer_visible = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- for diagnostics = "nvim_lsp"
|
||||
error = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
error_diagnostic = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- close buttons
|
||||
close_button = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
close_button_visible = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
close_button_selected = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
fill = {
|
||||
guifg = default.colors.grey_fg,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
indicator_selected = {
|
||||
guifg = default.colors.black,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
|
||||
-- modified
|
||||
modified = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
modified_visible = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
modified_selected = {
|
||||
guifg = default.colors.green,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
|
||||
-- separators
|
||||
separator = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
separator_visible = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.black2,
|
||||
},
|
||||
|
||||
-- tabs
|
||||
tab = {
|
||||
guifg = default.colors.light_grey,
|
||||
guibg = default.colors.one_bg3,
|
||||
},
|
||||
tab_selected = {
|
||||
guifg = default.colors.black2,
|
||||
guibg = default.colors.nord_blue,
|
||||
},
|
||||
tab_close = {
|
||||
guifg = default.colors.red,
|
||||
guibg = default.colors.black,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("bufferline", default)
|
||||
end
|
||||
bufferline.setup(default)
|
||||
end
|
||||
|
||||
return M
|
76
config/nvim/lua/plugins/configs/cmp.lua
Normal file
76
config/nvim/lua/plugins/configs/cmp.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local present, cmp = pcall(require, "cmp")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local default = {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local icons = require "plugins.configs.lspkind_icons"
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
buffer = "[BUF]",
|
||||
})[entry.source.name]
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_cmp", default)
|
||||
end
|
||||
cmp.setup(default)
|
||||
end
|
||||
|
||||
return M
|
158
config/nvim/lua/plugins/configs/icons.lua
Normal file
158
config/nvim/lua/plugins/configs/icons.lua
Normal file
|
@ -0,0 +1,158 @@
|
|||
local present, icons = pcall(require, "nvim-web-devicons")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
}
|
||||
|
||||
default = {
|
||||
override = {
|
||||
c = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "c",
|
||||
},
|
||||
css = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "css",
|
||||
},
|
||||
deb = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "deb",
|
||||
},
|
||||
Dockerfile = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "Dockerfile",
|
||||
},
|
||||
html = {
|
||||
icon = "",
|
||||
color = default.colors.baby_pink,
|
||||
name = "html",
|
||||
},
|
||||
jpeg = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "jpeg",
|
||||
},
|
||||
jpg = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "jpg",
|
||||
},
|
||||
js = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "js",
|
||||
},
|
||||
kt = {
|
||||
icon = "",
|
||||
color = default.colors.orange,
|
||||
name = "kt",
|
||||
},
|
||||
lock = {
|
||||
icon = "",
|
||||
color = default.colors.red,
|
||||
name = "lock",
|
||||
},
|
||||
lua = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "lua",
|
||||
},
|
||||
mp3 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "mp3",
|
||||
},
|
||||
mp4 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "mp4",
|
||||
},
|
||||
out = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "out",
|
||||
},
|
||||
png = {
|
||||
icon = "",
|
||||
color = default.colors.dark_purple,
|
||||
name = "png",
|
||||
},
|
||||
py = {
|
||||
icon = "",
|
||||
color = default.colors.cyan,
|
||||
name = "py",
|
||||
},
|
||||
["robots.txt"] = {
|
||||
icon = "ﮧ",
|
||||
color = default.colors.red,
|
||||
name = "robots",
|
||||
},
|
||||
toml = {
|
||||
icon = "",
|
||||
color = default.colors.blue,
|
||||
name = "toml",
|
||||
},
|
||||
ts = {
|
||||
icon = "ﯤ",
|
||||
color = default.colors.teal,
|
||||
name = "ts",
|
||||
},
|
||||
ttf = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "TrueTypeFont",
|
||||
},
|
||||
rb = {
|
||||
icon = "",
|
||||
color = default.colors.pink,
|
||||
name = "rb",
|
||||
},
|
||||
rpm = {
|
||||
icon = "",
|
||||
color = default.colors.orange,
|
||||
name = "rpm",
|
||||
},
|
||||
vue = {
|
||||
icon = "﵂",
|
||||
color = default.colors.vibrant_green,
|
||||
name = "vue",
|
||||
},
|
||||
woff = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "WebOpenFontFormat",
|
||||
},
|
||||
woff2 = {
|
||||
icon = "",
|
||||
color = default.colors.white,
|
||||
name = "WebOpenFontFormat2",
|
||||
},
|
||||
xz = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "xz",
|
||||
},
|
||||
zip = {
|
||||
icon = "",
|
||||
color = default.colors.sun,
|
||||
name = "zip",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_web_devicons", default)
|
||||
end
|
||||
icons.setup(default)
|
||||
end
|
||||
|
||||
return M
|
41
config/nvim/lua/plugins/configs/lspconfig.lua
Normal file
41
config/nvim/lua/plugins/configs/lspconfig.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local M = {}
|
||||
require("plugins.configs.others").lsp_handlers()
|
||||
|
||||
function M.on_attach(client, bufnr)
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_range_formatting = false
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
require("core.mappings").lspconfig()
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.preselectSupport = true
|
||||
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
|
||||
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
|
||||
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
||||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"detail",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
}
|
||||
|
||||
-- requires a file containing user's lspconfigs
|
||||
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
||||
|
||||
if #addlsp_confs ~= 0 then
|
||||
require(addlsp_confs).setup_lsp(M.on_attach, capabilities)
|
||||
end
|
||||
|
||||
return M
|
29
config/nvim/lua/plugins/configs/lspkind_icons.lua
Normal file
29
config/nvim/lua/plugins/configs/lspkind_icons.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "ﰠ",
|
||||
Variable = "",
|
||||
Class = "ﴯ",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "ﰠ",
|
||||
Unit = "塞",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "פּ",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
|
||||
return icons
|
90
config/nvim/lua/plugins/configs/nvimtree.lua
Normal file
90
config/nvim/lua/plugins/configs/nvimtree.lua
Normal file
|
@ -0,0 +1,90 @@
|
|||
-- globals must be set prior to requiring nvim-tree to function
|
||||
local g = vim.g
|
||||
|
||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||
g.nvim_tree_git_hl = 0
|
||||
g.nvim_tree_highlight_opened_files = 0
|
||||
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
||||
|
||||
g.nvim_tree_show_icons = {
|
||||
folders = 1,
|
||||
files = 1,
|
||||
git = 1,
|
||||
}
|
||||
|
||||
g.nvim_tree_icons = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
deleted = "",
|
||||
ignored = "◌",
|
||||
renamed = "➜",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
unstaged = "✗",
|
||||
untracked = "★",
|
||||
},
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
},
|
||||
}
|
||||
|
||||
local present, nvimtree = pcall(require, "nvim-tree")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
ignore_ft_on_setup = { "dashboard" },
|
||||
auto_close = false,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
update_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = false,
|
||||
},
|
||||
view = {
|
||||
allow_resize = true,
|
||||
side = "left",
|
||||
width = 25,
|
||||
hide_root_folder = true,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
ignore = false,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_tree", default)
|
||||
end
|
||||
nvimtree.setup(default)
|
||||
end
|
||||
|
||||
return M
|
200
config/nvim/lua/plugins/configs/others.lua
Normal file
200
config/nvim/lua/plugins/configs/others.lua
Normal file
|
@ -0,0 +1,200 @@
|
|||
local M = {}
|
||||
|
||||
local chadrc_config = require("core.utils").load_config()
|
||||
|
||||
M.autopairs = function(override_flag)
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
|
||||
if present1 and present2 then
|
||||
local default = { fast_wrap = {} }
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_autopairs", default)
|
||||
end
|
||||
autopairs.setup(default)
|
||||
|
||||
local cmp = require "cmp"
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end
|
||||
end
|
||||
|
||||
M.better_escape = function(override_flag)
|
||||
local default = {
|
||||
mapping = chadrc_config.mappings.plugins.better_escape.esc_insertmode,
|
||||
timeout = chadrc_config.plugins.options.esc_insertmode_timeout,
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("better_escape", default)
|
||||
end
|
||||
require("better_escape").setup(default)
|
||||
end
|
||||
|
||||
M.blankline = function(override_flag)
|
||||
local default = {
|
||||
indentLine_enabled = 1,
|
||||
char = "▏",
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"alpha",
|
||||
"packer",
|
||||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"nvchad_cheatsheet",
|
||||
"lsp-installer",
|
||||
"",
|
||||
},
|
||||
buftype_exclude = { "terminal" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = false,
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("indent_blankline", default)
|
||||
end
|
||||
require("indent_blankline").setup(default)
|
||||
end
|
||||
|
||||
M.colorizer = function(override_flag)
|
||||
local present, colorizer = pcall(require, "colorizer")
|
||||
if present then
|
||||
local default = {
|
||||
filetypes = {
|
||||
"*",
|
||||
},
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = false, -- #RRGGBBAA hex codes
|
||||
rgb_fn = false, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = false, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
|
||||
-- Available modes: foreground, background
|
||||
mode = "background", -- Set the display mode.
|
||||
},
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_colorizer", default)
|
||||
end
|
||||
colorizer.setup(default["filetypes"], default["user_default_options"])
|
||||
vim.cmd "ColorizerReloadAllBuffers"
|
||||
end
|
||||
end
|
||||
|
||||
M.comment = function(override_flag)
|
||||
local present, nvim_comment = pcall(require, "Comment")
|
||||
if present then
|
||||
local default = {}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_comment", default)
|
||||
end
|
||||
nvim_comment.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
M.luasnip = function(override_flag)
|
||||
local present, luasnip = pcall(require, "luasnip")
|
||||
if present then
|
||||
local default = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("luasnip", default)
|
||||
end
|
||||
luasnip.config.set_config(default)
|
||||
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
end
|
||||
end
|
||||
|
||||
M.signature = function(override_flag)
|
||||
local present, lspsignature = pcall(require, "lsp_signature")
|
||||
if present then
|
||||
local default = {
|
||||
bind = true,
|
||||
doc_lines = 0,
|
||||
floating_window = true,
|
||||
fix_pos = true,
|
||||
hint_enable = true,
|
||||
hint_prefix = " ",
|
||||
hint_scheme = "String",
|
||||
hi_parameter = "Search",
|
||||
max_height = 22,
|
||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
handler_opts = {
|
||||
border = "single", -- double, single, shadow, none
|
||||
},
|
||||
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
|
||||
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("signature", default)
|
||||
end
|
||||
lspsignature.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
M.lsp_handlers = function()
|
||||
local function lspSymbol(name, icon)
|
||||
local hl = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
|
||||
end
|
||||
|
||||
lspSymbol("Error", "")
|
||||
lspSymbol("Info", "")
|
||||
lspSymbol("Hint", "")
|
||||
lspSymbol("Warn", "")
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = {
|
||||
prefix = "",
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
}
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
})
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
})
|
||||
|
||||
-- suppress error messages from lang servers
|
||||
vim.notify = function(msg, log_level)
|
||||
if msg:match "exit code" then
|
||||
return
|
||||
end
|
||||
if log_level == vim.log.levels.ERROR then
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
else
|
||||
vim.api.nvim_echo({ { msg } }, true, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.gitsigns = function(override_flag)
|
||||
local present, gitsigns = pcall(require, "gitsigns")
|
||||
if present then
|
||||
local default = {
|
||||
signs = {
|
||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("gitsigns", default)
|
||||
end
|
||||
gitsigns.setup(default)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
438
config/nvim/lua/plugins/configs/statusline.lua
Normal file
438
config/nvim/lua/plugins/configs/statusline.lua
Normal file
|
@ -0,0 +1,438 @@
|
|||
local present, feline = pcall(require, "feline")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
colors = require("colors").get(),
|
||||
lsp = require "feline.providers.lsp",
|
||||
lsp_severity = vim.diagnostic.severity,
|
||||
config = require("core.utils").load_config().plugins.options.statusline,
|
||||
}
|
||||
|
||||
default.icon_styles = {
|
||||
default = {
|
||||
left = "",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
arrow = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
block = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
round = {
|
||||
left = "",
|
||||
right = "",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
|
||||
slant = {
|
||||
left = " ",
|
||||
right = " ",
|
||||
main_icon = " ",
|
||||
vi_mode_icon = " ",
|
||||
position_icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
-- statusline style
|
||||
default.statusline_style = default.icon_styles[default.config.style]
|
||||
|
||||
-- show short statusline on small screens
|
||||
default.shortline = default.config.shortline == false and true
|
||||
|
||||
-- Initialize the components table
|
||||
default.components = {
|
||||
active = {},
|
||||
}
|
||||
|
||||
default.main_icon = {
|
||||
provider = default.statusline_style.main_icon,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.statusline_bg,
|
||||
bg = default.colors.nord_blue,
|
||||
},
|
||||
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hl = {
|
||||
fg = default.colors.nord_blue,
|
||||
bg = default.colors.lightbg,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
default.file_name = {
|
||||
provider = function()
|
||||
local filename = vim.fn.expand "%:t"
|
||||
local extension = vim.fn.expand "%:e"
|
||||
local icon = require("nvim-web-devicons").get_icon(filename, extension)
|
||||
if icon == nil then
|
||||
icon = " "
|
||||
return icon
|
||||
end
|
||||
return " " .. icon .. " " .. filename .. " "
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.white,
|
||||
bg = default.colors.lightbg,
|
||||
},
|
||||
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
|
||||
},
|
||||
}
|
||||
|
||||
default.dir_name = {
|
||||
provider = function()
|
||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||
return " " .. dir_name .. " "
|
||||
end,
|
||||
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||
end,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.lightbg2,
|
||||
},
|
||||
right_sep = {
|
||||
str = default.statusline_style.right,
|
||||
hi = {
|
||||
fg = default.colors.lightbg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
default.diff = {
|
||||
add = {
|
||||
provider = "git_diff_added",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
change = {
|
||||
provider = "git_diff_changed",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
remove = {
|
||||
provider = "git_diff_removed",
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
default.git_branch = {
|
||||
provider = "git_branch",
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.grey_fg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
icon = " ",
|
||||
}
|
||||
|
||||
default.diagnostic = {
|
||||
error = {
|
||||
provider = "diagnostic_errors",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
|
||||
end,
|
||||
|
||||
hl = { fg = default.colors.red },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
warning = {
|
||||
provider = "diagnostic_warnings",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
|
||||
end,
|
||||
hl = { fg = default.colors.yellow },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
hint = {
|
||||
provider = "diagnostic_hints",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
|
||||
end,
|
||||
hl = { fg = default.colors.grey_fg2 },
|
||||
icon = " ",
|
||||
},
|
||||
|
||||
info = {
|
||||
provider = "diagnostic_info",
|
||||
enabled = function()
|
||||
return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
|
||||
end,
|
||||
hl = { fg = default.colors.green },
|
||||
icon = " ",
|
||||
},
|
||||
}
|
||||
|
||||
default.lsp_progress = {
|
||||
provider = function()
|
||||
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
||||
|
||||
if Lsp then
|
||||
local msg = Lsp.message or ""
|
||||
local percentage = Lsp.percentage or 0
|
||||
local title = Lsp.title or ""
|
||||
local spinners = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
local success_icon = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
local ms = vim.loop.hrtime() / 1000000
|
||||
local frame = math.floor(ms / 120) % #spinners
|
||||
|
||||
if percentage >= 70 then
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return ""
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
|
||||
end,
|
||||
hl = { fg = default.colors.green },
|
||||
}
|
||||
|
||||
default.lsp_icon = {
|
||||
provider = function()
|
||||
if next(vim.lsp.buf_get_clients()) ~= nil then
|
||||
return " LSP"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
|
||||
end,
|
||||
hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
|
||||
}
|
||||
|
||||
default.mode_colors = {
|
||||
["n"] = { "NORMAL", default.colors.red },
|
||||
["no"] = { "N-PENDING", default.colors.red },
|
||||
["i"] = { "INSERT", default.colors.dark_purple },
|
||||
["ic"] = { "INSERT", default.colors.dark_purple },
|
||||
["t"] = { "TERMINAL", default.colors.green },
|
||||
["v"] = { "VISUAL", default.colors.cyan },
|
||||
["V"] = { "V-LINE", default.colors.cyan },
|
||||
[""] = { "V-BLOCK", default.colors.cyan },
|
||||
["R"] = { "REPLACE", default.colors.orange },
|
||||
["Rv"] = { "V-REPLACE", default.colors.orange },
|
||||
["s"] = { "SELECT", default.colors.nord_blue },
|
||||
["S"] = { "S-LINE", default.colors.nord_blue },
|
||||
[""] = { "S-BLOCK", default.colors.nord_blue },
|
||||
["c"] = { "COMMAND", default.colors.pink },
|
||||
["cv"] = { "COMMAND", default.colors.pink },
|
||||
["ce"] = { "COMMAND", default.colors.pink },
|
||||
["r"] = { "PROMPT", default.colors.teal },
|
||||
["rm"] = { "MORE", default.colors.teal },
|
||||
["r?"] = { "CONFIRM", default.colors.teal },
|
||||
["!"] = { "SHELL", default.colors.green },
|
||||
}
|
||||
|
||||
default.chad_mode_hl = function()
|
||||
return {
|
||||
fg = default.mode_colors[vim.fn.mode()][2],
|
||||
bg = default.colors.one_bg,
|
||||
}
|
||||
end
|
||||
|
||||
default.empty_space = {
|
||||
provider = " " .. default.statusline_style.left,
|
||||
hl = {
|
||||
fg = default.colors.one_bg2,
|
||||
bg = default.colors.statusline_bg,
|
||||
},
|
||||
}
|
||||
|
||||
-- this matches the vi mode color
|
||||
default.empty_spaceColored = {
|
||||
provider = default.statusline_style.left,
|
||||
hl = function()
|
||||
return {
|
||||
fg = default.mode_colors[vim.fn.mode()][2],
|
||||
bg = default.colors.one_bg2,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
default.mode_icon = {
|
||||
provider = default.statusline_style.vi_mode_icon,
|
||||
hl = function()
|
||||
return {
|
||||
fg = default.colors.statusline_bg,
|
||||
bg = default.mode_colors[vim.fn.mode()][2],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
default.empty_space2 = {
|
||||
provider = function()
|
||||
return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
|
||||
end,
|
||||
hl = default.chad_mode_hl,
|
||||
}
|
||||
|
||||
default.separator_right = {
|
||||
provider = default.statusline_style.left,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.grey,
|
||||
bg = default.colors.one_bg,
|
||||
},
|
||||
}
|
||||
|
||||
default.separator_right2 = {
|
||||
provider = default.statusline_style.left,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.green,
|
||||
bg = default.colors.grey,
|
||||
},
|
||||
}
|
||||
|
||||
default.position_icon = {
|
||||
provider = default.statusline_style.position_icon,
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
hl = {
|
||||
fg = default.colors.black,
|
||||
bg = default.colors.green,
|
||||
},
|
||||
}
|
||||
|
||||
default.current_line = {
|
||||
provider = function()
|
||||
local current_line = vim.fn.line "."
|
||||
local total_line = vim.fn.line "$"
|
||||
|
||||
if current_line == 1 then
|
||||
return " Top "
|
||||
elseif current_line == vim.fn.line "$" then
|
||||
return " Bot "
|
||||
end
|
||||
local result, _ = math.modf((current_line / total_line) * 100)
|
||||
return " " .. result .. "%% "
|
||||
end,
|
||||
|
||||
enabled = default.shortline or function(winid)
|
||||
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
|
||||
end,
|
||||
|
||||
hl = {
|
||||
fg = default.colors.green,
|
||||
bg = default.colors.one_bg,
|
||||
},
|
||||
}
|
||||
|
||||
local function add_table(a, b)
|
||||
table.insert(a, b)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("feline", default)
|
||||
end
|
||||
-- components are divided in 3 sections
|
||||
default.left = {}
|
||||
default.middle = {}
|
||||
default.right = {}
|
||||
|
||||
-- left
|
||||
add_table(default.left, default.main_icon)
|
||||
add_table(default.left, default.file_name)
|
||||
add_table(default.left, default.dir_name)
|
||||
add_table(default.left, default.diff.add)
|
||||
add_table(default.left, default.diff.change)
|
||||
add_table(default.left, default.diff.remove)
|
||||
add_table(default.left, default.diagnostic.error)
|
||||
add_table(default.left, default.diagnostic.warning)
|
||||
add_table(default.left, default.diagnostic.hint)
|
||||
add_table(default.left, default.diagnostic.info)
|
||||
|
||||
add_table(default.middle, default.lsp_progress)
|
||||
|
||||
-- right
|
||||
add_table(default.right, default.lsp_icon)
|
||||
add_table(default.right, default.git_branch)
|
||||
add_table(default.right, default.empty_space)
|
||||
add_table(default.right, default.empty_spaceColored)
|
||||
add_table(default.right, default.mode_icon)
|
||||
add_table(default.right, default.empty_space2)
|
||||
add_table(default.right, default.separator_right)
|
||||
add_table(default.right, default.separator_right2)
|
||||
add_table(default.right, default.position_icon)
|
||||
add_table(default.right, default.current_line)
|
||||
|
||||
default.components.active[1] = default.left
|
||||
default.components.active[2] = default.middle
|
||||
default.components.active[3] = default.right
|
||||
|
||||
feline.setup {
|
||||
theme = {
|
||||
bg = default.colors.statusline_bg,
|
||||
fg = default.colors.fg,
|
||||
},
|
||||
components = default.components,
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
73
config/nvim/lua/plugins/configs/telescope.lua
Normal file
73
config/nvim/lua/plugins/configs/telescope.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
local present, telescope = pcall(require, "telescope")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "truncate" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("telescope", default)
|
||||
end
|
||||
|
||||
telescope.setup(default)
|
||||
|
||||
local extensions = { "themes", "terms" }
|
||||
|
||||
pcall(function()
|
||||
for _, ext in ipairs(extensions) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
26
config/nvim/lua/plugins/configs/treesitter.lua
Normal file
26
config/nvim/lua/plugins/configs/treesitter.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local default = {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"vim",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
}
|
||||
|
||||
local M = {}
|
||||
M.setup = function(override_flag)
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("nvim_treesitter", default)
|
||||
end
|
||||
ts_config.setup(default)
|
||||
end
|
||||
|
||||
return M
|
244
config/nvim/lua/plugins/init.lua
Normal file
244
config/nvim/lua/plugins/init.lua
Normal file
|
@ -0,0 +1,244 @@
|
|||
local plugin_settings = require("core.utils").load_config().plugins
|
||||
local present, packer = pcall(require, plugin_settings.options.packer.init_file)
|
||||
|
||||
if not present then
|
||||
return false
|
||||
end
|
||||
|
||||
local override_req = require("core.utils").override_req
|
||||
|
||||
local plugins = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "lewis6991/impatient.nvim" },
|
||||
{ "nathom/filetype.nvim" },
|
||||
|
||||
{
|
||||
"wbthomason/packer.nvim",
|
||||
event = "VimEnter",
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/extensions",
|
||||
config = function ()
|
||||
vim.schedule_wrap(require("nvchad.terminal").init())
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-base16.lua",
|
||||
after = "packer.nvim",
|
||||
config = function()
|
||||
require("colors").init()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
after = "nvim-base16.lua",
|
||||
config = override_req("nvim_web_devicons", "plugins.configs.icons", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"feline-nvim/feline.nvim",
|
||||
disable = not plugin_settings.status.feline,
|
||||
after = "nvim-web-devicons",
|
||||
config = override_req("feline", "plugins.configs.statusline", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
branch = "main",
|
||||
disable = not plugin_settings.status.bufferline,
|
||||
after = "nvim-web-devicons",
|
||||
config = override_req("bufferline", "plugins.configs.bufferline", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").bufferline()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
disable = not plugin_settings.status.blankline,
|
||||
event = "BufRead",
|
||||
config = override_req("indent_blankline", "plugins.configs.others", "blankline"),
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
disable = not plugin_settings.status.colorizer,
|
||||
event = "BufRead",
|
||||
config = override_req("nvim_colorizer", "plugins.configs.others", "colorizer"),
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
config = override_req("nvim_treesitter", "plugins.configs.treesitter", "setup"),
|
||||
run = ":TSUpdate",
|
||||
},
|
||||
|
||||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
disable = not plugin_settings.status.gitsigns,
|
||||
opt = true,
|
||||
config = override_req("gitsigns", "plugins.configs.others", "gitsigns"),
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "gitsigns.nvim"
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp stuff
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
module = "lspconfig",
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "nvim-lspconfig"
|
||||
-- reload the current file so lsp actually starts for it
|
||||
vim.defer_fn(function()
|
||||
vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %'
|
||||
end, 0)
|
||||
end,
|
||||
config = override_req("lspconfig", "plugins.configs.lspconfig"),
|
||||
},
|
||||
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
disable = not plugin_settings.status.lspsignature,
|
||||
after = "nvim-lspconfig",
|
||||
config = override_req("signature", "plugins.configs.others", "signature"),
|
||||
},
|
||||
|
||||
{
|
||||
"andymass/vim-matchup",
|
||||
disable = not plugin_settings.status.vim_matchup,
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "vim-matchup"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
disable = not plugin_settings.status.better_escape,
|
||||
event = "InsertCharPre",
|
||||
config = override_req("better_escape", "plugins.configs.others", "better_escape"),
|
||||
},
|
||||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
module = "cmp_nvim_lsp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
event = "InsertEnter",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "friendly-snippets",
|
||||
config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
wants = "friendly-snippets",
|
||||
after = "nvim-cmp",
|
||||
config = override_req("luasnip", "plugins.configs.others", "luasnip"),
|
||||
},
|
||||
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp_luasnip",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-nvim-lua",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-buffer",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-nvim-lsp",
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/cmp-path",
|
||||
disable = not plugin_settings.status.cmp,
|
||||
after = "cmp-buffer",
|
||||
},
|
||||
|
||||
-- misc plugins
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
disable = not plugin_settings.status.autopairs,
|
||||
after = plugin_settings.options.autopairs.loadAfter,
|
||||
config = override_req("nvim_autopairs", "plugins.configs.others", "autopairs"),
|
||||
},
|
||||
|
||||
{
|
||||
disable = not plugin_settings.status.alpha,
|
||||
"goolord/alpha-nvim",
|
||||
config = override_req("alpha", "plugins.configs.alpha", "setup"),
|
||||
},
|
||||
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
disable = not plugin_settings.status.comment,
|
||||
module = "Comment",
|
||||
keys = { "gcc" },
|
||||
config = override_req("nvim_comment", "plugins.configs.others", "comment"),
|
||||
setup = function()
|
||||
require("core.mappings").comment()
|
||||
end,
|
||||
},
|
||||
|
||||
-- file managing , picker etc
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
disable = not plugin_settings.status.nvimtree,
|
||||
-- only set "after" if lazy load is disabled and vice versa for "cmd"
|
||||
after = not plugin_settings.options.nvimtree.lazy_load and "nvim-web-devicons",
|
||||
cmd = plugin_settings.options.nvimtree.lazy_load and { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
config = override_req("nvim_tree", "plugins.configs.nvimtree", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").nvimtree()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
module = "telescope",
|
||||
cmd = "Telescope",
|
||||
config = override_req("telescope", "plugins.configs.telescope", "setup"),
|
||||
setup = function()
|
||||
require("core.mappings").telescope()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
--label plugins for operational assistance
|
||||
plugins = require("core.utils").label_plugins(plugins)
|
||||
--remove plugins specified in chadrc
|
||||
plugins = require("core.utils").remove_default_plugins(plugins)
|
||||
--add plugins specified in chadrc
|
||||
plugins = require("core.utils").add_user_plugins(plugins)
|
||||
|
||||
return packer.startup(function(use)
|
||||
for _, v in pairs(plugins) do
|
||||
use(v)
|
||||
end
|
||||
end)
|
44
config/nvim/lua/plugins/packerInit.lua
Normal file
44
config/nvim/lua/plugins/packerInit.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
vim.cmd "packadd packer.nvim"
|
||||
|
||||
local present, packer = pcall(require, "packer")
|
||||
|
||||
if not present then
|
||||
local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
|
||||
|
||||
print "Cloning packer.."
|
||||
-- remove the dir before cloning
|
||||
vim.fn.delete(packer_path, "rf")
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
"--depth",
|
||||
"20",
|
||||
packer_path,
|
||||
}
|
||||
|
||||
vim.cmd "packadd packer.nvim"
|
||||
present, packer = pcall(require, "packer")
|
||||
|
||||
if present then
|
||||
print "Packer cloned successfully."
|
||||
else
|
||||
error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer)
|
||||
end
|
||||
end
|
||||
|
||||
packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "single" }
|
||||
end,
|
||||
prompt_border = "single",
|
||||
},
|
||||
git = {
|
||||
clone_timeout = 6000, -- seconds
|
||||
},
|
||||
auto_clean = true,
|
||||
compile_on_sync = true,
|
||||
}
|
||||
|
||||
return packer
|
440
config/nvim/plugin/packer_compiled.lua
Normal file
440
config/nvim/plugin/packer_compiled.lua
Normal file
|
@ -0,0 +1,440 @@
|
|||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/home/gallant/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/gallant/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/gallant/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/gallant/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/gallant/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
["Comment.nvim"] = {
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/Comment.nvim/after/plugin/Comment.lua" },
|
||||
config = { "require('plugins.configs.others').comment(false)" },
|
||||
keys = { { "", "gcc" } },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/Comment.nvim",
|
||||
url = "https://github.com/numToStr/Comment.nvim"
|
||||
},
|
||||
LuaSnip = {
|
||||
after = { "cmp_luasnip" },
|
||||
config = { "require('plugins.configs.others').luasnip(false)" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip",
|
||||
wants = { "friendly-snippets" }
|
||||
},
|
||||
["better-escape.nvim"] = {
|
||||
config = { "require('plugins.configs.others').better_escape(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/better-escape.nvim",
|
||||
url = "https://github.com/max397574/better-escape.nvim"
|
||||
},
|
||||
["bufferline.nvim"] = {
|
||||
config = { "require('plugins.configs.bufferline').setup(false)" },
|
||||
load_after = {
|
||||
["nvim-web-devicons"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/bufferline.nvim",
|
||||
url = "https://github.com/akinsho/bufferline.nvim"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
after = { "cmp-path" },
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-buffer/after/plugin/cmp_buffer.lua" },
|
||||
load_after = {
|
||||
["cmp-nvim-lsp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
after = { "cmp-buffer" },
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua" },
|
||||
load_after = {
|
||||
["cmp-nvim-lua"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-nvim-lua"] = {
|
||||
after = { "cmp-nvim-lsp" },
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua/after/plugin/cmp_nvim_lua.lua" },
|
||||
load_after = {
|
||||
cmp_luasnip = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-nvim-lua",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lua"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-path/after/plugin/cmp_path.lua" },
|
||||
load_after = {
|
||||
["cmp-buffer"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
after = { "cmp-nvim-lua" },
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp_luasnip/after/plugin/cmp_luasnip.lua" },
|
||||
load_after = {
|
||||
LuaSnip = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
extensions = {
|
||||
config = { "\27LJ\2\nZ\0\0\5\0\5\0\t6\0\0\0009\0\1\0006\2\2\0'\4\3\0B\2\2\0029\2\4\2B\2\1\0A\0\0\1K\0\1\0\tinit\20nvchad.terminal\frequire\18schedule_wrap\bvim\0" },
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/extensions",
|
||||
url = "https://github.com/NvChad/extensions"
|
||||
},
|
||||
["feline.nvim"] = {
|
||||
config = { "require('plugins.configs.statusline').setup(false)" },
|
||||
load_after = {
|
||||
["nvim-web-devicons"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/feline.nvim",
|
||||
url = "https://github.com/feline-nvim/feline.nvim"
|
||||
},
|
||||
["filetype.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/filetype.nvim",
|
||||
url = "https://github.com/nathom/filetype.nvim"
|
||||
},
|
||||
["friendly-snippets"] = {
|
||||
after = { "nvim-cmp" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/friendly-snippets",
|
||||
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
config = { "require('plugins.configs.others').gitsigns(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["impatient.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/impatient.nvim",
|
||||
url = "https://github.com/lewis6991/impatient.nvim"
|
||||
},
|
||||
["indent-blankline.nvim"] = {
|
||||
config = { "require('plugins.configs.others').blankline(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/indent-blankline.nvim",
|
||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||
},
|
||||
["lsp_signature.nvim"] = {
|
||||
config = { "require('plugins.configs.others').signature(false)" },
|
||||
load_after = {
|
||||
["nvim-lspconfig"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/lsp_signature.nvim",
|
||||
url = "https://github.com/ray-x/lsp_signature.nvim"
|
||||
},
|
||||
["nvim-autopairs"] = {
|
||||
config = { "require('plugins.configs.others').autopairs(false)" },
|
||||
load_after = {
|
||||
["nvim-cmp"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
["nvim-base16.lua"] = {
|
||||
after = { "nvim-web-devicons" },
|
||||
config = { "\27LJ\2\n3\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\tinit\vcolors\frequire\0" },
|
||||
load_after = {
|
||||
["packer.nvim"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-base16.lua",
|
||||
url = "https://github.com/NvChad/nvim-base16.lua"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
after = { "LuaSnip", "nvim-autopairs" },
|
||||
config = { "require('plugins.configs.cmp').setup(false)" },
|
||||
load_after = {
|
||||
["friendly-snippets"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
after = { "lsp_signature.nvim" },
|
||||
config = { "require('plugins.configs.lspconfig')" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
commands = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
config = { "require('plugins.configs.nvimtree').setup(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua",
|
||||
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
config = { "require('plugins.configs.treesitter').setup(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
after = { "bufferline.nvim", "feline.nvim" },
|
||||
config = { "require('plugins.configs.icons').setup(false)" },
|
||||
load_after = {
|
||||
["nvim-base16.lua"] = true
|
||||
},
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons",
|
||||
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
after = { "nvim-base16.lua" },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
commands = { "Telescope" },
|
||||
config = { "require('plugins.configs.telescope').setup(false)" },
|
||||
loaded = false,
|
||||
needs_bufread = true,
|
||||
only_cond = false,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["vim-cargo"] = {
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/vim-cargo",
|
||||
url = "https://github.com/timonv/vim-cargo"
|
||||
},
|
||||
["vim-matchup"] = {
|
||||
after_files = { "/home/gallant/.local/share/nvim/site/pack/packer/opt/vim-matchup/after/plugin/matchit.vim" },
|
||||
loaded = false,
|
||||
needs_bufread = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/opt/vim-matchup",
|
||||
url = "https://github.com/andymass/vim-matchup"
|
||||
},
|
||||
["vim-transparent"] = {
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/vim-transparent",
|
||||
url = "https://github.com/tribela/vim-transparent"
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/gallant/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||
url = "https://github.com/folke/which-key.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
local module_lazy_loads = {
|
||||
["^Comment"] = "Comment.nvim",
|
||||
["^cmp_nvim_lsp"] = "friendly-snippets",
|
||||
["^lspconfig"] = "nvim-lspconfig",
|
||||
["^telescope"] = "telescope.nvim"
|
||||
}
|
||||
local lazy_load_called = {['packer.load'] = true}
|
||||
local function lazy_load_module(module_name)
|
||||
local to_load = {}
|
||||
if lazy_load_called[module_name] then return nil end
|
||||
lazy_load_called[module_name] = true
|
||||
for module_pat, plugin_name in pairs(module_lazy_loads) do
|
||||
if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then
|
||||
to_load[#to_load + 1] = plugin_name
|
||||
end
|
||||
end
|
||||
|
||||
if #to_load > 0 then
|
||||
require('packer.load')(to_load, {module = module_name}, _G.packer_plugins)
|
||||
local loaded_mod = package.loaded[module_name]
|
||||
if loaded_mod then
|
||||
return function(modname) return loaded_mod end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not vim.g.packer_custom_loader_enabled then
|
||||
table.insert(package.loaders, 1, lazy_load_module)
|
||||
vim.g.packer_custom_loader_enabled = true
|
||||
end
|
||||
|
||||
-- Setup for: nvim-lspconfig
|
||||
time([[Setup for nvim-lspconfig]], true)
|
||||
try_loadstring("\27LJ\2\nU\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0006if &ft == \"packer\" | echo \"\" | else | silent! e %\bcmd\bvimx\1\0\4\0\a\0\f6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\0016\0\4\0009\0\5\0003\2\6\0)\3\0\0B\0\3\1K\0\1\0\0\rdefer_fn\bvim\19nvim-lspconfig\21packer_lazy_load\15core.utils\frequire\0", "setup", "nvim-lspconfig")
|
||||
time([[Setup for nvim-lspconfig]], false)
|
||||
-- Setup for: gitsigns.nvim
|
||||
time([[Setup for gitsigns.nvim]], true)
|
||||
try_loadstring("\27LJ\2\nU\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\18gitsigns.nvim\21packer_lazy_load\15core.utils\frequire\0", "setup", "gitsigns.nvim")
|
||||
time([[Setup for gitsigns.nvim]], false)
|
||||
-- Setup for: nvim-tree.lua
|
||||
time([[Setup for nvim-tree.lua]], true)
|
||||
try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\rnvimtree\18core.mappings\frequire\0", "setup", "nvim-tree.lua")
|
||||
time([[Setup for nvim-tree.lua]], false)
|
||||
-- Setup for: vim-matchup
|
||||
time([[Setup for vim-matchup]], true)
|
||||
try_loadstring("\27LJ\2\nS\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0'\2\3\0B\0\2\1K\0\1\0\16vim-matchup\21packer_lazy_load\15core.utils\frequire\0", "setup", "vim-matchup")
|
||||
time([[Setup for vim-matchup]], false)
|
||||
-- Setup for: telescope.nvim
|
||||
time([[Setup for telescope.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\14telescope\18core.mappings\frequire\0", "setup", "telescope.nvim")
|
||||
time([[Setup for telescope.nvim]], false)
|
||||
-- Setup for: bufferline.nvim
|
||||
time([[Setup for bufferline.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\15bufferline\18core.mappings\frequire\0", "setup", "bufferline.nvim")
|
||||
time([[Setup for bufferline.nvim]], false)
|
||||
-- Setup for: Comment.nvim
|
||||
time([[Setup for Comment.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\fcomment\18core.mappings\frequire\0", "setup", "Comment.nvim")
|
||||
time([[Setup for Comment.nvim]], false)
|
||||
-- Config for: which-key.nvim
|
||||
time([[Config for which-key.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")
|
||||
time([[Config for which-key.nvim]], false)
|
||||
-- Config for: extensions
|
||||
time([[Config for extensions]], true)
|
||||
try_loadstring("\27LJ\2\nZ\0\0\5\0\5\0\t6\0\0\0009\0\1\0006\2\2\0'\4\3\0B\2\2\0029\2\4\2B\2\1\0A\0\0\1K\0\1\0\tinit\20nvchad.terminal\frequire\18schedule_wrap\bvim\0", "config", "extensions")
|
||||
time([[Config for extensions]], false)
|
||||
|
||||
-- Command lazy-loads
|
||||
time([[Defining lazy-load commands]], true)
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file NvimTreeToggle lua require("packer.load")({'nvim-tree.lua'}, { cmd = "NvimTreeToggle", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file Telescope lua require("packer.load")({'telescope.nvim'}, { cmd = "Telescope", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file NvimTreeFocus lua require("packer.load")({'nvim-tree.lua'}, { cmd = "NvimTreeFocus", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]])
|
||||
time([[Defining lazy-load commands]], false)
|
||||
|
||||
-- Keymap lazy-loads
|
||||
time([[Defining lazy-load keymaps]], true)
|
||||
vim.cmd [[noremap <silent> gcc <cmd>lua require("packer.load")({'Comment.nvim'}, { keys = "gcc", prefix = "" }, _G.packer_plugins)<cr>]]
|
||||
time([[Defining lazy-load keymaps]], false)
|
||||
|
||||
vim.cmd [[augroup packer_load_aucmds]]
|
||||
vim.cmd [[au!]]
|
||||
-- Event lazy-loads
|
||||
time([[Defining lazy-load event autocommands]], true)
|
||||
vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter', 'indent-blankline.nvim'}, { event = "BufRead *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au BufNewFile * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufNewFile *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au VimEnter * ++once lua require("packer.load")({'packer.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au InsertCharPre * ++once lua require("packer.load")({'better-escape.nvim'}, { event = "InsertCharPre *" }, _G.packer_plugins)]]
|
||||
vim.cmd [[au InsertEnter * ++once lua require("packer.load")({'friendly-snippets'}, { event = "InsertEnter *" }, _G.packer_plugins)]]
|
||||
time([[Defining lazy-load event autocommands]], false)
|
||||
vim.cmd("augroup END")
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
Loading…
Reference in a new issue