diff --git a/.gitignore b/.gitignore index e5cd05f..cbaaf90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Log +*.log + # Private Files *private* .private.env.* @@ -15,24 +18,9 @@ test.* # Utils xdg-ninja/ -# nvim config cache -tools/nvim/tt.* -tools/nvim/.tests -tools/nvim/doc/tags -tools/nvim/debug -tools/nvim/.repro -tools/nvim/foo.* -tools/nvim/*.log -tools/nvim/data -tools/nvim/lazy-lock.json -tools/nvim/lazyvim.json -tools/nvim/lua/plugins/obsidian.lua - # Undone # Windows PowerToys PowerToys/ -# Just Script -Justfile # Nushell tools/nushell/ # fzf @@ -43,6 +31,6 @@ common/fzfrc .venv/ -platforms/win/komorebi/applications.json - gitconfig + +spacemacs/ diff --git a/.vscode/settings.json b/.vscode/settings.json index a719ff3..5826f1c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,4 +30,8 @@ ".wslconfig": "properties", "WindowsTerminal.json": "jsonc", }, -} \ No newline at end of file + "[json]": { + "editor.formatOnPaste": false, + "editor.formatOnSave": false, + } +} diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..675329d --- /dev/null +++ b/Justfile @@ -0,0 +1,15 @@ +set shell := ["fish", "-c"] +set windows-shell := ["pwsh", "-c"] + +pull: + git pull github master + git pull codeberg master + +push: + git push github master + git push codeberg master + +init: + git remote remove origin + git remote add github git@github.com:js0ny/dotfiles.git + git remote add codeberg git@codeberg.org:js0ny/dotfiles.git diff --git a/LICENSE b/LICENSE index e064b30..f288702 100644 --- a/LICENSE +++ b/LICENSE @@ -1,44 +1,674 @@ -Copyright (c) 2024-2024 js0ny + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 -This dotfiles repository uses multiple licenses for different tools' configuration files: + 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. -1. **MIT License** - Unless otherwise specified, all files and directories in this repository are licensed - under the MIT License. + Preamble - See the full text of the MIT License below. + The GNU General Public License is a free, copyleft license for +software and other kinds of works. -2. **GNU General Public License v3 (GPLv3)** - Files under the following directory are licensed under the GNU GPLv3: - - `./platforms/mac/sketchybar/` - These files are based on or intended for use with `FelixKratz/SketchyBar` - See the `LICENSE` file within the directory for the full text of the GNU GPLv3 license. + 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. -Refer to individual directories or files for detailed license information + 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. -Full text of MIT License is below. + 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. -MIT License + 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. -Copyright (c) 2024 js0ny + 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. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + 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 above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + The precise terms and conditions for copying, distribution and +modification follow. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + 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/_assets/windows-1.png b/_assets/windows-1.png new file mode 100644 index 0000000..313ae1c Binary files /dev/null and b/_assets/windows-1.png differ diff --git a/bootstrap/Windows.ps1 b/bootstrap/Windows.ps1 index 2c1046d..1611145 100644 --- a/bootstrap/Windows.ps1 +++ b/bootstrap/Windows.ps1 @@ -16,10 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression # Set Environment Variables # Use %PATH_EXT% to prevent PATH from being too long [System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\jsony\AppData\Local\Cargo\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\jsony\AppData\Local\Go\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\jsony\AppData\Local\Cargo\bin", "User") $currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User") if ($currentPath -notlike "*%PATH_EXT%*") { $currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%" @@ -36,8 +35,8 @@ if ($currentPath -notlike "*%PATH_EXT%*") { # Simulate XDG Base Directory Specification $Env:XDG_CONFIG_HOME = "$Env:AppData" $Env:XDG_DATA_HOME = "$Env:LocalAppData" -$Env:XDG_CACHE_HOME = "$Env:LocalAppData\cache" -$Env:XDG_STATE_HOME = "$Env:LocalAppData\state" +$Env:XDG_CACHE_HOME = "$Env:LocalAppData\Cache" +$Env:XDG_STATE_HOME = "$Env:LocalAppData\State" [System.Environment]::SetEnvironmentVariable("XDG_CONFIG_HOME", "$Env:XDG_CONFIG_HOME", "User") [System.Environment]::SetEnvironmentVariable("XDG_DATA_HOME", "$Env:XDG_DATA_HOME", "User") New-Item -ItemType Directory -Path "$Env:LocalAppData\cache" -Force diff --git a/bootstrap/common-pm.txt b/bootstrap/common-pm.txt new file mode 100644 index 0000000..c7c52a4 --- /dev/null +++ b/bootstrap/common-pm.txt @@ -0,0 +1,17 @@ +# nodejs +npm install -g typescript +npm install -g tsx + +# dotnet +dotnet tool install -g dotnet-script +dotnet tool install -g dotnet-repl + +# python +pip install neovim +pip install requests +pip install ipython +pip install jupyter +pip install numpy +pip install matplotlib +pip install pandas +pip install scipy diff --git a/bootstrap/set_symlink_unix.bash b/bootstrap/set_symlink_unix.bash index 39cfbe7..3e36ff0 100644 --- a/bootstrap/set_symlink_unix.bash +++ b/bootstrap/set_symlink_unix.bash @@ -3,7 +3,7 @@ # Date: 2024-12-01 # Author: js0ny # Set symbolic links for Unix-like systems -mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython +mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython $XDG_CONFIG_HOME/lazygit # Not support XDG_CONFIG_HOME but same directory mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow # mkdir -p $WAKATIME_HOME @@ -15,8 +15,9 @@ cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml ln -sf $DOTFILES/common/haskeline ~/.haskeline ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +ln -sf $DOTFILES/common/lazygit.yaml $XDG_CONFIG_HOME/lazygit/config.yml ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey -ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG +# ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf @@ -37,5 +38,5 @@ if [ $(uname) = "Darwin" ]; then ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc else - ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc + ln -sf $DOTFILES/common/inputrc ~/.inputrc fi diff --git a/bootstrap/set_symlink_win.ps1 b/bootstrap/set_symlink_win.ps1 index cc19bde..2919e93 100644 --- a/bootstrap/set_symlink_win.ps1 +++ b/bootstrap/set_symlink_win.ps1 @@ -9,29 +9,34 @@ $BASE_COMMON = Join-Path $DOTFILES "common" $BASE_TOOLS = Join-Path $DOTFILES "tools" $BASE_WIN = Join-Path $DOTFILES "platforms" "win" $linkDots = @{ - "$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig" - "$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml" - "$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc" - "$BASE_WIN\komorebi" = "$Env:KOMOREBI_CONFIG_HOME" - "$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc" - "$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig" - "$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml" - "$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline" - "$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc" - "$BASE_COMMON\lesskey" = "$Env:LessKeyIn" - "$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG" - "$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config" - "$BASE_COMMON\obsidian.vimrc" = "$Env:UserProfile\Obsidian\.obsidian.vimrc" - "$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini" - "$BASE_COMMON\vimrc" = "$Env:Vim\_vimrc" - "$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR" - "$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim" + "$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig" + "$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml" + "$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc" + "$BASE_WIN\komorebi" = "$Env:KOMOREBI_CONFIG_HOME" + "$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc" + "$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig" + "$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml" + "$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline" + "$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc" + "$BASE_COMMON\lesskey" = "$Env:LessKeyIn" + "$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG" + "$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config" + "$BASE_COMMON\obsidian.vimrc" = "$Env:UserProfile\Obsidian\.obsidian.vimrc" + "$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini" + "$BASE_COMMON\vimrc" = "$Env:Vim\_vimrc" + "$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR" + "$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim" } -# TODO: Auto create directories + foreach ($target in $linkDots.Keys) { $path = $linkDots[$target] + # Auto create directories (Untested) + $dir = Split-Path $path + if (!(Test-Path $dir)) { + New-Item -ItemType Directory -Path $dir -Force + } New-Item -ItemType SymbolicLink -Target $target -Path $path -Force } diff --git a/bootstrap/sh/load_plugins.zsh b/bootstrap/sh/load_plugins.zsh new file mode 100644 index 0000000..9ccafcb --- /dev/null +++ b/bootstrap/sh/load_plugins.zsh @@ -0,0 +1,12 @@ +set -e +ZDOTDIR="${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}" +mkdir -p $ZDOTDIR/plugins + +#plugins=( +# "zsh-autosuggestions" +# "zsh-syntax-highlighting" +# "zsh-history-substring-search" +#) +git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions +git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting +git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search diff --git a/bootstrap/win/Defender.ps1 b/bootstrap/win/Defender.ps1 new file mode 100644 index 0000000..acea93d --- /dev/null +++ b/bootstrap/win/Defender.ps1 @@ -0,0 +1,23 @@ +# Run as Administrator + +Set-MpPreference -EnableControlledFolderAccess 1 + +$protected = (Get-MpPreference).ControlledFolderAccessProtectedFolders +$protected += "$Env:UserProfile\.ssh" +$protected += "$Env:UserProfile\.config" +$protected += "$Env:UserProfile\Vault" +Set-MpPreference -ControlledFolderAccessProtectedFolders $protected + +$apps = (Get-MpPreference).ControlledFolderAccessAllowedApplications +$apps += "$Env:Windir\System32\OpenSSH\ssh.exe" +$apps += "$Env:ProgramFiles\GPSoftware\Directory Opus\DOpus.exe" +$apps += (Get-Command -Name code).Source.Replace("bin\code.cmd", "Code.exe") +$apps += (Get-Command -Name pwsh).Source +$apps += (Get-Command -Name git).Source +Set-MpPreference -ControlledFolderAccessAllowedApplications $apps + +$exclusion = (Get-MpPreference).ExclusionPath +$exclusion += "$env:ProgramFiles\JetBrains" +$exclusion += "$env:LocalAppData\JetBrains" +$exclusion += "D:\Source" +Set-MpPreference -ExclusionPath $exclusion diff --git a/common/ideavimrc b/common/ideavimrc index 9e0505c..f4b0436 100644 --- a/common/ideavimrc +++ b/common/ideavimrc @@ -67,6 +67,11 @@ Plug 'easymotion/vim-easymotion' """ Keybindings """ +"" don't lose selection when indenting "" +vnoremap < >gv +vnoremap = =gv + "" edit ideavim config v + "" nnoremap vv :e ~/.ideavimrc nnoremap vr :source ~/.ideavimrc @@ -82,48 +87,7 @@ nmap S (easymotion-F) nmap f (sneak-s) nmap F (sneak-S) -"" Miscs "" -nnoremap : :action GotoAction - -"" AI Related a + "" -nnoremap ac :action copilot.chat.show -nnoremap ad :action copilot.disableCopilot -nnoremap ae :action copilot.enableCopilot -nnoremap ai :action copilot.openCopilot - -"" Codes Action c + "" -nnoremap cf :action ReformatCode -nnoremap cs :action GotoSymbol -nnoremap c/ :action CommentByLineComment - -"" Project Action p + "" -nnoremap pr :action Run -nnoremap pd :action Debug -nnoremap pb :action Build - -"" Files Action f + "" -nnoremap fe :NERDTreeToggle -nnoremap ft :action ActivateTerminalToolWindow - -"" Tab Actions + "" -nnoremap :action Switcher - -"" Collapse and Expand z + "" -nnoremap zi :action ExpandCollapseToggleAction -nnoremap zc :action CollapseRegion -nnoremap zC :action CollapseRegionRecursively -nnoremap zM :action CollapseAll -nnoremap zo :action ExpandRegion -nnoremap zO :action ExpandRegionRecursively -nnoremap zR :action ExpandAll - -"" don't lose selection when indenting "" -vnoremap < >gv -vnoremap = =gv - - -nnoremap a :action FindInPath +"" Language Server Protocol "" nnoremap gd :action GotoDeclaration nnoremap gtd :action GotoTypeDeclaration nnoremap gtD :action QuickTypeDefinition @@ -135,13 +99,82 @@ nnoremap ga :action nnoremap gq :action ShowIntentionActions nnoremap ge :action GotoNextError -nnoremap :action ParameterInfo -inoremap :action ParameterInfo +"" Collapse and Expand z + "" +nnoremap zi :action ExpandCollapseToggleAction +nnoremap zc :action CollapseRegion +nnoremap zC :action CollapseRegionRecursively +nnoremap zM :action CollapseAll +nnoremap zo :action ExpandRegion +nnoremap zO :action ExpandRegionRecursively +nnoremap zR :action ExpandAll -"" Refractor r + "" +"" Miscs "" +nnoremap : :action GotoAction +nnoremap :action GotoFile +nnoremap h :action PrevSplitter +nnoremap i :action NextSplitter +"" AI Related a + "" +nnoremap ac :action copilot.chat.show +nnoremap ad :action copilot.disableCopilot +nnoremap ae :action copilot.enableCopilot +nnoremap aa :action copilot.openCopilot + +" b : +buffer +nnoremap bb :action Switcher +noremap bd :bdelete +noremap bh :bprevious +noremap bi :bnext +noremap bp :bprevious +noremap bn :bnext + +" c : +code/compile +nnoremap cr :action Run +nnoremap cf :action ReformatCode +nnoremap cs :action GotoSymbol +nnoremap cS :action GotoSymbol +nnoremap cR :action RenameElement +""" Works for Rider only +nnoremap ce :action ReSharperGotoNextErrorInSolution +nnoremap cE :action ReSharperGotoPrevErrorInSolution + +" d : +debug + +" f : +file +nnoremap ff :action GotoFile +nnoremap fF :action TextSearchAction +nnoremap fc :action ShowSettings +nnoremap fC :action ShowSettings +nnoremap fe :NERDTreeToggle +nnoremap fo :OpenInAssociatedApplication +nnoremap ft :action ActivateTerminalToolWindow +nnoremap fx :action WelcomeScreen.Plugins + +" g : +git +nnoremap gp :action Git.Pull +nnoremap gP :action Vcs.Push +nnoremap gb :action Git.Branches +nnoremap gR :action Git.Rebase +nnoremap gM :action Git.Merge +nnoremap gc :action CheckinProject +nnoremap gC :action Git.Clone +nnoremap gg :action ActivateVersionControlToolWindow +nnoremap gS :action Git.Stash + +" h : +help + +" p : +project +nnoremap pr :action Run +nnoremap pd :action Debug +nnoremap pb :action Build + +" q : +quit +nnoremap qq :action Exit +nnoremap Q :action Exit + +" r : +refactor nnoremap ri :action Inline -nnoremap rr :action RenameElement +nnoremap rr :action RenamElement nnoremap rev :action IntroduceVariable vnoremap rev :action IntroduceVariable nnoremap rem :action ExtractMethod @@ -150,6 +183,32 @@ nnoremap rm :action Move nnoremap ro :action OptimizeImports nnoremap rG :action Generate +" t : +test +nnoremap tt :action RiderUnitTestRunSolutionAction +nnoremap tT :action Rider.UnitTesting.MainMenu + +" u : +ui +nnoremap ui :action ChangeLaf +nnoremap uw :action EditorToggleUseSoftWraps + +" w : +write/window +nnoremap ww :write +nnoremap wa :wall +nnoremap wq :wq +nnoremap W :write +nnoremap wh :action PrevSplitter +nnoremap wi :action NextSplitter +nnoremap wH :action SplitHorizontally +nnoremap wI :action SplitHorizontally +nnoremap wN :action SplitVertically +nnoremap wE :action SplitVertically +nnoremap w- :action SplitHorizontally +nnoremap w| :action SplitVertically +nnoremap w\ :action SplitVertically + +nnoremap :action ParameterInfo +inoremap :action ParameterInfo + """ Handling Ctrls """ sethandler i:ide diff --git a/common/lazygit.yaml b/common/lazygit.yaml new file mode 100644 index 0000000..94799da --- /dev/null +++ b/common/lazygit.yaml @@ -0,0 +1,496 @@ +# $DOTFILES/common/lazygit.yaml +# Date: 2024-12-22 +# Author: js0ny + +# Location: +# *nix: ~/.config/lazygit/config.yml +# Windows: %APPDATA%\lazygit\config.yml +# Linking: +# ln -sf ~/.dotfiles/common/lazygit.yaml ~/.config/lazygit/config.yml + +yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json +# Config relating to the Lazygit UI +gui: + # The number of lines you scroll by when scrolling the main window + scrollHeight: 2 + # If true, allow scrolling past the bottom of the content in the main window + scrollPastBottom: true + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin + scrollOffMargin: 2 + # One of: 'margin' (default) | 'jump' + scrollOffBehavior: margin + # If true, capture mouse events. + # When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS. + mouseEvents: true + # If true, do not show a warning when discarding changes in the staging view. + skipDiscardChangeWarning: false + # If true, do not show warning when applying/popping the stash + skipStashWarning: false + # If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files. + skipNoStagedFilesWarning: false + # If true, do not show a warning when rewording a commit via an external editor + skipRewordInEditorWarning: false + # Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section. + # Number from 0 to 1.0. + sidePanelWidth: 0.3333 + # If true, increase the height of the focused side window; creating an accordion effect. + expandFocusedSidePanel: false + # The weight of the expanded side panel, relative to the other panels. 2 means + # twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true. + expandedSidePanelWeight: 2 + # Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. + # Options are: + # - 'horizontal': split the window horizontally + # - 'vertical': split the window vertically + # - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically + mainPanelSplitMode: flexible + # How the window is split when in half screen mode (i.e. after hitting '+' once). + # Possible values: + # - 'left': split the window horizontally (side panel on the left, main view on the right) + # - 'top': split the window vertically (side panel on top, main view below) + enlargedSideViewLocation: left + # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' + language: auto + # Format used when displaying time e.g. commit time. + # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format + timeFormat: 02 Jan 06 + # Format used when displaying time if the time is less than 24 hours ago. + # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format + shortTimeFormat: 3:04PM + # Config relating to colors and styles. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes + theme: + # Border color of focused window + activeBorderColor: + - green + - bold + # Border color of non-focused windows + inactiveBorderColor: + - default + # Border color of focused window when searching in that window + searchingActiveBorderColor: + - cyan + - bold + # Color of keybindings help text in the bottom line + optionsTextColor: + - blue + # Background color of selected line. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line + selectedLineBgColor: + - blue + # Background color of selected line when view doesn't have focus. + inactiveViewSelectedLineBgColor: + - bold + # Foreground color of copied commit + cherryPickedCommitFgColor: + - blue + # Background color of copied commit + cherryPickedCommitBgColor: + - cyan + # Foreground color of marked base commit (for rebase) + markedBaseCommitFgColor: + - blue + # Background color of marked base commit (for rebase) + markedBaseCommitBgColor: + - yellow + # Color for file with unstaged changes + unstagedChangesColor: + - red + # Default text color + defaultFgColor: + - default + # Config relating to the commit length indicator + commitLength: + # If true, show an indicator of commit message length + show: true + # If true, show the '5 of 20' footer at the bottom of list views + showListFooter: true + # If true, display the files in the file views as a tree. If false, display the files as a flat list. + # This can be toggled from within Lazygit with the '~' key, but that will not change the default. + showFileTree: true + # If true, show the number of lines changed per file in the Files view + showNumstatInFilesView: false + # If true, show a random tip in the command log when Lazygit starts + showRandomTip: true + # If true, show the command log + showCommandLog: true + # If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action. + showBottomLine: true + # If true, show jump-to-window keybindings in window titles. + showPanelJumps: true + # Deprecated: use nerdFontsVersion instead + showIcons: false + # Nerd fonts version to use. + # One of: '2' | '3' | empty string (default) + # If empty, do not show icons. + nerdFontsVersion: "" + # If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty. + showFileIcons: true + # Length of author name in (non-expanded) commits view. 2 means show initials only. + commitAuthorShortLength: 2 + # Length of author name in expanded commits view. 2 means show initials only. + commitAuthorLongLength: 17 + # Length of commit hash in commits view. 0 shows '*' if NF icons aren't on. + commitHashLength: 8 + # If true, show commit hashes alongside branch names in the branches view. + showBranchCommitHash: false + # Whether to show the divergence from the base branch in the branches view. + # One of: 'none' | 'onlyArrow' | 'arrowAndNumber' + showDivergenceFromBaseBranch: none + # Height of the command log view + commandLogSize: 8 + # Whether to split the main window when viewing file changes. + # One of: 'auto' | 'always' + # If 'auto', only split the main window when a file has both staged and unstaged changes + splitDiff: auto + # Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default). + # One of: 'normal' (default) | 'half' | 'full' + screenMode: normal + # Window border style. + # One of 'rounded' (default) | 'single' | 'double' | 'hidden' + border: rounded + # If true, show a seriously epic explosion animation when nuking the working tree. + animateExplosion: true + # Whether to stack UI components on top of each other. + # One of 'auto' (default) | 'always' | 'never' + portraitMode: auto + # How things are filtered when typing '/'. + # One of 'substring' (default) | 'fuzzy' + filterMode: substring + # Config relating to the spinner. + spinner: + # The frames of the spinner animation. + frames: + - "|" + - / + - "-" + - \ + # The "speed" of the spinner in milliseconds. + rate: 50 + # Status panel view. + # One of 'dashboard' (default) | 'allBranchesLog' + statusPanelView: dashboard + # If true, jump to the Files panel after popping a stash + switchToFilesAfterStashPop: true + # If true, jump to the Files panel after applying a stash + switchToFilesAfterStashApply: true + # If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead + switchTabsWithPanelJumpKeys: false +# Config relating to git +git: + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md + paging: + # Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never' + colorArg: always + # e.g. + # diff-so-fancy + # delta --dark --paging=never + # ydiff -p cat -s --wrap --width={{columnWidth}} + pager: "delta --dark --paging=never" + # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). + useConfig: false + # e.g. 'difft --color=always' + externalDiffCommand: "" + # Config relating to committing + commit: + # If true, pass '--signoff' flag when committing + signOff: false + # Automatic WYSIWYG wrapping of the commit message as you type + autoWrapCommitMessage: true + # If autoWrapCommitMessage is true, the width to wrap to + autoWrapWidth: 72 + # Config relating to merging + merging: + # If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang + # Only applicable to unix users. + manualCommit: false + # Extra args passed to `git merge`, e.g. --no-ff + args: "" + # The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders. + squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}} + # list of branches that are considered 'main' branches, used when displaying commits + mainBranches: + - master + - main + # Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP' + skipHookPrefix: WIP + # If true, periodically fetch from remote + autoFetch: true + # If true, periodically refresh files and submodules + autoRefresh: true + # If true, pass the --all arg to git fetch + fetchAll: true + # If true, lazygit will automatically stage files that used to have merge + # conflicts but no longer do; and it will also ask you if you want to + # continue a merge or rebase if you've resolved all conflicts. If false, it + # won't do either of these things. + autoStageResolvedConflicts: true + # Command used when displaying the current branch git log in the main window + branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} -- + # Command used to display git log of all branches in the main window. + # Deprecated: Use `allBranchesLogCmds` instead. + allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium + # If true, do not spawn a separate process when using GPG + overrideGpg: false + # If true, do not allow force pushes + disableForcePushing: false + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix + commitPrefix: + # pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*" + pattern: "" + # Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] " + replace: "" + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix + branchPrefix: "" + # If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀 + # (This should really be under 'gui', not 'git') + parseEmoji: false + # Config for showing the log in the commits view + log: + # One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default' + # 'topo-order' makes it easier to read the git log graph, but commits may not + # appear chronologically. See https://git-scm.com/docs/ + # + # Deprecated: Configure this with `Log menu -> Commit sort order` ( in the commits window by default). + order: topo-order + # This determines whether the git graph is rendered in the commits panel + # One of 'always' | 'never' | 'when-maximised' + # + # Deprecated: Configure this with `Log menu -> Show git graph` ( in the commits window by default). + showGraph: always + # displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`) + showWholeGraph: false + # When copying commit hashes to the clipboard, truncate them to this + # length. Set to 40 to disable truncation. + truncateCopiedCommitHashesTo: 12 +# Periodic update checks +update: + # One of: 'prompt' (default) | 'background' | 'never' + method: prompt + # Period in days between update checks + days: 14 +# Background refreshes +refresher: + # File/submodule refresh interval in seconds. + # Auto-refresh can be disabled via option 'git.autoRefresh'. + refreshInterval: 10 + # Re-fetch interval in seconds. + # Auto-fetch can be disabled via option 'git.autoFetch'. + fetchInterval: 60 +# If true, show a confirmation popup before quitting Lazygit +confirmOnQuit: false +# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close +quitOnTopLevelReturn: false +# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc +os: + # Command for editing a file. Should contain "{{filename}}". + edit: "" + # Command for editing a file at a given line number. Should contain + # "{{filename}}", and may optionally contain "{{line}}". + editAtLine: "" + # Same as EditAtLine, except that the command needs to wait until the + # window is closed. + editAtLineAndWait: "" + # For opening a directory in an editor + openDirInEditor: "" + # A built-in preset that sets all of the above settings. Supported presets + # are defined in the getPreset function in editor_presets.go. + editPreset: "" + # Command for opening a file, as if the file is double-clicked. Should + # contain "{{filename}}", but doesn't support "{{line}}". + open: "" + # Command for opening a link. Should contain "{{link}}". + openLink: "" + # EditCommand is the command for editing a file. + # Deprecated: use Edit instead. Note that semantics are different: + # EditCommand is just the command itself, whereas Edit contains a + # "{{filename}}" variable. + editCommand: "" + # EditCommandTemplate is the command template for editing a file + # Deprecated: use EditAtLine instead. + editCommandTemplate: "" + # OpenCommand is the command for opening a file + # Deprecated: use Open instead. + openCommand: "" + # OpenLinkCommand is the command for opening a link + # Deprecated: use OpenLink instead. + openLinkCommand: "" + # CopyToClipboardCmd is the command for copying to clipboard. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard + copyToClipboardCmd: "" + # ReadFromClipboardCmd is the command for reading the clipboard. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard + readFromClipboardCmd: "" +# If true, don't display introductory popups upon opening Lazygit. +disableStartupPopups: false +# What to do when opening Lazygit outside of a git repo. +# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo +# - 'create': initialize a new repo +# - 'skip': open most recent repo +# - 'quit': exit Lazygit +notARepository: prompt +# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit. +promptToReturnFromSubprocess: true +# Keybindings +keybinding: + universal: + quit: q + quit-alt1: + return: + quitWithoutChangingDirectory: Q + togglePanel: + prevItem: + nextItem: + prevItem-alt: e + nextItem-alt: "n" + prevPage: "," + nextPage: . + scrollLeft: H + scrollRight: L + gotoTop: < + gotoBottom: ">" + toggleRangeSelect: v + rangeSelectDown: + rangeSelectUp: + prevBlock: + nextBlock: + prevBlock-alt: h + nextBlock-alt: i + nextBlock-alt2: + prevBlock-alt2: + jumpToBlock: + - "1" + - "2" + - "3" + - "4" + - "5" + nextMatch: "k" + prevMatch: "K" + startSearch: / + optionMenu: + optionMenu-alt1: "?" + select: + goInto: + confirm: + confirmInEditor: + remove: d + new: "n" + edit: l + openFile: o + scrollUpMain: + scrollDownMain: + scrollUpMain-alt1: K + scrollDownMain-alt1: J + scrollUpMain-alt2: + scrollDownMain-alt2: + executeShellCommand: ":" + createRebaseOptionsMenu: m + # 'Files' appended for legacy reasons + pushFiles: P + # 'Files' appended for legacy reasons + pullFiles: p + refresh: R + createPatchOptionsMenu: + nextTab: "]" + prevTab: "[" + nextScreenMode: + + prevScreenMode: _ + undo: z + redo: + filteringMenu: + diffingMenu: W + diffingMenu-alt: + copyToClipboard: + openRecentRepos: + submitEditorText: + extrasMenu: "@" + toggleWhitespaceInDiffView: + increaseContextInDiffView: "}" + decreaseContextInDiffView: "{" + increaseRenameSimilarityThreshold: ) + decreaseRenameSimilarityThreshold: ( + openDiffTool: + status: + checkForUpdate: u + recentRepos: + allBranchesLogGraph: a + files: + commitChanges: c + commitChangesWithoutHook: w + amendLastCommit: A + commitChangesWithEditor: C + findBaseCommitForFixup: + confirmDiscard: x + ignoreFile: i + refreshFiles: r + stashAllChanges: s + viewStashOptions: S + toggleStagedAll: a + viewResetOptions: D + fetch: f + toggleTreeView: "`" + openMergeTool: M + openStatusFilter: + copyFileInfoToClipboard: "y" + branches: + createPullRequest: o + viewPullRequestOptions: O + copyPullRequestURL: + checkoutBranchByName: c + forceCheckoutBranch: F + rebaseBranch: r + renameBranch: R + mergeIntoCurrentBranch: M + viewGitFlowOptions: i + fastForward: f + createTag: T + pushTag: P + setUpstream: u + fetchRemote: f + sortOrder: s + worktrees: + viewWorktreeOptions: w + commits: + squashDown: s + renameCommit: r + renameCommitWithEditor: R + viewResetOptions: g + markCommitAsFixup: f + createFixupCommit: F + squashAboveCommits: S + moveDownCommit: + moveUpCommit: + amendToCommit: A + resetCommitAuthor: a + pickCommit: p + revertCommit: t + cherryPickCopy: C + pasteCommits: V + markCommitAsBaseForRebase: B + tagCommit: T + checkoutCommit: + resetCherryPick: + copyCommitAttributeToClipboard: "y" + openLogMenu: + openInBrowser: o + viewBisectOptions: b + startInteractiveRebase: i + amendAttribute: + resetAuthor: a + setAuthor: A + addCoAuthor: c + stash: + popStash: g + renameStash: r + commitFiles: + checkoutCommitFile: c + main: + toggleSelectHunk: a + pickBothHunks: b + editSelectHunk: E + submodules: + init: i + update: u + bulkMenu: b + commitMessage: + commitMenu: diff --git a/common/lesskey b/common/lesskey index 8eb0c4f..de66057 100644 --- a/common/lesskey +++ b/common/lesskey @@ -4,10 +4,12 @@ # Less the pager. # Location: -# $XDG_CONFIG_HOME/lesskey -# Or specified by the environment variable $LESSKEYIN +# *nix: $XDG_CONFIG_HOME/lesskey (Or specified by the environment variable $LESSKEYIN) +# Windows: %LESSKEYIN% (environment variable, default: %UserProfile%/_lesskey) +# $Env:LESSKEYIN = $Env:AppData\less\lesskey # Linking: # ln -sf $DOTFILES/common/lesskey ~/.config/lesskey +# New-Item -ItemType SymbolicLink -Target $DOTFILES\common\lesskey -Path $Env:LESSKEYIN # =========================================================== # work for less -V > 582, for mac, use brew install less to override the system less # In Windows (current version), the default pager is `more`, should be specifed to `less` by `$Env:Pager = less` diff --git a/common/remote.bashrc b/common/remote.bashrc index 0811d77..ba05799 100644 --- a/common/remote.bashrc +++ b/common/remote.bashrc @@ -134,9 +134,7 @@ alias netl="netstat -tulnp" alias apt="sudo apt" alias apts="apt search" alias apti="sudo apt install" -aptr() { - sudo apt remove $1 || sudo apt autoremove -} +alias aptr="sudo apt remove" alias aptu="sudo apt upgrade && sudo apt update" alias l="ls -lah" diff --git a/platforms/linux/fastfetch.jsonc b/platforms/linux/fastfetch.jsonc new file mode 100644 index 0000000..f2df0ef --- /dev/null +++ b/platforms/linux/fastfetch.jsonc @@ -0,0 +1,61 @@ +// ~/.config/fastfetch/config.jsonc +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + // "type": "auto", + "source": "arch_small", + "padding": { + "top": 2, + "left": 1, + "right": 2 + } + }, + "general": { + "multithreading": true + }, + "display": { + "separator": " ", + "key": { + "width": 10, + "paddingLeft": 2, + "type": "icon" + } + }, + "modules": [ + { + "type": "title", + "format": "{#1}───────────── {#}{user-name-colored}@{host-name-colored}" + }, + { + "type": "colors", + "symbol": "diamond", + "paddingLeft": 15 + }, + "os", + // "host", + // "kernel", + // "uptime", + { + "type": "packages" + }, + "shell", + "display", + // "de", + // "wm", + // "wmtheme", + // "theme", + // "icons", + // "font", + // "cursor", + "terminal", + // "terminalfont", + "cpu", + "gpu", + "memory", + // "swap", + "disk", + // "battery", + "poweradapter", + "locale" + ] +} \ No newline at end of file diff --git a/platforms/linux/hyprland/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf similarity index 99% rename from platforms/linux/hyprland/hypr/hyprland.conf rename to platforms/linux/hypr/hyprland.conf index 6a37019..5a1871d 100644 --- a/platforms/linux/hyprland/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -62,7 +62,7 @@ $menu = wofi --show drun # exec-once = $terminal # exec-once = nm-applet & -exec-once = waybar & hyprpaper & mako & systemctl --user start hyprpolkitagent +exec-once = waybar & hyprpaper & mako & systemctl --user start hyprpolkitagent & fcitx5 ############################# diff --git a/platforms/linux/hyprland/hypr/hyprpaper.conf b/platforms/linux/hypr/hyprpaper.conf similarity index 100% rename from platforms/linux/hyprland/hypr/hyprpaper.conf rename to platforms/linux/hypr/hyprpaper.conf diff --git a/platforms/linux/hyprland/code-flags.conf b/platforms/linux/wayland/code-flags.conf similarity index 68% rename from platforms/linux/hyprland/code-flags.conf rename to platforms/linux/wayland/code-flags.conf index 0119c79..5a37672 100644 --- a/platforms/linux/hyprland/code-flags.conf +++ b/platforms/linux/wayland/code-flags.conf @@ -8,5 +8,7 @@ # Linking: # ln -sf $DOTFILES/platforms/linux/hyprland/code-flags.conf ~/.config/ ---enable-features=UseOzonePlatform ---ozone-platform=wayland +# --enable-features=UseOzonePlatform +# --ozone-platform=wayland +--ozone-platform-hint=auto +--enable-wayland-ime diff --git a/platforms/linux/hyprland/electron-flags.conf b/platforms/linux/wayland/electron-flags.conf similarity index 67% rename from platforms/linux/hyprland/electron-flags.conf rename to platforms/linux/wayland/electron-flags.conf index 560f083..7ff2980 100644 --- a/platforms/linux/hyprland/electron-flags.conf +++ b/platforms/linux/wayland/electron-flags.conf @@ -8,6 +8,8 @@ # Linking: # ln -sf $DOTFILES/platforms/linux/hyprland/electron-flags.conf ~/.config/ ---enable-features=UseOzonePlatform ---ozone-platform=wayland ---enable-icd +# --enable-features=UseOzonePlatform +# --ozone-platform=wayland +# --enable-icd +--ozone-platform-hint=auto +--enable-wayland-ime diff --git a/platforms/linux/zshrc b/platforms/linux/zshrc index 5fa6f30..c846ac1 100644 --- a/platforms/linux/zshrc +++ b/platforms/linux/zshrc @@ -8,6 +8,6 @@ if [ -n "$WAYLAND_DISPLAY" ]; then alias clip="wl-copy" alias paste="wl-paste" -else [ -n "$DISPLAY" ]; then +elif [ -n "$DISPLAY" ]; then alias clip="xclip" fi diff --git a/platforms/mac/pwshProfile.ps1 b/platforms/mac/pwshProfile.ps1 index 386b296..ac0ce0d 100644 --- a/platforms/mac/pwshProfile.ps1 +++ b/platforms/mac/pwshProfile.ps1 @@ -6,8 +6,7 @@ $DOTFILES = "$HOME/.dotfiles" ### Load Configs ### -Get-ChildItem -Path $DOTFILES/powershell -Filter *.ps1 | ForEach-Object {. $_} -Get-ChildItem -Path $DOTFILES/powershell_private -Filter *.ps1 | ForEach-Object {. $_} +Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_} ## Aliases ### diff --git a/platforms/win/Microsoft.PowerShell_profile.ps1 b/platforms/win/Microsoft.PowerShell_profile.ps1 index 05b468a..ef8ee96 100644 --- a/platforms/win/Microsoft.PowerShell_profile.ps1 +++ b/platforms/win/Microsoft.PowerShell_profile.ps1 @@ -5,26 +5,13 @@ ### Load Configs ### $DOTFILES = Join-Path $HOME ".dotfiles" -Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_} +Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object { . $_ } ### Aliases ### # Toggle Theme # -# TODO: Change to `bat` script implementation -# function Set-SystemTheme { -# $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -# $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -# if ($currentMode.AppsUseLightTheme -eq 1) { -# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0 -# Write-Host "已切换到深色模式" -# } -# else { -# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1 -# Write-Host "已切换到浅色模式" -# } -# } -# Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`) +Set-Alias "dark-mode" "$DOTFILES\platforms\win\cmd\dark-mode.bat" # Consistent with macOS (`dark-mode`) # Miscs # @@ -35,7 +22,7 @@ ${function:qwen} = "ollama run qwen2.5:14b" #region conda initialize # !! Contents within this block are managed by 'conda init' !! If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") { - (& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object{$_} | Invoke-Expression + (& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object { $_ } | Invoke-Expression } #endregion @@ -67,10 +54,10 @@ $Env:VISUAL = "code --wait" $Env:FILE_MANAGER = "dopus.exe" -${function:wsl2} = {wsl.exe --distribution Ubuntu} +${function:wsl2} = { wsl.exe --distribution kali-linux $args } ${function:wini} = { winget install $args } ${function:winr} = { winget uninstall $args } ${function:wins} = { winget search $args } ${function:winu} = { winget upgrade $args } -${function:killp} = {ps | ? ProcessName -like $args | kill -Force} +${function:pkill} = { ps *$args* | kill -Force } diff --git a/platforms/win/ahk/Caps.ahk b/platforms/win/ahk/Caps.ahk new file mode 100644 index 0000000..5f11baf --- /dev/null +++ b/platforms/win/ahk/Caps.ahk @@ -0,0 +1,114 @@ +#Requires AutoHotkey v2.0 +#SingleInstance Force + +; 全局变量声明 +global g_LastCtrlKeyDownTime := 0 +global g_AbortSendEsc := false +global g_ControlRepeatDetected := false + +*CapsLock:: { + global g_ControlRepeatDetected + global g_LastCtrlKeyDownTime + global g_AbortSendEsc + + if (g_ControlRepeatDetected) { + return + } + + Send "{Ctrl down}" + g_LastCtrlKeyDownTime := A_TickCount + g_AbortSendEsc := false + g_ControlRepeatDetected := true +} + +*CapsLock Up:: { + global g_ControlRepeatDetected + global g_LastCtrlKeyDownTime + global g_AbortSendEsc + + Send "{Ctrl up}" + g_ControlRepeatDetected := false + if (g_AbortSendEsc) { + return + } + current_time := A_TickCount + time_elapsed := current_time - g_LastCtrlKeyDownTime + if (time_elapsed <= 250) { + SendInput "{Esc}" + } +} + +; 组合所有 Ctrl 快捷键 +#HotIf +~*^a:: +~*^b:: +~*^c:: +~*^d:: +~*^e:: +~*^f:: +~*^g:: +~*^h:: +~*^i:: +~*^j:: +~*^k:: +~*^l:: +~*^m:: +~*^n:: +~*^o:: +~*^p:: +~*^q:: +~*^r:: +~*^s:: +~*^t:: +~*^u:: +~*^v:: +~*^w:: +~*^x:: +~*^y:: +~*^z:: +~*^1:: +~*^2:: +~*^3:: +~*^4:: +~*^5:: +~*^6:: +~*^7:: +~*^8:: +~*^9:: +~*^0:: +~*^Space:: +~*^Backspace:: +~*^Delete:: +~*^Insert:: +~*^Home:: +~*^End:: +~*^PgUp:: +~*^PgDn:: +~*^Tab:: +~*^Enter:: +~*^,:: +~*^.:: +~*^/:: +~*^;:: +~*^':: +~*^[:: +~*^]:: +~*^\:: +~*^-:: +~*^=:: +~*^`:: +~*^F1:: +~*^F2:: +~*^F3:: +~*^F4:: +~*^F5:: +~*^F6:: +~*^F7:: +~*^F8:: +~*^F9:: +~*^F10:: +~*^F11:: +~*^F12:: { + global g_AbortSendEsc + g_AbortSendEsc := true +} diff --git a/platforms/win/ahk/colemak.ahk b/platforms/win/ahk/colemak.ahk new file mode 100644 index 0000000..2974bff --- /dev/null +++ b/platforms/win/ahk/colemak.ahk @@ -0,0 +1,29 @@ +#Requires AutoHotkey v2.0 + +q::q +w::w +e::f +r::p +t::g +y::j +u::l +i::u +o::y +p::; +a::a +s::r +d::s +f::t +g::d +h::h +j::n +k::e +l::i +`;::o +z::z +x::x +c::c +v::v +b::b +n::k +m::m \ No newline at end of file diff --git a/tools/fastfetch/win.jsonc b/platforms/win/fastfetch.jsonc similarity index 95% rename from tools/fastfetch/win.jsonc rename to platforms/win/fastfetch.jsonc index 2b5c2e6..1824115 100644 --- a/tools/fastfetch/win.jsonc +++ b/platforms/win/fastfetch.jsonc @@ -1,4 +1,4 @@ -// ~\.config\fastfetch\config.jsonc +// %UserProfile%\.config\fastfetch\config.jsonc { "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", "logo": { @@ -54,9 +54,8 @@ "memory", "swap", "disk", - "localip", "battery", "poweradapter", "locale" ] -} +} \ No newline at end of file diff --git a/platforms/win/glzr/.gitignore b/platforms/win/glzr/.gitignore new file mode 100644 index 0000000..40ddb92 --- /dev/null +++ b/platforms/win/glzr/.gitignore @@ -0,0 +1,4 @@ +# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force +boilerplate* +starter/ +neobrutal/ diff --git a/platforms/win/glzr/glazewm/config.yaml b/platforms/win/glzr/glazewm/config.yaml new file mode 100644 index 0000000..ecbda6e --- /dev/null +++ b/platforms/win/glzr/glazewm/config.yaml @@ -0,0 +1,317 @@ +# $DOTFILES/platforms/win/glzr/glazewm/config.yaml +# Date: 2025-01-05 +# Author: js0ny + +# Location: +# - %UserProfile%\.glzr\glazewm\config.yaml +# Linking: Link to whole directory +# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force + +general: + # Commands to run when the WM has started. This is useful for running a + # script or launching another application. + # Example: The below command launches Zebar. + startup_commands: ["shell-exec zebar"] + + # Commands to run just before the WM is shutdown. + # Example: The below command kills Zebar. + shutdown_commands: ["shell-exec taskkill /IM zebar.exe /F"] + + # Commands to run after the WM config is reloaded. + config_reload_commands: [] + + # Whether to automatically focus windows underneath the cursor. + focus_follows_cursor: true + + # Whether to switch back and forth between the previously focused + # workspace when focusing the current workspace. + toggle_workspace_on_refocus: false + + cursor_jump: + # Whether to automatically move the cursor on the specified trigger. + enabled: true + + # Trigger for cursor jump: + # - 'monitor_focus': Jump when focus changes between monitors. + # - 'window_focus': Jump when focus changes between windows. + trigger: "monitor_focus" + + # How windows should be hidden when switching workspaces. + # - 'cloak': Recommended. Hides windows with no animation. + # - 'hide': Legacy method (v3.5 and earlier) that has a brief animation, + # but has stability issues with some apps. + hide_method: "cloak" + + # Affects which windows get shown in the native Windows taskbar. Has no + # effect if `hide_method: 'hide'`. + # - 'true': Show all windows (regardless of workspace). + # - 'false': Only show windows from the currently shown workspaces. + show_all_in_taskbar: false + +gaps: + # Whether to scale the gaps with the DPI of the monitor. + scale_with_dpi: true + + # Gap between adjacent windows. + inner_gap: "5px" + + # Gap between windows and the screen edge. + outer_gap: + top: "50px" + right: "5px" + bottom: "5px" + left: "5px" + +window_effects: + # Visual effects to apply to the focused window. + focused_window: + # Highlight the window with a colored border. + # ** Exclusive to Windows 11 due to API limitations. + border: + enabled: true + color: "#f6a7ba" + + # Remove the title bar from the window's frame. Note that this can + # cause rendering issues for some applications. + hide_title_bar: + enabled: false + + # Change the corner style of the window's frame. + # ** Exclusive to Windows 11 due to API limitations. + corner_style: + enabled: false + # Allowed values: 'square', 'rounded', 'small_rounded'. + style: "square" + + # Visual effects to apply to non-focused windows. + other_windows: + border: + enabled: false + color: "#a1a1a1" + hide_title_bar: + enabled: true + corner_style: + enabled: false + style: "square" + +window_behavior: + # New windows are created in this state whenever possible. + # Allowed values: 'tiling', 'floating'. + initial_state: "tiling" + + # Sets the default options for when a new window is created. This also + # changes the defaults for when the state change commands, like + # `set-floating`, are used without any flags. + state_defaults: + floating: + # Whether to center floating windows by default. + centered: true + + # Whether to show floating windows as always on top. + shown_on_top: false + + fullscreen: + # Maximize the window if possible. If the window doesn't have a + # maximize button, then it'll be fullscreen'ed normally instead. + maximized: false + + # Whether to show fullscreen windows as always on top. + shown_on_top: false + +workspaces: + - name: "1" + - name: "2" + - name: "3" + - name: "4" + - name: "5" + - name: "6" + - name: "7" + - name: "8" + - name: "9" + +window_rules: + - commands: ["ignore"] + match: + # Ignores any Zebar windows. + - window_process: { equals: "zebar" } + - window_process: { equals: "WindowsTerminal" } + + # Ignores picture-in-picture windows for browsers. + - window_title: { regex: "[Pp]icture.in.[Pp]icture" } + window_class: { regex: "Chrome_WidgetWin_1|MozillaDialogClass" } + + # Ignore rules for various 3rd-party apps. + - window_process: { equals: "PowerToys" } + window_class: { regex: 'HwndWrapper\[PowerToys\.PowerAccent.*?\]' } + - window_process: { equals: "PowerToys" } + window_title: { regex: ".*? - Peek" } + - window_process: { equals: "Lively" } + window_class: { regex: "HwndWrapper" } + +binding_modes: + # When enabled, the focused window can be resized via arrow keys or HJKL. + - name: "resize" + keybindings: + - commands: ["resize --width -2%"] + bindings: ["h", "left"] + - commands: ["resize --width +2%"] + bindings: ["i", "right"] + - commands: ["resize --height +2%"] + bindings: ["e", "up"] + - commands: ["resize --height -2%"] + bindings: ["n", "down"] + # Press enter/escape to return to default keybindings. + - commands: ["wm-disable-binding-mode --name resize"] + bindings: ["escape", "enter"] + +keybindings: + # Shift focus in a given direction. + - commands: ["focus --direction left"] + bindings: ["lwin+h", "lwin+left"] + - commands: ["focus --direction right"] + bindings: ["lwin+i", "lwin+right"] + - commands: ["focus --direction up"] + bindings: ["lwin+e", "lwin+up"] + - commands: ["focus --direction down"] + bindings: ["lwin+n", "lwin+down"] + + # Move focused window in a given direction. + - commands: ["move --direction left"] + bindings: ["lwin+shift+h", "lwin+shift+left"] + - commands: ["move --direction right"] + bindings: ["lwin+shift+i", "lwin+shift+right"] + - commands: ["move --direction up"] + bindings: ["lwin+shift+e", "lwin+shift+up"] + - commands: ["move --direction down"] + bindings: ["lwin+shift+n", "lwin+shift+down"] + + # Resize focused window by a percentage or pixel amount. + - commands: ["resize --width -2%"] + bindings: ["alt+u"] + - commands: ["resize --width +2%"] + bindings: ["alt+p"] + - commands: ["resize --height +2%"] + bindings: ["alt+o"] + - commands: ["resize --height -2%"] + bindings: ["alt+i"] + + # As an alternative to the resize keybindings above, resize mode enables + # resizing via arrow keys or HJKL. The binding mode is defined above with + # the name 'resize'. + - commands: ["wm-enable-binding-mode --name resize"] + bindings: ["lwin+shift+r"] + + # Disables window management and all other keybindings until alt+shift+p + # is pressed again. + - commands: ["wm-toggle-pause"] + bindings: ["alt+shift+p"] + + # Change tiling direction. This determines where new tiling windows will + # be inserted. + - commands: ["toggle-tiling-direction"] + bindings: ["lwin+v"] + + # Change focus from tiling windows -> floating -> fullscreen. + # - commands: ["wm-cycle-focus"] + # bindings: ["alt+space"] + + # Change the focused window to be floating. + - commands: ["toggle-floating --centered"] + bindings: ["alt+shift+space"] + + # Change the focused window to be tiling. + - commands: ["toggle-tiling"] + bindings: ["lwin+t"] + + # Change the focused window to be fullscreen. + # - commands: ["toggle-fullscreen"] + # bindings: ["lwin+f"] + - commands: ["shell-exec dopus.exe"] + bindings: ["lwin+f"] + + # Minimize focused window. + - commands: ["toggle-minimized"] + bindings: ["lwin+m"] + + # Close focused window. + - commands: ["close"] + bindings: ["lwin+q"] + + # Kill GlazeWM process safely. + - commands: ["wm-exit"] + bindings: ["alt+shift+e"] + + # Re-evaluate configuration file. + - commands: ["wm-reload-config"] + bindings: ["alt+shift+r"] + + # Redraw all windows. + - commands: ["wm-redraw"] + bindings: ["alt+shift+w"] + + # Launch CMD terminal. Alternatively, use `shell-exec wt` or + # `shell-exec %ProgramFiles%/Git/git-bash.exe` to start Windows + # Terminal and Git Bash respectively. + - commands: ["shell-exec wezterm-gui.exe start"] + bindings: ["lwin+r"] + + # Focus the next/previous active workspace defined in `workspaces` config. + - commands: ["focus --next-active-workspace"] + bindings: ["alt+s"] + - commands: ["focus --prev-active-workspace"] + bindings: ["alt+a"] + + # Focus the workspace that last had focus. + - commands: ["focus --recent-workspace"] + bindings: ["alt+d"] + + # Change focus to a workspace defined in `workspaces` config. + - commands: ["focus --workspace 1"] + bindings: ["lwin+1"] + - commands: ["focus --workspace 2"] + bindings: ["lwin+2"] + - commands: ["focus --workspace 3"] + bindings: ["lwin+3"] + - commands: ["focus --workspace 4"] + bindings: ["lwin+4"] + - commands: ["focus --workspace 5"] + bindings: ["lwin+5"] + - commands: ["focus --workspace 6"] + bindings: ["lwin+6"] + - commands: ["focus --workspace 7"] + bindings: ["lwin+7"] + - commands: ["focus --workspace 8"] + bindings: ["lwin+8"] + - commands: ["focus --workspace 9"] + bindings: ["lwin+9"] + + # Move the focused window's parent workspace to a monitor in a given + # direction. + - commands: ["move-workspace --direction left"] + bindings: ["alt+shift+a"] + - commands: ["move-workspace --direction right"] + bindings: ["alt+shift+f"] + - commands: ["move-workspace --direction up"] + bindings: ["alt+shift+d"] + - commands: ["move-workspace --direction down"] + bindings: ["alt+shift+s"] + + # Move focused window to a workspace defined in `workspaces` config. + - commands: ["move --workspace 1", "focus --workspace 1"] + bindings: ["lwin+shift+1"] + - commands: ["move --workspace 2", "focus --workspace 2"] + bindings: ["lwin+shift+2"] + - commands: ["move --workspace 3", "focus --workspace 3"] + bindings: ["lwin+shift+3"] + - commands: ["move --workspace 4", "focus --workspace 4"] + bindings: ["lwin+shift+4"] + - commands: ["move --workspace 5", "focus --workspace 5"] + bindings: ["lwin+shift+5"] + - commands: ["move --workspace 6", "focus --workspace 6"] + bindings: ["lwin+shift+6"] + - commands: ["move --workspace 7", "focus --workspace 7"] + bindings: ["lwin+shift+7"] + - commands: ["move --workspace 8", "focus --workspace 8"] + bindings: ["lwin+shift+8"] + - commands: ["move --workspace 9", "focus --workspace 9"] + bindings: ["lwin+shift+9"] diff --git a/platforms/win/glzr/readme.md b/platforms/win/glzr/readme.md new file mode 100644 index 0000000..0409c2a --- /dev/null +++ b/platforms/win/glzr/readme.md @@ -0,0 +1,38 @@ +# GlazeWM Setup + +Link the whole `glzr` directory to the user's home directory. + +```powershell +New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force +``` + +The Zebar config should be downloaded from [this repository](https://github.com/js0ny/neobrutal-zebar) and extracted to the `glzr\zebar` directory. + +```powershell +Invoke-WebRequest -Uri "https://github.com/js0ny/neobrutal-zebar/releases/download/2/neobrutal.zip" -OutFile "$Env:UserProfile\.glzr\zebar\neobrutal.zip" +Expand-Archive -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" -DestinationPath "$Env:UserProfile\.glzr\zebar" +Remove-Item -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" +``` + +If `just` and `pwsh` are installed, you can build the config by running `just build-zebar`. + +```powershell +git clone https://github.com/js0ny/neobrutal-zebar.git --depth 1 +just init +just build +``` + +Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfigs.path` to `minimal/bar.zebar.json`. + +```diff + { + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json", + "startupConfigs": [ + { +- "path": "neobrutal/bar.zebar.json", ++ "path": "minimal/bar.zebar.json", + "preset": "default" + } + ] + } +``` diff --git a/platforms/win/glzr/zebar/minimal/bar.zebar.json b/platforms/win/glzr/zebar/minimal/bar.zebar.json new file mode 100644 index 0000000..1dcb03c --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/bar.zebar.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/widget-schema.json", + "htmlPath": "./index.html", + "zOrder": "normal", + "shownInTaskbar": false, + "focused": false, + "resizable": false, + "transparent": true, + "presets": [ + { + "name": "default", + "anchor": "top_left", + "offsetX": "0px", + "offsetY": "0px", + "width": "100%", + "height": "40px", + "monitorSelection": { + "type": "all" + } + } + ] +} diff --git a/platforms/win/glzr/zebar/minimal/index.html b/platforms/win/glzr/zebar/minimal/index.html new file mode 100644 index 0000000..b97b52f --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/index.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/platforms/win/glzr/zebar/minimal/scripts.jsx b/platforms/win/glzr/zebar/minimal/scripts.jsx new file mode 100644 index 0000000..fbbace9 --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/scripts.jsx @@ -0,0 +1,197 @@ +import React, { + useState, + useEffect, +} from 'https://esm.sh/react@18?dev'; +import { createRoot } from 'https://esm.sh/react-dom@18/client?dev'; +import * as zebar from 'https://esm.sh/zebar@2'; + +const providers = zebar.createProviderGroup({ + // network: { type: 'network' }, + glazewm: { type: 'glazewm' }, + cpu: { type: 'cpu' }, + date: { type: 'date', formatting: 'HH:mm:ss MMM月d日 EEE', locale: 'zh-CN' }, + battery: { type: 'battery' }, + memory: { type: 'memory' }, + weather: { type: 'weather' }, +}); + +function getNetworkIcon(networkOutput) { + switch (networkOutput.defaultInterface?.type) { + case 'ethernet': + return ; + case 'wifi': + if (networkOutput.defaultGateway?.signalStrength >= 80) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 65 + ) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 40 + ) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 25 + ) { + return ; + } else { + return ; + } + default: + return ( + + ); + } +} +// Get icon to show for how much of the battery is charged. +function getBatteryIcon(batteryOutput) { + if (batteryOutput.chargePercent > 90) + return ; + if (batteryOutput.chargePercent > 70) + return ; + if (batteryOutput.chargePercent > 40) + return ; + if (batteryOutput.chargePercent > 20) + return ; + return ; +} +// Get icon to show for current weather status. +function getWeatherIcon(weatherOutput) { + switch (weatherOutput.status) { + case 'clear_day': + return ; + case 'clear_night': + return ; + case 'cloudy_day': + return ; + case 'cloudy_night': + return ; + case 'light_rain_day': + return ; + case 'light_rain_night': + return ; + case 'heavy_rain_day': + return ; + case 'heavy_rain_night': + return ; + case 'snow_day': + return ; + case 'snow_night': + return ; + case 'thunder_day': + return ; + case 'thunder_night': + return ; + } +} + +createRoot(document.getElementById('root')).render(); + +function App() { + const [output, setOutput] = useState(providers.outputMap); + + useEffect(() => { + providers.onOutput(() => setOutput(providers.outputMap)); + }, []); + + + + return ( +
+
+ + {output.glazewm && ( +
+ {output.glazewm.currentWorkspaces.map(workspace => ( + + ))} +
+ )} +
+ +
{output.date?.formatted}
+ +
+ {output.glazewm && ( + <> + {output.glazewm.bindingModes.map(bindingMode => ( + + ))} + + + + )} + + {output.network && ( +
+ {getNetworkIcon(output.network)} + {output.network.defaultGateway?.ssid} +
+ )} + + {output.memory && ( +
+ + {Math.round(output.memory.usage)}% +
+ )} + + {output.cpu && ( +
+ + + {/* Change the text color if the CPU usage is high. */} + 85 ? 'high-usage' : ''} + > + {Math.round(output.cpu.usage)}% + +
+ )} + + {output.battery && ( +
+ {/* Show icon for whether battery is charging. */} + {output.battery.isCharging && ( + + )} + {getBatteryIcon(output.battery)} + {Math.round(output.battery.chargePercent)}% +
+ )} + + {output.weather && ( +
+ {getWeatherIcon(output.weather)} + {Math.round(output.weather.celsiusTemp)}°C +
+ )} +
+
+ ); +} diff --git a/platforms/win/glzr/zebar/minimal/styles.css b/platforms/win/glzr/zebar/minimal/styles.css new file mode 100644 index 0000000..c28280d --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/styles.css @@ -0,0 +1,115 @@ +/** + * Import the Nerdfonts icon font. + * Ref https://www.nerdfonts.com/cheat-sheet for a cheatsheet of available Nerdfonts icons. + */ +@import 'https://www.nerdfonts.com/assets/css/webfont.css'; + +i { + color: rgb(115 130 175 / 95%); + margin-right: 7px; +} + +body { + color: rgb(255 255 255 / 90%); + font-family: "JetBrainsMono Nerd Font", "LXGW Wenkai", ui-monospace, monospace; + font-size: 12px; + overflow: hidden; +} + +html, +body, +#root { + height: 100%; +} + +#root { + border-bottom: 1px solid rgb(255 255 255 / 5%); + background: linear-gradient(rgb(0 0 0 / 90%), rgb(5 2 20 / 85%)); +} + +.app { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + align-items: center; + height: 100%; + padding: 4px 1.5vw; +} + +.left, +.center, +.right { + display: flex; + align-items: center; +} + +.center { + justify-self: center; +} + +.right { + justify-self: end; +} + +.logo, +.binding-mode, +.tiling-direction, +.network, +.memory, +.cpu, +.battery { + margin-right: 20px; +} + +.workspaces { + display: flex; + align-items: center; +} + +.workspace { + background: rgb(255 255 255 / 5%); + margin-right: 4px; + padding: 4px 8px; + color: rgb(255 255 255 / 90%); + border: none; + border-radius: 2px; + cursor: pointer; + + &.displayed { + background: rgb(255 255 255 / 15%); + } + + &.focused, + &:hover { + background: rgb(75 115 255 / 50%); + } +} + +.binding-mode, +.tiling-direction { + background: rgb(255 255 255 / 15%); + color: rgb(255 255 255 / 90%); + border-radius: 2px; + line-height: 1; + padding: 4px 8px; + border: 0; + cursor: pointer; +} + +.binding-mode { + margin-right: 4px; +} + +.cpu .high-usage { + color: #900029; +} + +.battery { + position: relative; +} + +.battery .charging-icon { + position: absolute; + font-size: 7px; + left: -8px; + top: 3px; +} diff --git a/platforms/win/glzr/zebar/normalize.css b/platforms/win/glzr/zebar/normalize.css new file mode 100644 index 0000000..2204e78 --- /dev/null +++ b/platforms/win/glzr/zebar/normalize.css @@ -0,0 +1,204 @@ +/** + * Base CSS styles for better consistency across platforms. + * Yoinked from: https://github.com/sindresorhus/modern-normalize + */ + +/* +Document +======== +*/ + +/** +Use a better box model (opinionated). +*/ + +*, +::before, +::after { + box-sizing: border-box; +} + +html { + /* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */ + font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji'; + line-height: 1.15; /* 1. Correct the line height in all browsers. */ + -webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */ + tab-size: 4; /* 3. Use a more readable tab size (opinionated). */ +} + +/* +Sections +======== +*/ + +body { + margin: 0; /* Remove the margin in all browsers. */ +} + +/* +Text-level semantics +==================== +*/ + +/** +Add the correct font weight in Chrome and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/** +1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) +2. Correct the odd 'em' font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', + Menlo, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/** +Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +Tabular data +============ +*/ + +/** +Correct table border color inheritance in Chrome and Safari. (https://issues.chromium.org/issues/40615503, https://bugs.webkit.org/show_bug.cgi?id=195016) +*/ + +table { + border-color: currentcolor; +} + +/* +Forms +===== +*/ + +/** +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** +Correct the inability to style clickable types in iOS and Safari. +*/ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; +} + +/** +Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers. +*/ + +legend { + padding: 0; +} + +/** +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/** +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/** +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to 'inherit' in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* +Interactive +=========== +*/ + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} diff --git a/platforms/win/glzr/zebar/settings.json b/platforms/win/glzr/zebar/settings.json new file mode 100644 index 0000000..66efb4e --- /dev/null +++ b/platforms/win/glzr/zebar/settings.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json", + "startupConfigs": [ + { + "path": "neobrutal/bar.zebar.json", + "preset": "default" + } + ] +} diff --git a/platforms/win/readme.md b/platforms/win/readme.md index 0c7f7f8..5280122 100644 --- a/platforms/win/readme.md +++ b/platforms/win/readme.md @@ -1,50 +1,82 @@ # Windows dotfiles -By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix: +![Windows](../../_assets/windows-1.png) -- `%APPDATA%` - `$XDG_CONFIG_HOME` (default: `%USERPROFILE%\AppData\Roaming`) +- Terminal Emulator: [WezTerm](../../tools/wezterm/) +- Tiling Window Manager: [GlazeWM](./glzr/glazewm/config.yaml) +- Status Bar: [Zebar](./glzr/zebar/settings.json) +- Quake Terminal: [Windows Terminal](./WindowsTerminal.json) +- Shell: [PowerShell Core](../../tools/powershell/readme.md) + - WSL1: [Arch Linux](https://github.com/yuk7/ArchWSL) + - WSL2: kali-linux +By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix, some of the software(like `wezterm`) will use these directories as the default configuration path: + +| Windows Path | XDG-Equivalent | Default | +|------------|----------|----------| +| `%APPDATA%` | `$XDG_CONFIG_HOME` | `%USERPROFILE%\AppData\Roaming` | +| `%LOCALAPPDATA%` | `$XDG_DATA_HOME` | `%USERPROFILE%\AppData\Local` | +| `%LOCALAPPDATA%\Cache` | `$XDG_CACHE_HOME` | `%USERPROFILE%\AppData\Local\Cache` | +| `%LOCALAPPDATA%\State` | `$XDG_STATE_HOME` | `%USERPROFILE%\AppData\Local\State` | + +An example bootstrap script is provided in [bootstrap/Windows.ps1](../../bootstrap/Windows.ps1), which will create necessary directories and link the files. ## PowerShell Profile -This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile. +This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile, which is faster(`powershell` vs `pwsh`, `pwsh` types 6 letters less lol), cross-platform and compatible with Unix. -By default, PowerShell profile is stored in `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`. +By default, PowerShell profile is stored in `%UserProfile%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`. It is convenient to use `$PROFILE` to locate the profile file. -```pwsh +```powershell Test-Path $PROFILE ``` +Just like Unix Shell, there are configs work for different sessions. To locate them, use `select *` followed by `$PROFILE`. + +If you want to change the `AllUsers` scoped profile, do not install `pwsh` via `winget`, use `scoop` instead, since `winget` will install `pwsh` to `%ProgramFiles%\PowerShell\7\pwsh.exe`, which is read-only even with Administrator privileges. + +```powershell +PS > $PROFILE | Select * +AllUsersAllHosts : C:\Users\jsony\scoop\apps\pwsh\current\profile.ps1 +AllUsersCurrentHost : C:\Users\jsony\scoop\apps\pwsh\current\Microsoft.PowerShell_profile.ps1 +CurrentUserAllHosts : C:\Users\jsony\Documents\PowerShell\profile.ps1 +CurrentUserCurrentHost : C:\Users\jsony\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 +Length : 68 +``` + +Note that the variable `$PROFILE.*` are constants, the only way to change it is to compile your own `pwsh` + To link the profile file: -```pwsh +```powershell New-Item -ItemType SymbolicLink -Path $PROFILE -Target "$DOTFILES\win\Microsoft.PowerShell_profile.ps1" -Force ``` -I use [starship](https://starship.rs/) to customize the prompt, which is located in [`.dotfiles/.config/starship/starship_pwsh.toml`](../.config/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the promp to identify the shell. +I use [starship](https://starship.rs/) to customize the prompt, which is located in [`tools/starship/starship_pwsh.toml`](../../tools/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the prompt to identify the shell. -## `.wslconfig` - WSL Configuration +## `.wslconfig` - WSL2 Configuration -`.wslconfig` only supports `~/.wslconfig` as the configuration path +`.wslconfig` only supports `%UserProfile%\.wslconfig` as the configuration path -```pwsh -New-Item -ItemType SymbolicLink -Path "~\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force +```powershell +New-Item -ItemType SymbolicLink -Path "$Env:UserProfile\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force ``` - + ## Neovide Neovide configuration is (only) stored in `%APPDATA%\neovide\config.toml` -```pwsh +```powershell New-Item -ItemType SymbolicLink -Path "$Env:AppData\neovide\config.toml" -Target "$DOTFILES\win\neovide.toml" -Force ``` \ No newline at end of file diff --git a/readme.md b/readme.md index a71c2e8..c31c24b 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,10 @@ This repository contains dotfiles for multiple platforms, with _colemak_ as the default keyboard layout. +No rice, no Unixporn/NTporn, just a simple setup that works for me. + +Works for Windows, Linux and MacOS. + ## Structure ```shell @@ -15,3 +19,13 @@ This repository contains dotfiles for multiple platforms, with _colemak_ as the ├──  scripts # Scripts for various tasks └──  tools # Multi-file configurations (shell, neovim etc) ``` + +## Keybindings + +``` + ^ + e + < h i > + n + v +``` diff --git a/scripts/Completions.ps1 b/scripts/Completions.ps1 deleted file mode 100644 index 2050048..0000000 --- a/scripts/Completions.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -function Invoke-Completion { - param ([string]$command) - switch ($command) { - 'docker' { docker completion powershell | Out-String | Invoke-Expression } - 'git' { Import-Module Posh-Git } - 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } - 'pip' { pip completion --powershell | Out-String | Invoke-Expression } - } -} diff --git a/scripts/Rename-FilesWithZeroPadding.ps1 b/scripts/Rename-FilesWithZeroPadding.ps1 new file mode 100644 index 0000000..9c8f9ea --- /dev/null +++ b/scripts/Rename-FilesWithZeroPadding.ps1 @@ -0,0 +1,43 @@ +<# +.SYNOPSIS +Rename files with a specified extension in a folder, padding the numeric part with zeros. +.PARAMETER ext +The extension of the files to rename, without the dot. Default is "md". +.PARAMETER Numeral +If specified, the files will be renamed in the order of their numeric part. +.EXAMPLE +Rename-FilesWithZeroPadding.ps1 -ext "txt" +Renames all files with the extension "txt" in the current folder, padding the numeric part with zeros. +For example: '1.txt', '2.txt', ... '12.txt' -> '01.txt', '02.txt', ... '12.txt'. +.EXAMPLE +Rename-FilesWithZeroPadding.ps1 -Numeral # This set the Numeral switch to false +Renames all files with the default extension "md" in the current folder, in the order of their filenames. +For example: 'file1.md', 'file2.md', ... 'file12.md' -> '01.md', '02.md', ... '12.md'. +#> +param( + [string]$ext = "md", + [switch]$Numeral +) +if ($Numeral) { + $files = $files | Sort-Object { [int]($_.BaseName -replace '\D', '') } +} +else { + $files = Get-ChildItem -Filter "*.$ext" | Sort-Object Name + $fnamecnt = 1 +} +$cnt = $files.Count + +$paddingLength = $cnt.ToString().Length + +foreach ($file in $files) { + if ($Numeral) { + $number = [int]($file.BaseName -replace '\D', '') + $newNumber = $number.ToString().PadLeft($paddingLength, '0') + $newName = "$newNumber.$ext" + } + else { + $newName = ($fnamecnt++).ToString().PadLeft($paddingLength, '0') + ".$ext" + } + + Rename-Item -Path $file.FullName -NewName $newName +} diff --git a/scripts/update.zsh b/scripts/update.zsh index 025ee96..7a46754 100644 --- a/scripts/update.zsh +++ b/scripts/update.zsh @@ -41,6 +41,6 @@ if command -v winget.exe > /dev/null; then fi # macOS - Rime -if [ $(uname) = "Darwin"]; then +if [ $(uname) = "Darwin" ]; then bash ~/plum/rime-install fi diff --git a/themes/alacritty-catppuccin-frappe.toml b/themes/alacritty-catppuccin-frappe.toml deleted file mode 100644 index 3e6fac1..0000000 --- a/themes/alacritty-catppuccin-frappe.toml +++ /dev/null @@ -1,65 +0,0 @@ -[colors.primary] -background = "#303446" -foreground = "#c6d0f5" -dim_foreground = "#838ba7" -bright_foreground = "#c6d0f5" - -[colors.cursor] -text = "#303446" -cursor = "#f2d5cf" - -[colors.vi_mode_cursor] -text = "#303446" -cursor = "#babbf1" - -[colors.search.matches] -foreground = "#303446" -background = "#a5adce" - -[colors.search.focused_match] -foreground = "#303446" -background = "#a6d189" - -[colors.footer_bar] -foreground = "#303446" -background = "#a5adce" - -[colors.hints.start] -foreground = "#303446" -background = "#e5c890" - -[colors.hints.end] -foreground = "#303446" -background = "#a5adce" - -[colors.selection] -text = "#303446" -background = "#f2d5cf" - -[colors.normal] -black = "#51576d" -red = "#e78284" -green = "#a6d189" -yellow = "#e5c890" -blue = "#8caaee" -magenta = "#f4b8e4" -cyan = "#81c8be" -white = "#b5bfe2" - -[colors.bright] -black = "#626880" -red = "#e78284" -green = "#a6d189" -yellow = "#e5c890" -blue = "#8caaee" -magenta = "#f4b8e4" -cyan = "#81c8be" -white = "#a5adce" - -[[colors.indexed_colors]] -index = 16 -color = "#ef9f76" - -[[colors.indexed_colors]] -index = 17 -color = "#f2d5cf" diff --git a/themes/flowlauncher-catppuccin-frappe.xaml b/themes/flowlauncher-catppuccin-frappe.xaml deleted file mode 100644 index 392cc86..0000000 --- a/themes/flowlauncher-catppuccin-frappe.xaml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - #414559 - - - - - - - - - - - - - - - - - diff --git a/tools/browser/surfingkeys.js b/tools/browser/surfingkeys.js index d778b0a..743c673 100644 --- a/tools/browser/surfingkeys.js +++ b/tools/browser/surfingkeys.js @@ -1,7 +1,6 @@ // Paste this into surfingkeys advanced settings // or use: // Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js -// TODO: Visual Mode // #region Example /** Examples @@ -23,406 +22,458 @@ api.unmap(''); // Settings settings.language = "zh-CN"; settings.showModeStatus = false; -// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main // #region Helper +const { + aceVimMap, + addVimMapKey, + mapkey, + imap, + imapkey, + getClickableElements, + vmapkey, + map, + unmap, + cmap, + addSearchAlias, + removeSearchAlias, + tabOpenLink, + readText, + Clipboard, + Front, + Hints, + Visual, + RUNTIME, +} = api; +// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main const forward = { - add: function (key) { // 转发即将被 unmap 的键 - return api.map(`for${key}`, key) + add: function (key) { + // 转发即将被 unmap 的键 + return api.map(`for${key}`, key); }, - cancel: function (key) { // 删除转发生成的键 - api.unmap(`for${key}`) - api.unmap(key) + cancel: function (key) { + // 删除转发生成的键 + api.unmap(`for${key}`); + api.unmap(key); }, use: function (key) { - return `for${key}` - } -} + return `for${key}`; + }, +}; const colemak = { - forward: function (key) { // 转发即将被 unmap 的键 - api.map(key, `col${key}`) - api.unmap(`col${key}`) - + forward: function (key) { + // 转发即将被 unmap 的键 + api.map(key, `col${key}`); + api.unmap(`col${key}`); }, use: function (key) { - return `col${key}` + return `col${key}`; }, map: function (a, b) { - api.map(colemak.use(a), forward.use(b)) - } -} + api.map(colemak.use(a), forward.use(b)); + }, +}; + +const vForward = { + add: function (key) { + // 转发即将被 unmap 的键 + return api.vmap(`vfor${key}`, key); + }, + cancel: function (key) { + // 删除转发生成的键 + api.vunmap(`vfor${key}`); + api.vunmap(key); + }, + use: function (key) { + return `vfor${key}`; + }, +}; + +const vColemak = { + forward: function (key) { + // 转发即将被 unmap 的键 + api.vmap(key, `vcol${key}`); + api.vunmap(`vcol${key}`); + }, + use: function (key) { + return `vcol${key}`; + }, + map: function (a, b) { + api.vmap(vColemak.use(a), vForward.use(b)); + }, +}; const forwardFactory = { - push: function (mapLists) { // forward original keys + push: function (mapLists) { + // forward original keys for (let key in mapLists) { - forward.add(mapLists[key]) + forward.add(mapLists[key]); } }, map: function (mapLists) { for (let key in mapLists) { - colemak.map(key, mapLists[key]) + colemak.map(key, mapLists[key]); } }, pull: function (mapLists) { for (let key in mapLists) { - forward.cancel(mapLists[key]) + forward.cancel(mapLists[key]); } for (let key in mapLists) { - colemak.forward(key) + colemak.forward(key); } - } -} + }, +}; +const vForwardFactory = { + push: function (mapLists) { + // forward original keys + for (let key in mapLists) { + vForward.add(mapLists[key]); + } + }, + map: function (mapLists) { + for (let key in mapLists) { + vColemak.map(key, mapLists[key]); + } + }, + pull: function (mapLists) { + for (let key in mapLists) { + vForward.cancel(mapLists[key]); + } + for (let key in mapLists) { + vColemak.forward(key); + } + }, +}; + +const parseSearchResponse = function (response) { + const res = JSON.parse(response.text); + return res.map((r) => r.phrase); +}; + +const _addSearchAlias = function ( + alias, + name, + searchUrl, + acUrl = "https://duckduckgo.com/ac/?q=", + searchPrefix = "s", + parseResponse = parseSearchResponse, +) { + api.addSearchAlias( + alias, + name, + searchUrl, + searchPrefix, + acUrl, + parseResponse, + ); +}; // #endregion + // #region Keymap const mapLists = { /// scroll page // Arrow - 'n': 'j', - 'e': 'k', - 'i': 'l', + n: "j", + e: "k", + i: "l", // l <-> i - 'l': 'i', - 'L': 'I', + l: "i", + L: "I", // k <-> n - 'k': 'n', - 'K': 'N', + k: "n", + K: "N", // j <-> e - 'j': 'e', + j: "e", // PrevTab < H - I > NextTab - 'H': 'E', - 'I': 'R', + H: "E", + I: "R", // E,N -> Up/Down HalfPage - 'N': 'd', - 'E': 'e', + N: "d", + E: "e", // F -> Open Link in New Tab - 'F': 'af', + F: "af", // oH -> Tab History - 'oH': 'H', + oH: "H", // gh/gi -> Prev/Next History - 'gh': 'S', - 'gi': 'D', + gh: "S", + gi: "D", // t -> Open Link in New Tab - 't': 'gf', + t: "gf", // 缩放 - 'zu': 'zi', - 'zo': 'ze', - 'zz': 'zr', -} + zu: "zi", + zo: "ze", + zz: "zr", +}; -const vmapLists = { - 'n': 'j', - 'N': 'J', - 'e': 'k', - 'E': 'K', - 'i': 'l', - 'I': 'L', - 'j': 'e', - 'J': 'E', - 'k': 'n', - 'K': 'N', -} +const vMapLists = { + n: "j", + N: "J", + e: "k", + E: "K", + i: "l", + I: "L", + j: "e", + J: "E", + k: "n", + K: "N", +}; -forwardFactory.push(mapLists) -forwardFactory.map(mapLists) +forwardFactory.push(mapLists); +forwardFactory.map(mapLists); + +vForwardFactory.push(vMapLists); +vForwardFactory.map(vMapLists); // 鼠标点击 -api.unmap('gi') -api.unmap('[[') -api.unmap(']]') -api.unmap(';m') -api.unmap(';fs') -api.unmap('O') -api.unmap('C') -api.map('g/', 'gU') // Goto Root Domain -forwardFactory.pull(mapLists) +api.unmap("gi"); +api.unmap("[["); +api.unmap("]]"); +api.unmap(";m"); +api.unmap(";fs"); +api.unmap("O"); +api.unmap("C"); +api.map("g/", "gU"); // Goto Root Domain +// p to site-specific +api.unmap("p"); +api.unmap(""); // Leader Key +forwardFactory.pull(mapLists); +vForwardFactory.pull(vMapLists); // #endregion - // #region Search Alias -api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) { - var res = JSON.parse(response.text); - return res.map(function (r) { - return r.phrase; - }); -}); -api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) { - var res = JSON.parse(response.text); - return res.map(function (r) { - return r.phrase; - }); -}); -api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function (response) { - var res = JSON.parse(response.text); - return res.map(function (r) { - return r.phrase; - }); -}); -api.addSearchAlias('c', 'ChatGPT', 'https://chatgpt.com/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) { - var res = JSON.parse(response.text); - return res.map(function (r) { - return r.phrase; - }); -}); +removeSearchAlias("s"); // StackOverflow +removeSearchAlias("d"); // DuckDuckGo +removeSearchAlias("g"); // Google +removeSearchAlias("b"); // Baidu +removeSearchAlias("w"); // Bing +removeSearchAlias("y"); // YouTube + +/// Common +_addSearchAlias("dd", "DuckDuckGo", "https://duckduckgo.com/?q="); +_addSearchAlias("gg", "Google", "https://www.google.com/search?q="); +_addSearchAlias("bd", "Baidu", "https://www.baidu.com/s?wd="); +_addSearchAlias("bi", "Bing", "https://www.bing.com/search?q="); +_addSearchAlias( + "wk", + "Wikipedia", + "https://en.wikipedia.org/w/index.php?title=Special:Search&search=", +); +_addSearchAlias("re", "Reddit", "https://www.reddit.com/search?q="); +_addSearchAlias("st", "Steam", "https://store.steampowered.com/search/?term="); +_addSearchAlias( + "ud", + "UrbanDictionary", + "https://www.urbandictionary.com/define.php?term=", +); +_addSearchAlias("tw", "X", "https://twitter.com/search?q="); +_addSearchAlias("de", "Thesaurus", "https://www.onelook.com/?w="); +_addSearchAlias( + "ww", + "WantWords", + "https://www.shenyandayi.com/wantWordsResult?lang=zh&query=", +); +/// AI Search +_addSearchAlias("fe", "Felo", "https://felo.ai/search?q="); +_addSearchAlias("pp", "Perplexity", "https://www.perplexity.ai/?q="); +_addSearchAlias("cg", "ChatGPT", "https://chat.openai.com/?q="); +_addSearchAlias("mc", "Metacritic", "https://www.metacritic.com/search/"); +/// EECS Related +_addSearchAlias( + "gh", + "GitHub", + "https://github.com/search?type=repositories&q=", +); +_addSearchAlias("so", "StackOverflow", "https://stackoverflow.com/search?q="); +_addSearchAlias("se", "StackExchange", "https://stackexchange.com/search?q="); +_addSearchAlias( + "aw", + "ArchWiki", + "https://wiki.archlinux.org/index.php?search=", +); +_addSearchAlias("wa", "WolframAlpha", "https://www.wolframalpha.com/input/?i="); +_addSearchAlias("eb", "ebay", "https://www.ebay.co.uk/sch/i.html?kw="); +// Programming language packages +_addSearchAlias("py", "pypi", "https://pypi.org/search/?q="); +_addSearchAlias("ng", "NuGet", "https://www.nuget.org/packages?q="); +_addSearchAlias("np", "npm", "https://www.npmjs.com/search?q="); +// Package Manager Search +_addSearchAlias("wg", "winget", "https://winget.ragerworks.com/search/all/"); +_addSearchAlias("sc", "Scoop", "https://scoop.sh/#/apps?q="); +_addSearchAlias("br", "HomeBrew", "https://duckduckgo.com/?q=!brew "); +_addSearchAlias("au", "AUR", "https://aur.archlinux.org/packages?K="); +_addSearchAlias("pa", "Pacman", "https://archlinux.org/packages/?q="); +_addSearchAlias("ap", "APT", "https://packages.ubuntu.com/search?keywords="); +_addSearchAlias( + "a2", + "AlternativeTo", + "https://alternativeto.net/browse/search/?q=", +); +_addSearchAlias( + "cr", + "Chrome Web Store", + "https://chrome.google.com/webstore/search/", +); +/// Video +_addSearchAlias( + "yt", + "YouTube", + "https://www.youtube.com/results?search_query=", +); +_addSearchAlias("bl", "Bilibili", "https://search.bilibili.com/all?keyword="); + // #endregion // #region Site-specific - // chatgpt.com -api.unmap('t', /chatgpt.com/); -api.mapkey('tn', 'New Chat', function () { - var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)') +const chatgptNewChat = function () { + var btn = document.querySelector( + "div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)", + ); btn.click(); -}, { domain: /chatgpt.com/ }); -api.mapkey('ts', 'Start/Stop Generating', function () { - var btn = document.querySelector('button.h-8:nth-child(2)'); +}; +const chatgptStartStop = function () { + var btn = document.querySelector("button.h-8:nth-child(2)"); btn.click(); -}, { domain: /chatgpt.com/ }); -api.mapkey('ts', 'Start/Stop Generating', function () { - var btn = document.querySelector('button.h-8:nth-child(2)'); - btn.click(); -}, { domain: /chatgpt.com/ }); -api.mapkey('S', 'Start/Stop Generating', function () { - var btn = document.querySelector('button.h-8:nth-child(2)'); - btn.click(); -}, { domain: /chatgpt.com/ }); +}; +api.unmap("t", /chatgpt.com/); +api.mapkey("tn", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ }); +api.mapkey("ts", "Start/Stop Generating", chatgptStartStop, { + domain: /chatgpt.com/, +}); +api.mapkey("S", "Start/Stop Generating", chatgptStartStop, { + domain: /chatgpt.com/, +}); +api.mapkey("an", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ }); +api.mapkey("as", "Start/Stop Generating", chatgptStartStop, { + domain: /chatgpt.com/, +}); + //api.mapkey('tm', 'Toggle Model', function () { // var btn = document.querySelector('#radix -\: r2i\:'); // btn.click(); //}, { domain: /chatgpt.com/ }); +// perplexity.ai +api.unmap("", /perplexity.ai/); // allows to use perplexity web keybindings +api.mapkey("aB", "Add Perplexity Bookmark", function () { + // button.border:nth-child(2) + var btn = document.querySelector("button.border:nth-child(2)"); + btn.click(); +}); // #endregion -// #region Theme -// reference to https://github.com/Foldex/surfingkeys-config -// api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;'); -// api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text"); -// api.Visual.style('marks', 'background-color: #A3BE8C99;'); -// api.Visual.style('cursor', 'background-color: #88C0D0;'); -// settings.theme = ` -// fg: #E5E9F0; -// bg: #3B4252; -// bg-dark: #2E3440; -// border: #4C566A; -// main-fg: #88C0D0; -// accent-fg: #A3BE8C; -// info-fg: #5E81AC; -// select: #4C566A; -// /* ---------- Generic ---------- */ -// .sk_theme { -// background: var(--bg); -// color: var(--fg); -// background-color: var(--bg); -// border-color: var(--border); -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// } +// #region ACE Editor +addVimMapKey( + // Navigation + { + keys: "k", + type: "motion", + motion: "findNext", + motionArgs: { forward: true, toJumplist: true }, + }, + { + keys: "K", + type: "motion", + motion: "findNext", + motionArgs: { forward: false, toJumplist: true }, + }, -// input { -// font-family: var(--font); -// font-weight: var(--font-weight); -// } + // Word movement + { + keys: "j", + type: "motion", + motion: "moveByWords", + motionArgs: { forward: true, wordEnd: true, inclusive: true }, + }, + { + keys: "J", + type: "motion", + motion: "moveByWords", + motionArgs: { + forward: true, + wordEnd: true, + bigWord: true, + inclusive: true, + }, + }, -// .sk_theme tbody { -// color: var(--fg); -// } + // Insert mode entries + { + keys: "l", + type: "action", + action: "enterInsertMode", + isEdit: true, + actionArgs: { insertAt: "inplace" }, + context: "normal", + }, + { + keys: "gl", + type: "action", + action: "enterInsertMode", + isEdit: true, + actionArgs: { insertAt: "lastEdit" }, + context: "normal", + }, + { + keys: "L", + type: "action", + action: "enterInsertMode", + isEdit: true, + actionArgs: { insertAt: "firstNonBlank" }, + context: "normal", + }, + { + keys: "gL", + type: "action", + action: "enterInsertMode", + isEdit: true, + actionArgs: { insertAt: "bol" }, + context: "normal", + }, + { + keys: "L", + type: "action", + action: "enterInsertMode", + isEdit: true, + actionArgs: { insertAt: "startOfSelectedArea" }, + context: "visual", + }, + { + keys: "n", + type: "motion", + motion: "moveByLines", + motionArgs: { forward: true, linewise: true }, + }, + { + keys: "e", + type: "motion", + motion: "moveByLines", + motionArgs: { forward: false, linewise: true }, + }, + { + keys: "i", + type: "motion", + motion: "moveByCharacters", + motionArgs: { forward: true }, + }, + { + keys: "H", + type: "keyToKey", + toKeys: "^", + }, + { + keys: "I", + type: "keyToKey", + toKeys: "$", + }, + { + keys: "Y", + type: "keyToKey", + toKeys: "y$", + }, +); -// .sk_theme input { -// color: var(--fg); -// } - -// /* Hints */ -// #sk_hints .begin { -// color: var(--accent-fg) !important; -// } - -// #sk_tabs .sk_tab { -// background: var(--bg-dark); -// border: 1px solid var(--border); -// } - -// #sk_tabs .sk_tab_title { -// color: var(--fg); -// } - -// #sk_tabs .sk_tab_url { -// color: var(--main-fg); -// } - -// #sk_tabs .sk_tab_hint { -// background: var(--bg); -// border: 1px solid var(--border); -// color: var(--accent-fg); -// } - -// .sk_theme #sk_frame { -// background: var(--bg); -// opacity: 0.2; -// color: var(--accent-fg); -// } - -// /* ---------- Omnibar ---------- */ -// /* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */ -// /* .sk_theme#sk_omnibar { -// width: 100%; -// left: 0; -// } */ - -// .sk_theme .title { -// color: var(--accent-fg); -// } - -// .sk_theme .url { -// color: var(--main-fg); -// } - -// .sk_theme .annotation { -// color: var(--accent-fg); -// } - -// .sk_theme .omnibar_highlight { -// color: var(--accent-fg); -// } - -// .sk_theme .omnibar_timestamp { -// color: var(--info-fg); -// } - -// .sk_theme .omnibar_visitcount { -// color: var(--accent-fg); -// } - -// .sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { -// background: var(--bg-dark); -// } - -// .sk_theme #sk_omnibarSearchResult ul li.focused { -// background: var(--border); -// } - -// .sk_theme #sk_omnibarSearchArea { -// border-top-color: var(--border); -// border-bottom-color: var(--border); -// } - -// .sk_theme #sk_omnibarSearchArea input, -// .sk_theme #sk_omnibarSearchArea span { -// font-size: var(--font-size); -// } - -// .sk_theme .separator { -// color: var(--accent-fg); -// } - -// /* ---------- Popup Notification Banner ---------- */ -// #sk_banner { -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// background: var(--bg); -// border-color: var(--border); -// color: var(--fg); -// opacity: 0.9; -// } - -// /* ---------- Popup Keys ---------- */ -// #sk_keystroke { -// background-color: var(--bg); -// } - -// .sk_theme kbd .candidates { -// color: var(--info-fg); -// } - -// .sk_theme span.annotation { -// color: var(--accent-fg); -// } - -// /* ---------- Popup Translation Bubble ---------- */ -// #sk_bubble { -// background-color: var(--bg) !important; -// color: var(--fg) !important; -// border-color: var(--border) !important; -// } - -// #sk_bubble * { -// color: var(--fg) !important; -// } - -// #sk_bubble div.sk_arrow div:nth-of-type(1) { -// border-top-color: var(--border) !important; -// border-bottom-color: var(--border) !important; -// } - -// #sk_bubble div.sk_arrow div:nth-of-type(2) { -// border-top-color: var(--bg) !important; -// border-bottom-color: var(--bg) !important; -// } - -// /* ---------- Search ---------- */ -// #sk_status, -// #sk_find { -// font-size: var(--font-size); -// border-color: var(--border); -// } - -// .sk_theme kbd { -// background: var(--bg-dark); -// border-color: var(--border); -// box-shadow: none; -// color: var(--fg); -// } - -// .sk_theme .feature_name span { -// color: var(--main-fg); -// } - -// /* ---------- ACE Editor ---------- */ -// #sk_editor { -// background: var(--bg-dark) !important; -// height: 50% !important; -// /* Remove this to restore the default editor size */ -// } - -// .ace_dialog-bottom { -// border-top: 1px solid var(--bg) !important; -// } - -// .ace-chrome .ace_print-margin, -// .ace_gutter, -// .ace_gutter-cell, -// .ace_dialog { -// background: var(--bg) !important; -// } - -// .ace-chrome { -// color: var(--fg) !important; -// } - -// .ace_gutter, -// .ace_dialog { -// color: var(--fg) !important; -// } - -// .ace_cursor { -// color: var(--fg) !important; -// } - -// .normal-mode .ace_cursor { -// background-color: var(--fg) !important; -// border: var(--fg) !important; -// opacity: 0.7 !important; -// } - -// .ace_marker-layer .ace_selection { -// background: var(--select) !important; -// } - -// .ace_editor, -// .ace_dialog span, -// .ace_dialog input { -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// }`; -// click `Save` button to make above settings to take effect. +// #endregion + +// #region Hints // #endregion diff --git a/tools/fish/conf.d/0init.fish b/tools/fish/conf.d/0init.fish index 23f2e3f..1b7a47f 100644 --- a/tools/fish/conf.d/0init.fish +++ b/tools/fish/conf.d/0init.fish @@ -31,6 +31,9 @@ else if test -d /home/linuxbrew/.linuxbrew/bin # Linux set -gx PATH /home/linuxbrew/.linuxbrew/bin $PATH end +if command -v brew > /dev/null + set -gx HOMEBREW_NO_ENV_HINTS +end # Azure CLI if command -v az > /dev/null @@ -102,6 +105,7 @@ if command -v gem > /dev/null set -gx PATH $dir $PATH end end + set -gx PATH $HOME/.local/share/gem/ruby/3.3.0/bin $PATH end # Spacemacs if command -v emacs > /dev/null @@ -135,3 +139,18 @@ if status is-interactive set IPYTHONDIR $XDG_CONFIG_HOME/ipython end end + +# Coursier: Scala dependency manager +if command -v coursier > /dev/null + set -gx PATH "$PATH:$XDG_DATA_HOME/coursier/bin" +end +# pnpm +set -gx PNPM_HOME "$XDG_DATA_HOME/pnpm" +if not string match -q -- $PNPM_HOME $PATH + set -gx PATH "$PNPM_HOME" $PATH +end +# pnpm end + +test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish + +test -f /opt/miniconda3/etc/fish/conf.d/conda.fish && source /opt/miniconda3/etc/fish/conf.d/conda.fish diff --git a/tools/fish/conf.d/alias.fish b/tools/fish/conf.d/alias.fish index 7af629a..a279315 100644 --- a/tools/fish/conf.d/alias.fish +++ b/tools/fish/conf.d/alias.fish @@ -69,4 +69,11 @@ if command -v pacman > /dev/null abbr --add paci "sudo pacman -S" abbr --add pacr "sudo pacman -R" abbr --add pacu "sudo pacman -Syu" + abbr --add pacs "sudo pacman -Ss" +end + +if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty" + abbr --add icat "kitten icat" +else if test "$TERM_PROGRAM" = "WezTerm" + abbr --add icat "wezterm imgcat" end diff --git a/tools/fish/conf.d/keymap.fish b/tools/fish/conf.d/keymap.fish index 2969ffe..3a9c09e 100644 --- a/tools/fish/conf.d/keymap.fish +++ b/tools/fish/conf.d/keymap.fish @@ -25,4 +25,4 @@ bind -M default 'i' forward-char bind -M default -m insert l repaint-mode bind -M default -m insert L beginning-of-line repaint-mode -# TODO: Add more key bindings here +fzf --fish | source diff --git a/tools/fish/conf.d/prompt.fish b/tools/fish/conf.d/prompt.fish index 0760923..890325e 100644 --- a/tools/fish/conf.d/prompt.fish +++ b/tools/fish/conf.d/prompt.fish @@ -8,6 +8,6 @@ # ln -sf $DOTFILES/tools/fish ~/.config/fish if command -v starship > /dev/null - set -gx STARSHIP_CONFIG $DOTFILES/tools/starship/starship_fish.toml + set -gx STARSHIP_CONFIG "~/.dotfiles/tools/starship/starship_fish.toml" starship init fish | source end diff --git a/tools/fish/config.fish b/tools/fish/config.fish index deb193c..6cb45ae 100644 --- a/tools/fish/config.fish +++ b/tools/fish/config.fish @@ -16,9 +16,22 @@ if status is-interactive # macOS Specific abbr --add clip pbcopy abbr --add paste pbpaste + # Use GNU Coreutils + alias cp=gcp + alias ln=gln + alias mkdir=gmkdir + alias mv=gmv + alias rm=grm + alias rmdir=grmdir + alias touch=gtouch + case "Linux" # Linux Specific case '*' # Default / Fallback case end end + +# bun +set --export BUN_INSTALL "$HOME/.bun" +set --export PATH $BUN_INSTALL/bin $PATH diff --git a/tools/nvim/.gitignore b/tools/nvim/.gitignore deleted file mode 100644 index 2fcefc7..0000000 --- a/tools/nvim/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lazy-lock.json \ No newline at end of file diff --git a/tools/nvim/init.lua b/tools/nvim/init.lua index cdb5629..820a3f2 100644 --- a/tools/nvim/init.lua +++ b/tools/nvim/init.lua @@ -5,24 +5,8 @@ @Date 2024-11-27 @Description neovim 配置文件 ]] --- 针对特定文件类型设置快捷键 -vim.api.nvim_create_autocmd("FileType", { - pattern = "markdown", -- 指定文件类型 - callback = function() - vim.api.nvim_buf_set_keymap(0, "v", "`", "c`\"`", { noremap = true, silent = true, desc = "Wrap selection with backticks" }) - end, -}) --- 加载配置 require("config.options") --- 加载键位映射 -require("config.keymaps") - --- 加载插件 require("config.plugins") - --- 加载主题 require("config.colorscheme") - - --- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) +require("config.keymaps") diff --git a/tools/nvim/lazy-lock.json b/tools/nvim/lazy-lock.json new file mode 100644 index 0000000..23c4ad7 --- /dev/null +++ b/tools/nvim/lazy-lock.json @@ -0,0 +1,47 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" }, + "betterTerm.nvim": { "branch": "main", "commit": "6f03af3a1ed4d054ecbcb0aa8266ddaf610aa657" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "code_runner.nvim": { "branch": "main", "commit": "65218f8f646fe61e506090522df357539642ae83" }, + "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "76d88f3b584e1f83b2aa51663a32cc6ee8d97eff" }, + "hover.nvim": { "branch": "main", "commit": "140c4d0ae9397b76baa46b87c574f5377de09309" }, + "kanagawa.nvim": { "branch": "master", "commit": "988082eb00b845e4afbcaa4fd8e903da8a3ab3b9" }, + "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "luasnip-latex-snippets.nvim": { "branch": "main", "commit": "cab134611eb755abe9ba95f5d86969f5cece448d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, + "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, + "nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" }, + "nvim-treesitter": { "branch": "master", "commit": "f0c928dbe93533b7e35894a8f957f40150d1f663" }, + "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" }, + "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, + "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, + "onedarkpro.nvim": { "branch": "main", "commit": "0feb5f55dd777352f2dddd7478dd13d050864ee3" }, + "orgmode": { "branch": "master", "commit": "4e4a14a7dd613953eddacbc0f0ff1583817d7de1" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, + "render-markdown.nvim": { "branch": "main", "commit": "f0eb5893556200e9f945c0f0ea3c83bbd20dd963" }, + "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, + "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, + "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, + "vim-just": { "branch": "main", "commit": "ed67f198e981f555c0f9e9ed5b69b4b06543a9e1" }, + "vim-wakatime": { "branch": "master", "commit": "cf51327a9e08935569614d1cb24e779ee9f45519" }, + "vimtex": { "branch": "master", "commit": "c8412f444bfaf447981242d685c40e45b1c96b82" }, + "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }, + "winbar.nvim": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" }, + "yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" } +} diff --git a/tools/nvim/lua/config/colorscheme.lua b/tools/nvim/lua/config/colorscheme.lua index d57d784..853c9a0 100644 --- a/tools/nvim/lua/config/colorscheme.lua +++ b/tools/nvim/lua/config/colorscheme.lua @@ -1 +1 @@ -vim.cmd.colorscheme("catppuccin") +vim.cmd.colorscheme("kanagawa") diff --git a/tools/nvim/lua/config/keymaps.lua b/tools/nvim/lua/config/keymaps.lua index dfc1d55..85058c1 100644 --- a/tools/nvim/lua/config/keymaps.lua +++ b/tools/nvim/lua/config/keymaps.lua @@ -1,2 +1 @@ require("keymaps") - diff --git a/tools/nvim/lua/config/options.lua b/tools/nvim/lua/config/options.lua index de77bff..d978c69 100644 --- a/tools/nvim/lua/config/options.lua +++ b/tools/nvim/lua/config/options.lua @@ -25,6 +25,7 @@ opt.linebreak = true -- Indentation opt.expandtab = true opt.shiftwidth = 4 +opt.tabstop = 4 opt.shiftround = true -- Case @@ -36,8 +37,10 @@ opt.cursorline = true opt.termguicolors = true -- Fold -opt.foldlevel = 99 opt.foldmethod = "expr" +opt.foldexpr = "nvim_treesitter#foldexpr()" +opt.foldlevel = 99 +opt.foldlevelstart = 1 -- Statusline opt.laststatus = 0 @@ -50,3 +53,5 @@ opt.scrolloff = 5 opt.sidescrolloff = 10 opt.conceallevel = 2 + +vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" diff --git a/tools/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua index 38cc888..e11a6ec 100644 --- a/tools/nvim/lua/config/servers.lua +++ b/tools/nvim/lua/config/servers.lua @@ -3,21 +3,15 @@ --- for available server and name local M = {} M.servers = { - "arduino_language_server", -- Arduino - "bashls", -- Bash - "clangd", -- C/C++ - -- "cmake", -- CMake - "eslint", -- JavaScript - "gopls", -- Go - "html", -- HTML - "julials", -- Julia - "lua_ls", -- Lua - "omnisharp", -- C# & F# - "powershell_es", -- PowerShell - "pyright", -- Python - "rust_analyzer", -- Rust - "taplo", -- TOML - "vimls", -- vimscript + "clangd", -- C/C++ + -- "cmake", -- CMake + "eslint", -- JavaScript + "html", -- HTML + "lua_ls", -- Lua + "omnisharp", -- C# & F# + "powershell_es", -- PowerShell + "pyright", -- Python + "vimls", -- vimscript } M.server_config = { diff --git a/tools/nvim/lua/keymaps/basic.lua b/tools/nvim/lua/keymaps/basic.lua index 00fa177..8035d48 100644 --- a/tools/nvim/lua/keymaps/basic.lua +++ b/tools/nvim/lua/keymaps/basic.lua @@ -1,20 +1,74 @@ -local mode_arrow = { "n", "v", "o", "s", "x" } +local mode_arrow = { "n", "v", "s", "x" } local keymaps_basic = { -- Modification of Original Keymap - Colemak - { mode = mode_arrow, keys = "n", cmd = "j" }, - { mode = mode_arrow, keys = "e", cmd = "k" }, - { mode = mode_arrow, keys = "i", cmd = "l" }, - { keys = "H", cmd = ":bprevious" }, - { keys = "N", cmd = "J" }, - { keys = "E", cmd = "K" }, - { keys = "I", cmd = ":bnext" }, - { keys = "l", cmd = "i" }, - { keys = "L", cmd = "I" }, - { keys = "k", cmd = "n" }, - { keys = "K", cmd = "N" }, - { keys = "j", cmd = "e" }, - { keys = "J", cmd = "E" }, - { keys = "Y", cmd = "y$"}, + -- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L8 + { + mode = mode_arrow, + keys = "n", + cmd = "v:count == 0 ? 'gj' : 'j'", + opts = { desc = "Down", expr = true, silent = true }, + }, + { + mode = mode_arrow, + keys = "", + cmd = "v:count == 0 ? 'gj' : 'j'", + opts = { desc = "Down", expr = true, silent = true }, + }, + { + mode = mode_arrow, + keys = "e", + cmd = "v:count == 0 ? 'gk' : 'k'", + opts = { desc = "Up", expr = true, silent = true }, + }, + { + mode = mode_arrow, + keys = "", + cmd = "v:count == 0 ? 'gk' : 'k'", + opts = { desc = "Up", expr = true, silent = true }, + }, + + { + mode = "o", + keys = "n", + cmd = "j", + opts = { desc = "Down", silent = true }, + }, + { + mode = "o", + keys = "", + cmd = "j", + opts = { desc = "Down", silent = true }, + }, + { + mode = "o", + keys = "e", + cmd = "k", + opts = { desc = "Up", silent = true }, + }, + { + mode = "o", + keys = "", + cmd = "k", + opts = { desc = "Up", silent = true }, + }, + + { mode = mode_arrow, keys = "h", cmd = "h", opts = { desc = "Left", silent = true } }, + { mode = mode_arrow, keys = "i", cmd = "l", opts = { desc = "Right", silent = true } }, + { keys = "H", cmd = ":bprevious", opts = { desc = "Previous Buffer" } }, + { keys = "I", cmd = ":bnext", opts = { desc = "Next Buffer" } }, + { keys = "N", cmd = "5k", opts = { desc = "Up 5 Lines" } }, + { keys = "E", cmd = "5j", opts = { desc = "Down 5 Lines" } }, + { keys = "Y", cmd = "y$", opts = { desc = "Yank to End of Line" } }, + { keys = "E", cmd = "5k" }, + -- Text object implementation + { mode = { "n", "o", "x" }, keys = "l", cmd = "i", opts = { desc = "Insert" } }, + { keys = "L", cmd = "I", opts = { desc = "Insert at Start of Line" } }, + { keys = "k", cmd = "n", opts = { desc = "Next Search" } }, + { keys = "K", cmd = "N", opts = { desc = "Previous Search" } }, + { keys = "j", cmd = "e", opts = { desc = "jump to end of word" } }, + { keys = "J", cmd = "E", opts = { desc = "jump to end of WORD" } }, + -- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L60 + { keys = "", cmd = "nohlsearchdiffupdate", opts = { desc = "Clear Search Highlight" } }, } return keymaps_basic diff --git a/tools/nvim/lua/keymaps/buffer.lua b/tools/nvim/lua/keymaps/buffer.lua new file mode 100644 index 0000000..709e3f8 --- /dev/null +++ b/tools/nvim/lua/keymaps/buffer.lua @@ -0,0 +1,55 @@ +local M = {} + +--- buffer that doesn't act as an editor or common buffer. +--- Use `q` to close the buffer. +local tmp_buf = { + "qf", -- quickfix + "crunner", -- code runner +} + +local term_buf = { + "floaterm", + "term", +} + +local term_mode = { + "n", + "i", + "t", +} + +local term_keymaps = { + { mode = term_mode, keys = "", cmd = ":FloatermToggle", desc = "Exit terminal mode" }, +} + +M.tmp_buf_keymaps = { + { mode = "n", keys = "q", cmd = "q", desc = "Close buffer" }, +} + +for _, buf in ipairs(tmp_buf) do + vim.api.nvim_create_autocmd("FileType", { + pattern = buf, + callback = function() + for _, map in ipairs(M.tmp_buf_keymaps) do + local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {}) + vim.keymap.set(map.mode, map.keys, map.cmd, opts) + end + end, + }) +end + +vim.api.nvim_create_autocmd("BufEnter", { + pattern = "*", + callback = function() + -- 检查当前 buffer 的 buftype + local buftype = vim.bo.buftype + if buftype == "terminal" then + for _, map in ipairs(term_keymaps) do + local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {}) + vim.keymap.set(map.mode, map.keys, map.cmd, opts) + end + end + end, +}) + +return M diff --git a/tools/nvim/lua/keymaps/init.lua b/tools/nvim/lua/keymaps/init.lua index 4849d72..d6546bb 100644 --- a/tools/nvim/lua/keymaps/init.lua +++ b/tools/nvim/lua/keymaps/init.lua @@ -1,52 +1,48 @@ local M = {} -local global_default_opts = { noremap = true, silent = true } -local global_default_mode = { "n" } --- local mode_arrow = { "n", "v", "o", "s", "x" } +local keymaps_user_command = require("keymaps.user-command") +local utils = require("keymaps.utils") -local function set_keymaps(maps, default_opts, default_mode) - for _, map in ipairs(maps) do - local opts = vim.tbl_extend("force", default_opts, map.opts or {}) - local mode = map.mode or default_mode - vim.keymap.set(mode, map.keys, map.cmd, opts) - end -end - - - -local keymaps_basic = require("keymaps.basic") local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global -local keymaps_leader = require("keymaps.leaders") -set_keymaps(keymaps_basic, global_default_opts, global_default_mode) -set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode) -set_keymaps(keymaps_leader, global_default_opts, global_default_mode) +local keymaps_general = vim.tbl_extend("force", {}, require("keymaps.leaders"), require("keymaps.lspkeys")) +-- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic` +local keymaps_basic = require("keymaps.basic") +local keymaps_buffer = require("keymaps.buffer") +-- local keymaps_leader = require("keymaps.leaders") +-- local keymaps_lsp = require("keymaps.lspkeys") + +utils.set_keymaps(keymaps_general) +utils.set_keymaps(keymaps_basic) +utils.set_keymaps(keymaps_nvim_tree_general) +utils.set_keymaps(keymaps_buffer) M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin --- `map` default for `cmp.mapping` function M.cmp_nvim_keymaps(map) return { - { keys = "", cmd = map.select_next_item(), desc = "Select next completion item" }, - { keys = "", cmd = map.select_prev_item(), desc = "Select previous completion item" }, - { keys = "", cmd = map.confirm({ select = true }), desc = "Confirm completion" }, - { keys = "", cmd = map.confirm({ select = true }), desc = "Confirm completion" }, - { keys = "", cmd = map.complete(), desc = "Trigger completion" }, - { keys = "", cmd = map.abort(), desc = "Abort completion" }, + { keys = "", cmd = map.select_next_item(), opts = { desc = "Select next completion item" } }, + { keys = "", cmd = map.select_prev_item(), opts = { desc = "Select previous completion item" } }, + { keys = "", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } }, + { keys = "", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } }, + { keys = "", cmd = map.complete(), opts = { desc = "Trigger completion" } }, + { keys = "", cmd = map.abort(), opts = { desc = "Abort completion" } }, } end -local function set_markdown_keymaps(bufnr) - local opts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("v", "`", "c`\"`", opts) -end +-- local function set_markdown_keymaps(bufnr) +-- local opts = { noremap = true, silent = true, buffer = bufnr } +-- vim.keymap.set("v", "`", 'c`"`', opts) +-- end -vim.api.nvim_create_autocmd("FileType", { - pattern = "markdown", - callback = function() - set_markdown_keymaps(0) - end, -}) +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "markdown", +-- callback = function() +-- set_markdown_keymaps(0) +-- end, +-- }) -require("keymaps.language") +-- which-key.nvim +require("keymaps.which") return M diff --git a/tools/nvim/lua/keymaps/language.lua b/tools/nvim/lua/keymaps/language.lua index 29f5d97..a2093b1 100644 --- a/tools/nvim/lua/keymaps/language.lua +++ b/tools/nvim/lua/keymaps/language.lua @@ -1,6 +1,5 @@ local M = {} - -- Markdown local function set_markdown_keymaps(bufnr) @@ -11,20 +10,19 @@ local function set_markdown_keymaps(bufnr) end end - M.markdown = { - { mode = "v", keys = "`", cmd = "c`pi`" , desc = "Wrap selection in ` for inline code" }, - { mode = "v", keys = "*", cmd = "c**pi**" , desc = "Wrap selection in ** for bold" }, - { mode = "v", keys = "_", cmd = "c*pi*" , desc = "Wrap selection in * for italic" }, + { mode = "v", keys = "`", cmd = "c`pi`", desc = "Wrap selection in ` for inline code" }, + { mode = "v", keys = "*", cmd = "c**pi**", desc = "Wrap selection in ** for bold" }, + { mode = "v", keys = "_", cmd = "c*pi*", desc = "Wrap selection in * for italic" }, } vim.api.nvim_create_autocmd("FileType", { - pattern = "markdown", - callback = function() - set_markdown_keymaps(0) - vim.opt_local.shiftwidth = 2 - vim.opt_local.tabstop = 2 - end, + pattern = "markdown", + callback = function() + set_markdown_keymaps(0) + vim.opt_local.shiftwidth = 2 + vim.opt_local.tabstop = 2 + end, }) return M diff --git a/tools/nvim/lua/keymaps/leaders.lua b/tools/nvim/lua/keymaps/leaders.lua index 3cfe04a..89823ff 100644 --- a/tools/nvim/lua/keymaps/leaders.lua +++ b/tools/nvim/lua/keymaps/leaders.lua @@ -1,79 +1,135 @@ local M = {} -local leader_general = { - { keys = "", cmd = ":Telescope find_files", desc = "Find Files" }, - { keys = "/", cmd = ":Telescope live_grep", desc = "Grep Files" }, -} - -for _,map in ipairs(leader_general) do - map.keys = "" .. map.keys - table.insert(M, map) +local formatFx = function() + require("conform").format({ async = true }) end -local leader_q = { -- leader q: Quit - { keys = "q", cmd = ":q", desc = "Quit" }, - { keys = "Q", cmd = ":qa!", desc = "Force Quit" }, - { keys = "w", cmd = ":wq", desc = "Write and Quit" }, - { keys = "W", cmd = ":wall:qa!", desc = "Write all and Force Quit" }, -} +local renameCurrentBuffer = function() + local old_name = vim.fn.expand("%:p") + local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/") -local leader_w = { -- leader w: Windows Management - { keys = "h", cmd = "h", desc = "Left Window" }, - { keys = "n", cmd = "j", desc = "Down Window" }, - { keys = "e", cmd = "k", desc = "Up Window" }, - { keys = "i", cmd = "l", desc = "Right Window" }, - { keys = "-", cmd = ":split", desc = "Split to down" }, - { keys = "|", cmd = ":vsplit", desc = "Split to right" }, - { keys = "c", cmd = "c", desc = "Close Window" }, - { keys = "o", cmd = "o", desc = "Close Other Windows" }, - { keys = "r", cmd = "r", desc = "Rotate Windows" }, - { keys = "R", cmd = "R", desc = "Reverse Rotate Windows" }, - { keys = "t", cmd = "T", desc = "Move Window to New Tab" }, - { keys = "H", cmd = ":vertical resize -5", desc = "Decrease Window Height" }, - { keys = "N", cmd = ":resize +5", desc = "Increase Window Height" }, - { keys = "E", cmd = ":vertical resize +5", desc = "Increase Window Width" }, - { keys = "I", cmd = ":resize -5", desc = "Decrease Window Width" }, -} + if new_name == "" then + print("No new name provided") + return + elseif new_name == old_name then + return + end -local leader_f = { -- leader f: Files/Find - { keys = "f", cmd = ":Telescope fd", desc = "Find Files"}, - { keys = "s", cmd = ":Telescope live_grep", desc = "Grep Files"}, - { keys = "b", cmd = ":Telescope buffers", desc = "List Buffers"}, - { keys = "e", cmd = ":NvimTreeToggle", desc = "Toggle File Explorer" }, -} + vim.cmd("write") -local leader_p = { -- leader p: Project -} + local success, err = os.rename(old_name, new_name) + if not success then + print("Error renaming file: " .. err) + return + end -local leader_b = { -- leader b: Buffer - { keys = "d", cmd = ":bdelete", desc = "Delete Buffer" }, - { keys = "h", cmd = ":bprevious", desc = "Previous Buffer" }, - { keys = "i", cmd = ":bnext", desc = "Next Buffer" }, - { keys = "H", cmd = ":bfirst", desc = "First Buffer" }, - { keys = "I", cmd = ":blast", desc = "Last Buffer" }, - { keys = "0", cmd = ":bfirst", desc = "First Buffer" }, - { keys = "^", cmd = ":bfirst", desc = "First Buffer" }, - { keys = "$", cmd = ":blast", desc = "Last Buffer" }, -} - -for _, map in ipairs(leader_q) do - map.keys = "q" .. map.keys - table.insert(M, map) + vim.cmd("edit " .. new_name) + vim.cmd("bdelete " .. old_name) end -for _, map in ipairs(leader_w) do - map.keys = "w" .. map.keys - table.insert(M, map) +-- 通用映射函数 +local function apply_mappings(maps, prefix) + for _, map in ipairs(maps) do + local new_map = { + keys = prefix .. map.keys, + cmd = map.cmd, + opts = map.opts, + } + table.insert(M, new_map) + end end +vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {}) -for _, map in ipairs(leader_f) do - map.keys = "f" .. map.keys - table.insert(M, map) -end +local leader_mappings = { + general = { + { keys = "", cmd = ":Telescope find_files", opts = { desc = "Find Files" } }, + { keys = "/", cmd = ":Telescope live_grep", opts = { desc = "Grep Files" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "\\", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "", cmd = "b#", opts = { desc = "Switch to last buffer" } }, + { keys = "!", cmd = ":FloatermToggle", opts = { desc = "" } }, + }, + b = { -- +buffer + { keys = "a", cmd = ":Alpha", opts = { desc = "Dashboard" } }, + { keys = "b", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, + { keys = "d", cmd = ":bdelete", opts = { desc = "Delete Buffer" } }, + { keys = "h", cmd = ":bprevious", opts = { desc = "Previous Buffer" } }, + { keys = "i", cmd = ":bnext", opts = { desc = "Next Buffer" } }, + { keys = "H", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "I", cmd = ":blast", opts = { desc = "Last Buffer" } }, + { keys = "0", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "^", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "$", cmd = ":blast", opts = { desc = "Last Buffer" } }, + -- { keys = "s", cmd = ":Telescope buffers", opts = { desc = "Search buffers" } }, + }, + c = { -- +code/compile + { keys = "r", cmd = ":RunCode", opts = { desc = "Run code" } }, + { keys = "e", cmd = ":Telescope diagnostics", opts = { desc = "Navigate errors/warnings" } }, + { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, + { keys = "s", cmd = ":Telescope treesitter", opts = { desc = "Search symbols" } }, + { keys = "S", cmd = ":Telescope grep_string", opts = { desc = "Search current symbol" } }, + }, + f = { -- +file/find + { keys = "f", cmd = ":Telescope fd", opts = { desc = "Find Files" } }, + { keys = "s", cmd = ":Telescope live_grep", opts = { desc = "Grep Files" } }, + { keys = "b", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, + { keys = "e", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, + { keys = "t", cmd = ":FloatermToggle", opts = { desc = "toggle visibility of the float terminal" } }, + { keys = "T", cmd = ":FloatermNew", opts = { desc = "Spawn a float terminal" } }, + { keys = "h", cmd = ":Telescope oldfiles", opts = { desc = "Search history files" } }, + { keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim", opts = { desc = "Search Config" } }, + { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, + { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, + }, + p = { -- +project + { keys = "p", cmd = ":Telescope projects", opts = { desc = "List all Projects" } }, + { keys = "g", cmd = ":Telescope projects", opts = { desc = "List all Git Projects" } }, + { keys = "s", cmd = ":Telescope session-lens", opts = { desc = "List all sessions" } }, + }, + q = { -- +quit + { keys = "q", cmd = ":q", opts = { desc = "Quit" } }, + { keys = "Q", cmd = ":qa!", opts = { desc = "Force Quit" } }, + { keys = "w", cmd = ":wq", opts = { desc = "Write and Quit" } }, + { keys = "W", cmd = ":wall:qa!", opts = { desc = "Write all and Force Quit" } }, + }, + t = { -- +toggle + { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, + { keys = "F", cmd = ":FormatToggle", opts = { desc = "Toggle autoformat-on-save" } }, + { keys = "t", cmd = ":FloatermToggle", opts = { desc = "toggle visibility of the float terminal" } }, + }, + u = { -- +ui + { keys = "i", cmd = ":Telescope colorscheme", opts = { desc = "Change colorscheme" } }, + }, + w = { -- +window + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "c", cmd = "c", opts = { desc = "Close Window" } }, + { keys = "o", cmd = "o", opts = { desc = "Close Other Windows" } }, + { keys = "r", cmd = "r", opts = { desc = "Rotate Windows" } }, + { keys = "R", cmd = "R", opts = { desc = "Reverse Rotate Windows" } }, + { keys = "t", cmd = "T", opts = { desc = "Move Window to New Tab" } }, + { keys = "H", cmd = ":vertical resize -5", opts = { desc = "Decrease Window Height" } }, + { keys = "N", cmd = ":resize +5", opts = { desc = "Increase Window Height" } }, + { keys = "E", cmd = ":vertical resize +5", opts = { desc = "Increase Window Width" } }, + { keys = "I", cmd = ":resize -5", opts = { desc = "Decrease Window Width" } }, + }, +} -for _, map in ipairs(leader_b) do - map.keys = "b" .. map.keys - table.insert(M, map) +for key, maps in pairs(leader_mappings) do + if key == "general" then + apply_mappings(maps, "") + else + apply_mappings(maps, "" .. key) + end end return M diff --git a/tools/nvim/lua/keymaps/lspkeys.lua b/tools/nvim/lua/keymaps/lspkeys.lua new file mode 100644 index 0000000..1682232 --- /dev/null +++ b/tools/nvim/lua/keymaps/lspkeys.lua @@ -0,0 +1,8 @@ +local M = { + { keys = "gd", cmd = vim.lsp.buf.definition, opts = { desc = "Goto Definition" } }, + { keys = "gD", cmd = vim.lsp.buf.declaration, opts = { desc = "Goto Declaration" } }, + { keys = "gr", cmd = vim.lsp.buf.references, opts = { desc = "Goto References" } }, + { keys = "gi", cmd = vim.lsp.buf.implementation, opts = { desc = "Goto Implementation" } }, +} + +return M diff --git a/tools/nvim/lua/keymaps/nvim-tree.lua b/tools/nvim/lua/keymaps/nvim-tree.lua index 2e8f57b..6d85c5c 100644 --- a/tools/nvim/lua/keymaps/nvim-tree.lua +++ b/tools/nvim/lua/keymaps/nvim-tree.lua @@ -1,80 +1,84 @@ local M = {} M.global = { - { mode = "n", keys = "e", cmd = ":NvimTreeToggle" }, + { mode = "n", keys = "E", cmd = ":NvimTreeToggle" }, + { mode = "n", keys = "", cmd = ":NvimTreeFocus" }, } function M.plugin(api, opts) -- mode is set to "n" by default, in `./lua/plugins/nvim-tree.lua` return { -- Toggle - { keys = "e", cmd = ":NvimTreeToggle", opts = opts("Toggle") }, + { keys = "e", cmd = ":NvimTreeToggle", opts = opts("Toggle") }, -- Arrow 箭头 hnei - { keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") }, - { keys = "i", cmd = api.node.open.edit, opts = opts("Open") }, - { keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") }, - { keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") }, - { keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") }, - { keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") }, + { keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") }, + { keys = "i", cmd = api.node.open.edit, opts = opts("Open") }, + { keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") }, + { keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") }, + { keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") }, + { keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") }, -- CONTROL KEYS 控制键 - { keys = "", cmd = api.node.navigate.parent_close, opts = opts("Close node") }, - { keys = "", cmd = api.node.open.edit, opts = opts("Open") }, - { keys = "", cmd = api.node.open.preview, opts = opts("Open Preview") }, + { keys = "", cmd = api.node.navigate.parent_close, opts = opts("Close node") }, + { keys = "", cmd = api.node.open.edit, opts = opts("Open") }, + { keys = "", cmd = api.node.open.preview, opts = opts("Open Preview") }, -- Alpha 字母键 - { keys = "a", cmd = api.fs.create, opts = opts("Create") }, - { keys = "A", cmd = api.fs.create, opts = opts("Create") }, - { keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") }, - { keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") }, - { keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") }, - { keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") }, - { keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") }, - { keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") }, - { keys = "d", cmd = api.fs.remove, opts = opts("Delete") }, - { keys = "D", cmd = api.fs.trash, opts = opts("Trash") }, - { keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") }, - { keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") }, - { keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") }, - { keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") }, - { keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") }, - { keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") }, - { keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") }, - { keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") }, - { keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") }, - { keys = "o", cmd = api.node.open.edit, opts = opts("Open") }, - { keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") }, - { keys = "p", cmd = api.fs.paste, opts = opts("Paste") }, - { keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") }, - { keys = "q", cmd = api.tree.close, opts = opts("Close") }, - { keys = "r", cmd = api.fs.rename, opts = opts("Rename") }, - { keys = "R", cmd = api.tree.reload, opts = opts("Refresh") }, - { keys = "s", cmd = api.node.run.system, opts = opts("Run System") }, - { keys = "S", cmd = api.tree.search_node, opts = opts("Search") }, - { keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") }, - { keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") }, - { keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") }, - { keys = "x", cmd = api.fs.cut, opts = opts("Cut") }, - { keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") }, - { keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") }, + { keys = "a", cmd = api.fs.create, opts = opts("Create") }, + { keys = "A", cmd = api.fs.create, opts = opts("Create") }, + { keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") }, + { keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") }, + { keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") }, + { keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") }, + { keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") }, + { keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") }, + { keys = "d", cmd = api.fs.remove, opts = opts("Delete") }, + { keys = "D", cmd = api.fs.trash, opts = opts("Trash") }, + { keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") }, + { keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") }, + { keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") }, + { keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") }, + { keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") }, + { keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") }, + { keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") }, + { keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") }, + { keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") }, + { keys = "o", cmd = api.node.open.edit, opts = opts("Open") }, + { keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") }, + { keys = "p", cmd = api.fs.paste, opts = opts("Paste") }, + { keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") }, + { keys = "q", cmd = api.tree.close, opts = opts("Close") }, + { keys = "r", cmd = api.fs.rename, opts = opts("Rename") }, + { keys = "R", cmd = api.tree.reload, opts = opts("Refresh") }, + { keys = "s", cmd = api.node.run.system, opts = opts("Run System") }, + { keys = "S", cmd = api.tree.search_node, opts = opts("Search") }, + { keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") }, + { keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") }, + { keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") }, + { keys = "x", cmd = api.fs.cut, opts = opts("Cut") }, + { keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") }, + { keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") }, + -- From Directory Opus + { keys = "#", cmd = "set relativenumber!", opts = opts("Toggle Relative Number") }, -- Numeric 数字键 - { keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") }, + { keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") }, -- Non-Alphanumeric 非字母数字键 - { keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") }, - { keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") }, - { keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") }, - { keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") }, - { keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") }, - { keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") }, + { keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") }, + { keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") }, + { keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") }, + { keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") }, + { keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") }, + { keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") }, -- MOD KEYS Ctrl+ - { keys = "", cmd = api.tree.change_root_to_node, opts = opts("CD") }, - { keys = "", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") }, - { keys = "", cmd = api.node.show_info_popup, opts = opts("Info") }, - { keys = "", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") }, - { keys = "", cmd = api.node.open.tab, opts = opts("Open: New Tab") }, - { keys = "", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") }, - { keys = "", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") }, + { keys = "", cmd = api.tree.change_root_to_node, opts = opts("CD") }, + { keys = "", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") }, + { keys = "", cmd = api.node.show_info_popup, opts = opts("Info") }, + { keys = "", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") }, + { keys = "", cmd = api.node.open.tab, opts = opts("Open: New Tab") }, + { keys = "", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") }, + { keys = "", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") }, + { keys = "", cmd = ":b#", opts = opts("Focus to previous buffer") }, -- Mouse 鼠标键 - { keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") }, - { keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") }, + { keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") }, + { keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") }, } end diff --git a/tools/nvim/lua/keymaps/user-command.lua b/tools/nvim/lua/keymaps/user-command.lua new file mode 100644 index 0000000..3395e44 --- /dev/null +++ b/tools/nvim/lua/keymaps/user-command.lua @@ -0,0 +1,30 @@ +vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + require("conform").format({ async = true, lsp_format = "fallback", range = range }) +end, { range = true }) + +vim.api.nvim_create_user_command("FormatToggle", function(args) + local buffer_local = args.bang + if buffer_local then + -- Toggle buffer-local formatting + vim.b.disable_autoformat = not vim.b.disable_autoformat + else + -- Toggle global formatting + vim.g.disable_autoformat = not vim.g.disable_autoformat + end + + -- Print current status + local scope = buffer_local and "buffer" or "global" + local status = buffer_local and vim.b.disable_autoformat or vim.g.disable_autoformat + print(string.format("Format-on-save %s: %s", scope, status and "disabled" or "enabled")) +end, { + desc = "Toggle autoformat-on-save (use ! for buffer-local)", + bang = true, +}) diff --git a/tools/nvim/lua/keymaps/utils.lua b/tools/nvim/lua/keymaps/utils.lua new file mode 100644 index 0000000..66bb98e --- /dev/null +++ b/tools/nvim/lua/keymaps/utils.lua @@ -0,0 +1,33 @@ +local M = {} +-- local mode_arrow = { "n", "v", "o", "s", "x" } + +local default_opts = { noremap = true, silent = true } +local default_mode = { "n" } + +M.set_keymaps = function(maps) + for _, map in ipairs(maps) do + local opts = vim.tbl_extend("force", default_opts, map.opts or {}) + local mode = map.mode or default_mode + vim.keymap.set(mode, map.keys, map.cmd, opts) + end +end + +M.set_lang_keymaps = function(maps) + vim.api.create_autocmd("FileType", { + pattern = maps.filetype, + callback = function() + M.set_keymaps(maps.keymaps) + end, + }) +end + +M.set_buf_keymaps = function(maps) + vim.api.create_autocmd("BufEnter", { + pattern = maps.filetype, + callback = function() + M.set_keymaps(maps.keymaps) + end, + }) +end + +return M diff --git a/tools/nvim/lua/keymaps/which.lua b/tools/nvim/lua/keymaps/which.lua new file mode 100644 index 0000000..742294a --- /dev/null +++ b/tools/nvim/lua/keymaps/which.lua @@ -0,0 +1,42 @@ +local wk = require("which-key") +wk.add({ + -- https://github.com/folke/which-key.nvim/tree/main?tab=readme-ov-file#%EF%B8%8F-mappings + { + -- Nested mappings are allowed and can be added in any order + -- Most attributes can be inherited or overridden on any level + -- There's no limit to the depth of nesting + mode = { "n" }, + { "b", group = "Buffer" }, -- no need to specify mode since it's inherited + { "c", group = "Code/Compile" }, + { "f", group = "File" }, + { "p", group = "Project", icon = "" }, + { "q", group = "Quit" }, + { "t", group = "Toggle" }, + { "u", group = "UI" }, + { "w", group = "Window" }, + }, + { -- https://github.com/folke/which-key.nvim/blob/1f8d414f61e0b05958c342df9b6a4c89ce268766/lua/which-key/plugins/presets.lua#L57-L98 + -- text objects + mode = { "o", "x" }, + { "l", group = "inside" }, + { 'l"', desc = 'inner " string' }, + { "l'", desc = "inner ' string" }, + { "l(", desc = "inner [(])" }, + { "l)", desc = "inner [(])" }, + { "l<", desc = "inner <>" }, + { "l>", desc = "inner <>" }, + { "lB", desc = "inner [{]}" }, + { "lW", desc = "inner WORD" }, + { "l[", desc = "inner []" }, + { "l]", desc = "inner []" }, + { "l`", desc = "inner ` string" }, + { "lb", desc = "inner [(])" }, + { "lp", desc = "inner paragraph" }, + { "ls", desc = "inner sentence" }, + { "lt", desc = "inner tag block" }, + { "lw", desc = "inner word" }, + { "l{", desc = "inner [{]}" }, + { "l}", desc = "inner [{]}" }, + { "i", desc = "Right" }, + }, +}) diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index f6c58b3..8557752 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -1,9 +1,11 @@ return { { "catppuccin/nvim", name = "catppuccin" }, + { "olimorris/onedarkpro.nvim" }, + { "rebelot/kanagawa.nvim" }, { "RRethy/vim-illuminate" }, { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("plugins.mod.lualine") end, @@ -18,9 +20,9 @@ return { timer = 500, }, }) - end + end, }, { import = "plugins.mod.alpha-nvim" }, - { import = "plugins.mod.winbar-nvim"}, + { import = "plugins.mod.winbar-nvim" }, { import = "plugins.mod.bufferline" }, } diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index f2d4577..b299de4 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -1,6 +1,55 @@ return { { import = "plugins.mod.auto-session" }, - { import = "plugins.mod.nvim-tree" }, - { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, - { import = "plugins.mod.projects" } + { import = "plugins.mod.nvim-tree" }, + { import = "plugins.mod.telescope" }, + { import = "plugins.mod.projects" }, + { + "lewis6991/hover.nvim", + config = function() + require("hover").setup({ + init = function() + -- Require providers + require("hover.providers.lsp") + -- require('hover.providers.gh') + -- require('hover.providers.gh_user') + -- require('hover.providers.jira') + -- require('hover.providers.dap') + -- require('hover.providers.fold_preview') + require("hover.providers.diagnostic") + -- require('hover.providers.man') + -- require('hover.providers.dictionary') + end, + preview_opts = { + border = "single", + }, + -- Whether the contents of a currently open hover window should be moved + -- to a :h preview-window when pressing the hover keymap. + preview_window = false, + title = true, + mouse_providers = { + "LSP", + }, + mouse_delay = 1000, + }) + + -- Setup keymaps + vim.keymap.set("n", "gE", require("hover").hover_select, { desc = "hover.nvim (select)" }) + vim.keymap.set("n", "", function() + require("hover").hover_switch("previous") + end, { desc = "hover.nvim (previous source)" }) + vim.keymap.set("n", "", function() + require("hover").hover_switch("next") + end, { desc = "hover.nvim (next source)" }) + + -- Mouse support + vim.keymap.set("n", "", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" }) + vim.o.mousemoveevent = true + end, + }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + end, + }, } diff --git a/tools/nvim/lua/plugins/init.lua b/tools/nvim/lua/plugins/init.lua index 866228d..89b5a13 100644 --- a/tools/nvim/lua/plugins/init.lua +++ b/tools/nvim/lua/plugins/init.lua @@ -1,26 +1,2 @@ -- Entry point of the plugin manager -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - - -require("lazy").setup({ - { import = "plugins.appearance" }, - { import = "plugins.completion" }, - { import = "plugins.fileutils" }, - { import = "plugins.lsp" }, - { import = "plugins.syntax" }, - { import = "plugins.misc" }, -}) +require("plugins.lazy-nvim") diff --git a/tools/nvim/lua/plugins/lazy-nvim.lua b/tools/nvim/lua/plugins/lazy-nvim.lua new file mode 100644 index 0000000..8dacc43 --- /dev/null +++ b/tools/nvim/lua/plugins/lazy-nvim.lua @@ -0,0 +1,39 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins.appearance" }, + { import = "plugins.completion" }, + { import = "plugins.fileutils" }, + { import = "plugins.lsp" }, + { import = "plugins.syntax" }, + { import = "plugins.misc" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 514a3c4..983cadf 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -1,17 +1,29 @@ - return { - { import = "plugins.mod.lspconfig" }, - { "MeanderingProgrammer/render-markdown.nvim" }, - -- { - -- "OXY2DEV/markview.nvim", - -- lazy = false, -- Recommended - -- -- ft = "markdown" -- If you decide to lazy-load anyway - -- - -- dependencies = { - -- "nvim-treesitter/nvim-treesitter", - -- "nvim-tree/nvim-web-devicons" - -- } - -- }, + { + "neovim/nvim-lspconfig", + lazy = false, + }, + { import = "plugins.mod.render-markdown" }, + -- { import = "plugins.mod.markview" }, + { + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_method = "sioyek" + end, + }, + { + "iurimateus/luasnip-latex-snippets.nvim", + -- vimtex isn't required if using treesitter + requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" }, + config = function() + require("luasnip-latex-snippets").setup() + -- or setup({ use_treesitter = true }) + require("luasnip").config.setup({ enable_autosnippets = true }) + end, + }, { "williamboman/mason.nvim", config = true }, { "williamboman/mason-lspconfig.nvim", @@ -27,6 +39,31 @@ return { mason_lspconfig.setup({ ensure_installed = servers, }) - end + end, + }, + { + "nvim-orgmode/orgmode", + event = "VeryLazy", + ft = { "org" }, + config = function() + -- Setup orgmode + require("orgmode").setup({ + org_agenda_files = "~/orgfiles/**/*", + org_default_notes_file = "~/orgfiles/refile.org", + }) + + -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option + -- add ~org~ to ignore_install + -- require('nvim-treesitter.configs').setup({ + -- ensure_installed = 'all', + -- ignore_install = { 'org' }, + -- }) + end, + }, + { import = "plugins.mod.conform-nvim" }, + { "nvim-treesitter/nvim-treesitter-context" }, + { + "NoahTheDuke/vim-just", + ft = { "just" }, }, } diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 15b2070..9a7bd8f 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,26 +1,15 @@ return { - { 'wakatime/vim-wakatime', lazy = false }, + { "wakatime/vim-wakatime", lazy = false }, + { "voldikss/vim-floaterm" }, + { "CRAG666/betterTerm.nvim", opts = { + position = "bot", + size = 15, + } }, + { "CRAG666/code_runner.nvim", config = true }, { import = "plugins.mod.obsidian-nvim" }, - { - "folke/which-key.nvim", - event = "VeryLazy", - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }, - keys = { - { - "?", - function() - require("which-key").show({ global = false }) - end, - desc = "Buffer Local Keymaps (which-key)", - }, - }, - }, + { import = "plugins.mod.which-keys-nvim" }, { "github/copilot.vim", lazy = false, - } + }, } diff --git a/tools/nvim/lua/plugins/mod/alpha-nvim.lua b/tools/nvim/lua/plugins/mod/alpha-nvim.lua index 3fe33dc..5db1a28 100644 --- a/tools/nvim/lua/plugins/mod/alpha-nvim.lua +++ b/tools/nvim/lua/plugins/mod/alpha-nvim.lua @@ -1,14 +1,14 @@ -- alpha-nvim.lua return { { - 'goolord/alpha-nvim', + "goolord/alpha-nvim", dependencies = { -- 'echasnovski/mini.icons', -- 'nvim-lua/plenary.nvim' }, - config = function () - local alpha = require'alpha' - local dashboard = require'alpha.themes.dashboard' + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") dashboard.section.header.val = { " ", "================= =============== =============== ======== ========", @@ -34,11 +34,11 @@ return { dashboard.section.buttons.val.leader = "SPC" dashboard.section.buttons.val = { -- leader = "SPC", - dashboard.button('p', '󰈞 查找项目', ':Telescope projects'), - dashboard.button('h', ' 历史文件', ':Telescope oldfiles'), - dashboard.button('l', ' 加载会话', ':SessionSearch'), - dashboard.button('c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim'), - dashboard.button('SPC q', '󱊷 退出', ':qa'), + dashboard.button("p", "󰈞 查找项目", ":Telescope projects"), + dashboard.button("h", " 历史文件", ":Telescope oldfiles"), + dashboard.button("l", " 加载会话", ":SessionSearch"), + dashboard.button("c", " 转到设置", ":Telescope find_files cwd=~/.config/nvim"), + dashboard.button("SPC q", "󱊷 退出", ":qa"), } dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " " @@ -47,6 +47,6 @@ return { -- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']] alpha.setup(dashboard.config) - end - }; + end, + }, } diff --git a/tools/nvim/lua/plugins/mod/auto-session.lua b/tools/nvim/lua/plugins/mod/auto-session.lua index 80ab9f7..829f1c5 100644 --- a/tools/nvim/lua/plugins/mod/auto-session.lua +++ b/tools/nvim/lua/plugins/mod/auto-session.lua @@ -1,15 +1,15 @@ ---@diagnostic disable: undefined-doc-name return { { - 'rmagatti/auto-session', + "rmagatti/auto-session", lazy = false, ---enables autocomplete for opts ---@module "auto-session" ---@type AutoSession.Config opts = { - suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, -- log_level = 'debug', - } - } + }, + }, } diff --git a/tools/nvim/lua/plugins/mod/bufferline.lua b/tools/nvim/lua/plugins/mod/bufferline.lua index e389de8..c02f345 100644 --- a/tools/nvim/lua/plugins/mod/bufferline.lua +++ b/tools/nvim/lua/plugins/mod/bufferline.lua @@ -1,17 +1,17 @@ return { - "akinsho/bufferline.nvim", - dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 - config = function() - require("bufferline").setup({ - options = { - numbers = "ordinal", -- 显示 buffer 序号 - close_command = "bdelete! %d", -- 关闭 buffer 的命令 - right_mouse_command = "bdelete! %d", -- 右键关闭 - offsets = { - { filetype = "NvimTree", text = "资源管理器", text_align = "center" }, - }, - separator_style = "thin", - }, - }) - end, + "akinsho/bufferline.nvim", + dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 + config = function() + require("bufferline").setup({ + options = { + numbers = "ordinal", -- 显示 buffer 序号 + close_command = "bdelete! %d", -- 关闭 buffer 的命令 + right_mouse_command = "bdelete! %d", -- 右键关闭 + offsets = { + { filetype = "NvimTree", text = "资源管理器", text_align = "center" }, + }, + separator_style = "thin", + }, + }) + end, } diff --git a/tools/nvim/lua/plugins/mod/conform-nvim.lua b/tools/nvim/lua/plugins/mod/conform-nvim.lua new file mode 100644 index 0000000..159f80a --- /dev/null +++ b/tools/nvim/lua/plugins/mod/conform-nvim.lua @@ -0,0 +1,38 @@ +return { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + opts = { + -- Define your formatters + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "black" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + -- Set default options + default_format_opts = { + lsp_format = "fallback", + }, + -- Set up format-on-save + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_format = "fallback" } + end, + -- Customize formatters + formatters = { + shfmt = { + prepend_args = { "-i", "2" }, + }, + }, + }, + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, +} diff --git a/tools/nvim/lua/plugins/mod/lspconfig.lua b/tools/nvim/lua/plugins/mod/lspconfig.lua index a190a7c..3d657d0 100644 --- a/tools/nvim/lua/plugins/mod/lspconfig.lua +++ b/tools/nvim/lua/plugins/mod/lspconfig.lua @@ -1,4 +1,4 @@ return { "neovim/nvim-lspconfig", - lazy = false + lazy = false, } diff --git a/tools/nvim/lua/plugins/mod/lualine.lua b/tools/nvim/lua/plugins/mod/lualine.lua index 5cddc86..56af922 100644 --- a/tools/nvim/lua/plugins/mod/lualine.lua +++ b/tools/nvim/lua/plugins/mod/lualine.lua @@ -1,6 +1,6 @@ -- Author: shadmansaleh -- Credit: glepnir -local lualine = require('lualine') +local lualine = require("lualine") -- Color table for highlights -- stylua: ignore @@ -20,14 +20,14 @@ local colors = { local conditions = { buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") return gitdir and #gitdir > 0 and #gitdir < #filepath end, } @@ -36,11 +36,11 @@ local conditions = { local config = { options = { disabled_filetypes = { - statusline = { "NvimTree", "alpha" } + statusline = { "NvimTree", "alpha" }, }, -- Disable sections and component separators - component_separators = '', - section_separators = '', + component_separators = "", + section_separators = "", theme = { -- We are going to use lualine_c an lualine_x as left and -- right section. Both are highlighted by c theme . So we @@ -80,18 +80,18 @@ local function ins_right(component) table.insert(config.sections.lualine_x, component) end -ins_left { +ins_left({ function() - return '▊' + return "▊" end, color = { fg = colors.blue }, -- Sets highlighting of component padding = { left = 0, right = 1 }, -- We don't need space before this -} +}) -ins_left { +ins_left({ -- mode component function() - return '' + return "" end, color = function() -- auto change color according to neovims mode @@ -99,13 +99,13 @@ ins_left { n = colors.red, i = colors.green, v = colors.blue, - [''] = colors.blue, + [""] = colors.blue, V = colors.blue, c = colors.magenta, no = colors.red, s = colors.orange, S = colors.orange, - [''] = colors.orange, + [""] = colors.orange, ic = colors.yellow, R = colors.violet, Rv = colors.violet, @@ -113,14 +113,14 @@ ins_left { ce = colors.red, r = colors.cyan, rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, + ["r?"] = colors.cyan, + ["!"] = colors.red, t = colors.red, } return { fg = mode_color[vim.fn.mode()] } end, padding = { right = 1 }, -} +}) -- ins_left { -- -- filesize component @@ -134,42 +134,39 @@ ins_left { -- color = { fg = colors.magenta, gui = 'bold' }, -- } - -- ins_left { 'location' } -ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } } +ins_right({ "progress", color = { fg = colors.fg, gui = "bold" } }) -ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, +ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, diagnostics_color = { error = { fg = colors.red }, warn = { fg = colors.yellow }, info = { fg = colors.cyan }, }, -} +}) -ins_left { +ins_left({ function() return vim.bo.filetype end, - color = { fg = colors.blue, gui = 'bold' }, -} + color = { fg = colors.blue, gui = "bold" }, +}) -ins_left { +ins_left({ function() return vim.bo.shiftwidth .. " space" end, -} +}) - - -ins_left { +ins_left({ -- Lsp server name . function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) + local msg = "No Active Lsp" + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) local clients = vim.lsp.get_clients() if next(clients) == nil then return msg @@ -182,59 +179,58 @@ ins_left { end return msg end, - icon = ' ', - color = { fg = '#ffffff', gui = 'bold' }, -} + icon = " ", + color = { fg = "#ffffff", gui = "bold" }, +}) -- Insert mid section. You can make any number of sections in neovim :) -- for lualine it's any number greater then 2 -ins_left { +ins_left({ function() - return '%=' + return "%=" end, -} +}) -- Add components to right sections -ins_right { - 'o:encoding', -- option component same as &encoding in viml +ins_right({ + "o:encoding", -- option component same as &encoding in viml fmt = string.upper, -- I'm not sure why it's upper case either ;) cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, -} + color = { fg = colors.green, gui = "bold" }, +}) -ins_right { - 'fileformat', +ins_right({ + "fileformat", fmt = string.upper, icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - color = { fg = colors.green, gui = 'bold' }, -} + color = { fg = colors.green, gui = "bold" }, +}) -ins_right { - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, -} +ins_right({ + "branch", + icon = "", + color = { fg = colors.violet, gui = "bold" }, +}) - -ins_right { - 'diff', +ins_right({ + "diff", -- Is it me or the symbol for modified us really weird - symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, + symbols = { added = " ", modified = "󰝤 ", removed = " " }, diff_color = { added = { fg = colors.green }, modified = { fg = colors.orange }, removed = { fg = colors.red }, }, cond = conditions.hide_in_width, -} +}) -ins_right { +ins_right({ function() - return '▊' + return "▊" end, color = { fg = colors.blue }, padding = { left = 1 }, -} +}) -- Now don't forget to initialize lualine lualine.setup(config) diff --git a/tools/nvim/lua/plugins/mod/markview.lua b/tools/nvim/lua/plugins/mod/markview.lua new file mode 100644 index 0000000..f4a097f --- /dev/null +++ b/tools/nvim/lua/plugins/mod/markview.lua @@ -0,0 +1,30 @@ +return { + { + "OXY2DEV/markview.nvim", + lazy = false, + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, + config = function() + local presets = require("markview.presets") + require("markview").setup({ + checkboxes = presets.checkboxes.nerd, + headings = { + enable = true, + shift_width = 1, + heading_1 = { + style = "label", + hl = "MarkviewH1", + }, + }, + code_blocks = { + style = "language", + language_direction = "right", + hl = "MarkviewCode", + info_hl = "MarkviewCodeInfo", + }, + }) + end, + }, +} diff --git a/tools/nvim/lua/plugins/mod/nvim-cmp.lua b/tools/nvim/lua/plugins/mod/nvim-cmp.lua index 100697b..165da17 100644 --- a/tools/nvim/lua/plugins/mod/nvim-cmp.lua +++ b/tools/nvim/lua/plugins/mod/nvim-cmp.lua @@ -1,9 +1,9 @@ local function set_keymaps(keymaps_cmp) local mappings = {} - for _, map in ipairs(keymaps_cmp) do - mappings[map.keys] = map.cmd - end - return mappings + for _, map in ipairs(keymaps_cmp) do + mappings[map.keys] = map.cmd + end + return mappings end return { diff --git a/tools/nvim/lua/plugins/mod/nvim-tree.lua b/tools/nvim/lua/plugins/mod/nvim-tree.lua index 32c312c..66091d9 100644 --- a/tools/nvim/lua/plugins/mod/nvim-tree.lua +++ b/tools/nvim/lua/plugins/mod/nvim-tree.lua @@ -1,6 +1,6 @@ local function my_on_attach(bufnr) -- local keymaps = require("config.keymaps") - local api = require "nvim-tree.api" + local api = require("nvim-tree.api") local default_mode = { "n" } local keymaps = require("keymaps") @@ -8,7 +8,6 @@ local function my_on_attach(bufnr) return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } end - local function set_keymaps(maps) for _, map in ipairs(maps) do local mode = map.mode or default_mode @@ -28,10 +27,26 @@ return { "nvim-tree/nvim-web-devicons", }, config = function() - require("nvim-tree").setup { + require("nvim-tree").setup({ on_attach = my_on_attach, sync_root_with_cwd = true, respect_buf_cwd = true, - } - end + disable_netrw = true, + renderer = { + icons = { + glyphs = { + git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29 + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + }, + }, + }, + }, + }) + end, } diff --git a/tools/nvim/lua/plugins/mod/nvim-treesitter.lua b/tools/nvim/lua/plugins/mod/nvim-treesitter.lua index 2a627f3..ca5ba90 100644 --- a/tools/nvim/lua/plugins/mod/nvim-treesitter.lua +++ b/tools/nvim/lua/plugins/mod/nvim-treesitter.lua @@ -1,11 +1,11 @@ return { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { "markdown", "markdown_inline" }, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "markdown", "markdown_inline", "latex", "python" }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, } diff --git a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua index 48ed3a7..600e3b2 100644 --- a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua +++ b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua @@ -1,6 +1,6 @@ return { "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit + version = "*", -- recommended, use latest release instead of latest commit lazy = false, ft = "markdown", -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: @@ -26,8 +26,11 @@ return { }, completion = { nvim_cmp = true, - min_chars = 2 - } + min_chars = 2, + }, + ui = { + enable = false, + }, -- see below for full list of options 👇 }, } diff --git a/tools/nvim/lua/plugins/mod/projects.lua b/tools/nvim/lua/plugins/mod/projects.lua index 9135b33..d8b66e0 100644 --- a/tools/nvim/lua/plugins/mod/projects.lua +++ b/tools/nvim/lua/plugins/mod/projects.lua @@ -1,15 +1,15 @@ return { - "ahmedkhalf/project.nvim", - config = function() - require("project_nvim").setup({ - detection_methods = { "lsp", "pattern" }, - patterns = { ".git", "Makefile", "package.json" }, - sync_root_with_cwd = true, - silent_chdir = true, - scope_chdir = "global", - }) + "ahmedkhalf/project.nvim", + config = function() + require("project_nvim").setup({ + detection_methods = { "lsp", "pattern" }, + patterns = { ".git", "Makefile", "package.json" }, + sync_root_with_cwd = true, + silent_chdir = true, + scope_chdir = "global", + }) - require("telescope").load_extension("projects") - end, - dependencies = { "nvim-telescope/telescope.nvim" }, + require("telescope").load_extension("projects") + end, + dependencies = { "nvim-telescope/telescope.nvim" }, } diff --git a/tools/nvim/lua/plugins/mod/render-markdown.lua b/tools/nvim/lua/plugins/mod/render-markdown.lua new file mode 100644 index 0000000..8f6f15a --- /dev/null +++ b/tools/nvim/lua/plugins/mod/render-markdown.lua @@ -0,0 +1,74 @@ +return { + { + "MeanderingProgrammer/render-markdown.nvim", + lazy = false, + config = function() + require("render-markdown").setup({ + render_modes = { "n", "c", "t" }, + latex = { + enabled = true, + converter = "latex2text", + highlight = "RenderMarkdownMath", + top_pad = 0, + bottom_pad = 0, + }, + heading = { + sign = false, + position = "inline", + width = "block", + left_margin = 0.5, + left_pad = 0.2, + right_pad = 0.2, + }, + link = { + custom = { + python = { pattern = "%.py", icon = " " }, + lua = { pattern = "%.lua", icon = " " }, + markdown = { pattern = "%.md", icon = " " }, + }, + }, + bullet = { + icons = { "󰮯 ", "●", "○", "◆", "◇" }, + }, + checkbox = { + checked = { scope_highlight = "@markup.strikethrough" }, + unchecked = { scope_highlight = "@comment.todo" }, + }, + code = { + position = "right", + width = "block", + right_pad = 10, + }, + callout = { + note = { raw = "[!NOTE]", rendered = "󰋽 Note", highlight = "RenderMarkdownInfo" }, + tip = { raw = "[!TIP]", rendered = "󰌶 Tip", highlight = "RenderMarkdownSuccess" }, + important = { raw = "[!IMPORTANT]", rendered = "󰅾 Important", highlight = "RenderMarkdownHint" }, + warning = { raw = "[!WARNING]", rendered = "󰀪 Warning", highlight = "RenderMarkdownWarn" }, + caution = { raw = "[!CAUTION]", rendered = "󰳦 Caution", highlight = "RenderMarkdownError" }, + abstract = { raw = "[!ABSTRACT]", rendered = "󰨸 Abstract", highlight = "RenderMarkdownInfo" }, + summary = { raw = "[!SUMMARY]", rendered = "󰨸 Summary", highlight = "RenderMarkdownInfo" }, + tldr = { raw = "[!TLDR]", rendered = "󰨸 Tldr", highlight = "RenderMarkdownInfo" }, + info = { raw = "[!INFO]", rendered = "󰋽 Info", highlight = "RenderMarkdownInfo" }, + todo = { raw = "[!TODO]", rendered = "󰗡 Todo", highlight = "RenderMarkdownInfo" }, + hint = { raw = "[!HINT]", rendered = "󰌶 Hint", highlight = "RenderMarkdownSuccess" }, + success = { raw = "[!SUCCESS]", rendered = "󰄬 Success", highlight = "RenderMarkdownSuccess" }, + check = { raw = "[!CHECK]", rendered = "󰄬 Check", highlight = "RenderMarkdownSuccess" }, + done = { raw = "[!DONE]", rendered = "󰄬 Done", highlight = "RenderMarkdownSuccess" }, + question = { raw = "[!QUESTION]", rendered = "󰘥 Question", highlight = "RenderMarkdownWarn" }, + help = { raw = "[!HELP]", rendered = "󰘥 Help", highlight = "RenderMarkdownWarn" }, + faq = { raw = "[!FAQ]", rendered = "󰘥 Faq", highlight = "RenderMarkdownWarn" }, + attention = { raw = "[!ATTENTION]", rendered = "󰀪 Attention", highlight = "RenderMarkdownWarn" }, + failure = { raw = "[!FAILURE]", rendered = "󰅖 Failure", highlight = "RenderMarkdownError" }, + fail = { raw = "[!FAIL]", rendered = "󰅖 Fail", highlight = "RenderMarkdownError" }, + missing = { raw = "[!MISSING]", rendered = "󰅖 Missing", highlight = "RenderMarkdownError" }, + danger = { raw = "[!DANGER]", rendered = "󱐌 Danger", highlight = "RenderMarkdownError" }, + error = { raw = "[!ERROR]", rendered = "󱐌 Error", highlight = "RenderMarkdownError" }, + bug = { raw = "[!BUG]", rendered = "󰨰 Bug", highlight = "RenderMarkdownError" }, + example = { raw = "[!EXAMPLE]", rendered = "󰉹 Example", highlight = "RenderMarkdownHint" }, + quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" }, + cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" }, + }, + }) + end, + }, +} diff --git a/tools/nvim/lua/plugins/mod/telescope.lua b/tools/nvim/lua/plugins/mod/telescope.lua new file mode 100644 index 0000000..108395a --- /dev/null +++ b/tools/nvim/lua/plugins/mod/telescope.lua @@ -0,0 +1,32 @@ +return { + "nvim-telescope/telescope.nvim", + config = function() + require("telescope").setup({ + defaults = { + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua + horizontal = { + prompt_position = "top", + preview_width = 0.55, + }, + width = 0.87, + height = 0.80, + }, + mappings = { + n = { + ["n"] = "move_selection_next", + ["e"] = "move_selection_previous", + ["w"] = "preview_scrolling_up", + ["r"] = "preview_scrolling_down", + ["a"] = "preview_scrolling_left", + ["s"] = "preview_scrolling_right", + ["q"] = require("telescope.actions").close, + }, + }, + }, + }) + end, + dependencies = { "nvim-lua/plenary.nvim" }, +} diff --git a/tools/nvim/lua/plugins/mod/which-keys-nvim.lua b/tools/nvim/lua/plugins/mod/which-keys-nvim.lua new file mode 100644 index 0000000..eb228f6 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/which-keys-nvim.lua @@ -0,0 +1,18 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/tools/nvim/lua/plugins/mod/winbar-nvim.lua b/tools/nvim/lua/plugins/mod/winbar-nvim.lua index ca27161..496ce0c 100644 --- a/tools/nvim/lua/plugins/mod/winbar-nvim.lua +++ b/tools/nvim/lua/plugins/mod/winbar-nvim.lua @@ -7,33 +7,32 @@ return { show_file_path = true, show_symbols = true, colors = { - path = '#9c1d91', - file_name = '', - symbols = '', + path = "#9c1d91", + file_name = "", + symbols = "", }, icons = { - file_icon_default = '', - seperator = '>', - editor_state = '●', - lock_icon = '', + file_icon_default = "", + seperator = ">", + editor_state = "●", + lock_icon = "", }, exclude_filetype = { - 'help', - 'startify', - 'dashboard', - 'packer', - 'neogitstatus', - 'NvimTree', - 'Trouble', - 'alpha', - 'lir', - 'Outline', - 'spectre_panel', - 'toggleterm', - 'qf', - } + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", + "alpha", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "qf", + }, }) end, }, } - diff --git a/tools/nvim/lua/plugins/syntax.lua b/tools/nvim/lua/plugins/syntax.lua index f32cff2..eea5c64 100644 --- a/tools/nvim/lua/plugins/syntax.lua +++ b/tools/nvim/lua/plugins/syntax.lua @@ -1,9 +1,10 @@ return { - { import = "plugins.mod.nvim-treesitter", }, - { 'echasnovski/mini.pairs', version = false, + { import = "plugins.mod.nvim-treesitter" }, + { + "echasnovski/mini.pairs", + version = false, config = function() require("mini.pairs").setup() end, }, } - diff --git a/tools/nvim/playground.txt b/tools/nvim/playground.txt new file mode 100644 index 0000000..c855ece --- /dev/null +++ b/tools/nvim/playground.txt @@ -0,0 +1,4 @@ +((( +This is a playground file. +{(1 + 2) * 3} +))) diff --git a/tools/powershell/Aliases.ps1 b/tools/powershell/Aliases.ps1 index 35986f6..367eced 100644 --- a/tools/powershell/Aliases.ps1 +++ b/tools/powershell/Aliases.ps1 @@ -31,5 +31,6 @@ Set-Alias "py" "python" Set-Alias "ipy" "ipython" if ($isWindows) { -function kex { wsl -d kali-linux kex --sl -s } + # Debugging + # function kex { wsl -d kali-linux kex --sl -s } } diff --git a/tools/powershell/Completions.ps1 b/tools/powershell/Completions.ps1 new file mode 100644 index 0000000..9dd8cb7 --- /dev/null +++ b/tools/powershell/Completions.ps1 @@ -0,0 +1,42 @@ +function Invoke-Completion { + param ([string]$command) + switch ($command) { + 'docker' { docker completion powershell | Out-String | Invoke-Expression } + 'dotnet' { + # https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell + Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + dotnet complete --position $cursorPosition "$commandAst" | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } + } + 'git' { Import-Module Posh-Git } + 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } + 'pip' { pip completion --powershell | Out-String | Invoke-Expression } + 'rg' { rg --generate complete-powershell | Out-String | Invoke-Expression } + 'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression } + 'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression } + 'winget' { + # https://learn.microsoft.com/en-us/windows/package-manager/winget/tab-completion + Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() + $Local:word = $wordToComplete.Replace('"', '""') + $Local:ast = $commandAst.ToString().Replace('"', '""') + winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } + } + } +} +Set-Alias "icmp" "Invoke-Completion" + +Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock { + param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) + + $cmds = @('docker', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget') + + $cmds | Where-Object { $_ -like "$wordToComplete*" } +} diff --git a/tools/powershell/Config.ps1 b/tools/powershell/Config.ps1 index e7cb656..431131c 100644 --- a/tools/powershell/Config.ps1 +++ b/tools/powershell/Config.ps1 @@ -1,7 +1,8 @@ -# Use XDG Base Directory Specification and its similar structure for Windows -# wget -${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} - -# yarn v1 -${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} +if ($Env:WEZTERM) { + # Environment variable injected by wezterm/wezterm.lua + ${function:icat} = { wezterm imgcat $args } +} +elseif ($Env:KITTY) { + ${function:icat} = { kitty +kitten icat $args } +} diff --git a/tools/powershell/Keymap.ps1 b/tools/powershell/Keymap.ps1 index ca110f3..41e78f8 100644 --- a/tools/powershell/Keymap.ps1 +++ b/tools/powershell/Keymap.ps1 @@ -23,6 +23,9 @@ Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory +Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory ## Use to Invoke MenuComplete Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete diff --git a/tools/powershell/Modules.ps1 b/tools/powershell/Modules.ps1 index 0137d59..8236f40 100644 --- a/tools/powershell/Modules.ps1 +++ b/tools/powershell/Modules.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name Terminal-Icons +# Import-Module -Name Terminal-Icons Import-Module -Name CompletionPredictor if ($IsWindows) { # Chocolatey diff --git a/tools/powershell/Prompt.ps1 b/tools/powershell/Prompt.ps1 index 9f43a8a..0fe1e0a 100644 --- a/tools/powershell/Prompt.ps1 +++ b/tools/powershell/Prompt.ps1 @@ -4,92 +4,4 @@ # Use starship to set prompt $ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml" -# Invoke-Expression (&starship init powershell) - -# Below is the backup of original prompt function -# $promptTime = $true -# # $promptWeather = $false - -# function prompt { -# $prompt = "`e[35m" -# # Time -# if ($promptTime) { -# $promptTime = Get-Date -Format HH:mm -# $prompt += "`[$promptTime]" -# } -# # UserInfo -# $prompt += " $Env:Username @ $Env:Userdomain" -# # Directory -# $promptCurrentDirectory = $(PWD).Path -# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~") -# $prompt += "`e[0m in `e[33m$promptCurrentDirectory " -# # Git -# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") { -# $prompt += "`e[32m`u{e702} $(git branch --show-current)" -# } -# # Conda -# if ( $Env:CONDA_PROMPT_MODIFIER ) { -# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","") -# $pythonVersion = $(python --version).Split(" ")[1] -# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion" -# } -# # Programming Language (by Get-ChildItem) -# ## Python -# if (Test-Path -Path "$PWD\pyproject.toml") { -# $pythonVersion = $(python --version).Split(" ")[1] -# $prompt += " `e[33m`u{e73c} $pythonVersion" -# } -# ## Node.js -# if (Test-Path -Path "$PWD\package.json") { -# $nodeVersion = $(node --version) -# $prompt += " `e[32m`u{e3a0} $nodeVersion" -# # Locked -# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") { -# $prompt += "`u{f023}" -# } -# } -# ## .NET -# ### C Sharp -# if (Test-Path -Path "$PWD\*.csproj") { -# $dotnetVersion = $(dotnet --version) -# $prompt += " `e[34m`u{e648} $dotnetVersion" -# } -# ### F Sharp -# if (Test-Path -Path "$PWD\*.fsproj") { -# $dotnetVersion = $(dotnet --version) -# $prompt += " `e[35m`u{e65a} $dotnetVersion" -# } -# ## Rust -# if (Test-Path -Path "$PWD\Cargo.toml") { -# $rustVersion = $(cargo --version).Split(" ")[1] -# $prompt += " `e[31m`u{e7a8} $rustVersion" -# } -# ## Java -# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") { -# $javaVersion = $(java --version).Split(" ")[1] -# $prompt += " `e[31m`u{e738} $javaVersion" -# } -# ## Makefile -# if (Test-Path -Path "$PWD\Makefile") { -# $prompt += " `e[32m`u{e673}" -# } -# if (Test-Path -Path "$PWD\CMakeLists.txt") { -# $prompt += " `e[32m `u{e61d}" -# } -# # Docker -# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") { -# $prompt += " `e[33m`u{f21f}" -# } -# # Weather -# # if ( $global:promptWeather ) { -# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY) -# # } -# # Error on last command -# ## TODO: Seems does not work -# if ($?) { -# $prompt += "`n`e[32m PS > `e[0m" -# } else { -# $prompt += "`n`e[31m PS > `e[0m" -# } -# return $prompt -# } +Invoke-Expression (&starship init powershell) diff --git a/tools/powershell/readme.md b/tools/powershell/readme.md index 7cd9a86..db44094 100644 --- a/tools/powershell/readme.md +++ b/tools/powershell/readme.md @@ -20,3 +20,20 @@ This is the cross-platform PowerShell profile for PowerShell Core | `^a` | To Beginning of Line | All | | `^e` | To End of Line | All | | `^[` | To Normal Mode | Insert | + +## `Get-Command` vs `which.exe` under Windows + +```powershell +PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10 +Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which' + Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms] + Range (min … max): 150.0 ms … 155.3 ms 18 runs + +Benchmark 2: pwsh.exe -NoProfile -Command 'which which' + Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms] + Range (min … max): 147.8 ms … 169.5 ms 19 runs + +Summary + pwsh.exe -NoProfile -Command 'Get-Command which' ran + 1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which' +``` diff --git a/tools/starship/starship.toml b/tools/starship/starship.toml deleted file mode 100644 index b88e5f7..0000000 --- a/tools/starship/starship.toml +++ /dev/null @@ -1,202 +0,0 @@ -# starship.toml -# ~/.config/starship.toml -format = '''$os$time $username @ $hostname $directory $all$character''' - -add_newline = true - -[time] -disabled = false -format = '[\[$time\]](purple)' -time_format = '%H:%M' - -[username] -format = '[$user](bold)' -show_always = true - -[hostname] -ssh_only = false -ssh_symbol = '󰞉 ' - -[directory] -truncation_length = 2 -truncate_to_repo = true -read_only = " 󰌾" -style ="bold cyan" -truncation_symbol = ".../" - -[directory.substitutions] -"~/Documents" = "󰈙 " -"~/Downloads" = " " -"~/Music" = " " -"~/Pictures" = " " -"Source" = " " -"src" = " " - -[aws] -symbol = " " - -[buf] -symbol = " " - -[c] -symbol = " " - -[conda] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - - -[docker_context] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[fennel] -symbol = " " - -[fossil_branch] -symbol = " " - -[git_branch] -symbol = " " - -[git_commit] -tag_symbol = '  ' - -[golang] -symbol = " " - -[guix_shell] -symbol = " " - -[haskell] -symbol = " " - -[haxe] -symbol = " " - -[hg_branch] -symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[kotlin] -symbol = " " - -[lua] -symbol = " " - -[memory_usage] -symbol = "󰍛 " - -[meson] -symbol = "󰔷 " - -[nim] -symbol = "󰆥 " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[os] -disabled = false - -[os.symbols] -Alpaquita = " " -Alpine = " " -AlmaLinux = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -DragonFly = " " -Emscripten = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Garuda = "󰛓 " -Gentoo = " " -HardenedBSD = "󰞌 " -Illumos = "󰈸 " -Kali = " " -Linux = " " -Mabox = " " -Macos = " " -Manjaro = " " -Mariner = " " -MidnightBSD = " " -Mint = " " -NetBSD = " " -NixOS = " " -OpenBSD = "󰈺 " -openSUSE = " " -OracleLinux = "󰌷 " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -RockyLinux = " " -Redox = "󰀘 " -Solus = "󰠳 " -SUSE = " " -Ubuntu = " " -Unknown = " " -Void = " " -Windows = "󰍲 " - -[package] -symbol = "󰏗 " - -[perl] -symbol = " " - -[php] -symbol = " " - -[pijul_channel] -symbol = " " - -[python] -symbol = " " - -[rlang] -symbol = "󰟔 " - -[ruby] -symbol = " " - -[rust] -symbol = "󱘗 " - -[scala] -symbol = " " - -[swift] -symbol = " " - -[zig] -symbol = " " - -[gradle] -symbol = " " diff --git a/tools/starship/starship_fish.toml b/tools/starship/starship_fish.toml index fb8f6f1..983acba 100644 --- a/tools/starship/starship_fish.toml +++ b/tools/starship/starship_fish.toml @@ -1,208 +1,144 @@ -# starship.toml -# ~/.config/starship.toml -format = '''$os$time $username @ $hostname $directory $all$character''' -continuation_prompt = "[r % ](bold cyan) " # Doesn't work in fish +format = """ +[](#9A348E)\ +$os\ +$username\ +[](bg:#DA627D fg:#9A348E)\ +$directory\ +[](fg:#DA627D bg:#FCA17D)\ +$git_branch\ +$git_status\ +[](fg:#FCA17D bg:#86BBD8)\ +$c\ +$elixir\ +$elm\ +$golang\ +$gradle\ +$haskell\ +$java\ +$julia\ +$nodejs\ +$nim\ +$rust\ +$scala\ +[](fg:#86BBD8 bg:#06969A)\ +$docker_context\ +[](fg:#06969A bg:#33658A)\ +$time\ +[ ](fg:#33658A)\ +""" -add_newline = true - -[time] -disabled = false -format = '[\[$time\]](purple)' -time_format = '%H:%M' +# Disable the blank line at the start of the prompt +# add_newline = false +# You can also replace your username with a neat symbol like  or disable this +# and use the os module below [username] -format = '[$user](bold)' show_always = true +style_user = "bg:#9A348E" +style_root = "bg:#9A348E" +format = '[$user ]($style)' +disabled = false -[hostname] -ssh_only = false -ssh_symbol = '󰞉 ' - -[character] -success_symbol = "[󰈺 >](bold green)" -error_symbol = "[󰈺 >](bold red)" -vimcmd_symbol = "[ <](bold green)" +# An alternative to the username module which displays a symbol that +# represents the current operating system +[os] +style = "bg:#9A348E" +disabled = true # Disabled by default [directory] -truncation_length = 2 -truncate_to_repo = true -read_only = " 󰌾" -style = "bold cyan" -truncation_symbol = ".../" +style = "bg:#DA627D" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" +# Here is how you can shorten some long paths by text replacement +# similar to mapped_locations in Oh My Posh: [directory.substitutions] -"~/Documents" = "󰈙 " -"~/Downloads" = " " -"~/Music" = " " -"~/Pictures" = " " -"Source" = " " -"src" = " " - -[aws] -symbol = " " - -[buf] -symbol = " " +"Documents" = "󰈙 " +"Downloads" = " " +"Music" = " " +"Pictures" = " " +# Keep in mind that the order matters. For example: +# "Important Documents" = " 󰈙 " +# will not be replaced, because "Documents" was already substituted before. +# So either put "Important Documents" before "Documents" or use the substituted version: +# "Important 󰈙 " = " 󰈙 " [c] symbol = " " - -[conda] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [docker_context] symbol = " " +style = "bg:#06969A" +format = '[ $symbol $context ]($style)' [elixir] -symbol = " " +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [elm] symbol = " " - -[fennel] -symbol = " " - -[fossil_branch] -symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [git_branch] -symbol = " " +symbol = "" +style = "bg:#FCA17D" +format = '[ $symbol $branch ]($style)' -[git_commit] -tag_symbol = '  ' +[git_status] +style = "bg:#FCA17D" +format = '[$all_status$ahead_behind ]($style)' [golang] symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' -[guix_shell] -symbol = " " +[gradle] +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [haskell] symbol = " " - -[haxe] -symbol = " " - -[hg_branch] -symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [java] symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [julia] symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' -[kotlin] -symbol = " " - -[lua] -symbol = " " - -[memory_usage] -symbol = "󰍛 " - -[meson] -symbol = "󰔷 " +[nodejs] +symbol = "" +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [nim] symbol = "󰆥 " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[os] -disabled = false - -[os.symbols] -Alpaquita = " " -Alpine = " " -AlmaLinux = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -DragonFly = " " -Emscripten = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Garuda = "󰛓 " -Gentoo = " " -HardenedBSD = "󰞌 " -Illumos = "󰈸 " -Kali = " " -Linux = " " -Mabox = " " -Macos = " " -Manjaro = " " -Mariner = " " -MidnightBSD = " " -Mint = " " -NetBSD = " " -NixOS = " " -OpenBSD = "󰈺 " -openSUSE = " " -OracleLinux = "󰌷 " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -RockyLinux = " " -Redox = "󰀘 " -Solus = "󰠳 " -SUSE = " " -Ubuntu = " " -Unknown = " " -Void = " " -Windows = "󰍲 " - -[package] -symbol = "󰏗 " - -[perl] -symbol = " " - -[php] -symbol = " " - -[pijul_channel] -symbol = " " - -[python] -symbol = " " - -[rlang] -symbol = "󰟔 " - -[ruby] -symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [rust] -symbol = "󱘗 " +symbol = "" +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' [scala] symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' -[swift] -symbol = " " - -[zig] -symbol = " " - -[gradle] -symbol = " " +[time] +disabled = false +time_format = "%R" # Hour:Minute Format +style = "bg:#33658A" +format = '[ ♥ $time ]($style)' diff --git a/tools/vscode/keybindings.json b/tools/vscode/keybindings.json index 77fd805..6eb5571 100644 --- a/tools/vscode/keybindings.json +++ b/tools/vscode/keybindings.json @@ -380,37 +380,37 @@ // #region Terminal Control, use ^a as prefix / leader key // tmux-like terminal control { // prefix + x : kill terminal - "key": "ctrl+a x", + "key": "ctrl+q x", "command": "workbench.action.terminal.kill", "when": "terminalFocus" }, { // prefix + c : create new terminal - "key": "ctrl+a c", + "key": "ctrl+q c", "command": "workbench.action.terminal.new", "when": "terminalFocus" }, { // prefix + | : split terminal vertically - "key": "ctrl+a shift+\\", + "key": "ctrl+q shift+\\", "command": "workbench.action.terminal.split", "when": "terminalFocus" }, { // prefix + \ : split terminal vertically - "key": "ctrl+a \\", + "key": "ctrl+q \\", "command": "workbench.action.terminal.split", "when": "terminalFocus" }, { // prefix + / : search - "key": "ctrl+a /", + "key": "ctrl+q /", "command": "workbench.action.terminal.focusFind", "when": "terminalFocus" }, { // prefix + t : toggle terminal - "key": "ctrl+a t", + "key": "ctrl+q t", "command": "workbench.action.terminal.toggleTerminal", "when": "terminalFocus" }, { // prefix + ^a: show information - "key": "ctrl+a ctrl+a", + "key": "ctrl+q ctrl+q", "command": "workbench.action.terminal.focusHover", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" }, @@ -420,22 +420,22 @@ "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" }, { // prefix + 1 : focus terminal 1 - "key": "ctrl+a 1", + "key": "ctrl+q 1", "command": "workbench.action.terminal.focusAtIndex1", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" }, { // prefix + 2 : focus terminal 2 - "key": "ctrl+a 2", + "key": "ctrl+q 2", "command": "workbench.action.terminal.focusAtIndex2", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" }, { // prefix + 3 : focus terminal 3 - "key": "ctrl+a 3", + "key": "ctrl+q 3", "command": "workbench.action.terminal.focusAtIndex3", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" }, { // prefix + g : Go to recent directory - "key": "ctrl+a g", + "key": "ctrl+q g", "command": "workbench.action.terminal.goToRecentDirectory", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, @@ -445,42 +445,42 @@ "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { // prefix + d : detach terminal - "key": "ctrl+a d", + "key": "ctrl+q d", "command": "workbench.action.terminal.detachSession", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { // prefix + a : attach to session - "key": "ctrl+a a", + "key": "ctrl+q a", "command": "workbench.action.terminal.attachToSession", "when": "terminalFocus" }, { - "key": "ctrl+a h", + "key": "ctrl+q h", "command": "workbench.action.terminal.focusPreviousPane", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { - "key": "ctrl+a i", + "key": "ctrl+q i", "command": "workbench.action.terminal.focusNextPane", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { - "key": "ctrl+a shift+H", + "key": "ctrl+q shift+H", "command": "workbench.action.terminal.resizePaneLeft", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { - "key": "ctrl+a shift+N", + "key": "ctrl+q shift+N", "command": "workbench.action.terminal.resizePaneDown", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { - "key": "ctrl+a shift+E", + "key": "ctrl+q shift+E", "command": "workbench.action.terminal.resizePaneUp", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" }, { - "key": "ctrl+a shift+I", + "key": "ctrl+q shift+I", "command": "workbench.action.terminal.resizePaneRight", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" } diff --git a/tools/vscode/vscode.former.vimrc b/tools/vscode/vscode.former.vimrc new file mode 100644 index 0000000..16eb0d2 --- /dev/null +++ b/tools/vscode/vscode.former.vimrc @@ -0,0 +1,169 @@ +" ~/.config/vscode/vscode.vimrc +" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc +" ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode/vscode.vimrc +" And go to vscode vim setting: +"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc", + + +" Arrow remap +noremap n j +noremap e k +noremap i l + +" Switch between tabs +noremap H :bprevious +noremap I :bnext + +noremap N 5j +noremap E 5k + +" Similar position to i +" The `noremap` implements text-object-like behavior in VSCodeVim +noremap l i +noremap L I +" ne[k]st +noremap k n +noremap K N +" [j]ump +noremap j e +noremap J E + +" Y to yank to end of line +noremap Y y$ + +" Define in settings.json, since this will remap under visual mode +" noremap :nohlsearch + +" 分词版本的w和b,支持中文,需要插件 +" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap` +" Comment if you don't use cjk or the plugin +nmap w cjkWordHandler.cursorWordEndRight +nmap b cjkWordHandler.cursorWordStartLeft + +" keep selection after indent (define in settings.json) +" voremap < >gv + +" lsp +noremap gi editor.action.goToImplementation +noremap gpi editor.action.peekImplementation +noremap gd editor.action.goToDefinition +noremap gpd editor.action.peekDefinition +noremap gt editor.action.goToTypeDefinition +noremap gpt editor.action.peekTypeDefinition +noremap gh editor.action.showDefinitionPreviewHover + +noremap workbench.action.quickOpen +noremap / workbench.action.quickTextSearch +noremap : workbench.action.showCommands +noremap E workbench.view.explorer +noremap - workbench.action.splitEditorDown +noremap | workbench.action.splitEditorRight +noremap \ workbench.action.splitEditorRight + +" a : +ai/action +noremap aa inlineChat.start +noremap aA workbench.panel.chat +noremap ae workbench.action.chat.openEditSession + +" b : +buffer +noremap bb workbench.action.showAllEditors +noremap bd :bdelete +noremap bh :bprevious +noremap bi :bnext +noremap bp :bprevious +noremap bn :bnext + +" c : +code/compile +noremap cr code-runner.run +noremap cf editor.action.formatDocument +noremap c editor.action.trimTrailingWhitespace +noremap cs workbench.action.gotoSymbol +noremap cS workbench.action.showAllSymbols +noremap ce editor.action.marker.next +noremap cE editor.action.marker.prev +noremap cg editor.action.dirtydiff.next +noremap cG editor.action.dirtydiff.previous +noremap cR editor.action.rename + +" d : +debug + +" f : +file +noremap ff workbench.action.quickOpen +noremap fF workbench.view.search +noremap fc workbench.action.openSettings +noremap fC workbench.action.openFolderSettingsFile +noremap fe workbench.view.explorer +noremap fo openInExternalApp.open +noremap fr workbench.action.showAllEditorsByMostRecentlyUsed +" Can only rename tracked files +noremap fR git.rename +" noremap fs workbench.action.search.toggleQueryDetails +noremap ft workbench.action.terminal.toggleTerminal +noremap fx workbench.view.extensions + +" g : +git +noremap gg workbench.view.scm +noremap gS git.stageAll + +" h : +help + +" j : +jump +noremap jj workbench.action.gotoLine + +" l : +language (define in settings.json) + +" p : +project (requires Project Manager extension) +noremap pp projectManager.listProjects +noremap pP projectManager.listAnyProjects#sideBarAny +noremap pc projectManager.openSettings#sideBarAny +noremap pe projectManager.editProjects +noremap pf projectManager.addToFavorites +noremap pF projectManager.filterProjectsByTag +noremap pg projectManager.listGitProjects#sideBarGit +noremap pr workbench.action.openRecent +noremap ps projectManager.saveProject + +" q : +quit +noremap qq :quit +noremap qQ :qall +noremap Q :quit + +" r : +refactor + +" s : +search + +" t : +test +noremap tt testing.runAll +noremap tT testing.debugAll +noremap ta testing.runAll +noremap tA testing.debugAll +noremap tf testing.reRunFailedTests +noremap tF testing.debugFailedTests +noremap tl testing.reRunLastRun +noremap tL testing.debugLastRun +noremap tc testing.runCurrentTest +noremap tC testing.debugCurrentTest +noremap tx testing.cancelTestRun + +" u : +ui +noremap ui workbench.action.selectTheme +noremap uw editor.action.toggleWordWrap +noremap uz workbench.action.toggleZenMode + +" w : +write/window +noremap ww :write +noremap wa :wall +noremap wq :wq +noremap W :write +noremap wh workbench.action.focusLeftGroup +noremap wH workbench.action.splitEditorLeft +noremap wn workbench.action.focusBelowGroup +noremap wN workbench.action.splitEditorDown +noremap we workbench.action.focusAboveGroup +noremap wE workbench.action.splitEditorUp +noremap wi workbench.action.focusRightGroup +noremap wI workbench.action.splitEditorRight +noremap w- workbench.action.splitEditorDown +noremap w| workbench.action.splitEditorRight +noremap w\ workbench.action.splitEditorRight diff --git a/tools/vscode/vscode.vimrc b/tools/vscode/vscode.vimrc index 84ab90d..2011909 100644 --- a/tools/vscode/vscode.vimrc +++ b/tools/vscode/vscode.vimrc @@ -4,6 +4,10 @@ " And go to vscode vim setting: "vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc", + +" Use VSpaceCode instead of +noremap vspacecode.space + " Arrow remap noremap n j noremap e k @@ -17,6 +21,7 @@ noremap N 5j noremap E 5k " Similar position to i +" The `noremap` implements text-object-like behavior in VSCodeVim noremap l i noremap L I " ne[k]st @@ -29,9 +34,11 @@ noremap J E " Y to yank to end of line noremap Y y$ +" Define in settings.json, since this will remap under visual mode +" noremap :nohlsearch + " 分词版本的w和b,支持中文,需要插件 " 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap` -" 由于 VSCode Vim 的限制,递归解析存在缺陷,目前这种情况,2w 符合预期,但 dw 不符合预期 " Comment if you don't use cjk or the plugin nmap w cjkWordHandler.cursorWordEndRight nmap b cjkWordHandler.cursorWordStartLeft @@ -48,98 +55,3 @@ noremap gpd editor.action.peekDefinition noremap gt editor.action.goToTypeDefinition noremap gpt editor.action.peekTypeDefinition noremap gh editor.action.showDefinitionPreviewHover - -noremap workbench.action.quickOpen -noremap : workbench.action.showCommands -noremap E workbench.view.explorer - -" q : +quit -noremap qq :quit -noremap qQ :qall -noremap Q :quit - -" w : +write/window -noremap ww :write -noremap wa :wall -noremap wq :wq -noremap W :write -noremap wh workbench.action.focusLeftGroup -noremap wH workbench.action.splitEditorLeft -noremap wn workbench.action.focusBelowGroup -noremap wN workbench.action.splitEditorDown -noremap we workbench.action.focusAboveGroup -noremap wE workbench.action.splitEditorUp -noremap wi workbench.action.focusRightGroup -noremap wI workbench.action.splitEditorRight - -" f : +find/file -noremap ff workbench.action.quickOpen -noremap fF workbench.view.search -noremap fc workbench.action.openSettings -noremap fC workbench.action.openFolderSettingsFile -noremap fe workbench.view.explorer -noremap fr workbench.action.showAllEditorsByMostRecentlyUsed -noremap fR workbench.action.openRecent -noremap fs workbench.action.search.toggleQueryDetails -noremap ft workbench.action.terminal.toggleTerminal -noremap fx workbench.view.extensions - -" p : +project (requires Project Manager extension) -noremap pp projectManager.listProjects -noremap pP projectManager.listAnyProjects#sideBarAny -noremap pc projectManager.openSettings#sideBarAny -noremap pe projectManager.editProjects -noremap pf projectManager.addToFavorites -noremap pF projectManager.filterProjectsByTag -noremap pg projectManager.listGitProjects#sideBarGit -noremap pr workbench.action.openRecent -noremap ps projectManager.saveProject - -" g : +git -noremap gg workbench.view.scm -noremap gS git.stageAll - -" j : +jump -noremap jj workbench.action.gotoLine - -" l : +language (define in settings.json) - -" u : +ui -noremap ui workbench.action.selectTheme -noremap uw editor.action.toggleWordWrap -noremap uz workbench.action.toggleZenMode -" a : +ai/action -noremap aa inlineChat.start -noremap aA workbench.panel.chat -noremap ae workbench.action.chat.openEditSession -" r : +refactor -" s : +search -" t : +test -noremap tt testing.runAll -noremap tT testing.debugAll -noremap ta testing.runAll -noremap tA testing.debugAll -noremap tf testing.reRunFailedTests -noremap tF testing.debugFailedTests -noremap tl testing.reRunLastRun -noremap tL testing.debugLastRun -noremap tc testing.runCurrentTest -noremap tC testing.debugCurrentTest -noremap tx testing.cancelTestRun -" d : +debug -" h : +help - -" c : +code -noremap cr code-runner.run -noremap cf editor.action.formatDocument -noremap c editor.action.trimTrailingWhitespace -noremap cs workbench.action.gotoSymbol -noremap cS workbench.action.showAllSymbols - -" b : +buffer -noremap bb workbench.action.showAllEditors -noremap bd :bdelete -noremap bh :bprevious -noremap bi :bnext - -" 中文分词测试用例 diff --git a/tools/wezterm/.gitignore b/tools/wezterm/.gitignore new file mode 100644 index 0000000..604ed6b --- /dev/null +++ b/tools/wezterm/.gitignore @@ -0,0 +1,12 @@ +# $DOTFILES/tools/wezterm/ +# Date: 2025-01-06 +# Author: js0ny + +# Location: +# $XDG_CONFIG_HOME/wezterm/wezterm.lua (works Windows) +# Linking: Link the whole directory +# ln -sf $DOTFILES/tools/wezterm $XDG_CONFIG_HOME/wezterm +# New-Item -ItemType SymbolicLink -Target $DOTFILES\tools\wezterm -Path $Env:XDG_CONFIG_HOME\wezterm + +*.json +check_update diff --git a/tools/wezterm/wezterm.lua b/tools/wezterm/wezterm.lua new file mode 100644 index 0000000..61c6e22 --- /dev/null +++ b/tools/wezterm/wezterm.lua @@ -0,0 +1,278 @@ +-- $DOTFILES/tools/wezterm/wezterm.lua +-- Date: 2024-12-22 +-- Author: js0ny + +--#region Import & Setup +local wezterm = require("wezterm") +local action = wezterm.action + +local config = {} +--#endregion + +--#region Helper +--[[ +local function detect_os() + local detected_os = "" + if package.config:sub(1, 1) == "\\" then + -- Windows + detected_os = "Windows" + elseif package.config:sub(1, 1) == "/" then + -- Unix-like (Linux, macOS, etc.) + if os.getenv("HOME") then + detected_os = "Unix-like" + -- You can differentiate further by checking for macOS or Linux if needed + if os.getenv("XDG_SESSION_TYPE") then + -- Likely Linux + detected_os = "Linux" + elseif os.execute("uname -s | grep -i darwin") == 0 then + -- macOS + detected_os = "macOS" + end + end + end + return detected_os +end +--]] +--[[ +wezterm.on("text-selection-callback", function(window, pane) + local text = window:get_selection_text_for_pane(pane) +end) +--]] + +local function detect_os() + local os_type = "" + if wezterm.target_triple == "x86_64-pc-windows-msvc" then + os_type = "Windows" + elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then + os_type = "Linux" + elseif wezterm.target_triple == "aarch64-apple-darwin" then + os_type = "macOS" + end + return os_type +end + +-- OS light/dark theme detection +local function detect_theme() end +--#endregion + +--#region Constant +local os_type = detect_os() +--#endregion + +--#region Appearance +-- Font and color scheme +-- config.font = 'FiraCode Nerd Font' + +config.max_fps = 120 +config.font = wezterm.font({ + family = "CaskaydiaCove Nerd Font", +}) +config.color_scheme = "Catppuccin Frappe" +config.font_size = 12.0 +config.front_end = "WebGpu" +config.webgpu_power_preference = "HighPerformance" +if os_type == "Windows" then + config.window_background_opacity = 0.7 -- Not working under WebGpu + config.win32_system_backdrop = "Mica" +end +-- Tab appearance +config.hide_tab_bar_if_only_one_tab = true +config.tab_bar_at_bottom = true +-- Cursor +-- config.animation_fps = 120 +-- config.cursor_blink_ease_in = 'EaseOut' +-- config.cursor_blink_ease_out = 'EaseOut' +-- config.default_cursor_style = 'BlinkingBlock' +-- config.cursor_blink_rate = 650 +-- Visual Bell +config.visual_bell = { + fade_in_function = "EaseIn", + fade_in_duration_ms = 250, + fade_out_function = "EaseOut", + fade_out_duration_ms = 250, + target = "CursorColor", +} +--#endregion + +--#region Keybindings +config.leader = { key = "q", mods = "CTRL" } +config.keys = { + { + key = "q", + mods = "LEADER", + action = action.SendKey({ key = "q", mods = "CTRL" }), + }, + -- Windows Management + { -- leader keys + key = "|", + mods = "LEADER|SHIFT", + action = action.SplitHorizontal({ domain = "CurrentPaneDomain" }), + }, + { + key = "-", + mods = "LEADER", + action = action.SplitVertical({ domain = "CurrentPaneDomain" }), + }, + { + key = "h", + mods = "LEADER", + action = action.ActivatePaneDirection("Left"), + }, + { + key = "n", + mods = "LEADER", + action = action.ActivatePaneDirection("Down"), + }, + { + key = "e", + mods = "LEADER", + action = action.ActivatePaneDirection("Up"), + }, + { + key = "i", + mods = "LEADER", + action = action.ActivatePaneDirection("Right"), + }, + { + key = "H", + mods = "LEADER", + action = action.AdjustPaneSize({ "Left", 5 }), + }, + { + key = "N", + mods = "LEADER", + action = action.AdjustPaneSize({ "Down", 5 }), + }, + { + key = "E", + mods = "LEADER", + action = action.AdjustPaneSize({ "Up", 5 }), + }, + { + key = "I", + mods = "LEADER", + action = action.AdjustPaneSize({ "Right", 5 }), + }, + { + key = "/", + mods = "LEADER", + action = action.Search({ Regex = "" }), + }, + { + key = "?", + mods = "LEADER|SHIFT", + action = action.Search({ CaseSensitiveString = "" }), + }, + { + key = ";", + mods = "LEADER", + action = action.ShowLauncher, + }, + { + key = ":", + mods = "LEADER|SHIFT", + action = action.ActivateCommandPalette, + }, + { + key = "W", + mods = "CTRL", + action = action.CloseCurrentPane({ confirm = true }), + }, + { -- ^C to copy if selection is active, otherwise send signal + -- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection + key = "c", + mods = "CTRL", + action = wezterm.action_callback(function(window, pane) + local has_selection = window:get_selection_text_for_pane(pane) ~= "" + if has_selection then + window:perform_action(action.CopyTo("ClipboardAndPrimarySelection"), pane) + + window:perform_action(action.ClearSelection, pane) + else + window:perform_action(action.SendKey({ key = "c", mods = "CTRL" }), pane) + end + end), + }, +} +config.mouse_bindings = { + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = action.OpenLinkAtMouseCursor, + }, + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "SUPER", + action = action.OpenLinkAtMouseCursor, + }, +} +--#endregion + +--#region Environment +config.set_environment_variables = { +} +--#endregion + +--#region Launching +if os_type == "Windows" then + config.default_prog = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" } + config.launch_menu = { + { + label = "Local - PowerShell", + args = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" }, + }, + { + label = "Local - PowerShell Administator", + args = { "sudo.exe", "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" }, + }, + { + label = "WSL1 - Arch", + args = { "wsl.exe", "-d", "Arch" }, + }, + { + label = "WSL2 - kali-linux", + args = { "wsl.exe", "-d", "kali-linux" }, + }, + { + label = "Local - NuShell", + args = { "nu" }, + }, + { + label = "Local - Windows PowerShell", + args = { "powershell.exe" }, + }, + { + label = "Local - Command Prompt", + args = { "cmd.exe" }, + }, + { + label = "WSL1 - Arch Zsh", + args = { "wsl.exe", "-d", "Arch", "zsh" }, + }, + } +elseif os_type == "macOS" then + config.default_prog = { "/opt/homebrew/bin/fish", "-l"} +else + config.default_prog = { "fish" } + config.launch_menu = { + { + label = "Local - Fish", + args = { "fish", "-l" }, + }, + { + label = "Local - Zsh", + args = { "zsh", "-l" }, + }, + { + label = "Local - PowerShell", + args = { "pwsh", "-NoLogo", "-NoProfileLoadTime", "-Login" }, + }, + { + label = "Local - NuShell", + args = { "nu", "-l" }, + }, + } +end +--#endregion + +return config diff --git a/tools/zsh/mod/alias.zsh b/tools/zsh/mod/alias.zsh index 46d9786..25c12fc 100644 --- a/tools/zsh/mod/alias.zsh +++ b/tools/zsh/mod/alias.zsh @@ -83,7 +83,7 @@ if command -v apt > /dev/null; then alias apt="sudo apt" alias apti="sudo apt install" alias aptu="sudo apt update && sudo apt upgrade" - alias aptr="sudo apt autoremove && sudo apt remove" + alias aptr="sudo apt remove" fi if command -v brew > /dev/null; then diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh index 77e710f..c62f4b5 100644 --- a/tools/zsh/mod/config.zsh +++ b/tools/zsh/mod/config.zsh @@ -38,8 +38,4 @@ done # Use `set -k` to mark leading `#` as a comment character set -k -# # TODO: Below should be reorganized -# export PATH=$HOME/.local/bin:$PATH - -# export NVM_DIR="$HOME/.config/nvm" -# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +source <(fzf --zsh) diff --git a/tools/zsh/mod/keymap.zsh b/tools/zsh/mod/keymap.zsh index e1fbbd5..c0b6a80 100644 --- a/tools/zsh/mod/keymap.zsh +++ b/tools/zsh/mod/keymap.zsh @@ -37,9 +37,7 @@ bindkey '^B' backward-char bindkey '^P' up-line-or-history bindkey '^N' down-line-or-history bindkey '^R' history-incremental-search-backward -# TODO: did not test bindkey '^K' kill-line -bindkey '^X^E' edit-command-line # LEADER CONVENTION # ^X defines as a prefix key in shell diff --git a/tools/zsh/mod/prompt.zsh b/tools/zsh/mod/prompt.zsh index 2953dcb..1f4ec4e 100644 --- a/tools/zsh/mod/prompt.zsh +++ b/tools/zsh/mod/prompt.zsh @@ -6,3 +6,4 @@ export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml eval "$(starship init zsh)" + diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index 7411ed5..f587e94 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -158,7 +158,7 @@ if command -v z > /dev/null; then fi # zsh .zcompdump # compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" -# Vcpkg TODO: Move vcpkg path +# Vcpkg if command -v vcpkg > /dev/null; then export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg fi