diff --git a/.chezmoiignore b/.chezmoiignore index 732173a..ef0c64d 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -11,4 +11,5 @@ .config/rofi .config/sway .config/waybar +launch-sway.sh {{ end }} diff --git a/dot_config/nvim/LICENSE b/dot_config/nvim/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/dot_config/nvim/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/dot_config/nvim/colors/default_theme.lua b/dot_config/nvim/colors/default_theme.lua new file mode 100644 index 0000000..c6fe0a2 --- /dev/null +++ b/dot_config/nvim/colors/default_theme.lua @@ -0,0 +1,9 @@ +vim.g.colors_name = "default_theme" + +package.loaded["default_theme"] = nil +package.loaded["default_theme.base"] = nil +package.loaded["default_theme.treesitter"] = nil +package.loaded["default_theme.lsp"] = nil +package.loaded["default_theme.others"] = nil + +require "default_theme" diff --git a/dot_config/nvim/dot_git/HEAD b/dot_config/nvim/dot_git/HEAD new file mode 100644 index 0000000..b870d82 --- /dev/null +++ b/dot_config/nvim/dot_git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/main diff --git a/dot_config/nvim/dot_git/config b/dot_config/nvim/dot_git/config new file mode 100644 index 0000000..db04f1a --- /dev/null +++ b/dot_config/nvim/dot_git/config @@ -0,0 +1,13 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[remote "origin"] + url = https://github.com/AstroNvim/AstroNvim + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "main"] + remote = origin + merge = refs/heads/main diff --git a/dot_config/nvim/dot_git/description b/dot_config/nvim/dot_git/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/dot_config/nvim/dot_git/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/dot_config/nvim/dot_git/hooks/executable_applypatch-msg.sample b/dot_config/nvim/dot_git/hooks/executable_applypatch-msg.sample new file mode 100644 index 0000000..a5d7b84 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/dot_config/nvim/dot_git/hooks/executable_commit-msg.sample b/dot_config/nvim/dot_git/hooks/executable_commit-msg.sample new file mode 100644 index 0000000..b58d118 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/dot_config/nvim/dot_git/hooks/executable_fsmonitor-watchman.sample b/dot_config/nvim/dot_git/hooks/executable_fsmonitor-watchman.sample new file mode 100644 index 0000000..23e856f --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_fsmonitor-watchman.sample @@ -0,0 +1,174 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 2) and last update token +# formatted as a string and outputs to stdout a new update token and +# all files that have been modified since the update token. Paths must +# be relative to the root of the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $last_update_token) = @ARGV; + +# Uncomment for debugging +# print STDERR "$0 $version $last_update_token\n"; + +# Check the hook interface version +if ($version ne 2) { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree = get_working_dir(); + +my $retry = 1; + +my $json_pkg; +eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; +} or do { + require JSON::PP; + $json_pkg = "JSON::PP"; +}; + +launch_watchman(); + +sub launch_watchman { + my $o = watchman_query(); + if (is_work_tree_watched($o)) { + output_result($o->{clock}, @{$o->{files}}); + } +} + +sub output_result { + my ($clockid, @files) = @_; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # binmode $fh, ":utf8"; + # print $fh "$clockid\n@files\n"; + # close $fh; + + binmode STDOUT, ":utf8"; + print $clockid; + print "\0"; + local $, = "\0"; + print @files; +} + +sub watchman_clock { + my $response = qx/watchman clock "$git_work_tree"/; + die "Failed to get clock id on '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + return $json_pkg->new->utf8->decode($response); +} + +sub watchman_query { + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $last_update_token but not from the .git folder. + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + my $last_update_line = ""; + if (substr($last_update_token, 0, 1) eq "c") { + $last_update_token = "\"$last_update_token\""; + $last_update_line = qq[\n"since": $last_update_token,]; + } + my $query = <<" END"; + ["query", "$git_work_tree", {$last_update_line + "fields": ["name"], + "expression": ["not", ["dirname", ".git"]] + }] + END + + # Uncomment for debugging the watchman query + # open (my $fh, ">", ".git/watchman-query.json"); + # print $fh $query; + # close $fh; + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + # Uncomment for debugging the watch response + # open ($fh, ">", ".git/watchman-response.json"); + # print $fh $response; + # close $fh; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + return $json_pkg->new->utf8->decode($response); +} + +sub is_work_tree_watched { + my ($output) = @_; + my $error = $output->{error}; + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { + $retry--; + my $response = qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + $output = $json_pkg->new->utf8->decode($response); + $error = $output->{error}; + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # close $fh; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + my $o = watchman_clock(); + $error = $output->{error}; + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + output_result($o->{clock}, ("/")); + $last_update_token = $o->{clock}; + + eval { launch_watchman() }; + return 0; + } + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + return 1; +} + +sub get_working_dir { + my $working_dir; + if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $working_dir = Win32::GetCwd(); + $working_dir =~ tr/\\/\//; + } else { + require Cwd; + $working_dir = Cwd::cwd(); + } + + return $working_dir; +} diff --git a/dot_config/nvim/dot_git/hooks/executable_post-update.sample b/dot_config/nvim/dot_git/hooks/executable_post-update.sample new file mode 100644 index 0000000..ec17ec1 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-applypatch.sample b/dot_config/nvim/dot_git/hooks/executable_pre-applypatch.sample new file mode 100644 index 0000000..4142082 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-commit.sample b/dot_config/nvim/dot_git/hooks/executable_pre-commit.sample new file mode 100644 index 0000000..e144712 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-merge-commit.sample b/dot_config/nvim/dot_git/hooks/executable_pre-merge-commit.sample new file mode 100644 index 0000000..399eab1 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-merge-commit.sample @@ -0,0 +1,13 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-push.sample b/dot_config/nvim/dot_git/hooks/executable_pre-push.sample new file mode 100644 index 0000000..4ce688d --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-rebase.sample b/dot_config/nvim/dot_git/hooks/executable_pre-rebase.sample new file mode 100644 index 0000000..6cbef5c --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/dot_config/nvim/dot_git/hooks/executable_pre-receive.sample b/dot_config/nvim/dot_git/hooks/executable_pre-receive.sample new file mode 100644 index 0000000..a1fd29e --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_pre-receive.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/dot_config/nvim/dot_git/hooks/executable_prepare-commit-msg.sample b/dot_config/nvim/dot_git/hooks/executable_prepare-commit-msg.sample new file mode 100644 index 0000000..10fa14c --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_prepare-commit-msg.sample @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/dot_config/nvim/dot_git/hooks/executable_push-to-checkout.sample b/dot_config/nvim/dot_git/hooks/executable_push-to-checkout.sample new file mode 100644 index 0000000..af5a0c0 --- /dev/null +++ b/dot_config/nvim/dot_git/hooks/executable_push-to-checkout.sample @@ -0,0 +1,78 @@ +#!/bin/sh + +# An example hook script to update a checked-out tree on a git push. +# +# This hook is invoked by git-receive-pack(1) when it reacts to git +# push and updates reference(s) in its repository, and when the push +# tries to update the branch that is currently checked out and the +# receive.denyCurrentBranch configuration variable is set to +# updateInstead. +# +# By default, such a push is refused if the working tree and the index +# of the remote repository has any difference from the currently +# checked out commit; when both the working tree and the index match +# the current commit, they are updated to match the newly pushed tip +# of the branch. This hook is to be used to override the default +# behaviour; however the code below reimplements the default behaviour +# as a starting point for convenient modification. +# +# The hook receives the commit with which the tip of the current +# branch is going to be updated: +commit=$1 + +# It can exit with a non-zero status to refuse the push (when it does +# so, it must not modify the index or the working tree). +die () { + echo >&2 "$*" + exit 1 +} + +# Or it can make any necessary changes to the working tree and to the +# index to bring them to the desired state when the tip of the current +# branch is updated to the new commit, and exit with a zero status. +# +# For example, the hook can simply run git read-tree -u -m HEAD "$1" +# in order to emulate git fetch that is run in the reverse direction +# with git push, as the two-tree form of git read-tree -u -m is +# essentially the same as git switch or git checkout that switches +# branches while keeping the local changes in the working tree that do +# not interfere with the difference between the branches. + +# The below is a more-or-less exact translation to shell of the C code +# for the default behaviour for git's push-to-checkout hook defined in +# the push_to_deploy() function in builtin/receive-pack.c. +# +# Note that the hook will be executed from the repository directory, +# not from the working tree, so if you want to perform operations on +# the working tree, you will have to adapt your code accordingly, e.g. +# by adding "cd .." or using relative paths. + +if ! git update-index -q --ignore-submodules --refresh +then + die "Up-to-date check failed" +fi + +if ! git diff-files --quiet --ignore-submodules -- +then + die "Working directory has unstaged changes" +fi + +# This is a rough translation of: +# +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX +if git cat-file -e HEAD 2>/dev/null +then + head=HEAD +else + head=$(git hash-object -t tree --stdin &2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --type=bool hooks.allowunannotated) +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) +denycreatebranch=$(git config --type=bool hooks.denycreatebranch) +allowdeletetag=$(git config --type=bool hooks.allowdeletetag) +allowmodifytag=$(git config --type=bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin &2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/dot_config/nvim/dot_git/index b/dot_config/nvim/dot_git/index new file mode 100644 index 0000000..2cb1d1b Binary files /dev/null and b/dot_config/nvim/dot_git/index differ diff --git a/dot_config/nvim/dot_git/info/exclude b/dot_config/nvim/dot_git/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/dot_config/nvim/dot_git/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/dot_config/nvim/dot_git/logs/HEAD b/dot_config/nvim/dot_git/logs/HEAD new file mode 100644 index 0000000..89b4775 --- /dev/null +++ b/dot_config/nvim/dot_git/logs/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim diff --git a/dot_config/nvim/dot_git/logs/refs/heads/main b/dot_config/nvim/dot_git/logs/refs/heads/main new file mode 100644 index 0000000..89b4775 --- /dev/null +++ b/dot_config/nvim/dot_git/logs/refs/heads/main @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim diff --git a/dot_config/nvim/dot_git/logs/refs/remotes/origin/HEAD b/dot_config/nvim/dot_git/logs/refs/remotes/origin/HEAD new file mode 100644 index 0000000..89b4775 --- /dev/null +++ b/dot_config/nvim/dot_git/logs/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 ba775276324b75e4f703cd63fea3cfe7726514de Riley Smith 1659027739 -0700 clone: from https://github.com/AstroNvim/AstroNvim diff --git a/dot_config/nvim/dot_git/objects/info/.keep b/dot_config/nvim/dot_git/objects/info/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.idx b/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.idx new file mode 100644 index 0000000..8cf0e37 Binary files /dev/null and b/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.idx differ diff --git a/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.pack b/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.pack new file mode 100644 index 0000000..ee3bf77 Binary files /dev/null and b/dot_config/nvim/dot_git/objects/pack/readonly_pack-33a23b1a698108fd26b05313b79912f1cb7c7109.pack differ diff --git a/dot_config/nvim/dot_git/packed-refs b/dot_config/nvim/dot_git/packed-refs new file mode 100644 index 0000000..5932b45 --- /dev/null +++ b/dot_config/nvim/dot_git/packed-refs @@ -0,0 +1,24 @@ +# pack-refs with: peeled fully-peeled sorted +ba775276324b75e4f703cd63fea3cfe7726514de refs/remotes/origin/main +433fdda5b4ff136aa809c0ea678a19ff2559f696 refs/remotes/origin/mason +22d1bd5ef53a0c68d15848e1af976924f3e74c0d refs/remotes/origin/neovim-0.8 +1c67dbfd97f89abd02588c61bee2ee2dd9090df9 refs/remotes/origin/v2 +dad69af980919aab0b3157f6f767ddda438605f6 refs/tags/nvim-0.6 +^fbdeb0f7ee3e351d025ad50aa08950bc8fb5db72 +5e06f9bd75f2cfca2862eeb68fdb9915114def90 refs/tags/v1.0.0 +bfcdfd6dbb738cdb03f4f44a213a971b8d8bcb56 refs/tags/v1.1.0 +f25e3a6bf4b9aa59c8f822e65930401c1fad521f refs/tags/v1.2.0 +^db1b310f9afd28670f61bf2c160165ffa12763f0 +fa8f1f66c488f8cc5cd30379cbd7b4c5cf630e9c refs/tags/v1.3.0 +^29f595f1fe916297b23ec0447c257dffe3164f80 +e0c08e43119962a3447156cc55116084779f7154 refs/tags/v1.4.0 +ccbfa441902c5d138fcd1ff6b5c300cb21a32a92 refs/tags/v1.4.1 +ed749b7879c8a0082f3edcad371b52d3a586a27d refs/tags/v1.4.2 +81439578e81d257607d6d11eabe00a6eb1ca6ea5 refs/tags/v1.4.3 +6a20f0ce418f672f8f78ecd436113a2b8f4cfbbd refs/tags/v1.4.4 +f06ecaf46d67bb3a2886eee7d5d62a9805b668c3 refs/tags/v1.5.0 +b5b620b2b823cade3a6f5c6fb7d83d4d8651390b refs/tags/v1.5.1 +5696a8b99becb36a3b91921e39ec2470d2b3533b refs/tags/v1.5.2 +e85e050a2798cbe69763fe91edc649c0bd1df48f refs/tags/v1.6.0 +d213b4ddfc5baa0ec4cd384e6a1fd74de3dc37f7 refs/tags/v1.6.1 +24760d63c27973e0c7573532cad89dffe1dcffa8 refs/tags/v1.7.0 diff --git a/dot_config/nvim/dot_git/refs/heads/main b/dot_config/nvim/dot_git/refs/heads/main new file mode 100644 index 0000000..17680fa --- /dev/null +++ b/dot_config/nvim/dot_git/refs/heads/main @@ -0,0 +1 @@ +ba775276324b75e4f703cd63fea3cfe7726514de diff --git a/dot_config/nvim/dot_git/refs/remotes/origin/HEAD b/dot_config/nvim/dot_git/refs/remotes/origin/HEAD new file mode 100644 index 0000000..4b0a875 --- /dev/null +++ b/dot_config/nvim/dot_git/refs/remotes/origin/HEAD @@ -0,0 +1 @@ +ref: refs/remotes/origin/main diff --git a/dot_config/nvim/dot_git/refs/tags/.keep b/dot_config/nvim/dot_git/refs/tags/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dot_config/nvim/dot_github/CODE_OF_CONDUCT.md b/dot_config/nvim/dot_github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..86a3913 --- /dev/null +++ b/dot_config/nvim/dot_github/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{ email }}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/dot_config/nvim/dot_github/CONTRIBUTING.md b/dot_config/nvim/dot_github/CONTRIBUTING.md new file mode 100644 index 0000000..3c6166a --- /dev/null +++ b/dot_config/nvim/dot_github/CONTRIBUTING.md @@ -0,0 +1,164 @@ +# CONTRIBUTING + +## AstroNvim install for contributors + +If you wish to contribute to AstroNvim, you should: +1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo) +2. clone your fork to your machine + - For ssh: + ```shell + $ git clone git@github.com:/AstroNvim.git ~/.config/nvim + ``` + - For https: + ```shell + $ git clone https://github.com//AstroNvim.git ~/.config/nvim + ``` +3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams) + - this means you can push/pull as normal to your own repo, but also easily track & update from the AstroNvim repo + - for ssh: + ```shell + $ git remote add upstream git@github.com:AstroNvim/AstroNvim.git + ``` + - for https: + ```shell + $ git remote add upstream https://github.com/AstroNvim/AstroNvim.git + ``` +4. any time you create a branch to do some work, use + ```shell + $ git fetch upstream && git checkout -b dev-myFEAT upstream/main + ``` +5. only use the **--rebase** flag to update your dev branch + - this means that there are no `Merge AstroNvim/main into devBranch` commits, which are to be avoided + ```shell + $ git pull upstream --rebase + ``` + +## Things to know before contributing + +- When making a PR (pull request), please be very descriptive about what you've done! + +- Commit messages must follow [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/) + + - PR titles and commit messages should be formatted with 'fix', 'feat', 'docs', 'refactor', or 'chore'. ex: `feat: add new plugin` + + - If your contribution mostly pertains to a single module in AstroNvim, please include that in the title. ex: If you have modified something in the `lua/configs/lsp` folder for the lsp configuration use something like `fix(lsp): typo in lsp mappings` + + - If your contribution contains any sort of breaking change include a `!` at the end of the change type. ex: `feat!: move status bar from lualine to feline` + +- PRs should follow the pull request formats where applicable + +- We are open to all PRs, but if a PR is denied for any reason please don't be discouraged! We'll still be open to discussions. If you have any questions before opening the PR feel free to join the [discord server](https://discord.gg/UcZutyeaFW). + +- AstroNvim aims to provide the best user experience when it comes to being able to support confident updating for users, for this reason please avoid opening PRs with breaking changes. Avoiding breaking changes is not always going to be possible, so if you think it is completely necessary we are open to discussion. + +## How to remove, squash, or edit commits from your PR +> You may have been directed here to remove a commit such as a merge commit: `Merge AstroNvim/main into devBranch` from your PR + +> As these commands edit your git history, you may need to **force push** with `git push origin --force-with-lease` + +1. Run the following: + ``` + $ git rebase -i HEAD~ + ``` +
Example +

+ + ```shell + $ git rebase -i HEAD~4 + ``` + + ```shell + pick 28b2dcb feat: statusline add lsp status + pick dad9a39 fix: typo + pick 68f72f1 add clickable btn for exiting nvim + pick b281b53 avoid using q! for quitting vim + + # Rebase 52b655b..b281b53 onto 52b655b (4 commands) + # + # Commands: + # p, pick = use commit + # r, reword = use commit, but edit the commit message + # e, edit = use commit, but stop for amending + # s, squash = use commit, but meld into previous commit + # f, fixup = like "squash", but discard this commit's log message + # x, exec = run command (the rest of the line) using shell + # b, break = stop here (continue rebase later with 'git rebase --continue') + # d, drop = remove commit + # l, label

+
+ +2. Change the `pick` commands to whatever you wish, you may wish to `s` `squash`, `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it. + +
Example +

+ + ```shell {3,4} + pick 28b2dcb feat: statusline add lsp status + squash dad9a39 fix: typo + edit 68f72f1 add clickable btn for exiting nvim + d b281b53 avoid using q! for quitting vim + + # Rebase 52b655b..b281b53 onto 52b655b (4 commands) + # + # Commands: + # p, pick = use commit + # r, reword = use commit, but edit the commit message + # e, edit = use commit, but stop for amending + # s, squash = use commit, but meld into previous commit + # f, fixup = like "squash", but discard this commit's log message + # x, exec = run command (the rest of the line) using shell + # b, break = stop here (continue rebase later with 'git rebase --continue') + # d, drop = remove commit + # l, label

+
+ +3. If you picked `drop` you are done. If you picked `squash` then you will be brought to a screen to update the commit message for the new aggregated commit, please make sure the new commit message follows the Conventional Commit specification. If you picked `edit` then edit your files, then run: + ```shell + $ git add + ``` + +4. Continue rebasing until all edits are finished. Run the following command to continue through the rebase if there are more changes: + + ```shell + $ git rebase --continue + ``` + +5. Push the changes with `--force-with-lease`: + ```shell + $ git push origin --force-with-lease + ``` + +## Help +For help with contributing and anything else AstroNvim related join the [discord](https://discord.gg/UcZutyeaFW) diff --git a/dot_config/nvim/dot_github/FUNDING.yml b/dot_config/nvim/dot_github/FUNDING.yml new file mode 100644 index 0000000..77746f6 --- /dev/null +++ b/dot_config/nvim/dot_github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://www.buymeacoffee.com/mehalter diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.md b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..aa23535 --- /dev/null +++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Checklist** +Please confirm you have run the following commands and restarted Neovim and are encountering the issue with the current latest version of AstroNvim +- [ ] `:PackerSync` +- [ ] `:AstroUpdate` +- [ ] restarted AstroNvim +- [ ] Neovim version >= 0.7.0 + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots or recording ([Asciinema](asciinema.org)) to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.md b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..59094e2 --- /dev/null +++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.md b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..10cb6c8 --- /dev/null +++ b/dot_config/nvim/dot_github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,10 @@ +--- +name: Question +about: Ask a general question about AstroNvim usage +title: '' +labels: question +assignees: '' + +--- + + diff --git a/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/chore.md b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/chore.md new file mode 100644 index 0000000..60c219a --- /dev/null +++ b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/chore.md @@ -0,0 +1,7 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Description: +Describe the refactor or cleanup that was completed + +Other: +Anything else relevant goes here diff --git a/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/feature.md b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/feature.md new file mode 100644 index 0000000..b2ff3d5 --- /dev/null +++ b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/feature.md @@ -0,0 +1,10 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Features Added: +- Plugin Name (Add links if possible too) + +Reasoning: +List why the feature is needed + +Other: +Anything else relevant goes here diff --git a/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/fix.md b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/fix.md new file mode 100644 index 0000000..a173370 --- /dev/null +++ b/dot_config/nvim/dot_github/PULL_REQUEST_TEMPLATE/fix.md @@ -0,0 +1,7 @@ +Fixes Issue # (If it doesn't fix an issue then delete this line) + +Bugs Fixed: +- A bullet for each bug fixed and a description + +Other: +Anything else relevant goes here diff --git a/dot_config/nvim/dot_github/README.md b/dot_config/nvim/dot_github/README.md new file mode 100644 index 0000000..7bad7ca --- /dev/null +++ b/dot_config/nvim/dot_github/README.md @@ -0,0 +1,126 @@ +
+ +
+ +

AstroNvim

+ + + +

+AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins +

+ +**_Notice:_** AstroNvim v1.4.0 has added `stable` and `nightly` update channels. For the time being we have kept the default update channel to `nightly` so that the behavior of AstroNvim doesn't change (this could be considered a breaking change to some). We are planning to make the `stable` channel the default update channel when Neovim v0.8 is released and we tag AstroNvim v2.0.0 to incorporate this "breaking" change. + +## 🌟 Preview + +![Preview1](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dashboard.png) +![Preview2](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/overview.png) +![Preview33](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/lsp_hover.png) + +## ✨ Features + +- File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) +- Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp) +- Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- Statusline with [Feline](https://github.com/feline-nvim/feline.nvim) +- Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim) +- Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim) +- Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) +- Formatting and linting with [Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim) +- Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig) +- Buffer Line with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim) + +## ⚡ Requirements + +- [Nerd Fonts](https://www.nerdfonts.com/font-downloads) +- [Neovim 0.7+](https://github.com/neovim/neovim/releases/tag/v0.7.0) +- A clipboard tool is necessary for the integration with the system clipboard (see [`:help clipboard-tool`](https://neovim.io/doc/user/provider.html#clipboard-tool) for supported solutions) +- Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) +- Optional Requirements: + - [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`fw`) + - [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`tl` or `gg`) + - [NCDU](https://dev.yorhel.nl/ncdu) - disk usage toggle terminal (`tu`) + - [Htop](https://htop.dev/) - process viewer toggle terminal (`tt`) + - [Python](https://www.python.org/) - python repl toggle terminal (`tp`) + - [Node](https://nodejs.org/en/) - node repl toggle terminal (`tn`) + +> Note when using default theme: For MacOS, the default terminal does not have true color support. You wil need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support. + +> Note if you are still on Neovim v0.6: You can still install the previous version of AstroNvim that supported. After cloning the repository run `git checkout nvim-0.6` to check out this version. This will no longer be receiving updates. + +## 🛠️ Installation + +#### Make a backup of your current nvim folder + +``` +mv ~/.config/nvim ~/.config/nvimbackup +``` + +#### Clone the repository + +``` +git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim +nvim +PackerSync +``` + +## 📦 Basic Setup + +#### Install LSP + +Enter `:LspInstall` followed by the name of the server you want to install
+Example: `:LspInstall pyright` + +#### Install language parser + +Enter `:TSInstall` followed by the name of the language you want to install
+Example: `:TSInstall python` + +#### Manage plugins + +Run `:PackerClean` to remove any disabled or unused plugins
+Run `:PackerSync` to update and clean plugins
+ +#### Update AstroNvim + +Run `:AstroUpdate` to get the latest updates from the repository
+ +## 🗒️ Links + +[AstroNvim Documentation](https://astronvim.github.io/) + +- [Basic Usage](https://astronvim.github.io/usage/walkthrough) is given for basic usage +- [Default Mappings](https://astronvim.github.io/usage/mappings) more about the default key bindings +- [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults +- [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration + +[Watch](https://www.youtube.com/watch?v=JQLZ7NJRTEo&t=4s&ab_channel=JohnCodes) a review video to know about the out of the box experience + +## ⭐ Credits + +Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible. + +- [Plugins](https://astronvim.github.io/acknowledgements#plugins-used-in-astronvim) +- [NvChad](https://github.com/NvChad/NvChad) +- [LunarVim](https://github.com/LunarVim) +- [CosmicVim](https://github.com/CosmicNvim/CosmicNvim) + +
+ +[![Lua](https://img.shields.io/badge/Made%20with%20Lua-blue.svg?style=for-the-badge&logo=lua)](https://lua.org) + +
diff --git a/dot_config/nvim/dot_github/stale.yml b/dot_config/nvim/dot_github/stale.yml new file mode 100644 index 0000000..0ccfb1b --- /dev/null +++ b/dot_config/nvim/dot_github/stale.yml @@ -0,0 +1,19 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + - notice + - wip +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/dot_config/nvim/dot_github/workflows/conventional_commit.yml b/dot_config/nvim/dot_github/workflows/conventional_commit.yml new file mode 100644 index 0000000..76819c4 --- /dev/null +++ b/dot_config/nvim/dot_github/workflows/conventional_commit.yml @@ -0,0 +1,13 @@ +name: Conventional Commits + +on: + pull_request: + branches: [ main ] + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: webiny/action-conventional-commits@v1.0.3 diff --git a/dot_config/nvim/dot_github/workflows/luacheck.yml b/dot_config/nvim/dot_github/workflows/luacheck.yml new file mode 100644 index 0000000..cee961e --- /dev/null +++ b/dot_config/nvim/dot_github/workflows/luacheck.yml @@ -0,0 +1,10 @@ +name: Lua Linting + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: nebularg/actions-luacheck@v1 diff --git a/dot_config/nvim/dot_github/workflows/style.yml b/dot_config/nvim/dot_github/workflows/style.yml new file mode 100644 index 0000000..b11412a --- /dev/null +++ b/dot_config/nvim/dot_github/workflows/style.yml @@ -0,0 +1,15 @@ +name: Style Check + +on: [push, pull_request] + +jobs: + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: JohnnyMorganz/stylua-action@1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: v0.14.0 + # CLI arguments + args: --check . diff --git a/dot_config/nvim/dot_github/workflows/updater.yml b/dot_config/nvim/dot_github/workflows/updater.yml new file mode 100644 index 0000000..43b71c2 --- /dev/null +++ b/dot_config/nvim/dot_github/workflows/updater.yml @@ -0,0 +1,38 @@ +name: Updater Comment + +on: + pull_request_target: + paths: + - "**.lua" + - "packer_snapshot" + types: + - opened + +jobs: + updater-comment: + name: Comment updater settings + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + const src = context.payload.pull_request.head + const user = src.user.login + const tab = " " + let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n` + if (src.ref != "main") { + settings += tab + tab + `branch = "${src.ref}",\n` + } + if (user != "AstroNvim") { + settings += tab + tab + `remote = "${user}",\n` + settings += tab + tab + `remotes = {\n` + settings += tab + tab + tab + `["${user}"] = "${user}/${src.repo.name}",\n` + settings += tab + tab + `},\n` + } + settings += tab + "}," + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Use the following `updater` settings in your `user/init.lua` file, restart, and run `:AstroUpdate` to test this pull request:\n```\n" + settings + "\n```", + }) diff --git a/dot_config/nvim/dot_gitignore b/dot_config/nvim/dot_gitignore new file mode 100644 index 0000000..3f29aef --- /dev/null +++ b/dot_config/nvim/dot_gitignore @@ -0,0 +1,4 @@ +plugin +lua/user +lua/packer_compiled.lua +ginit.vim diff --git a/dot_config/nvim/dot_luacheckrc b/dot_config/nvim/dot_luacheckrc new file mode 100644 index 0000000..00ce173 --- /dev/null +++ b/dot_config/nvim/dot_luacheckrc @@ -0,0 +1,20 @@ +-- Global objects +globals = { + "PACKER_BOOTSTRAP", + "astronvim", + "astronvim_installation", + "vim", + "C", + "packer_plugins", +} + +-- Rerun tests only if their modification time changed +cache = true + +-- Don't report unused self arguments of methods +self = false + +ignore = { + "631", -- max_line_length + "212/_.*", -- unused argument, for vars with "_" prefix +} diff --git a/dot_config/nvim/dot_stylua.toml b/dot_config/nvim/dot_stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/dot_config/nvim/dot_stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..0c5f0fa --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,17 @@ +local impatient_ok, impatient = pcall(require, "impatient") +if impatient_ok then impatient.enable_profile() end + +for _, source in ipairs { + "core.utils", + "core.options", + "core.bootstrap", + "core.plugins", + "core.autocmds", + "core.mappings", + "configs.which-key-register", +} do + local status_ok, fault = pcall(require, source) + if not status_ok then vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) end +end + +astronvim.conditional_func(astronvim.user_plugin_opts("polish", nil, false)) diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim deleted file mode 100644 index 867c16b..0000000 --- a/dot_config/nvim/init.vim +++ /dev/null @@ -1,6 +0,0 @@ -call plug#begin() - -Plug 'neoclide/coc.nvim', {'branch': 'release'} - -" Initalize Plugin system -call plug#end() diff --git a/dot_config/nvim/lua/configs/Comment.lua b/dot_config/nvim/lua/configs/Comment.lua new file mode 100644 index 0000000..b1cd8cd --- /dev/null +++ b/dot_config/nvim/lua/configs/Comment.lua @@ -0,0 +1,18 @@ +local status_ok, Comment = pcall(require, "Comment") +if not status_ok then return end +local utils = require "Comment.utils" +Comment.setup(astronvim.user_plugin_opts("plugins.Comment", { + pre_hook = function(ctx) + local location = nil + if ctx.ctype == utils.ctype.block then + location = require("ts_context_commentstring.utils").get_cursor_location() + elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then + location = require("ts_context_commentstring.utils").get_visual_start_location() + end + + return require("ts_context_commentstring.internal").calculate_commentstring { + key = ctx.ctype == utils.ctype.line and "__default" or "__multiline", + location = location, + } + end, +})) diff --git a/dot_config/nvim/lua/configs/aerial.lua b/dot_config/nvim/lua/configs/aerial.lua new file mode 100644 index 0000000..1b3f0f9 --- /dev/null +++ b/dot_config/nvim/lua/configs/aerial.lua @@ -0,0 +1,51 @@ +local status_ok, aerial = pcall(require, "aerial") +if not status_ok then return end +aerial.setup(astronvim.user_plugin_opts("plugins.aerial", { + close_behavior = "global", + backends = { "lsp", "treesitter", "markdown" }, + min_width = 28, + show_guides = true, + filter_kind = false, + icons = { + Array = "", + Boolean = "⊨", + Class = "", + Constant = "", + Constructor = "", + Key = "", + Function = "", + Method = "ƒ", + Namespace = "", + Null = "NULL", + Number = "#", + Object = "⦿", + Property = "", + TypeParameter = "𝙏", + Variable = "", + Enum = "ℰ", + Package = "", + EnumMember = "", + File = "", + Module = "", + Field = "", + Interface = "ﰮ", + String = "𝓐", + Struct = "𝓢", + Event = "", + Operator = "+", + }, + guides = { + mid_item = "├ ", + last_item = "└ ", + nested_top = "│ ", + whitespace = " ", + }, + on_attach = function(bufnr) + -- Jump forwards/backwards with '{' and '}' + vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr, desc = "Jump backwards in Aerial" }) + vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr, desc = "Jump forwards in Aerial" }) + -- Jump up the tree with '[[' or ']]' + vim.keymap.set("n", "[[", "AerialPrevUp", { buffer = bufnr, desc = "Jump up and backwards in Aerial" }) + vim.keymap.set("n", "]]", "AerialNextUp", { buffer = bufnr, desc = "Jump up and forwards in Aerial" }) + end, +})) diff --git a/dot_config/nvim/lua/configs/alpha.lua b/dot_config/nvim/lua/configs/alpha.lua new file mode 100644 index 0000000..c5a004a --- /dev/null +++ b/dot_config/nvim/lua/configs/alpha.lua @@ -0,0 +1,39 @@ +local status_ok, alpha = pcall(require, "alpha") +if not status_ok then return end +local alpha_button = astronvim.alpha_button +alpha.setup(astronvim.user_plugin_opts("plugins.alpha", { + layout = { + { type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } }, + { + type = "text", + val = astronvim.user_plugin_opts("header", { + " █████ ███████ ████████ ██████ ██████", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████", + " ", + " ███  ██ ██  ██ ██ ███  ███", + " ████  ██ ██  ██ ██ ████  ████", + " ██ ██  ██ ██  ██ ██ ██ ████ ██", + " ██  ██ ██  ██  ██  ██ ██  ██  ██", + " ██   ████   ████   ██ ██      ██", + }, false), + opts = { position = "center", hl = "DashboardHeader" }, + }, + { type = "padding", val = 5 }, + { + type = "group", + val = { + alpha_button("LDR f f", " Find File "), + alpha_button("LDR f o", " Recents "), + alpha_button("LDR f w", " Find Word "), + alpha_button("LDR f n", " New File "), + alpha_button("LDR f m", " Bookmarks "), + alpha_button("LDR S l", " Last Session "), + }, + opts = { spacing = 1 }, + }, + }, + opts = {}, +})) diff --git a/dot_config/nvim/lua/configs/autopairs.lua b/dot_config/nvim/lua/configs/autopairs.lua new file mode 100644 index 0000000..063ae3a --- /dev/null +++ b/dot_config/nvim/lua/configs/autopairs.lua @@ -0,0 +1,32 @@ +local status_ok, npairs = pcall(require, "nvim-autopairs") +if not status_ok then return end +npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", { + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, +})) + +local rules = astronvim.user_plugin_opts("nvim-autopairs").add_rules +if vim.tbl_contains({ "function", "table" }, type(rules)) then + npairs.add_rules(type(rules) == "function" and rules(npairs) or rules) +end + +local cmp_status_ok, cmp = pcall(require, "cmp") +if cmp_status_ok then + cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { map_char = { tex = "" } }) +end diff --git a/dot_config/nvim/lua/configs/better_escape.lua b/dot_config/nvim/lua/configs/better_escape.lua new file mode 100644 index 0000000..2f12a70 --- /dev/null +++ b/dot_config/nvim/lua/configs/better_escape.lua @@ -0,0 +1,3 @@ +local status_ok, better_escape = pcall(require, "better_escape") +if not status_ok then return end +better_escape.setup(astronvim.user_plugin_opts "plugins.better_escape") diff --git a/dot_config/nvim/lua/configs/bufferline.lua b/dot_config/nvim/lua/configs/bufferline.lua new file mode 100644 index 0000000..2959391 --- /dev/null +++ b/dot_config/nvim/lua/configs/bufferline.lua @@ -0,0 +1,18 @@ +local status_ok, bufferline = pcall(require, "bufferline") +if not status_ok then return end +bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", { + options = { + offsets = { + { filetype = "NvimTree", text = "", padding = 1 }, + { filetype = "neo-tree", text = "", padding = 1 }, + { filetype = "Outline", text = "", padding = 1 }, + }, + buffer_close_icon = "", + modified_icon = "", + close_icon = "", + max_name_length = 14, + max_prefix_length = 13, + tab_size = 20, + separator_style = "thin", + }, +})) diff --git a/dot_config/nvim/lua/configs/cinnamon.lua b/dot_config/nvim/lua/configs/cinnamon.lua new file mode 100644 index 0000000..aae68f9 --- /dev/null +++ b/dot_config/nvim/lua/configs/cinnamon.lua @@ -0,0 +1,3 @@ +local status_ok, cinnamon = pcall(require, "cinnamon") +if not status_ok then return end +cinnamon.setup(astronvim.user_plugin_opts("plugins.cinnamon", {})) diff --git a/dot_config/nvim/lua/configs/cmp.lua b/dot_config/nvim/lua/configs/cmp.lua new file mode 100644 index 0000000..174eb2b --- /dev/null +++ b/dot_config/nvim/lua/configs/cmp.lua @@ -0,0 +1,116 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not (cmp_status_ok and snip_status_ok) then return end +local setup = cmp.setup +local kind_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 = "", +} + +local function has_words_before() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil +end + +setup(astronvim.user_plugin_opts("plugins.cmp", { + preselect = cmp.PreselectMode.None, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(_, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + return vim_item + end, + }, + snippet = { + expand = function(args) luasnip.lsp_expand(args.body) end, + }, + duplicates = { + nvim_lsp = 1, + luasnip = 1, + cmp_tabnine = 1, + buffer = 1, + path = 1, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + [""] = cmp.mapping.confirm { select = false }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, +})) +for setup_opt, setup_table in pairs(astronvim.user_plugin_opts("cmp.setup", {})) do + for pattern, options in pairs(setup_table) do + setup[setup_opt](pattern, options) + end +end diff --git a/dot_config/nvim/lua/configs/colorizer.lua b/dot_config/nvim/lua/configs/colorizer.lua new file mode 100644 index 0000000..0f59361 --- /dev/null +++ b/dot_config/nvim/lua/configs/colorizer.lua @@ -0,0 +1,17 @@ +local status_ok, colorizer = pcall(require, "colorizer") +if not status_ok then return end +local colorizer_opts = astronvim.user_plugin_opts("plugins.colorizer", { + { "*" }, + { + 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 + mode = "background", -- Set the display mode + }, +}) +colorizer.setup(colorizer_opts[1], colorizer_opts[2]) diff --git a/dot_config/nvim/lua/configs/dressing.lua b/dot_config/nvim/lua/configs/dressing.lua new file mode 100644 index 0000000..b790705 --- /dev/null +++ b/dot_config/nvim/lua/configs/dressing.lua @@ -0,0 +1,16 @@ +local status_ok, dressing = pcall(require, "dressing") +if not status_ok then return end +-- TODO: Deprecate user ui options table with v2 +local ui_opts = astronvim.user_plugin_opts("ui", { nui_input = true, telescope_select = true }) +dressing.setup(astronvim.user_plugin_opts("plugins.dressing", { + input = { + enabled = ui_opts.nui_input, + default_prompt = "➤ ", + winhighlight = "Normal:Normal,NormalNC:Normal", + }, + select = { + enabled = ui_opts.telescope_select, + backend = { "telescope", "builtin" }, + builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" }, + }, +})) diff --git a/dot_config/nvim/lua/configs/feline.lua b/dot_config/nvim/lua/configs/feline.lua new file mode 100644 index 0000000..2ab43bb --- /dev/null +++ b/dot_config/nvim/lua/configs/feline.lua @@ -0,0 +1,45 @@ +local status_ok, feline = pcall(require, "feline") +if not status_ok then return end +local C = require "default_theme.colors" +local hl = require("core.status").hl +local provider = require("core.status").provider +local conditional = require("core.status").conditional +-- stylua: ignore +feline.setup(astronvim.user_plugin_opts("plugins.feline", { + disable = { filetypes = { "^NvimTree$", "^neo%-tree$", "^dashboard$", "^Outline$", "^aerial$" } }, + theme = hl.group("StatusLine", { fg = C.fg, bg = C.bg_1 }), + components = { + active = { + { + { provider = provider.spacer(), hl = hl.mode() }, + { provider = provider.spacer(2) }, + { provider = "git_branch", hl = hl.fg("Conditional", { fg = C.purple_1, style = "bold" }), icon = " " }, + { provider = provider.spacer(3), enabled = conditional.git_available }, + { provider = { name = "file_type", opts = { filetype_icon = true, case = "lowercase" } }, enabled = conditional.has_filetype }, + { provider = provider.spacer(2), enabled = conditional.has_filetype }, + { provider = "git_diff_added", hl = hl.fg("GitSignsAdd", { fg = C.green }), icon = "  " }, + { provider = "git_diff_changed", hl = hl.fg("GitSignsChange", { fg = C.orange_1 }), icon = " 柳" }, + { provider = "git_diff_removed", hl = hl.fg("GitSignsDelete", { fg = C.red_1 }), icon = "  " }, + { provider = provider.spacer(2), enabled = conditional.git_changed }, + { provider = "diagnostic_errors", hl = hl.fg("DiagnosticError", { fg = C.red_1 }), icon = "  " }, + { provider = "diagnostic_warnings", hl = hl.fg("DiagnosticWarn", { fg = C.orange_1 }), icon = "  " }, + { provider = "diagnostic_info", hl = hl.fg("DiagnosticInfo", { fg = C.white_2 }), icon = "  " }, + { provider = "diagnostic_hints", hl = hl.fg("DiagnosticHint", { fg = C.yellow_1 }), icon = "  " }, + }, + { + { provider = provider.lsp_progress, enabled = conditional.bar_width() }, + { provider = provider.lsp_client_names(true), short_provider = provider.lsp_client_names(), enabled = conditional.bar_width(), icon = "  " }, + { provider = provider.spacer(2), enabled = conditional.bar_width() }, + { provider = provider.treesitter_status, enabled = conditional.bar_width(), hl = hl.fg("GitSignsAdd", { fg = C.green }) }, + { provider = provider.spacer(2) }, + { provider = "position" }, + { provider = provider.spacer(2) }, + { provider = "line_percentage" }, + { provider = provider.spacer() }, + { provider = "scroll_bar", hl = hl.fg("TypeDef", { fg = C.yellow }) }, + { provider = provider.spacer(2) }, + { provider = provider.spacer(), hl = hl.mode() }, + }, + }, + }, +})) diff --git a/dot_config/nvim/lua/configs/gitsigns.lua b/dot_config/nvim/lua/configs/gitsigns.lua new file mode 100644 index 0000000..c261bbf --- /dev/null +++ b/dot_config/nvim/lua/configs/gitsigns.lua @@ -0,0 +1,11 @@ +local status_ok, gitsigns = pcall(require, "gitsigns") +if not status_ok then return end +gitsigns.setup(astronvim.user_plugin_opts("plugins.gitsigns", { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "▎" }, + topdelete = { text = "契" }, + changedelete = { text = "▎" }, + }, +})) diff --git a/dot_config/nvim/lua/configs/icons.lua b/dot_config/nvim/lua/configs/icons.lua new file mode 100644 index 0000000..a519d71 --- /dev/null +++ b/dot_config/nvim/lua/configs/icons.lua @@ -0,0 +1,16 @@ +local status_ok, icons = pcall(require, "nvim-web-devicons") +if not status_ok then return end +icons.set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", { + deb = { icon = "", name = "Deb" }, + lock = { icon = "", name = "Lock" }, + mp3 = { icon = "", name = "Mp3" }, + mp4 = { icon = "", name = "Mp4" }, + out = { icon = "", name = "Out" }, + ["robots.txt"] = { icon = "ﮧ", name = "Robots" }, + ttf = { icon = "", name = "TrueTypeFont" }, + rpm = { icon = "", name = "Rpm" }, + woff = { icon = "", name = "WebOpenFontFormat" }, + woff2 = { icon = "", name = "WebOpenFontFormat2" }, + xz = { icon = "", name = "Xz" }, + zip = { icon = "", name = "Zip" }, +})) diff --git a/dot_config/nvim/lua/configs/indent-line.lua b/dot_config/nvim/lua/configs/indent-line.lua new file mode 100644 index 0000000..80618b0 --- /dev/null +++ b/dot_config/nvim/lua/configs/indent-line.lua @@ -0,0 +1,49 @@ +local status_ok, indent_blankline = pcall(require, "indent_blankline") +if not status_ok then return end +indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", { + buftype_exclude = { + "nofile", + "terminal", + "lsp-installer", + "lspinfo", + }, + filetype_exclude = { + "help", + "startify", + "aerial", + "alpha", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "neo-tree", + "Trouble", + }, + context_patterns = { + "class", + "return", + "function", + "method", + "^if", + "^while", + "jsx_element", + "^for", + "^object", + "^table", + "block", + "arguments", + "if_statement", + "else_clause", + "jsx_element", + "jsx_self_closing_element", + "try_statement", + "catch_clause", + "import_statement", + "operation_type", + }, + show_trailing_blankline_indent = false, + use_treesitter = true, + char = "▏", + context_char = "▏", + show_current_context = true, +})) diff --git a/dot_config/nvim/lua/configs/indent-o-matic.lua b/dot_config/nvim/lua/configs/indent-o-matic.lua new file mode 100644 index 0000000..53f007e --- /dev/null +++ b/dot_config/nvim/lua/configs/indent-o-matic.lua @@ -0,0 +1,3 @@ +local status_ok, indent_o_matic = pcall(require, "indent-o-matic") +if not status_ok then return end +indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic") diff --git a/dot_config/nvim/lua/configs/lsp/handlers.lua b/dot_config/nvim/lua/configs/lsp/handlers.lua new file mode 100644 index 0000000..f1f0ed5 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/handlers.lua @@ -0,0 +1,90 @@ +astronvim.lsp = {} +local user_plugin_opts = astronvim.user_plugin_opts +local conditional_func = astronvim.conditional_func + +astronvim.lsp.on_attach = function(client, bufnr) + astronvim.set_mappings( + user_plugin_opts("lsp.mappings", { + n = { + ["K"] = { function() vim.lsp.buf.hover() end, desc = "Hover symbol details" }, + ["la"] = { function() vim.lsp.buf.code_action() end, desc = "LSP code action" }, + ["lf"] = { function() vim.lsp.buf.formatting_sync() end, desc = "Format code" }, + ["lh"] = { function() vim.lsp.buf.signature_help() end, desc = "Signature help" }, + ["lr"] = { function() vim.lsp.buf.rename() end, desc = "Rename current symbol" }, + ["gD"] = { function() vim.lsp.buf.declaration() end, desc = "Declaration of current symbol" }, + ["gI"] = { function() vim.lsp.buf.implementation() end, desc = "Implementation of current symbol" }, + ["gd"] = { function() vim.lsp.buf.definition() end, desc = "Show the definition of current symbol" }, + ["gr"] = { function() vim.lsp.buf.references() end, desc = "References of current symbol" }, + ["ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, + ["[d"] = { function() vim.diagnostic.goto_prev() end, desc = "Previous diagnostic" }, + ["]d"] = { function() vim.diagnostic.goto_next() end, desc = "Next diagnostic" }, + ["gl"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, + }, + }), + { buffer = bufnr } + ) + + vim.api.nvim_buf_create_user_command( + bufnr, + "Format", + function() vim.lsp.buf.formatting() end, + { desc = "Format file with LSP" } + ) + + if client.resolved_capabilities.document_highlight then + vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true }) + vim.api.nvim_create_autocmd("CursorHold", { + group = "lsp_document_highlight", + pattern = "", + callback = vim.lsp.buf.document_highlight, + }) + vim.api.nvim_create_autocmd("CursorMoved", { + group = "lsp_document_highlight", + pattern = "", + callback = vim.lsp.buf.clear_references, + }) + end + + local on_attach_override = user_plugin_opts("lsp.on_attach", nil, false) + local aerial_avail, aerial = pcall(require, "aerial") + conditional_func(on_attach_override, true, client, bufnr) + conditional_func(aerial.on_attach, aerial_avail, client, bufnr) +end + +astronvim.lsp.capabilities = vim.lsp.protocol.make_client_capabilities() +astronvim.lsp.capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" } +astronvim.lsp.capabilities.textDocument.completion.completionItem.snippetSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.preselectSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.insertReplaceSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.labelDetailsSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.deprecatedSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.commitCharactersSupport = true +astronvim.lsp.capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } +astronvim.lsp.capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { "documentation", "detail", "additionalTextEdits" }, +} +astronvim.lsp.capabilities = user_plugin_opts("lsp.capabilities", astronvim.lsp.capabilities) +astronvim.lsp.flags = user_plugin_opts "lsp.flags" + +function astronvim.lsp.server_settings(server_name) + local server = require("lspconfig")[server_name] + local opts = user_plugin_opts( + "lsp.server-settings." .. server_name, + user_plugin_opts("lsp.server-settings." .. server_name, { + capabilities = vim.tbl_deep_extend("force", astronvim.lsp.capabilities, server.capabilities or {}), + flags = vim.tbl_deep_extend("force", astronvim.lsp.flags, server.flags or {}), + }, true, "configs") + ) + local old_on_attach = server.on_attach + local user_on_attach = opts.on_attach + opts.on_attach = function(client, bufnr) + conditional_func(old_on_attach, true, client, bufnr) + astronvim.lsp.on_attach(client, bufnr) + conditional_func(user_on_attach, true, client, bufnr) + end + return opts +end + +function astronvim.lsp.disable_formatting(client) client.resolved_capabilities.document_formatting = false end + +return astronvim.lsp diff --git a/dot_config/nvim/lua/configs/lsp/init.lua b/dot_config/nvim/lua/configs/lsp/init.lua new file mode 100644 index 0000000..9793e9a --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/init.lua @@ -0,0 +1,54 @@ +local status_ok, lspconfig = pcall(require, "lspconfig") +if not status_ok then return end +require "configs.lsp.handlers" +local insert = table.insert +local tbl_contains = vim.tbl_contains +local sign_define = vim.fn.sign_define +local user_plugin_opts = astronvim.user_plugin_opts +local user_registration = user_plugin_opts("lsp.server_registration", nil, false) + +local signs = { + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, +} +for _, sign in ipairs(signs) do + sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) +end +vim.diagnostic.config(user_plugin_opts("diagnostics", { + virtual_text = true, + signs = { active = signs }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, +})) +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }) + +local servers = user_plugin_opts "lsp.servers" +local skip_setup = user_plugin_opts "lsp.skip_setup" +local installer_avail, lsp_installer = pcall(require, "nvim-lsp-installer") +if installer_avail then + for _, server in ipairs(lsp_installer.get_installed_servers()) do + insert(servers, server.name) + end +end +for _, server in ipairs(servers) do + if not tbl_contains(skip_setup, server) then + local opts = astronvim.lsp.server_settings(server) + if type(user_registration) == "function" then + user_registration(server, opts) + else + lspconfig[server].setup(opts) + end + end +end diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/html.lua b/dot_config/nvim/lua/configs/lsp/server-settings/html.lua new file mode 100644 index 0000000..1c6b4d5 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/html.lua @@ -0,0 +1 @@ +return { on_attach = astronvim.lsp.disable_formatting } diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/jsonls.lua b/dot_config/nvim/lua/configs/lsp/server-settings/jsonls.lua new file mode 100644 index 0000000..89b7201 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/jsonls.lua @@ -0,0 +1,15 @@ +return { + on_attach = astronvim.lsp.disable_formatting, + settings = { + json = { + schemas = require("schemastore").json.schemas(), + }, + }, + setup = { + commands = { + Format = { + function() vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) end, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/pyright.lua b/dot_config/nvim/lua/configs/lsp/server-settings/pyright.lua new file mode 100644 index 0000000..c2a518d --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/pyright.lua @@ -0,0 +1,9 @@ +return { + settings = { + python = { + analysis = { + typeCheckingMode = "off", + }, + }, + }, +} diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/rust_analyzer.lua b/dot_config/nvim/lua/configs/lsp/server-settings/rust_analyzer.lua new file mode 100644 index 0000000..f9b89a9 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/rust_analyzer.lua @@ -0,0 +1,15 @@ +return { + settings = { + ["rust-analyzer"] = { + cargo = { + loadOutDirsFromCheck = true, + }, + checkOnSave = { + command = "clippy", + }, + experimental = { + procAttrMacros = true, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/sumneko_lua.lua b/dot_config/nvim/lua/configs/lsp/server-settings/sumneko_lua.lua new file mode 100644 index 0000000..3bf46a2 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/sumneko_lua.lua @@ -0,0 +1,17 @@ +return { + on_attach = astronvim.lsp.disable_formatting, + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [astronvim.install.home .. "/lua"] = true, + [astronvim.install.config .. "/lua"] = true, + }, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/configs/lsp/server-settings/tsserver.lua b/dot_config/nvim/lua/configs/lsp/server-settings/tsserver.lua new file mode 100644 index 0000000..1c6b4d5 --- /dev/null +++ b/dot_config/nvim/lua/configs/lsp/server-settings/tsserver.lua @@ -0,0 +1 @@ +return { on_attach = astronvim.lsp.disable_formatting } diff --git a/dot_config/nvim/lua/configs/luasnip.lua b/dot_config/nvim/lua/configs/luasnip.lua new file mode 100644 index 0000000..798e95c --- /dev/null +++ b/dot_config/nvim/lua/configs/luasnip.lua @@ -0,0 +1,11 @@ +local user_settings = astronvim.user_plugin_opts "luasnip" +local luasnip_avail, luasnip = pcall(require, "luasnip") +local loader_avail, loader = pcall(require, "luasnip/loaders/from_vscode") +if not (luasnip_avail and loader_avail) then return end +if user_settings.vscode_snippet_paths ~= nil then loader.lazy_load { paths = user_settings.vscode_snippet_paths } end +loader.lazy_load() +if type(user_settings.filetype_extend) == "table" then + for filetype, snippets in pairs(user_settings.filetype_extend) do + luasnip.filetype_extend(filetype, snippets) + end +end diff --git a/dot_config/nvim/lua/configs/neo-tree.lua b/dot_config/nvim/lua/configs/neo-tree.lua new file mode 100644 index 0000000..1d4ee1a --- /dev/null +++ b/dot_config/nvim/lua/configs/neo-tree.lua @@ -0,0 +1,62 @@ +local status_ok, neotree = pcall(require, "neo-tree") +if not status_ok then return end +neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", { + close_if_last_window = true, + popup_border_style = "rounded", + enable_diagnostics = false, + default_component_configs = { + indent = { + padding = 0, + with_expanders = false, + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "", + default = "", + }, + git_status = { + symbols = { + added = "", + deleted = "", + modified = "", + renamed = "➜", + untracked = "★", + ignored = "◌", + unstaged = "✗", + staged = "✓", + conflict = "", + }, + }, + }, + window = { + width = 25, + mappings = { + ["o"] = "open", + }, + }, + filesystem = { + filtered_items = { + visible = false, + hide_dotfiles = true, + hide_gitignored = false, + hide_by_name = { + ".DS_Store", + "thumbs.db", + "node_modules", + "__pycache__", + }, + }, + follow_current_file = true, + hijack_netrw_behavior = "open_current", + use_libuv_file_watcher = true, + }, + git_status = { + window = { + position = "float", + }, + }, + event_handlers = { + { event = "neo_tree_buffer_enter", handler = function(_) vim.opt_local.signcolumn = "auto" end }, + }, +})) diff --git a/dot_config/nvim/lua/configs/notify.lua b/dot_config/nvim/lua/configs/notify.lua new file mode 100644 index 0000000..2888046 --- /dev/null +++ b/dot_config/nvim/lua/configs/notify.lua @@ -0,0 +1,4 @@ +local status_ok, notify = pcall(require, "notify") +if not status_ok then return end +notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" })) +vim.notify = notify diff --git a/dot_config/nvim/lua/configs/null-ls.lua b/dot_config/nvim/lua/configs/null-ls.lua new file mode 100644 index 0000000..1b6d853 --- /dev/null +++ b/dot_config/nvim/lua/configs/null-ls.lua @@ -0,0 +1,3 @@ +local status_ok, null_ls = pcall(require, "null-ls") +if not status_ok then return end +null_ls.setup(astronvim.user_plugin_opts "plugins.null-ls") diff --git a/dot_config/nvim/lua/configs/nvim-lsp-installer.lua b/dot_config/nvim/lua/configs/nvim-lsp-installer.lua new file mode 100644 index 0000000..ec3eaba --- /dev/null +++ b/dot_config/nvim/lua/configs/nvim-lsp-installer.lua @@ -0,0 +1,11 @@ +local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") +if not status_ok then return end +lsp_installer.setup(astronvim.user_plugin_opts("plugins.nvim-lsp-installer", { + ui = { + icons = { + server_installed = "✓", + server_uninstalled = "✗", + server_pending = "⟳", + }, + }, +})) diff --git a/dot_config/nvim/lua/configs/session_manager.lua b/dot_config/nvim/lua/configs/session_manager.lua new file mode 100644 index 0000000..9a330f2 --- /dev/null +++ b/dot_config/nvim/lua/configs/session_manager.lua @@ -0,0 +1,3 @@ +local status_ok, session_manager = pcall(require, "session_manager") +if not status_ok then return end +session_manager.setup(astronvim.user_plugin_opts("plugins.session_manager", { autosave_last_session = false })) diff --git a/dot_config/nvim/lua/configs/smart-splits.lua b/dot_config/nvim/lua/configs/smart-splits.lua new file mode 100644 index 0000000..54aeb4c --- /dev/null +++ b/dot_config/nvim/lua/configs/smart-splits.lua @@ -0,0 +1,11 @@ +local status_ok, smart_splits = pcall(require, "smart-splits") +if not status_ok then return end +smart_splits.setup(astronvim.user_plugin_opts("plugins.smart-splits", { + ignored_filetypes = { + "nofile", + "quickfix", + "qf", + "prompt", + }, + ignored_buftypes = { "nofile" }, +})) diff --git a/dot_config/nvim/lua/configs/telescope.lua b/dot_config/nvim/lua/configs/telescope.lua new file mode 100644 index 0000000..c5f5b4f --- /dev/null +++ b/dot_config/nvim/lua/configs/telescope.lua @@ -0,0 +1,95 @@ +local status_ok, telescope = pcall(require, "telescope") +if not status_ok then return end +local actions = require "telescope.actions" + +astronvim.conditional_func(telescope.load_extension, pcall(require, "notify"), "notify") +astronvim.conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial") + +telescope.setup(astronvim.user_plugin_opts("plugins.telescope", { + defaults = { + + prompt_prefix = " ", + selection_caret = "❯ ", + path_display = { "truncate" }, + 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, + }, + + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + ["H"] = actions.move_to_top, + ["M"] = actions.move_to_middle, + ["L"] = actions.move_to_bottom, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + }, + }, + }, + pickers = {}, + extensions = {}, +})) diff --git a/dot_config/nvim/lua/configs/toggleterm.lua b/dot_config/nvim/lua/configs/toggleterm.lua new file mode 100644 index 0000000..1e6a891 --- /dev/null +++ b/dot_config/nvim/lua/configs/toggleterm.lua @@ -0,0 +1,15 @@ +local status_ok, toggleterm = pcall(require, "toggleterm") +if not status_ok then return end +toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", { + size = 10, + open_mapping = [[]], + shading_factor = 2, + direction = "float", + float_opts = { + border = "curved", + highlights = { + border = "Normal", + background = "Normal", + }, + }, +})) diff --git a/dot_config/nvim/lua/configs/treesitter.lua b/dot_config/nvim/lua/configs/treesitter.lua new file mode 100644 index 0000000..47f581d --- /dev/null +++ b/dot_config/nvim/lua/configs/treesitter.lua @@ -0,0 +1,25 @@ +local status_ok, treesitter = pcall(require, "nvim-treesitter.configs") +if not status_ok then return end +treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", { + ensure_installed = {}, + sync_install = false, + ignore_install = {}, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, + rainbow = { + enable = true, + disable = { "html" }, + extended_mode = false, + max_file_lines = nil, + }, + autopairs = { enable = true }, + autotag = { enable = true }, + incremental_selection = { enable = true }, + indent = { enable = false }, +})) diff --git a/dot_config/nvim/lua/configs/which-key-register.lua b/dot_config/nvim/lua/configs/which-key-register.lua new file mode 100644 index 0000000..91c42b5 --- /dev/null +++ b/dot_config/nvim/lua/configs/which-key-register.lua @@ -0,0 +1,54 @@ +local status_ok, which_key = pcall(require, "which-key") +if not status_ok then return end +local is_available = astronvim.is_available +local user_plugin_opts = astronvim.user_plugin_opts +local mappings = { + n = { + [""] = { + f = { name = "File" }, + p = { name = "Packer" }, + l = { name = "LSP" }, + }, + }, +} + +local extra_sections = { + g = "Git", + s = "Search", + S = "Session", + t = "Terminal", +} + +local function init_table(mode, prefix, idx) + if not mappings[mode][prefix][idx] then mappings[mode][prefix][idx] = { name = extra_sections[idx] } end +end + +if is_available "neovim-session-manager" then init_table("n", "", "S") end + +if is_available "gitsigns.nvim" then init_table("n", "", "g") end + +if is_available "toggleterm.nvim" then + init_table("n", "", "g") + init_table("n", "", "t") +end + +if is_available "telescope.nvim" then + init_table("n", "", "s") + init_table("n", "", "g") +end + +mappings = user_plugin_opts("which-key.register_mappings", mappings) +-- support previous legacy notation, deprecate at some point +mappings.n[""] = user_plugin_opts("which-key.register_n_leader", mappings.n[""]) +for mode, prefixes in pairs(mappings) do + for prefix, mapping_table in pairs(prefixes) do + which_key.register(mapping_table, { + mode = mode, + prefix = prefix, + buffer = nil, + silent = true, + noremap = true, + nowait = true, + }) + end +end diff --git a/dot_config/nvim/lua/configs/which-key.lua b/dot_config/nvim/lua/configs/which-key.lua new file mode 100644 index 0000000..6fd369e --- /dev/null +++ b/dot_config/nvim/lua/configs/which-key.lua @@ -0,0 +1,18 @@ +local status_ok, which_key = pcall(require, "which-key") +if not status_ok then return end +local show = which_key.show +local show_override = astronvim.user_plugin_opts("which-key.show", nil, false) +which_key.show = type(show_override) == "function" and show_override(show) + or function(keys, opts) + if vim.bo.filetype ~= "TelescopePrompt" then show(keys, opts) end + end +which_key.setup(astronvim.user_plugin_opts("plugins.which-key", { + plugins = { + spelling = { enabled = true }, + presets = { operators = false }, + }, + window = { + border = "rounded", + padding = { 2, 2, 2, 2 }, + }, +})) diff --git a/dot_config/nvim/lua/core/autocmds.lua b/dot_config/nvim/lua/core/autocmds.lua new file mode 100644 index 0000000..b03e195 --- /dev/null +++ b/dot_config/nvim/lua/core/autocmds.lua @@ -0,0 +1,108 @@ +local is_available = astronvim.is_available +local user_plugin_opts = astronvim.user_plugin_opts +local cmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup +local create_command = vim.api.nvim_create_user_command + +augroup("highlighturl", { clear = true }) +cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, { + desc = "URL Highlighting", + group = "highlighturl", + pattern = "*", + callback = function() astronvim.set_url_match() end, +}) + +if is_available "alpha-nvim" then + augroup("alpha_settings", { clear = true }) + if is_available "bufferline.nvim" then + cmd("FileType", { + desc = "Disable tabline for alpha", + group = "alpha_settings", + pattern = "alpha", + callback = function() + local prev_showtabline = vim.opt.showtabline + vim.opt.showtabline = 0 + cmd("BufUnload", { + pattern = "", + callback = function() vim.opt.showtabline = prev_showtabline end, + }) + end, + }) + end + cmd("FileType", { + desc = "Disable statusline for alpha", + group = "alpha_settings", + pattern = "alpha", + callback = function() + local prev_status = vim.opt.laststatus + vim.opt.laststatus = 0 + cmd("BufUnload", { + pattern = "", + callback = function() vim.opt.laststatus = prev_status end, + }) + end, + }) + cmd("VimEnter", { + desc = "Start Alpha when vim is opened with no arguments", + group = "alpha_settings", + callback = function() + -- optimized start check from https://github.com/goolord/alpha-nvim + local alpha_avail, alpha = pcall(require, "alpha") + if alpha_avail then + local should_skip = false + if vim.fn.argc() > 0 or vim.fn.line2byte "$" ~= -1 or not vim.o.modifiable then + should_skip = true + else + for _, arg in pairs(vim.v.argv) do + if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then + should_skip = true + break + end + end + end + if not should_skip then alpha.start(true) end + end + end, + }) +end + +if is_available "neo-tree.nvim" then + augroup("neotree_start", { clear = true }) + cmd("BufEnter", { + desc = "Open Neo-Tree on startup with directory", + group = "neotree_start", + callback = function() + local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) + if stats and stats.type == "directory" then require("neo-tree.setup.netrw").hijack() end + end, + }) +end + +if is_available "feline.nvim" then + augroup("feline_setup", { clear = true }) + cmd("ColorScheme", { + desc = "Reload feline on colorscheme change", + group = "feline_setup", + callback = function() + package.loaded["configs.feline"] = nil + require "configs.feline" + end, + }) +end + +augroup("astronvim_highlights", { clear = true }) +cmd({ "VimEnter", "ColorScheme" }, { + desc = "Load custom highlights from user configuration", + group = "astronvim_highlights", + callback = function() + if vim.g.colors_name then + for group, spec in pairs(user_plugin_opts("highlights." .. vim.g.colors_name)) do + vim.api.nvim_set_hl(0, group, spec) + end + end + end, +}) + +create_command("AstroUpdate", astronvim.updater.update, { desc = "Update AstroNvim" }) +create_command("AstroVersion", astronvim.updater.version, { desc = "Check AstroNvim Version" }) +create_command("ToggleHighlightURL", astronvim.toggle_url_match, { desc = "Toggle URL Highlights" }) diff --git a/dot_config/nvim/lua/core/bootstrap.lua b/dot_config/nvim/lua/core/bootstrap.lua new file mode 100644 index 0000000..bc91db9 --- /dev/null +++ b/dot_config/nvim/lua/core/bootstrap.lua @@ -0,0 +1,7 @@ +astronvim.initialize_packer() + +local colorscheme = astronvim.user_plugin_opts("colorscheme", nil, false) +vim.api.nvim_command( + "colorscheme " + .. (vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme") +) diff --git a/dot_config/nvim/lua/core/mappings.lua b/dot_config/nvim/lua/core/mappings.lua new file mode 100644 index 0000000..80b2812 --- /dev/null +++ b/dot_config/nvim/lua/core/mappings.lua @@ -0,0 +1,193 @@ +local is_available = astronvim.is_available + +local maps = { n = {}, v = {}, t = {}, [""] = {} } + +maps[""][""] = "" + +-- Normal -- +-- Standard Operations +maps.n["w"] = { "w", desc = "Save" } +maps.n["q"] = { "q", desc = "Quit" } +maps.n["h"] = { "nohlsearch", desc = "No Highlight" } +maps.n["u"] = { function() astronvim.toggle_url_match() end, desc = "Toggle URL Highlights" } +maps.n["fn"] = { "enew", desc = "New File" } +maps.n["gx"] = { function() astronvim.url_opener() end, desc = "Open the file under cursor with system app" } +maps.n[""] = { "w!", desc = "Force write" } +maps.n[""] = { "q!", desc = "Force quit" } +maps.n["Q"] = "" + +-- Packer +maps.n["pc"] = { "PackerCompile", desc = "Packer Compile" } +maps.n["pi"] = { "PackerInstall", desc = "Packer Install" } +maps.n["ps"] = { "PackerSync", desc = "Packer Sync" } +maps.n["pS"] = { "PackerStatus", desc = "Packer Status" } +maps.n["pu"] = { "PackerUpdate", desc = "Packer Update" } + +-- Alpha +if is_available "alpha-nvim" then maps.n["d"] = { "Alpha", desc = "Alpha Dashboard" } end + +-- Bufdelete +if is_available "bufdelete.nvim" then + maps.n["c"] = { "Bdelete", desc = "Close window" } +else + maps.n["c"] = { "bdelete", desc = "Close window" } +end + +-- Navigate buffers +if is_available "bufferline.nvim" then + maps.n[""] = { "BufferLineCycleNext", desc = "Next buffer tab" } + maps.n[""] = { "BufferLineCyclePrev", desc = "Previous buffer tab" } + maps.n[">b"] = { "BufferLineMoveNext", desc = "Move buffer tab right" } + maps.n["BufferLineMovePrev", desc = "Move buffer tab left" } +else + maps.n[""] = { "bnext", desc = "Next buffer" } + maps.n[""] = { "bprevious", desc = "Previous buffer" } +end + +-- Comment +if is_available "Comment.nvim" then + maps.n["/"] = { function() require("Comment.api").toggle_current_linewise() end, desc = "Comment line" } + maps.v["/"] = { + "lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())", + desc = "Toggle comment line", + } +end + +-- GitSigns +if is_available "gitsigns.nvim" then + maps.n["gj"] = { function() require("gitsigns").next_hunk() end, desc = "Next git hunk" } + maps.n["gk"] = { function() require("gitsigns").prev_hunk() end, desc = "Previous git hunk" } + maps.n["gl"] = { function() require("gitsigns").blame_line() end, desc = "View git blame" } + maps.n["gp"] = { function() require("gitsigns").preview_hunk() end, desc = "Preview git hunk" } + maps.n["gh"] = { function() require("gitsigns").reset_hunk() end, desc = "Reset git hunk" } + maps.n["gr"] = { function() require("gitsigns").reset_buffer() end, desc = "Reset git buffer" } + maps.n["gs"] = { function() require("gitsigns").stage_hunk() end, desc = "Stage git hunk" } + maps.n["gu"] = { function() require("gitsigns").undo_stage_hunk() end, desc = "Unstage git hunk" } + maps.n["gd"] = { function() require("gitsigns").diffthis() end, desc = "View git diff" } +end + +-- NeoTree +if is_available "neo-tree.nvim" then + maps.n["e"] = { "Neotree toggle", desc = "Toggle Explorer" } + maps.n["o"] = { "Neotree focus", desc = "Focus Explorer" } +end + +-- Session Manager +if is_available "neovim-session-manager" then + maps.n["Sl"] = { "SessionManager! load_last_session", desc = "Load last session" } + maps.n["Ss"] = { "SessionManager! save_current_session", desc = "Save this session" } + maps.n["Sd"] = { "SessionManager! delete_session", desc = "Delete session" } + maps.n["Sf"] = { "SessionManager! load_session", desc = "Search sessions" } + maps.n["S."] = + { "SessionManager! load_current_dir_session", desc = "Load current directory session" } +end + +-- LSP Installer +if is_available "nvim-lsp-installer" then + maps.n["li"] = { "LspInfo", desc = "LSP information" } + maps.n["lI"] = { "LspInstallInfo", desc = "LSP installer" } +end + +-- Smart Splits +if is_available "smart-splits.nvim" then + -- Better window navigation + maps.n[""] = { function() require("smart-splits").move_cursor_left() end, desc = "Move to left split" } + maps.n[""] = { function() require("smart-splits").move_cursor_down() end, desc = "Move to below split" } + maps.n[""] = { function() require("smart-splits").move_cursor_up() end, desc = "Move to above split" } + maps.n[""] = { function() require("smart-splits").move_cursor_right() end, desc = "Move to right split" } + + -- Resize with arrows + maps.n[""] = { function() require("smart-splits").resize_up() end, desc = "Resize split up" } + maps.n[""] = { function() require("smart-splits").resize_down() end, desc = "Resize split down" } + maps.n[""] = { function() require("smart-splits").resize_left() end, desc = "Resize split left" } + maps.n[""] = { function() require("smart-splits").resize_right() end, desc = "Resize split right" } +else + maps.n[""] = { "h", desc = "Move to left split" } + maps.n[""] = { "j", desc = "Move to below split" } + maps.n[""] = { "k", desc = "Move to above split" } + maps.n[""] = { "l", desc = "Move to right split" } + maps.n[""] = { "resize -2", desc = "Resize split up" } + maps.n[""] = { "resize +2", desc = "Resize split down" } + maps.n[""] = { "vertical resize -2", desc = "Resize split left" } + maps.n[""] = { "vertical resize +2", desc = "Resize split right" } +end + +-- SymbolsOutline +if is_available "aerial.nvim" then maps.n["lS"] = { "AerialToggle", desc = "Symbols outline" } end + +-- Telescope +if is_available "telescope.nvim" then + maps.n["fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Search words" } + maps.n["fW"] = { + function() + require("telescope.builtin").live_grep { + additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end, + } + end, + desc = "Search words in all files", + } + maps.n["gt"] = { function() require("telescope.builtin").git_status() end, desc = "Git status" } + maps.n["gb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" } + maps.n["gc"] = { function() require("telescope.builtin").git_commits() end, desc = "Git commits" } + maps.n["ff"] = { function() require("telescope.builtin").find_files() end, desc = "Search files" } + maps.n["fF"] = { + function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end, + desc = "Search all files", + } + maps.n["fb"] = { function() require("telescope.builtin").buffers() end, desc = "Search buffers" } + maps.n["fh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" } + maps.n["fm"] = { function() require("telescope.builtin").marks() end, desc = "Search marks" } + maps.n["fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Search history" } + maps.n["fc"] = + { function() require("telescope.builtin").grep_string() end, desc = "Search for word under cursor" } + maps.n["sb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" } + maps.n["sh"] = { function() require("telescope.builtin").help_tags() end, desc = "Search help" } + maps.n["sm"] = { function() require("telescope.builtin").man_pages() end, desc = "Search man" } + maps.n["sn"] = + { function() require("telescope").extensions.notify.notify() end, desc = "Search notifications" } + maps.n["sr"] = { function() require("telescope.builtin").registers() end, desc = "Search registers" } + maps.n["sk"] = { function() require("telescope.builtin").keymaps() end, desc = "Search keymaps" } + maps.n["sc"] = { function() require("telescope.builtin").commands() end, desc = "Search commands" } + maps.n["ls"] = { + function() + local aerial_avail, _ = pcall(require, "aerial") + if aerial_avail then + require("telescope").extensions.aerial.aerial() + else + require("telescope.builtin").lsp_document_symbols() + end + end, + desc = "Search symbols", + } + maps.n["lR"] = { function() require("telescope.builtin").lsp_references() end, desc = "Search references" } + maps.n["lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" } +end + +-- Terminal +if is_available "toggleterm.nvim" then + local toggle_term_cmd = astronvim.toggle_term_cmd + maps.n[""] = { "ToggleTerm", desc = "Toggle terminal" } + maps.n["gg"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } + maps.n["tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" } + maps.n["tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" } + maps.n["tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" } + maps.n["tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" } + maps.n["tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } + maps.n["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" } + maps.n["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" } + maps.n["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" } +end + +-- Stay in indent mode +maps.v["<"] = { ""] = { ">gv", desc = "indent line" } + +-- Improved Terminal Mappings +maps.t[""] = { "", desc = "Terminal normal mode" } +maps.t["jk"] = { "", desc = "Terminal normal mode" } +maps.t[""] = { "h", desc = "Terminal left window navigation" } +maps.t[""] = { "j", desc = "Terminal down window navigation" } +maps.t[""] = { "k", desc = "Terminal up window navigation" } +maps.t[""] = { "l", desc = "Terminal right window naviation" } + +astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps)) diff --git a/dot_config/nvim/lua/core/options.lua b/dot_config/nvim/lua/core/options.lua new file mode 100644 index 0000000..38dcc93 --- /dev/null +++ b/dot_config/nvim/lua/core/options.lua @@ -0,0 +1,61 @@ +astronvim.vim_opts(astronvim.user_plugin_opts("options", { + opt = { + backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert + clipboard = "unnamedplus", -- Connection to the system clipboard + completeopt = { "menuone", "noselect" }, -- Options for insert mode completion + copyindent = true, -- Copy the previous indentation on autoindenting + cursorline = true, -- Highlight the text line of the cursor + expandtab = true, -- Enable the use of space in tab + fileencoding = "utf-8", -- File content encoding for the buffer + fillchars = { eob = " " }, -- Disable `~` on nonexistent lines + history = 100, -- Number of commands to remember in a history table + ignorecase = true, -- Case insensitive searching + laststatus = 3, -- globalstatus + lazyredraw = true, -- lazily redraw screen + mouse = "a", -- Enable mouse support + number = true, -- Show numberline + preserveindent = true, -- Preserve indent structure as much as possible + pumheight = 10, -- Height of the pop up menu + relativenumber = true, -- Show relative numberline + scrolloff = 8, -- Number of lines to keep above and below the cursor + shiftwidth = 2, -- Number of space inserted for indentation + showmode = false, -- Disable showing modes in command line + sidescrolloff = 8, -- Number of columns to keep at the sides of the cursor + signcolumn = "yes", -- Always show the sign column + smartcase = true, -- Case sensitivie searching + splitbelow = true, -- Splitting a new window below the current one + splitright = true, -- Splitting a new window at the right of the current one + swapfile = false, -- Disable use of swapfile for the buffer + tabstop = 2, -- Number of space in a tab + termguicolors = true, -- Enable 24-bit RGB color in the TUI + timeoutlen = 300, -- Length of time to wait for a mapped sequence + undofile = true, -- Enable persistent undo + updatetime = 300, -- Length of time to wait before triggering the plugin + wrap = false, -- Disable wrapping of lines longer than the width of window + writebackup = false, -- Disable making a backup before overwriting a file + }, + g = { + do_filetype_lua = 1, -- use filetype.lua + did_load_filetypes = 0, -- don't use filetype.vim + highlighturl_enabled = true, -- highlight URLs by default + mapleader = " ", -- set leader key + zipPlugin = false, -- disable zip + load_black = false, -- disable black + loaded_2html_plugin = true, -- disable 2html + loaded_getscript = true, -- disable getscript + loaded_getscriptPlugin = true, -- disable getscript + loaded_gzip = true, -- disable gzip + loaded_logipat = true, -- disable logipat + loaded_matchit = true, -- disable matchit + loaded_netrwFileHandlers = true, -- disable netrw + loaded_netrwPlugin = true, -- disable netrw + loaded_netrwSettngs = true, -- disable netrw + loaded_remote_plugins = true, -- disable remote plugins + loaded_tar = true, -- disable tar + loaded_tarPlugin = true, -- disable tar + loaded_zip = true, -- disable zip + loaded_zipPlugin = true, -- disable zip + loaded_vimball = true, -- disable vimball + loaded_vimballPlugin = true, -- disable vimball + }, +})) diff --git a/dot_config/nvim/lua/core/plugins.lua b/dot_config/nvim/lua/core/plugins.lua new file mode 100644 index 0000000..3e495ab --- /dev/null +++ b/dot_config/nvim/lua/core/plugins.lua @@ -0,0 +1,291 @@ +local astro_plugins = { + -- Plugin manager + ["wbthomason/packer.nvim"] = {}, + + -- Optimiser + ["lewis6991/impatient.nvim"] = {}, + + -- Lua functions + ["nvim-lua/plenary.nvim"] = { module = "plenary" }, + + -- Popup API + ["nvim-lua/popup.nvim"] = {}, + + -- Indent detection + ["Darazaki/indent-o-matic"] = { + event = "BufReadPost", + config = function() require "configs.indent-o-matic" end, + }, + + -- Notification Enhancer + ["rcarriga/nvim-notify"] = { + event = "VimEnter", + config = function() require "configs.notify" end, + }, + + -- Neovim UI Enhancer + ["stevearc/dressing.nvim"] = { + event = "VimEnter", + config = function() require "configs.dressing" end, + }, + + -- Cursorhold fix + ["antoinemadec/FixCursorHold.nvim"] = { + event = { "BufRead", "BufNewFile" }, + config = function() vim.g.cursorhold_updatetime = 100 end, + }, + + -- Smarter Splits + ["mrjones2014/smart-splits.nvim"] = { + module = "smart-splits", + config = function() require "configs.smart-splits" end, + }, + + -- Icons + ["kyazdani42/nvim-web-devicons"] = { + event = "VimEnter", + config = function() require "configs.icons" end, + }, + + -- Bufferline + ["akinsho/bufferline.nvim"] = { + after = "nvim-web-devicons", + config = function() require "configs.bufferline" end, + }, + + -- Better buffer closing + ["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } }, + + -- File explorer + ["nvim-neo-tree/neo-tree.nvim"] = { + branch = "v2.x", + module = "neo-tree", + cmd = "Neotree", + requires = { { "MunifTanjim/nui.nvim", module = "nui" } }, + setup = function() vim.g.neo_tree_remove_legacy_commands = true end, + config = function() require "configs.neo-tree" end, + }, + + -- Statusline + ["feline-nvim/feline.nvim"] = { + after = "nvim-web-devicons", + config = function() require "configs.feline" end, + }, + + -- Parenthesis highlighting + ["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" }, + + -- Autoclose tags + ["windwp/nvim-ts-autotag"] = { after = "nvim-treesitter" }, + + -- Context based commenting + ["JoosepAlviste/nvim-ts-context-commentstring"] = { after = "nvim-treesitter" }, + + -- Syntax highlighting + ["nvim-treesitter/nvim-treesitter"] = { + run = ":TSUpdate", + event = { "BufRead", "BufNewFile" }, + cmd = { + "TSInstall", + "TSInstallInfo", + "TSInstallSync", + "TSUninstall", + "TSUpdate", + "TSUpdateSync", + "TSDisableAll", + "TSEnableAll", + }, + config = function() require "configs.treesitter" end, + }, + + -- Snippet collection + ["rafamadriz/friendly-snippets"] = { opt = true }, + + -- Snippet engine + ["L3MON4D3/LuaSnip"] = { + module = "luasnip", + wants = "friendly-snippets", + config = function() require "configs.luasnip" end, + }, + + -- Completion engine + ["hrsh7th/nvim-cmp"] = { + event = "InsertEnter", + config = function() require "configs.cmp" end, + }, + + -- Snippet completion source + ["saadparwaiz1/cmp_luasnip"] = { + after = "nvim-cmp", + config = function() astronvim.add_user_cmp_source "luasnip" end, + }, + + -- Buffer completion source + ["hrsh7th/cmp-buffer"] = { + after = "nvim-cmp", + config = function() astronvim.add_user_cmp_source "buffer" end, + }, + + -- Path completion source + ["hrsh7th/cmp-path"] = { + after = "nvim-cmp", + config = function() astronvim.add_user_cmp_source "path" end, + }, + + -- LSP completion source + ["hrsh7th/cmp-nvim-lsp"] = { + after = "nvim-cmp", + config = function() astronvim.add_user_cmp_source "nvim_lsp" end, + }, + + -- Built-in LSP + ["neovim/nvim-lspconfig"] = { event = "VimEnter" }, + + -- LSP manager + ["williamboman/nvim-lsp-installer"] = { + after = "nvim-lspconfig", + config = function() + require "configs.nvim-lsp-installer" + require "configs.lsp" + end, + }, + + -- LSP symbols + ["stevearc/aerial.nvim"] = { + module = "aerial", + cmd = { "AerialToggle", "AerialOpen", "AerialInfo" }, + config = function() require "configs.aerial" end, + }, + + -- Formatting and linting + ["jose-elias-alvarez/null-ls.nvim"] = { + event = { "BufRead", "BufNewFile" }, + config = function() require "configs.null-ls" end, + }, + + -- Fuzzy finder + ["nvim-telescope/telescope.nvim"] = { + cmd = "Telescope", + module = "telescope", + config = function() require "configs.telescope" end, + }, + + -- Fuzzy finder syntax support + [("nvim-telescope/telescope-%s-native.nvim"):format(vim.fn.has "win32" == 1 and "fzy" or "fzf")] = { + after = "telescope.nvim", + run = vim.fn.has "win32" ~= 1 and "make" or nil, + config = function() require("telescope").load_extension(vim.fn.has "win32" == 1 and "fzy_native" or "fzf") end, + }, + + -- Git integration + ["lewis6991/gitsigns.nvim"] = { + event = "BufEnter", + config = function() require "configs.gitsigns" end, + }, + + -- Start screen + ["goolord/alpha-nvim"] = { + cmd = "Alpha", + module = "alpha", + config = function() require "configs.alpha" end, + }, + + -- Color highlighting + ["norcalli/nvim-colorizer.lua"] = { + event = { "BufRead", "BufNewFile" }, + config = function() require "configs.colorizer" end, + }, + + -- Autopairs + ["windwp/nvim-autopairs"] = { + event = "InsertEnter", + config = function() require "configs.autopairs" end, + }, + + -- Terminal + ["akinsho/toggleterm.nvim"] = { + cmd = "ToggleTerm", + module = { "toggleterm", "toggleterm.terminal" }, + config = function() require "configs.toggleterm" end, + }, + + -- Commenting + ["numToStr/Comment.nvim"] = { + module = { "Comment", "Comment.api" }, + keys = { "gc", "gb", "g<", "g>" }, + config = function() require "configs.Comment" end, + }, + + -- Indentation + ["lukas-reineke/indent-blankline.nvim"] = { + event = "BufRead", + config = function() require "configs.indent-line" end, + }, + + -- Keymaps popup + ["folke/which-key.nvim"] = { + module = "which-key", + config = function() require "configs.which-key" end, + }, + + -- Smooth scrolling + ["declancm/cinnamon.nvim"] = { + event = { "BufRead", "BufNewFile" }, + config = function() require "configs.cinnamon" end, + }, + + -- Smooth escaping + ["max397574/better-escape.nvim"] = { + event = "InsertCharPre", + config = function() require "configs.better_escape" end, + }, + + -- Get extra JSON schemas + ["b0o/SchemaStore.nvim"] = { module = "schemastore" }, + + -- Session manager + ["Shatur/neovim-session-manager"] = { + module = "session_manager", + cmd = "SessionManager", + event = "BufWritePost", + config = function() require "configs.session_manager" end, + }, +} + +if astronvim.updater.snapshot then + for plugin, options in pairs(astro_plugins) do + local pin = astronvim.updater.snapshot[plugin:match "/([^/]*)$"] + options.commit = pin and pin.commit or options.commit + end +end + +local user_plugin_opts = astronvim.user_plugin_opts +local status_ok, packer = pcall(require, "packer") +if status_ok then + packer.startup { + function(use) + for key, plugin in pairs(user_plugin_opts("plugins.init", astro_plugins)) do + if type(key) == "string" and not plugin[1] then plugin[1] = key end + use(plugin) + end + end, + config = user_plugin_opts("plugins.packer", { + compile_path = astronvim.default_compile_path, + display = { + open_fn = function() return require("packer.util").float { border = "rounded" } end, + }, + profile = { + enable = true, + threshold = 0.0001, + }, + git = { + clone_timeout = 300, + subcommands = { + update = "pull --rebase", + }, + }, + auto_clean = true, + compile_on_sync = true, + }), + } +end diff --git a/dot_config/nvim/lua/core/status.lua b/dot_config/nvim/lua/core/status.lua new file mode 100644 index 0000000..90f571d --- /dev/null +++ b/dot_config/nvim/lua/core/status.lua @@ -0,0 +1,112 @@ +local M = { hl = {}, provider = {}, conditional = {} } +local C = require "default_theme.colors" + +local function hl_by_name(name) return string.format("#%06x", vim.api.nvim_get_hl_by_name(name.group, true)[name.prop]) end + +local function hl_prop(group, prop) + local status_ok, color = pcall(hl_by_name, { group = group, prop = prop }) + return status_ok and color or nil +end + +M.modes = { + ["n"] = { "NORMAL", "Normal", C.blue }, + ["no"] = { "N-PENDING", "Normal", C.blue }, + ["i"] = { "INSERT", "Insert", C.green }, + ["ic"] = { "INSERT", "Insert", C.green }, + ["t"] = { "TERMINAL", "Insert", C.green }, + ["v"] = { "VISUAL", "Visual", C.purple }, + ["V"] = { "V-LINE", "Visual", C.purple }, + [""] = { "V-BLOCK", "Visual", C.purple }, + ["R"] = { "REPLACE", "Replace", C.red_1 }, + ["Rv"] = { "V-REPLACE", "Replace", C.red_1 }, + ["s"] = { "SELECT", "Visual", C.orange_1 }, + ["S"] = { "S-LINE", "Visual", C.orange_1 }, + [""] = { "S-BLOCK", "Visual", C.orange_1 }, + ["c"] = { "COMMAND", "Command", C.yellow_1 }, + ["cv"] = { "COMMAND", "Command", C.yellow_1 }, + ["ce"] = { "COMMAND", "Command", C.yellow_1 }, + ["r"] = { "PROMPT", "Inactive", C.grey_7 }, + ["rm"] = { "MORE", "Inactive", C.grey_7 }, + ["r?"] = { "CONFIRM", "Inactive", C.grey_7 }, + ["!"] = { "SHELL", "Inactive", C.grey_7 }, +} + +function M.hl.group(hlgroup, base) + return vim.tbl_deep_extend( + "force", + base or {}, + { fg = hl_prop(hlgroup, "foreground"), bg = hl_prop(hlgroup, "background") } + ) +end + +function M.hl.fg(hlgroup, base) return vim.tbl_deep_extend("force", base or {}, { fg = hl_prop(hlgroup, "foreground") }) end + +function M.hl.mode(base) + local lualine_avail, lualine = pcall(require, "lualine.themes." .. (vim.g.colors_name or "default_theme")) + return function() + local lualine_opts = lualine_avail and lualine[M.modes[vim.fn.mode()][2]:lower()] + return M.hl.group( + "Feline" .. M.modes[vim.fn.mode()][2], + vim.tbl_deep_extend( + "force", + lualine_opts and type(lualine_opts.a) == "table" and lualine_opts.a + or { fg = C.bg_1, bg = M.modes[vim.fn.mode()][3] }, + base or {} + ) + ) + end +end + +function M.provider.lsp_progress() + local Lsp = vim.lsp.util.get_progress_messages()[1] + return Lsp + and string.format( + " %%<%s %s %s (%s%%%%) ", + ((Lsp.percentage or 0) >= 70 and { "", "", "" } or { "", "", "" })[math.floor( + vim.loop.hrtime() / 12e7 + ) % 3 + 1], + Lsp.title or "", + Lsp.message or "", + Lsp.percentage or 0 + ) + or "" +end + +function M.provider.lsp_client_names(expand_null_ls) + return function() + local buf_client_names = {} + for _, client in pairs(vim.lsp.buf_get_clients(0)) do + if client.name == "null-ls" and expand_null_ls then + vim.list_extend(buf_client_names, astronvim.null_ls_sources(vim.bo.filetype, "FORMATTING")) + vim.list_extend(buf_client_names, astronvim.null_ls_sources(vim.bo.filetype, "DIAGNOSTICS")) + else + table.insert(buf_client_names, client.name) + end + end + return table.concat(buf_client_names, ", ") + end +end + +function M.provider.treesitter_status() + local ts = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] + return (ts and next(ts)) and " 綠TS" or "" +end + +function M.provider.spacer(n) return string.rep(" ", n or 1) end + +function M.conditional.git_available() return vim.b.gitsigns_head ~= nil end + +function M.conditional.git_changed() + local git_status = vim.b.gitsigns_status_dict + return git_status and (git_status.added or 0) + (git_status.removed or 0) + (git_status.changed or 0) > 0 +end + +function M.conditional.has_filetype() + return vim.fn.empty(vim.fn.expand "%:t") ~= 1 and vim.bo.filetype and vim.bo.filetype ~= "" +end + +function M.conditional.bar_width(n) + return function() return (vim.opt.laststatus:get() == 3 and vim.opt.columns:get() or vim.fn.winwidth(0)) > (n or 80) end +end + +return M diff --git a/dot_config/nvim/lua/core/utils/git.lua b/dot_config/nvim/lua/core/utils/git.lua new file mode 100644 index 0000000..3a3870b --- /dev/null +++ b/dot_config/nvim/lua/core/utils/git.lua @@ -0,0 +1,76 @@ +local git = { url = "https://github.com/" } + +function git.cmd(args, ...) return astronvim.cmd("git -C " .. astronvim.install.home .. " " .. args, ...) end + +function git.is_repo() return git.cmd("rev-parse --is-inside-work-tree", false) end + +function git.fetch(remote, ...) return git.cmd("fetch " .. remote, ...) end + +function git.pull(...) return git.cmd("pull --rebase", ...) end + +function git.checkout(dest, ...) return git.cmd("checkout " .. dest, ...) end + +function git.hard_reset(dest, ...) return git.cmd("reset --hard " .. dest, ...) end + +function git.branch_contains(remote, branch, commit, ...) + return git.cmd("merge-base --is-ancestor " .. commit .. " " .. remote .. "/" .. branch, ...) ~= nil +end + +function git.remote_add(remote, url, ...) return git.cmd("remote add " .. remote .. " " .. url, ...) end + +function git.remote_update(remote, url, ...) return git.cmd("remote set-url " .. remote .. " " .. url, ...) end + +function git.remote_url(remote, ...) return astronvim.trim_or_nil(git.cmd("remote get-url " .. remote, ...)) end + +function git.current_version(...) return astronvim.trim_or_nil(git.cmd("describe --tags", ...)) end + +function git.current_branch(...) return astronvim.trim_or_nil(git.cmd("rev-parse --abbrev-ref HEAD", ...)) end + +function git.local_head(...) return astronvim.trim_or_nil(git.cmd("rev-parse HEAD", ...)) end + +function git.remote_head(remote, branch, ...) + return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. remote .. "/" .. branch, ...)) +end + +function git.tag_commit(tag, ...) return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. tag, ...)) end + +function git.get_commit_range(start_hash, end_hash, ...) + local log = git.cmd("log --no-merges --pretty='format:[%h] %s' " .. start_hash .. ".." .. end_hash, ...) + return log and vim.fn.split(log, "\n") or {} +end + +function git.get_versions(search, ...) + local tags = git.cmd("tag -l --sort=version:refname '" .. (search == "latest" and "v*" or search) .. "'", ...) + return tags and vim.fn.split(tags, "\n") or {} +end + +function git.latest_version(versions, ...) + versions = versions and versions or git.get_versions(...) + return versions[#versions] +end + +function git.parse_remote_url(str) + return vim.fn.match(str, astronvim.url_matcher) == -1 + and git.url .. str .. (vim.fn.match(str, "/") == -1 and "/AstroNvim.git" or ".git") + or str +end + +function git.breaking_changes(commits) + return vim.tbl_filter( + function(v) return vim.fn.match(v, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 end, + commits + ) +end + +function git.pretty_changelog(commits) + local changelog = {} + for _, commit in ipairs(commits) do + local hash, type, msg = commit:match "(%[.*%])(.*:)(.*)" + if hash and type and msg then + vim.list_extend(changelog, { { hash, "DiffText" }, { type, "Typedef" }, { msg }, { "\n" } }) + end + end + return changelog +end + +return git diff --git a/dot_config/nvim/lua/core/utils/init.lua b/dot_config/nvim/lua/core/utils/init.lua new file mode 100644 index 0000000..edc8cbd --- /dev/null +++ b/dot_config/nvim/lua/core/utils/init.lua @@ -0,0 +1,262 @@ +_G.astronvim = {} +local stdpath = vim.fn.stdpath +local tbl_insert = table.insert +local map = vim.keymap.set + +astronvim.install = astronvim_installation or { home = stdpath "config" } +astronvim.install.config = stdpath("config"):gsub("nvim$", "astronvim") +vim.opt.rtp:append(astronvim.install.config) +local supported_configs = { astronvim.install.home, astronvim.install.config } + +local function load_module_file(module) + local found_module = nil + for _, config_path in ipairs(supported_configs) do + local module_path = config_path .. "/lua/" .. module:gsub("%.", "/") .. ".lua" + if vim.fn.filereadable(module_path) == 1 then found_module = module_path end + end + if found_module then + local status_ok, loaded_module = pcall(require, module) + if status_ok then + found_module = loaded_module + else + astronvim.notify("Error loading " .. found_module, "error") + end + end + return found_module +end + +astronvim.user_settings = load_module_file "user.init" +astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua" +astronvim.user_terminals = {} +astronvim.url_matcher = + "\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+" + +local function func_or_extend(overrides, default, extend) + if extend then + if type(overrides) == "table" then + default = vim.tbl_deep_extend("force", default, overrides) + elseif type(overrides) == "function" then + default = overrides(default) + end + elseif overrides ~= nil then + default = overrides + end + return default +end + +function astronvim.conditional_func(func, condition, ...) + if (condition == nil and true or condition) and type(func) == "function" then return func(...) end +end + +function astronvim.trim_or_nil(str) return type(str) == "string" and vim.trim(str) or nil end + +function astronvim.notify(msg, type, opts) + vim.notify(msg, type, vim.tbl_deep_extend("force", { title = "AstroNvim" }, opts or {})) +end + +function astronvim.echo(messages) + messages = messages or { { "\n" } } + if type(messages) == "table" then vim.api.nvim_echo(messages, false, {}) end +end + +function astronvim.confirm_prompt(messages) + if messages then astronvim.echo(messages) end + local confirmed = string.lower(vim.fn.input "(y/n) ") == "y" + astronvim.echo() + astronvim.echo() + return confirmed +end + +local function user_setting_table(module) + local settings = astronvim.user_settings or {} + for tbl in string.gmatch(module, "([^%.]+)") do + settings = settings[tbl] + if settings == nil then break end + end + return settings +end + +function astronvim.initialize_packer() + local packer_avail, _ = pcall(require, "packer") + if not packer_avail then + local packer_path = stdpath "data" .. "/site/pack/packer/start/packer.nvim" + vim.fn.delete(packer_path, "rf") + vim.fn.system { + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + packer_path, + } + astronvim.echo { { "Initializing Packer...\n\n" } } + vim.cmd "packadd packer.nvim" + packer_avail, _ = pcall(require, "packer") + if not packer_avail then vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path) end + end + if packer_avail then + local run_me, _ = loadfile( + astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path + ) + if run_me then + run_me() + else + astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } } + end + end +end + +function astronvim.vim_opts(options) + for scope, table in pairs(options) do + for setting, value in pairs(table) do + vim[scope][setting] = value + end + end +end + +function astronvim.user_plugin_opts(module, default, extend, prefix) + if extend == nil then extend = true end + default = default or {} + local user_settings = load_module_file((prefix or "user") .. "." .. module) + if user_settings == nil and prefix == nil then user_settings = user_setting_table(module) end + if user_settings ~= nil then default = func_or_extend(user_settings, default, extend) end + return default +end + +function astronvim.url_opener() + if vim.fn.has "mac" == 1 then + vim.fn.jobstart({ "open", vim.fn.expand "" }, { detach = true }) + elseif vim.fn.has "unix" == 1 then + vim.fn.jobstart({ "xdg-open", vim.fn.expand "" }, { detach = true }) + else + astronvim.notify("gx is not supported on this OS!", "error") + end +end + +-- term_details can be either a string for just a command or +-- a complete table to provide full access to configuration when calling Terminal:new() +function astronvim.toggle_term_cmd(term_details) + if type(term_details) == "string" then term_details = { cmd = term_details, hidden = true } end + local term_key = term_details.cmd + if vim.v.count > 0 and term_details.count == nil then + term_details.count = vim.v.count + term_key = term_key .. vim.v.count + end + if astronvim.user_terminals[term_key] == nil then + astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details) + end + astronvim.user_terminals[term_key]:toggle() +end + +function astronvim.add_cmp_source(source) + local cmp_avail, cmp = pcall(require, "cmp") + if cmp_avail then + local config = cmp.get_config() + tbl_insert(config.sources, source) + cmp.setup(config) + end +end + +function astronvim.get_user_cmp_source(source) + source = type(source) == "string" and { name = source } or source + local priority = astronvim.user_plugin_opts("cmp.source_priority", { + nvim_lsp = 1000, + luasnip = 750, + buffer = 500, + path = 250, + })[source.name] + if priority then source.priority = priority end + return source +end + +function astronvim.add_user_cmp_source(source) astronvim.add_cmp_source(astronvim.get_user_cmp_source(source)) end + +function astronvim.null_ls_providers(filetype) + local registered = {} + local sources_avail, sources = pcall(require, "null-ls.sources") + if sources_avail then + for _, source in ipairs(sources.get_available(filetype)) do + for method in pairs(source.methods) do + registered[method] = registered[method] or {} + tbl_insert(registered[method], source.name) + end + end + end + return registered +end + +function astronvim.null_ls_sources(filetype, source) + local methods_avail, methods = pcall(require, "null-ls.methods") + return methods_avail and astronvim.null_ls_providers(filetype)[methods.internal[source]] or {} +end + +function astronvim.alpha_button(sc, txt) + local sc_ = sc:gsub("%s", ""):gsub("LDR", "") + if vim.g.mapleader then sc = sc:gsub("LDR", vim.g.mapleader == " " and "SPC" or vim.g.mapleader) 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 = { + position = "center", + text = txt, + shortcut = sc, + cursor = 5, + width = 36, + align_shortcut = "right", + hl = "DashboardCenter", + hl_shortcut = "DashboardShortcut", + }, + } +end + +function astronvim.is_available(plugin) return packer_plugins ~= nil and packer_plugins[plugin] ~= nil end + +function astronvim.set_mappings(map_table, base) + for mode, maps in pairs(map_table) do + for keymap, options in pairs(maps) do + if options then + local cmd = options + if type(options) == "table" then + cmd = options[1] + options[1] = nil + else + options = {} + end + map(mode, keymap, cmd, vim.tbl_deep_extend("force", options, base or {})) + end + end + end +end + +function astronvim.delete_url_match() + for _, match in ipairs(vim.fn.getmatches()) do + if match.group == "HighlightURL" then vim.fn.matchdelete(match.id) end + end +end + +function astronvim.set_url_match() + astronvim.delete_url_match() + if vim.g.highlighturl_enabled then vim.fn.matchadd("HighlightURL", astronvim.url_matcher, 15) end +end + +function astronvim.toggle_url_match() + vim.g.highlighturl_enabled = not vim.g.highlighturl_enabled + astronvim.set_url_match() +end + +function astronvim.cmd(cmd, show_error) + local result = vim.fn.system(cmd) + local success = vim.api.nvim_get_vvar "shell_error" == 0 + if not success and (show_error == nil and true or show_error) then + vim.api.nvim_err_writeln("Error running command: " .. cmd .. "\nError message:\n" .. result) + end + return success and result or nil +end + +require "core.utils.updater" + +return astronvim diff --git a/dot_config/nvim/lua/core/utils/updater.lua b/dot_config/nvim/lua/core/utils/updater.lua new file mode 100644 index 0000000..8dad31f --- /dev/null +++ b/dot_config/nvim/lua/core/utils/updater.lua @@ -0,0 +1,154 @@ +local fn = vim.fn +local git = require "core.utils.git" +local options = astronvim.user_plugin_opts( + "updater", + { remote = "origin", branch = "main", channel = "nightly", show_changelog = true } +) + +if astronvim.install.is_stable ~= nil then options.channel = astronvim.install.is_stable and "stable" or "nightly" end + +astronvim.updater = { options = options } +if options.pin_plugins == nil and options.channel == "stable" or options.pin_plugins then + local loaded, snapshot = pcall(fn.readfile, astronvim.install.home .. "/packer_snapshot") + if loaded then + loaded, snapshot = pcall(fn.json_decode, snapshot) + astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil + end + if not loaded then vim.api.nvim_err_writeln "Error loading packer snapshot" end +end + +function astronvim.updater.version() + local version = astronvim.install.version or git.current_version(false) + if version then astronvim.notify("Version: " .. version) end +end + +local function attempt_update(target) + if options.channel == "stable" or options.commit then + return git.checkout(target, false) + else + return git.pull(false) + end +end + +local cancelled_message = { { "Update cancelled", "WarningMsg" } } + +function astronvim.updater.update() + if not git.is_repo() then + astronvim.notify("Updater not available for non-git installations", "error") + return + end + for remote, entry in pairs(options.remotes and options.remotes or {}) do + local url = git.parse_remote_url(entry) + local current_url = git.remote_url(remote, false) + local check_needed = false + if not current_url then + git.remote_add(remote, url) + check_needed = true + elseif + current_url ~= url + and astronvim.confirm_prompt { + { "Remote " }, + { remote, "Title" }, + { " is currently set to " }, + { current_url, "WarningMsg" }, + { "\nWould you like us to set it to " }, + { url, "String" }, + { "?" }, + } + then + git.remote_update(remote, url) + check_needed = true + end + if check_needed and git.remote_url(remote, false) ~= url then + vim.api.nvim_err_writeln("Error setting up remote " .. remote .. " to " .. url) + return + end + end + local is_stable = options.channel == "stable" + options.branch = is_stable and "main" or options.branch + if not git.fetch(options.remote) then + vim.api.nvim_err_writeln("Error fetching remote: " .. options.remote) + return + end + local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch + if git.current_branch() ~= local_branch then + astronvim.echo { + { "Switching to branch: " }, + { options.remote .. "/" .. options.branch .. "\n\n", "String" }, + } + if not git.checkout(local_branch, false) then + git.checkout("-b " .. local_branch .. " " .. options.remote .. "/" .. options.branch, false) + end + end + if git.current_branch() ~= local_branch then + vim.api.nvim_err_writeln("Error checking out branch: " .. options.remote .. "/" .. options.branch) + return + end + local source = git.local_head() -- calculate current commit + local target -- calculate target commit + if is_stable then -- if stable get tag commit + options.version = git.latest_version(git.get_versions(options.version or "latest")) + target = git.tag_commit(options.version) + elseif options.commit then -- if commit specified use it + target = git.branch_contains(options.remote, options.branch, options.commit) and options.commit or nil + else -- get most recent commit + target = git.remote_head(options.remote, options.branch) + end + if not source or not target then -- continue if current and target commits were found + vim.api.nvim_err_writeln "Error checking for updates" + return + elseif source == target then + astronvim.echo { { "No updates available", "String" } } + return + elseif -- prompt user if they want to accept update + not options.skip_prompts + and not astronvim.confirm_prompt { + { "Update available to ", "Title" }, + { is_stable and options.version or target, "String" }, + { "\nContinue?" }, + } + then + astronvim.echo(cancelled_message) + return + else -- perform update + local changelog = git.get_commit_range(source, target) + local breaking = git.breaking_changes(changelog) + local breaking_prompt = { { "Update contains the following breaking changes:\n", "WarningMsg" } } + vim.list_extend(breaking_prompt, git.pretty_changelog(breaking)) + vim.list_extend(breaking_prompt, { { "\nWould you like to continue?" } }) + if #breaking > 0 and not options.skip_prompts and not astronvim.confirm_prompt(breaking_prompt) then + astronvim.echo(cancelled_message) + return + end + local updated = attempt_update(target) + if + not updated + and not options.skip_prompts + and not astronvim.confirm_prompt { + { "Unable to pull due to local modifications to base files.\n", "ErrorMsg" }, + { "Reset local files and continue?" }, + } + then + astronvim.echo(cancelled_message) + return + elseif not updated then + git.hard_reset(source) + updated = attempt_update(target) + end + if not updated then + vim.api.nvim_err_writeln "Error ocurred performing update" + return + end + local summary = { + { "AstroNvim updated successfully to ", "Title" }, + { git.current_version(), "String" }, + { "!\n", "Title" }, + { "Please restart and run :PackerSync.\n\n", "WarningMsg" }, + } + if options.show_changelog and #changelog > 0 then + vim.list_extend(summary, { { "Changelog:\n", "Title" } }) + vim.list_extend(summary, git.pretty_changelog(changelog)) + end + astronvim.echo(summary) + end +end diff --git a/dot_config/nvim/lua/default_theme/base.lua b/dot_config/nvim/lua/default_theme/base.lua new file mode 100644 index 0000000..0e945d2 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/base.lua @@ -0,0 +1,89 @@ +local base = { + Normal = { fg = C.fg, bg = C.bg }, + Comment = { fg = C.grey_2, bg = C.none }, + Constant = { fg = C.yellow, bg = C.none }, + String = { fg = C.green, bg = C.none }, + Character = { fg = C.green, bg = C.none }, + Number = { fg = C.orange, bg = C.none }, + Boolean = { fg = C.blue, bg = C.none }, + Float = { fg = C.yellow, bg = C.none }, + Identifier = { fg = C.blue, bg = C.none }, + Function = { fg = C.yellow, bg = C.none }, + Statement = { fg = C.purple, bg = C.none }, + Conditional = { fg = C.purple_1, bg = C.none }, + Repeat = { fg = C.purple, bg = C.none }, + Label = { fg = C.blue, bg = C.none }, + Operator = { fg = C.purple, bg = C.none }, + Keyword = { fg = C.purple, bg = C.none }, + Exception = { fg = C.purple, bg = C.none }, + Preproc = { fg = C.yellow, bg = C.none }, + Include = { fg = C.purple, bg = C.none }, + Define = { fg = C.purple, bg = C.none }, + Title = { fg = C.cyan, bg = C.none }, + Macro = { fg = C.purple, bg = C.none }, + PreCondit = { fg = C.blue, bg = C.none }, + Type = { fg = C.blue, bg = C.none }, + StorageClass = { fg = C.blue, bg = C.none }, + Structure = { fg = C.yellow, bg = C.none }, + Typedef = { fg = C.yellow, bg = C.none }, + Special = { fg = C.blue, bg = C.none }, + SpecialComment = { fg = C.grey, bg = C.none }, + Error = { fg = C.red, bg = C.none }, + Todo = { fg = C.purple, bg = C.none }, + Underlined = { fg = C.cyan, bg = C.none }, + Cursor = { fg = C.none, bg = C.none }, + ColorColumn = { fg = C.none, bg = C.grey_4 }, + CursorLineNr = { fg = C.fg, bg = C.none }, + Conceal = { fg = C.grey, bg = C.none }, + CursorColumn = { fg = C.none, bg = C.grey_4 }, + CursorLine = { fg = C.none, bg = C.grey_8 }, + Directory = { fg = C.blue, bg = C.none }, + DiffAdd = { fg = C.grey_3, bg = C.green }, + DiffChange = { fg = C.yellow, bg = C.none }, + DiffDelete = { fg = C.grey_3, bg = C.red }, + DiffText = { fg = C.grey_3, bg = C.yellow }, + ErrorMsg = { fg = C.red, bg = C.none }, + VertSplit = { fg = C.grey_4, bg = C.none }, + Folded = { fg = C.grey, bg = C.none }, + FoldColumn = { fg = C.none, bg = C.none }, + IncSearch = { fg = C.yellow, bg = C.grey }, + LineNr = { fg = C.grey_1, bg = C.none }, + NonText = { fg = C.grey_1, bg = C.none }, + Pmenu = { fg = C.fg, bg = C.black_1 }, + PmenuSel = { fg = C.none, bg = C.grey_4 }, + PmenuSbar = { fg = C.none, bg = C.grey_3 }, + PmenuThumb = { fg = C.none, bg = C.fg }, + Question = { fg = C.purple, bg = C.none }, + QuickFixLine = { fg = C.grey_3, bg = C.yellow }, + Search = { fg = C.grey_3, bg = C.yellow }, + SignColumn = { fg = C.none, bg = C.none }, + SpecialKey = { fg = C.grey_1, bg = C.none }, + SpellBad = { fg = C.red, bg = C.none }, + SpellCap = { fg = C.yellow, bg = C.none }, + SpellLocal = { fg = C.yellow, bg = C.none }, + SpellRare = { fg = C.yellow, bg = C.none }, + StatusLine = { fg = C.fg, bg = C.grey_4 }, + StatusLineNC = { fg = C.grey, bg = C.none }, + StatusLineTerm = { fg = C.fg, bg = C.grey_4 }, + StatusLineTermNC = { fg = C.grey_4, bg = C.none }, + TabLine = { fg = C.grey, bg = C.none }, + TabLineSel = { fg = C.fg, bg = C.none }, + TabLineFill = { fg = C.none, bg = C.grey_3 }, + Terminal = { fg = C.fg, bg = C.grey_3 }, + Visual = { fg = C.none, bg = C.grey_5 }, + VisualNOS = { fg = C.grey_5, bg = C.none }, + WarningMsg = { fg = C.yellow, bg = C.none }, + WildMenu = { fg = C.grey_3, bg = C.blue }, + EndOfBuffer = { fg = C.bg, bg = C.none }, + CmpItemAbbrDefault = { fg = C.fg }, + CmpItemAbbrDeprecatedDefault = { fg = C.grey_2 }, + CmpItemAbbrMatchDefault = { fg = C.white }, + CmpItemAbbrMatchFuzzyDefault = { fg = C.white }, + CmpItemKind = { fg = C.yellow }, + CmpItemAbbr = { fg = C.fg }, + CmpItemMenuDefault = { fg = C.fg }, + FloatBorder = { bg = C.none }, + MatchParen = { fg = C.none, bg = C.grey_5 }, +} + +return base diff --git a/dot_config/nvim/lua/default_theme/colors.lua b/dot_config/nvim/lua/default_theme/colors.lua new file mode 100644 index 0000000..558d8f5 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/colors.lua @@ -0,0 +1,77 @@ +local colors = { + none = "NONE", + fg = "#abb2bf", + bg = "#1e222a", + bg_1 = "#303742", + black = "#181a1f", + black_1 = "#1f1f25", + green = "#98c379", + green_1 = "#89b06d", + green_2 = "#95be76", + white = "#dedede", + white_1 = "#afb2bb", + white_2 = "#c9c9c9", + blue = "#61afef", + blue_1 = "#40d9ff", + blue_2 = "#1b1f27", + blue_3 = "#8094B4", + orange = "#d19a66", + orange_1 = "#ff9640", + orange_2 = "#ff8800", + yellow = "#e5c07b", + yellow_1 = "#ebae34", + yellow_2 = "#d1b071", + red = "#e06c75", + red_1 = "#ec5f67", + red_2 = "#ffbba6", + red_3 = "#cc626a", + red_4 = "#d47d85", + grey = "#5c6370", + grey_1 = "#4b5263", + grey_2 = "#777d86", + grey_3 = "#282c34", + grey_4 = "#2c323c", + grey_5 = "#3e4452", + grey_6 = "#3b4048", + grey_7 = "#5c5c5c", + grey_8 = "#252931", + grey_9 = "#787e87", + grey_10 = "#D3D3D3", + gold = "#ffcc00", + cyan = "#56b6c2", + purple = "#c678dd", + purple_1 = "#a9a1e1", + + -- icon colors + c = "#519aba", + css = "#61afef", + deb = "#a1b7ee", + docker = "#384d54", + html = "#de8c92", + jpeg = "#c882e7", + jpg = "#c882e7", + js = "#ebcb8b", + jsx = "#519ab8", + kt = "#7bc99c", + lock = "#c4c720", + lua = "#51a0cf", + mp3 = "#d39ede", + mp4 = "#9ea3de", + out = "#abb2bf", + png = "#c882e7", + py = "#a3b8ef", + rb = "#ff75a0", + robots = "#abb2bf", + rpm = "#fca2aa", + rs = "#dea584", + toml = "#39bf39", + ts = "#519aba", + ttf = "#abb2bf", + vue = "#7bc99c", + woff = "#abb2bf", + woff2 = "#abb2bf", + zip = "#f9d71c", + md = "#519aba", +} + +return astronvim.user_plugin_opts("default_theme.colors", colors) diff --git a/dot_config/nvim/lua/default_theme/init.lua b/dot_config/nvim/lua/default_theme/init.lua new file mode 100644 index 0000000..50202e1 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/init.lua @@ -0,0 +1,45 @@ +vim.cmd "highlight clear" +if vim.fn.exists "syntax_on" then vim.cmd "syntax reset" end +vim.o.background = "dark" +vim.o.termguicolors = true +vim.g.colors_name = "default_theme" + +local user_plugin_opts = astronvim.user_plugin_opts +local utils = require "default_theme.utils" + +C = require "default_theme.colors" + +local highlights = {} + +for _, module in ipairs { "base", "treesitter", "lsp" } do + highlights = vim.tbl_deep_extend("force", highlights, require("default_theme." .. module)) +end + +for plugin, enabled in + pairs(user_plugin_opts("default_theme.plugins", { + aerial = true, + beacon = false, + bufferline = true, + dashboard = true, + gitsigns = true, + highlighturl = true, + hop = false, + indent_blankline = true, + lightspeed = false, + ["neo-tree"] = true, + notify = true, + ["nvim-tree"] = false, + ["nvim-web-devicons"] = true, + rainbow = true, + symbols_outline = false, + telescope = true, + vimwiki = false, + ["which-key"] = true, + })) +do + if enabled then highlights = vim.tbl_deep_extend("force", highlights, require("default_theme.plugins." .. plugin)) end +end + +for group, spec in pairs(user_plugin_opts("default_theme.highlights", highlights)) do + vim.api.nvim_set_hl(0, group, utils.parse_style(spec)) +end diff --git a/dot_config/nvim/lua/default_theme/lsp.lua b/dot_config/nvim/lua/default_theme/lsp.lua new file mode 100644 index 0000000..c801c9a --- /dev/null +++ b/dot_config/nvim/lua/default_theme/lsp.lua @@ -0,0 +1,26 @@ +local utils = require "default_theme.utils" + +local lsp = { + DiagnosticError = utils.parse_diagnostic_style { fg = C.red_1 }, + DiagnosticHint = utils.parse_diagnostic_style { fg = C.yellow_1 }, + DiagnosticInfo = utils.parse_diagnostic_style { fg = C.white_2 }, + DiagnosticWarn = utils.parse_diagnostic_style { fg = C.orange_1 }, + DiagnosticInformation = { fg = C.yellow, bold = true }, + DiagnosticTruncateLine = { fg = C.white_1, bold = true }, + DiagnosticUnderlineError = { sp = C.red_2, undercurl = true }, + DiagnosticUnderlineHint = { sp = C.red_2, undercurl = true }, + DiagnosticUnderlineInfo = { sp = C.red_2, undercurl = true }, + DiagnosticUnderlineWarn = { sp = C.red_2, undercurl = true }, + LspDiagnosticsFloatingError = { fg = C.red_1 }, + LspDiagnosticsFloatingHint = { fg = C.yellow_1 }, + LspDiagnosticsFloatingInfor = { fg = C.white_2 }, + LspDiagnosticsFloatingWarn = { fg = C.orange_1 }, + LspFloatWinBorder = { fg = C.white_1 }, + LspFloatWinNormal = { fg = C.fg, bg = C.black_1 }, + LspReferenceRead = { fg = C.none, bg = C.grey_5 }, + LspReferenceText = { fg = C.none, bg = C.grey_5 }, + LspReferenceWrite = { fg = C.none, bg = C.grey_5 }, + ProviderTruncateLine = { fg = C.white_1 }, +} + +return lsp diff --git a/dot_config/nvim/lua/default_theme/plugins/aerial.lua b/dot_config/nvim/lua/default_theme/plugins/aerial.lua new file mode 100644 index 0000000..d4c4686 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/aerial.lua @@ -0,0 +1,30 @@ +return { + AerialLine = { fg = C.yellow, bg = C.none }, + AerialGuide = { fg = C.grey_2 }, + AerialBooleanIcon = { link = "TSBoolean" }, + AerialClassIcon = { link = "TSType" }, + AerialConstantIcon = { link = "TSConstant" }, + AerialConstructorIcon = { link = "TSConstructor" }, + AerialFieldIcon = { link = "TSField" }, + AerialFunctionIcon = { link = "TSFunction" }, + AerialMethodIcon = { link = "TSMethod" }, + AerialNamespaceIcon = { link = "TSNamespace" }, + AerialNumberIcon = { link = "TSNumber" }, + AerialOperatorIcon = { link = "TSOperator" }, + AerialTypeParameterIcon = { link = "TSParameter" }, + AerialPropertyIcon = { link = "TSProperty" }, + AerialStringIcon = { link = "TSString" }, + AerialVariableIcon = { link = "TSConstant" }, + AerialEnumMemberIcon = { link = "TSField" }, + AerialEnumIcon = { link = "TSType" }, + AerialFileIcon = { link = "TSURI" }, + AerialModuleIcon = { link = "TSNamespace" }, + AerialPackageIcon = { link = "TSNamespace" }, + AerialInterfaceIcon = { link = "TSType" }, + AerialStructIcon = { link = "TSType" }, + AerialEventIcon = { link = "TSType" }, + AerialArrayIcon = { link = "TSConstant" }, + AerialObjectIcon = { link = "TSType" }, + AerialKeyIcon = { link = "TSType" }, + AerialNullIcon = { link = "TSType" }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/beacon.lua b/dot_config/nvim/lua/default_theme/plugins/beacon.lua new file mode 100644 index 0000000..43b34b8 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/beacon.lua @@ -0,0 +1 @@ +return { Beacon = { bg = C.blue } } diff --git a/dot_config/nvim/lua/default_theme/plugins/bufferline.lua b/dot_config/nvim/lua/default_theme/plugins/bufferline.lua new file mode 100644 index 0000000..8dc2a2d --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/bufferline.lua @@ -0,0 +1,21 @@ +return { + BufferLineFill = { fg = C.grey_9, bg = C.grey_4 }, + BufferLineBackground = { fg = C.grey_9, bg = C.grey_4 }, + BufferLineBufferVisible = { fg = C.fg, bg = C.bg }, + BufferLineBufferSelected = { fg = C.white, bg = C.bg, bold = true }, + BufferLineTab = { fg = C.grey_9, bg = C.bg }, + BufferLineTabSelected = { fg = C.fg, bg = C.bg }, + BufferLineTabClose = { fg = C.red_4, bg = C.bg }, + BufferLineIndicatorSelected = { fg = C.bg, bg = C.bg }, + BufferLineSeparator = { fg = C.grey_4, bg = C.grey_4 }, + BufferLineSeparatorVisible = { fg = C.bg, bg = C.bg }, + BufferLineSeparatorSelected = { fg = C.grey_4, bg = C.grey_4 }, + BufferLineCloseButton = { fg = C.grey_9, bg = C.grey_4 }, + BufferLineCloseButtonVisible = { fg = C.grey_10, bg = C.bg }, + BufferLineCloseButtonSelected = { fg = C.red_4, bg = C.bg }, + BufferLineModified = { fg = C.red_4, bg = C.grey_4 }, + BufferLineModifiedVisible = { fg = C.fg, bg = C.bg }, + BufferLineModifiedSelected = { fg = C.green_2, bg = C.bg }, + BufferLineError = { fg = C.red_1, bg = C.red_1 }, + BufferLineErrorDiagnostic = { fg = C.red_1, bg = C.red_1 }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/dashboard.lua b/dot_config/nvim/lua/default_theme/plugins/dashboard.lua new file mode 100644 index 0000000..4aa0598 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/dashboard.lua @@ -0,0 +1,6 @@ +return { + DashboardHeader = { fg = C.cyan }, + DashboardShortcut = { fg = C.yellow }, + DashboardFooter = { fg = C.cyan }, + DashboardCenter = { fg = C.blue }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/gitsigns.lua b/dot_config/nvim/lua/default_theme/plugins/gitsigns.lua new file mode 100644 index 0000000..7c2b159 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/gitsigns.lua @@ -0,0 +1,7 @@ +return { + GitSignsAdd = { fg = C.green, bg = C.none }, + GitSignsChange = { fg = C.orange_1, bg = C.none }, + GitSignsDelete = { fg = C.red_1, bg = C.none }, + MoreMsg = { fg = C.green, bold = true }, + ModeMsg = { fg = C.grey, bold = true }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/highlighturl.lua b/dot_config/nvim/lua/default_theme/plugins/highlighturl.lua new file mode 100644 index 0000000..c69fdf0 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/highlighturl.lua @@ -0,0 +1 @@ +return { HighlightURL = { underline = true } } diff --git a/dot_config/nvim/lua/default_theme/plugins/hop.lua b/dot_config/nvim/lua/default_theme/plugins/hop.lua new file mode 100644 index 0000000..7d3b1ac --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/hop.lua @@ -0,0 +1,6 @@ +return { + HopNextKey = { fg = C.red, bold = true }, + HopNextKey1 = { fg = C.cyan, bold = true }, + HopNextKey2 = { fg = C.blue }, + HopUnmatched = { fg = C.grey }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/indent_blankline.lua b/dot_config/nvim/lua/default_theme/plugins/indent_blankline.lua new file mode 100644 index 0000000..b79419a --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/indent_blankline.lua @@ -0,0 +1,7 @@ +return { + IndentBlanklineSpaceChar = { fg = C.grey_6, nocombine = true }, + IndentBlanklineChar = { fg = C.grey_6, nocombine = true }, + IndentBlanklineContextStart = { fg = C.grey_7, underline = true }, + IndentBlanklineContextChar = { fg = C.grey_7, nocombine = true }, + IndentBlanklineSpaceCharBlankline = { fg = C.grey_6, nocombine = true }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/lightspeed.lua b/dot_config/nvim/lua/default_theme/plugins/lightspeed.lua new file mode 100644 index 0000000..e891d61 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/lightspeed.lua @@ -0,0 +1,14 @@ +return { + LightspeedLabel = { fg = C.red_3, underline = true }, + LightspeedLabelOverlapped = { fg = C.blue, underline = true }, + LightspeedLabelDistant = { fg = C.red_1, underline = true }, + LightspeedLabelDistantOverlapped = { fg = C.blue_1, underline = true }, + LightspeedShortcut = { fg = C.black, bg = C.red_3, bold = true, underline = true }, + LightspeedShortcutOverlapped = { fg = C.black, bg = C.blue, bold = true, underline = true }, + LightspeedMaskedChar = { fg = C.green_1 }, + LightspeedGreyWash = { fg = C.grey_2, bg = C.none }, + LightspeedUnlabeledMatch = { fg = C.white, bold = true }, + LightspeedOneCharMatch = { fg = C.green, bg = C.red_3, bold = true }, + LightspeedUniqueChar = { fg = C.white, bold = true }, + LightspeedPendingOpArea = { fg = C.yellow }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/neo-tree.lua b/dot_config/nvim/lua/default_theme/plugins/neo-tree.lua new file mode 100644 index 0000000..810e56b --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/neo-tree.lua @@ -0,0 +1,15 @@ +return { + NeoTreeDirectoryIcon = { fg = C.blue }, + NeoTreeRootName = { fg = C.fg, bold = true }, + NeoTreeFileName = { fg = C.fg }, + NeoTreeFileIcon = { fg = C.fg }, + NeoTreeFileNameOpened = { fg = C.green }, + NeoTreeIndentMarker = { fg = C.blue_3 }, + NeoTreeGitAdded = { fg = C.green }, + NeoTreeGitConflict = { fg = C.red }, + NeoTreeGitModified = { fg = C.orange }, + NeoTreeGitUntracked = { fg = C.yellow }, + NeoTreeNormal = { bg = C.blue_2 }, + NeoTreeNormalNC = { bg = C.blue_2 }, + NeoTreeSymbolicLinkTarget = { fg = C.cyan }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/notify.lua b/dot_config/nvim/lua/default_theme/plugins/notify.lua new file mode 100644 index 0000000..02f1b08 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/notify.lua @@ -0,0 +1,24 @@ +return { + NotifyERRORBorder = { fg = C.red }, + NotifyWARNBorder = { fg = C.orange_1 }, + NotifyINFOBorder = { fg = C.green }, + NotifyDEBUGBorder = { fg = C.cyan }, + NotifyTRACERBorder = { fg = C.purple }, + NotifyERRORIcon = { fg = C.red }, + NotifyWARNIcon = { fg = C.orange_1 }, + NotifyINFOIcon = { fg = C.green }, + NotifyDEBUGIcon = { fg = C.cyan }, + NotifyTRACEIcon = { fg = C.purple }, + NotifyERRORTitle = { fg = C.red }, + NotifyWARNTitle = { fg = C.orange_1 }, + NotifyINFOTitle = { fg = C.green }, + NotifyDEBUGTitle = { fg = C.cyan }, + NotifyTRACETitle = { fg = C.purple }, + NotifyERRORBody = { fg = C.fg }, + NotifyWARNBody = { fg = C.fg }, + NotifyINFOBody = { fg = C.fg }, + NotifyDEBUGBody = { fg = C.fg }, + NotifyTRACEBody = { fg = C.fg }, + NotifyLogTime = { fg = C.grey_2 }, + NotifyLogTitle = { fg = C.blue }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/nvim-tree.lua b/dot_config/nvim/lua/default_theme/plugins/nvim-tree.lua new file mode 100644 index 0000000..48114ff --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/nvim-tree.lua @@ -0,0 +1,19 @@ +return { + NvimTreeFolderIcon = { fg = C.blue }, + NvimTreeExecFile = { fg = C.green }, + NvimTreeOpenedFile = { fg = C.green }, + NvimTreeRootFolder = { fg = C.bg }, + NvimTreeEndOfBuffer = { fg = C.bg }, + NvimTreeNormal = { bg = C.blue_2 }, + NvimTreeNormalNC = { bg = C.blue_2 }, + NvimTreeVertSplit = { fg = C.blue_2, bg = C.blue_2 }, + NvimTreeImageFile = { fg = C.purple }, + NvimTreeSymlink = { fg = C.cyan }, + NvimTreeSpecialFile = { fg = C.yellow }, + NvimTreeGitDeleted = { fg = C.red }, + NvimTreeGitMerge = { fg = C.orange }, + NvimTreeGitRenamed = { fg = C.purple }, + NvimTreeGitStaged = { fg = C.green }, + NvimTreeGitDirty = { fg = C.red }, + NvimTreeGitNew = { fg = C.yellow }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/nvim-web-devicons.lua b/dot_config/nvim/lua/default_theme/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..084ec99 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/nvim-web-devicons.lua @@ -0,0 +1,32 @@ +return { + DevIconC = { fg = C.c }, + DevIconCss = { fg = C.css }, + DevIconDeb = { fg = C.deb }, + DevIconDockerfile = { fg = C.docker }, + DevIconHtml = { fg = C.html }, + DevIconJpeg = { fg = C.jpeg }, + DevIconJpg = { fg = C.jpg }, + DevIconJs = { fg = C.js }, + DevIconJsx = { fg = C.jsx }, + DevIconKotlin = { fg = C.kt }, + DevIconLock = { fg = C.lock }, + DevIconLua = { fg = C.lua }, + DevIconMp3 = { fg = C.mp3 }, + DevIconMp4 = { fg = C.mp4 }, + DevIconOut = { fg = C.out }, + DevIconPng = { fg = C.png }, + DevIconPy = { fg = C.py }, + DevIconRb = { fg = C.rb }, + DevIconRobots = { fg = C.robots }, + DevIconRpm = { fg = C.rpm }, + DevIconRs = { fg = C.rs }, + DevIconToml = { fg = C.toml }, + DevIconTrueTypeFont = { fg = C.ttf }, + DevIconTs = { fg = C.ts }, + DevIconVue = { fg = C.vue }, + DevIconWebOpenFontFormat = { fg = C.woff }, + DevIconWebOpenFontFormat2 = { fg = C.woff2 }, + DevIconXz = { fg = C.zip }, + DevIconZip = { fg = C.zip }, + DevIconMd = { fg = C.md }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/rainbow.lua b/dot_config/nvim/lua/default_theme/plugins/rainbow.lua new file mode 100644 index 0000000..2165c07 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/rainbow.lua @@ -0,0 +1,9 @@ +return { + rainbowcol1 = { fg = "Gold" }, + rainbowcol2 = { fg = "Orchid" }, + rainbowcol3 = { fg = "LightSkyBlue" }, + rainbowcol4 = { fg = "Gold" }, + rainbowcol5 = { fg = "Orchid" }, + rainbowcol6 = { fg = "LightSkyBlue" }, + rainbowcol7 = { fg = "Orchid" }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/symbols_outline.lua b/dot_config/nvim/lua/default_theme/plugins/symbols_outline.lua new file mode 100644 index 0000000..362e49e --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/symbols_outline.lua @@ -0,0 +1 @@ +return { FocusedSymbol = { fg = C.yellow, bg = C.none } } diff --git a/dot_config/nvim/lua/default_theme/plugins/telescope.lua b/dot_config/nvim/lua/default_theme/plugins/telescope.lua new file mode 100644 index 0000000..3d0a8f0 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/telescope.lua @@ -0,0 +1,57 @@ +return { + TelescopeResultsTitle = { fg = C.green }, + TelescopePromptTitle = { fg = C.blue }, + TelescopePreviewTitle = { fg = C.purple }, + TelescopeResultsBorder = { fg = C.fg }, + TelescopePromptBorder = { fg = C.fg }, + TelescopePreviewBorder = { fg = C.fg }, + TelescopeSelectionCaret = { fg = C.red }, + TelescopeMatching = { fg = C.yellow }, + TelescopeSelection = { bg = C.grey_5 }, + TelescopeMultiSelection = { fg = C.blue }, + TelescopeMultiIcon = { fg = C.blue }, + TelescopeNormal = { fg = C.fg, bg = C.bg }, + TelescopePreviewNormal = { fg = C.fg, bg = C.bg }, + TelescopePromptNormal = { fg = C.fg, bg = C.bg }, + TelescopeResultsNormal = { fg = C.fg, bg = C.bg }, + TelescopeBorder = { fg = C.fg }, + TelescopeTitle = { fg = C.fg }, + TelescopePromptCounter = { fg = C.grey_1 }, + TelescopePromptPrefix = { fg = C.blue }, + TelescopePreviewLine = { bg = C.grey_5 }, + TelescopePreviewMatch = { fg = C.yellow }, + TelescopePreviewPipe = { fg = C.yellow }, + TelescopePreviewCharDev = { fg = C.yellow }, + TelescopePreviewDirectory = { fg = C.blue }, + TelescopePreviewBlock = { fg = C.yellow }, + TelescopePreviewLink = { fg = C.blue }, + TelescopePreviewSocket = { fg = C.purple }, + TelescopePreviewRead = { fg = C.yellow }, + TelescopePreviewWrite = { fg = C.purple }, + TelescopePreviewExecute = { fg = C.green }, + TelescopePreviewHyphen = { fg = C.grey_1 }, + TelescopePreviewSticky = { fg = C.blue }, + TelescopePreviewSize = { fg = C.green }, + TelescopePreviewUser = { fg = C.yellow }, + TelescopePreviewGroup = { fg = C.yellow }, + TelescopePreviewDate = { fg = C.blue }, + TelescopePreviewMessage = { fg = C.fg }, + TelescopePreviewMessageFillchar = { fg = C.fg }, + TelescopeResultsClass = { fg = C.yellow }, + TelescopeResultsConstant = { fg = C.yellow }, + TelescopeResultsField = { fg = C.red }, + TelescopeResultsFunction = { fg = C.blue }, + TelescopeResultsMethod = { fg = C.blue }, + TelescopeResultsOperator = { fg = C.cyan }, + TelescopeResultsStruct = { fg = C.purple }, + TelescopeResultsVariable = { fg = C.red }, + TelescopeResultsLineNr = { fg = C.grey_1 }, + TelescopeResultsIdentifier = { fg = C.blue }, + TelescopeResultsNumber = { fg = C.orange }, + TelescopeResultsComment = { fg = C.grey_2 }, + TelescopeResultsSpecialComment = { fg = C.grey }, + TelescopeResultsDiffChange = { fg = C.none, bg = C.yellow }, + TelescopeResultsDiffAdd = { fg = C.none, bg = C.green }, + TelescopeResultsDiffDelete = { fg = C.none, bg = C.red }, + TelescopeResultsDiffUntracked = { fg = C.none, bg = C.grey_1 }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/vimwiki.lua b/dot_config/nvim/lua/default_theme/plugins/vimwiki.lua new file mode 100644 index 0000000..b1936ed --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/vimwiki.lua @@ -0,0 +1,14 @@ +return { + VimwikiLink = { fg = C.cyan, bg = C.none }, + VimwikiHeaderChar = { fg = C.grey, bg = C.none }, + VimwikiHR = { fg = C.yellow, bg = C.none }, + VimwikiList = { fg = C.orange, bg = C.orange }, + VimwikiTag = { fg = C.orange, bg = C.orange }, + VimwikiMarkers = { fg = C.grey, bg = C.none }, + VimwikiHeader1 = { fg = C.orange, bg = C.none, bold = true }, + VimwikiHeader2 = { fg = C.green, bg = C.none, bold = true }, + VimwikiHeader3 = { fg = C.blue, bg = C.none, bold = true }, + VimwikiHeader4 = { fg = C.cyan, bg = C.none, bold = true }, + VimwikiHeader5 = { fg = C.yellow, bg = C.none, bold = true }, + VimwikiHeader6 = { fg = C.purple, bg = C.none, bold = true }, +} diff --git a/dot_config/nvim/lua/default_theme/plugins/which-key.lua b/dot_config/nvim/lua/default_theme/plugins/which-key.lua new file mode 100644 index 0000000..7bc6da2 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/plugins/which-key.lua @@ -0,0 +1,5 @@ +return { + WhichKeyFloat = { fg = C.fg }, + WhichKeyDesc = { fg = C.blue }, + WhichKeyGroup = { fg = C.blue }, +} diff --git a/dot_config/nvim/lua/default_theme/treesitter.lua b/dot_config/nvim/lua/default_theme/treesitter.lua new file mode 100644 index 0000000..c5ea515 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/treesitter.lua @@ -0,0 +1,59 @@ +local treesitter = { + TSError = { fg = C.red }, + TSPunctDelimiter = { fg = C.fg }, + TSPunctBracket = { fg = C.fg }, + TSPunctSpecial = { fg = C.fg }, + TSConstant = { fg = C.yellow }, + TSConstBuiltin = { fg = C.orange }, + TSConstMacro = { fg = C.red }, + TSStringRegex = { fg = C.green }, + TSString = { fg = C.green }, + TSStringEscap = { fg = C.red }, + TSCharacter = { fg = C.green }, + TSNumber = { fg = C.orange }, + TSBoolean = { fg = C.orange }, + TSFloat = { fg = C.green }, + TSAnnotation = { fg = C.yellow }, + TSAttribute = { fg = C.red }, + TSNamespace = { fg = C.purple }, + TSFuncBuiltin = { fg = C.blue }, + TSFunction = { fg = C.blue }, + TSFuncMacro = { fg = C.yellow }, + TSParameter = { fg = C.red }, + TSParameterReference = { fg = C.cyan }, + TSMethod = { fg = C.blue }, + TSField = { fg = C.red }, + TSProperty = { fg = C.yellow }, + TSConstructor = { fg = C.yellow }, + TSConditional = { fg = C.purple }, + TSRepeat = { fg = C.purple }, + TSLabel = { fg = C.blue }, + TSKeyword = { fg = C.purple }, + TSKeywordFunction = { fg = C.purple }, + TSKeywordOperator = { fg = C.purple }, + TSOperator = { fg = C.cyan }, + TSException = { fg = C.purple }, + TSType = { fg = C.blue }, + TSTypeBuiltin = { fg = C.blue }, + TSStructure = { fg = C.purple }, + TSInclude = { fg = C.purple }, + TSVariable = { fg = C.red }, + TSVariableBuiltin = { fg = C.yellow }, + TSText = { fg = C.fg }, + TSTextReference = { fg = C.yellow }, + TSStrong = { fg = C.blue, style = "bold" }, + TSEmphasis = { fg = C.purple, style = "italic" }, + TSUnderline = { fg = C.fg }, + TSTitle = { fg = C.fg }, + TSLiteral = { fg = C.fg }, + TSURI = { fg = C.green }, + TSTag = { fg = C.red }, + TSTagDelimiter = { fg = C.fg }, + markdownTSNone = { fg = C.fg }, + markdownTSTitle = { fg = C.red }, + markdownTSLiteral = { fg = C.green }, + markdownTSPunctSpecial = { fg = C.red }, + markdownTSPunctDelimiter = { fg = C.fg }, +} + +return treesitter diff --git a/dot_config/nvim/lua/default_theme/utils.lua b/dot_config/nvim/lua/default_theme/utils.lua new file mode 100644 index 0000000..cfb45b7 --- /dev/null +++ b/dot_config/nvim/lua/default_theme/utils.lua @@ -0,0 +1,24 @@ +local M = {} + +local user_settings = astronvim.user_plugin_opts "default_theme" + +function M.parse_diagnostic_style(default) + if type(user_settings.diagnostics_style) == "table" then + default = vim.tbl_deep_extend("force", user_settings.diagnostics_style, default) + elseif type(user_settings.diagnostics_style) == "string" then + default.style = user_settings.diagnostics_style + end + return default +end + +function M.parse_style(spec) + if spec.style then + for match in (spec.style .. ","):gmatch "(.-)," do + spec[match] = true + end + spec.style = nil + end + return spec +end + +return M diff --git a/dot_config/nvim/lua/user_example/init.lua b/dot_config/nvim/lua/user_example/init.lua new file mode 100644 index 0000000..43ef125 --- /dev/null +++ b/dot_config/nvim/lua/user_example/init.lua @@ -0,0 +1,257 @@ +local config = { + + -- Configure AstroNvim updates + updater = { + remote = "origin", -- remote to use + channel = "nightly", -- "stable" or "nightly" + version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) + branch = "main", -- branch name (NIGHTLY ONLY) + commit = nil, -- commit hash (NIGHTLY ONLY) + pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) + skip_prompts = false, -- skip prompts about breaking changes + show_changelog = true, -- show the changelog after performing an update + -- remotes = { -- easily add new remotes to track + -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url + -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, + -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork + -- }, + }, + + -- Set colorscheme + colorscheme = "default_theme", + + -- Override highlight groups in any theme + highlights = { + -- duskfox = { -- a table of overrides + -- Normal = { bg = "#000000" }, + -- }, + default_theme = function(highlights) -- or a function that returns one + local C = require "default_theme.colors" + + highlights.Normal = { fg = C.fg, bg = C.bg } + return highlights + end, + }, + + -- set vim options here (vim.. = value) + options = { + opt = { + relativenumber = true, -- sets vim.opt.relativenumber + }, + g = { + mapleader = " ", -- sets vim.g.mapleader + }, + }, + + -- Default theme configuration + default_theme = { + diagnostics_style = { italic = true }, + -- Modify the color table + colors = { + fg = "#abb2bf", + }, + plugins = { -- enable or disable extra plugin highlighting + aerial = true, + beacon = false, + bufferline = true, + dashboard = true, + highlighturl = true, + hop = false, + indent_blankline = true, + lightspeed = false, + ["neo-tree"] = true, + notify = true, + ["nvim-tree"] = false, + ["nvim-web-devicons"] = true, + rainbow = true, + symbols_outline = false, + telescope = true, + vimwiki = false, + ["which-key"] = true, + }, + }, + + -- Disable AstroNvim ui features + ui = { + nui_input = true, + telescope_select = true, + }, + + -- Configure plugins + plugins = { + -- Add plugins, the packer syntax without the "use" + init = { + -- You can disable default plugins as follows: + -- ["goolord/alpha-nvim"] = { disable = true }, + + -- You can also add new plugins here as well: + -- { "andweeb/presence.nvim" }, + -- { + -- "ray-x/lsp_signature.nvim", + -- event = "BufRead", + -- config = function() + -- require("lsp_signature").setup() + -- end, + -- }, + }, + -- All other entries override the setup() call for default plugins + ["null-ls"] = function(config) + local null_ls = require "null-ls" + -- Check supported formatters and linters + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + config.sources = { + -- Set a formatter + null_ls.builtins.formatting.rufo, + -- Set a linter + null_ls.builtins.diagnostics.rubocop, + } + -- set up null-ls's on_attach function + config.on_attach = function(client) + -- NOTE: You can remove this on attach function to disable format on save + if client.resolved_capabilities.document_formatting then + vim.api.nvim_create_autocmd("BufWritePre", { + desc = "Auto format before save", + pattern = "", + callback = vim.lsp.buf.formatting_sync, + }) + end + end + return config -- return final config table + end, + treesitter = { + ensure_installed = { "lua" }, + }, + ["nvim-lsp-installer"] = { + ensure_installed = { "sumneko_lua" }, + }, + packer = { + compile_path = vim.fn.stdpath "data" .. "/packer_compiled.lua", + }, + }, + + -- LuaSnip Options + luasnip = { + -- Add paths for including more VS Code style snippets in luasnip + vscode_snippet_paths = {}, + -- Extend filetypes + filetype_extend = { + javascript = { "javascriptreact" }, + }, + }, + + -- Modify which-key registration + ["which-key"] = { + -- Add bindings + register_mappings = { + -- first key is the mode, n == normal mode + n = { + -- second key is the prefix, prefixes + [""] = { + -- which-key registration table for normal mode, leader prefix + -- ["N"] = { "tabnew", "New Buffer" }, + }, + }, + }, + }, + + -- CMP Source Priorities + -- modify here the priorities of default cmp sources + -- higher value == higher priority + -- The value can also be set to a boolean for disabling default sources: + -- false == disabled + -- true == 1000 + cmp = { + source_priority = { + nvim_lsp = 1000, + luasnip = 750, + buffer = 500, + path = 250, + }, + }, + + -- Extend LSP configuration + lsp = { + -- enable servers that you already have installed without lsp-installer + servers = { + -- "pyright" + }, + -- easily add or disable built in mappings added during LSP attaching + mappings = { + n = { + -- ["lf"] = false -- disable formatting keymap + }, + }, + -- add to the server on_attach function + -- on_attach = function(client, bufnr) + -- end, + + -- override the lsp installer server-registration function + -- server_registration = function(server, opts) + -- require("lspconfig")[server].setup(opts) + -- end, + + -- Add overrides for LSP server settings, the keys are the name of the server + ["server-settings"] = { + -- example for addings schemas to yamlls + -- yamlls = { + -- settings = { + -- yaml = { + -- schemas = { + -- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}", + -- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", + -- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", + -- }, + -- }, + -- }, + -- }, + }, + }, + + -- Diagnostics configuration (for vim.diagnostics.config({})) + diagnostics = { + virtual_text = true, + underline = true, + }, + + mappings = { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + [""] = { ":w!", desc = "Save File" }, + }, + t = { + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + + -- This function is run last + -- good place to configuring augroups/autocommands and custom filetypes + polish = function() + -- Set key binding + -- Set autocommands + vim.api.nvim_create_augroup("packer_conf", { clear = true }) + vim.api.nvim_create_autocmd("BufWritePost", { + desc = "Sync packer after modifying plugins.lua", + group = "packer_conf", + pattern = "plugins.lua", + command = "source | PackerSync", + }) + + -- Set up custom filetypes + -- vim.filetype.add { + -- extension = { + -- foo = "fooscript", + -- }, + -- filename = { + -- ["Foofile"] = "fooscript", + -- }, + -- pattern = { + -- ["~/%.config/foo/.*"] = "fooscript", + -- }, + -- } + end, +} + +return config diff --git a/dot_config/nvim/packer_snapshot b/dot_config/nvim/packer_snapshot new file mode 100644 index 0000000..c3f9039 --- /dev/null +++ b/dot_config/nvim/packer_snapshot @@ -0,0 +1 @@ +{"better-escape.nvim": {"commit": "d5ee0ce"}, "FixCursorHold.nvim": {"commit": "5aa5ff1"}, "telescope-fzf-native.nvim": {"commit": "6a33ece"}, "packer.nvim": {"commit": "e4c2afb"}, "nvim-notify": {"commit": "74ba257"}, "nvim-lspconfig": {"commit": "d17179d"}, "smart-splits.nvim": {"commit": "2af8bc3"}, "null-ls.nvim": {"commit": "fbb1929"}, "which-key.nvim": {"commit": "bd4411a"}, "aerial.nvim": {"commit": "95a66fa"}, "nvim-autopairs": {"commit": "972a797"}, "neovim-session-manager": {"commit": "9652b39"}, "friendly-snippets": {"commit": "24afb4c"}, "nvim-colorizer.lua": {"commit": "36c610a"}, "gitsigns.nvim": {"commit": "bb6c3bf"}, "SchemaStore.nvim": {"commit": "8f9c4b4"}, "indent-blankline.nvim": {"commit": "4a58fe6"}, "nvim-ts-autotag": {"commit": "044a05c"}, "neo-tree.nvim": {"commit": "4ad0458"}, "telescope.nvim": {"commit": "524c4eb"}, "nvim-ts-context-commentstring": {"commit": "8834375"}, "Comment.nvim": {"commit": "4086630"}, "bufferline.nvim": {"commit": "b5a2b1f"}, "alpha-nvim": {"commit": "411ce27"}, "cmp-nvim-lsp": {"commit": "affe808"}, "cinnamon.nvim": {"commit": "2806c5d"}, "LuaSnip": {"commit": "7d78278"}, "popup.nvim": {"commit": "b7404d3"}, "nvim-web-devicons": {"commit": "2d02a56"}, "cmp_luasnip": {"commit": "a9de941"}, "nvim-treesitter": {"commit": "559f2e7"}, "nui.nvim": {"commit": "284e2d1"}, "impatient.nvim": {"commit": "2aa872d"}, "feline.nvim": {"commit": "1ea4267"}, "nvim-lsp-installer": {"commit": "33700e2"}, "indent-o-matic": {"commit": "bf37c6e"}, "toggleterm.nvim": {"commit": "8cba5c2"}, "plenary.nvim": {"commit": "46e8bb9"}, "bufdelete.nvim": {"commit": "46255e4"}, "nvim-cmp": {"commit": "9897465"}, "nvim-ts-rainbow": {"commit": "6c0b3b6"}, "cmp-path": {"commit": "981baf9"}, "cmp-buffer": {"commit": "62fc67a"}}