Repository: LintaoAmons/CoolStuffes Branch: main Commit: 5460c29ebb8f Files: 121 Total size: 420.5 KB Directory structure: gitextract_1f212uj9/ ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── hammerspoon/ │ ├── .gitignore │ ├── .hammerspoon/ │ │ ├── LICENSE │ │ ├── Spoons/ │ │ │ ├── ReloadConfiguration.spoon/ │ │ │ │ ├── docs.json │ │ │ │ └── init.lua │ │ │ └── WinWin.spoon/ │ │ │ ├── docs.json │ │ │ └── init.lua │ │ ├── countdown.lua │ │ ├── init.lua │ │ ├── scenarioShortcuts.lua │ │ ├── switch-app.lua │ │ └── windows.lua │ └── .luarc.json ├── ideavim/ │ └── .ideavimrc ├── karabiner/ │ └── .config/ │ └── karabiner/ │ ├── assets/ │ │ └── complex_modifications/ │ │ ├── bring-back-grave-accent-and-tilde.json │ │ ├── hyper-key.json │ │ ├── switch-option-and-cmd-when-wezterm.json │ │ └── tab-only-keyboard-core.json │ ├── automatic_backups/ │ │ ├── karabiner_20230719.json │ │ ├── karabiner_20230814.json │ │ └── karabiner_20231011.json │ └── karabiner.json ├── nvim/ │ └── .config/ │ └── nvim/ │ ├── .stylua.toml │ ├── READMD.md │ ├── init.lua │ └── lua/ │ ├── config/ │ │ ├── keymaps.lua │ │ └── options.lua │ ├── features/ │ │ ├── readme.md │ │ └── terminal-and-run.lua │ ├── plugins/ │ │ ├── editor-core/ │ │ │ ├── auto-close-pair.lua │ │ │ ├── autosave.lua │ │ │ ├── context-menu.lua │ │ │ ├── file-navi.lua │ │ │ ├── fuzzy-finders.lua │ │ │ ├── window-tab-management/ │ │ │ │ ├── tab.lua │ │ │ │ └── window.lua │ │ │ └── window-tab-management.lua │ │ ├── editor-enhance/ │ │ │ ├── aerial.lua │ │ │ ├── ai/ │ │ │ │ ├── avante.lua │ │ │ │ ├── code-companion.lua │ │ │ │ ├── gp.lua │ │ │ │ └── supermaven-nvim.lua │ │ │ ├── ai.lua │ │ │ ├── bookmarks.lua │ │ │ ├── comment.lua │ │ │ ├── copy.lua │ │ │ ├── duplicate.lua │ │ │ ├── encode-decode.lua │ │ │ ├── flash.lua │ │ │ ├── flatten.lua │ │ │ ├── fold.lua │ │ │ ├── lazydev.lua │ │ │ ├── leap.lua │ │ │ ├── multi-cursor.lua │ │ │ ├── preview-plantuml.lua │ │ │ ├── project.lua │ │ │ ├── scratch.lua │ │ │ ├── show-color.lua │ │ │ ├── smart-open.lua │ │ │ ├── surround.lua │ │ │ ├── switch-case.lua │ │ │ ├── terminal-and-run.lua │ │ │ ├── text-objects.lua │ │ │ └── trouble.lua │ │ ├── git/ │ │ │ ├── context-menu.lua │ │ │ ├── diffview.lua │ │ │ ├── gitgraph.lua │ │ │ ├── gitsign.lua │ │ │ └── neogit.lua │ │ ├── init.lua │ │ ├── lang/ │ │ │ ├── css.lua │ │ │ ├── go.lua │ │ │ ├── helm.lua │ │ │ ├── http.lua │ │ │ ├── json.lua │ │ │ ├── jsts.lua │ │ │ ├── lua-and-example.lua │ │ │ ├── markdown.lua │ │ │ ├── prisma.lua │ │ │ ├── python.lua │ │ │ ├── sh.lua │ │ │ ├── terraform.lua │ │ │ ├── test-menu.lua │ │ │ └── vim.lua │ │ ├── lang-core/ │ │ │ ├── cmp.lua │ │ │ ├── debug.lua │ │ │ ├── find-and-replace.lua │ │ │ ├── formatting.lua │ │ │ ├── lint.lua │ │ │ ├── lsp.lua │ │ │ ├── refactor.lua │ │ │ ├── snippet.lua │ │ │ ├── test.lua │ │ │ └── treesitter.lua │ │ └── ui/ │ │ ├── beacon.lua │ │ ├── cursor-word.lua │ │ ├── dress.lua │ │ ├── heirline.lua │ │ ├── hlchuck.lua │ │ ├── noice.lua │ │ ├── nui-components.lua │ │ ├── themes.lua │ │ └── todo-comments.lua │ └── util/ │ ├── base/ │ │ ├── fs.lua │ │ ├── git.lua │ │ ├── strings.lua │ │ ├── sys.lua │ │ └── table.lua │ ├── editor.lua │ ├── init.lua │ ├── lang.lua │ └── log.lua ├── tmux/ │ └── .tmux.conf ├── update.sh ├── vscode-jupyter-notebook/ │ └── vscode-jupyter-notebook.md ├── warpd/ │ └── .config/ │ └── warpd/ │ └── config ├── wezterm/ │ └── .wezterm.lua └── zsh/ └── .zshrc ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .local lvim/.config/lvim/bckgit lvim/.config/lvim/plugin .DS_Store ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2022 LintaoAmons 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. ================================================ FILE: Makefile ================================================ update: git pull --rebase /opt/homebrew/bin/bash update.sh ================================================ FILE: README.md ================================================ 转移到了/Moved to [VimEverywhere](https://github.com/LintaoAmons/VimEverywhere) ================================================ FILE: hammerspoon/.gitignore ================================================ # Compiled Lua sources luac.out # luarocks build files *.src.rock *.zip *.tar.gz # Object files *.o *.os *.ko *.obj *.elf # Precompiled Headers *.gch *.pch # Libraries *.lib *.a *.la *.lo *.def *.exp # Shared objects (inc. Windows DLLs) *.dll *.so *.so.* *.dylib # Executables *.exe *.out *.app *.i*86 *.x86_64 *.hex .local-history ================================================ FILE: hammerspoon/.hammerspoon/LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: hammerspoon/.hammerspoon/Spoons/ReloadConfiguration.spoon/docs.json ================================================ [ { "Command": [], "Constant": [], "Constructor": [], "Deprecated": [], "Field": [], "Function": [], "Method": [ { "def": "ReloadConfiguration:bindHotkeys(mapping)", "desc": "Binds hotkeys for ReloadConfiguration", "doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded", "name": "bindHotkeys", "parameters": [ " * mapping - A table containing hotkey modifier/key details for the following items:", " * reloadConfiguration - This will cause the configuration to be reloaded" ], "signature": "ReloadConfiguration:bindHotkeys(mapping)", "stripped_doc": "", "type": "Method" }, { "def": "ReloadConfiguration:start()", "desc": "Start ReloadConfiguration", "doc": "Start ReloadConfiguration\n\nParameters:\n * None", "name": "start", "parameters": [ " * None" ], "signature": "ReloadConfiguration:start()", "stripped_doc": "", "type": "Method" } ], "Variable": [ { "def": "ReloadConfiguration.watch_paths", "desc": "List of directories to watch for changes, defaults to hs.configdir", "doc": "List of directories to watch for changes, defaults to hs.configdir", "name": "watch_paths", "signature": "ReloadConfiguration.watch_paths", "stripped_doc": "", "type": "Variable" } ], "desc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.", "doc": "Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes.\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)", "items": [ { "def": "ReloadConfiguration:bindHotkeys(mapping)", "desc": "Binds hotkeys for ReloadConfiguration", "doc": "Binds hotkeys for ReloadConfiguration\n\nParameters:\n * mapping - A table containing hotkey modifier/key details for the following items:\n * reloadConfiguration - This will cause the configuration to be reloaded", "name": "bindHotkeys", "parameters": [ " * mapping - A table containing hotkey modifier/key details for the following items:", " * reloadConfiguration - This will cause the configuration to be reloaded" ], "signature": "ReloadConfiguration:bindHotkeys(mapping)", "stripped_doc": "", "type": "Method" }, { "def": "ReloadConfiguration:start()", "desc": "Start ReloadConfiguration", "doc": "Start ReloadConfiguration\n\nParameters:\n * None", "name": "start", "parameters": [ " * None" ], "signature": "ReloadConfiguration:start()", "stripped_doc": "", "type": "Method" }, { "def": "ReloadConfiguration.watch_paths", "desc": "List of directories to watch for changes, defaults to hs.configdir", "doc": "List of directories to watch for changes, defaults to hs.configdir", "name": "watch_paths", "signature": "ReloadConfiguration.watch_paths", "stripped_doc": "", "type": "Variable" } ], "name": "ReloadConfiguration", "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip)", "submodules": [], "type": "Module" } ] ================================================ FILE: hammerspoon/.hammerspoon/Spoons/ReloadConfiguration.spoon/init.lua ================================================ --- === ReloadConfiguration === --- --- Adds a hotkey to reload the hammerspoon configuration, and a pathwatcher to automatically reload on changes. --- --- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ReloadConfiguration.spoon.zip) local obj = {} obj.__index = obj -- Metadata obj.name = "ReloadConfiguration" obj.version = "1.0" obj.author = "Jon Lorusso " obj.homepage = "https://github.com/Hammerspoon/Spoons" obj.license = "MIT - https://opensource.org/licenses/MIT" --- ReloadConfiguration.watch_paths --- Variable --- List of directories to watch for changes, defaults to hs.configdir obj.watch_paths = { hs.configdir } --- ReloadConfiguration:bindHotkeys(mapping) --- Method --- Binds hotkeys for ReloadConfiguration --- --- Parameters: --- * mapping - A table containing hotkey modifier/key details for the following items: --- * reloadConfiguration - This will cause the configuration to be reloaded function obj:bindHotkeys(mapping) local def = { reloadConfiguration = hs.fnutils.partial(hs.reload, self) } hs.spoons.bindHotkeysToSpec(def, mapping) end --- ReloadConfiguration:start() --- Method --- Start ReloadConfiguration --- --- Parameters: --- * None function obj:start() self.watchers = {} for _,dir in pairs(self.watch_paths) do self.watchers[dir] = hs.pathwatcher.new(dir, hs.reload):start() end return self end return obj ================================================ FILE: hammerspoon/.hammerspoon/Spoons/WinWin.spoon/docs.json ================================================ [ { "Command": [], "Constant": [], "Constructor": [], "Deprecated": [], "Field": [], "Function": [], "Method": [ { "def": "WinWin:centerCursor()", "desc": "Center the cursor on the focused window.", "doc": "Center the cursor on the focused window.\n", "name": "centerCursor", "signature": "WinWin:centerCursor()", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:moveAndResize(option)", "desc": "Move and resize the focused window.", "doc": "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `maximize`, `minimize`, `expand`, `shrink`.", "name": "moveAndResize", "parameters": [ " * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `maximize`, `minimize`, `expand`, `shrink`." ], "signature": "WinWin:moveAndResize(option)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:moveToScreen(direction)", "desc": "Move the focused window between all of the screens in the `direction`.", "doc": "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", "name": "moveToScreen", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`." ], "signature": "WinWin:moveToScreen(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:stepMove(direction)", "desc": "Move the focused window in the `direction` by on step. The step scale equals to the width/height of one gridpart.", "doc": "Move the focused window in the `direction` by on step. The step scale equals to the width/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "name": "stepMove", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "signature": "WinWin:stepMove(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:stepResize(direction)", "desc": "Resize the focused window in the `direction` by on step.", "doc": "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "name": "stepResize", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "signature": "WinWin:stepResize(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:undo()", "desc": "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "doc": "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.\n", "name": "undo", "signature": "WinWin:undo()", "stripped_doc": "", "type": "Method" } ], "Variable": [ { "def": "WinWin.gridparts", "desc": "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "doc": "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "name": "gridparts", "signature": "WinWin.gridparts", "stripped_doc": "", "type": "Variable" } ], "desc": "Windows manipulation", "doc": "Windows manipulation\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip)", "items": [ { "def": "WinWin:centerCursor()", "desc": "Center the cursor on the focused window.", "doc": "Center the cursor on the focused window.\n", "name": "centerCursor", "signature": "WinWin:centerCursor()", "stripped_doc": "", "type": "Method" }, { "def": "WinWin.gridparts", "desc": "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "doc": "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "name": "gridparts", "signature": "WinWin.gridparts", "stripped_doc": "", "type": "Variable" }, { "def": "WinWin:moveAndResize(option)", "desc": "Move and resize the focused window.", "doc": "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `maximize`, `minimize`, `expand`, `shrink`.", "name": "moveAndResize", "parameters": [ " * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `maximize`, `minimize`, `expand`, `shrink`." ], "signature": "WinWin:moveAndResize(option)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:moveToScreen(direction)", "desc": "Move the focused window between all of the screens in the `direction`.", "doc": "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", "name": "moveToScreen", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`." ], "signature": "WinWin:moveToScreen(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:stepMove(direction)", "desc": "Move the focused window in the `direction` by on step. The step scale equals to the width/height of one gridpart.", "doc": "Move the focused window in the `direction` by on step. The step scale equals to the width/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "name": "stepMove", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "signature": "WinWin:stepMove(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:stepResize(direction)", "desc": "Resize the focused window in the `direction` by on step.", "doc": "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "name": "stepResize", "parameters": [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "signature": "WinWin:stepResize(direction)", "stripped_doc": "", "type": "Method" }, { "def": "WinWin:undo()", "desc": "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "doc": "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.\n", "name": "undo", "signature": "WinWin:undo()", "stripped_doc": "", "type": "Method" } ], "name": "WinWin", "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip)", "submodules": [], "type": "Module" } ] ================================================ FILE: hammerspoon/.hammerspoon/Spoons/WinWin.spoon/init.lua ================================================ --- === WinWin === --- --- Windows manipulation --- --- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WinWin.spoon.zip) local obj = {} obj.__index = obj -- Metadata obj.name = "WinWin" obj.version = "1.0" obj.author = "ashfinal " obj.homepage = "https://github.com/Hammerspoon/Spoons" obj.license = "MIT - https://opensource.org/licenses/MIT" -- Windows manipulation history. Only the last operation is stored. obj.history = {} --- WinWin.gridparts --- Variable --- An integer specifying how many gridparts the screen should be divided into. Defaults to 30. obj.gridparts = 30 --- WinWin:stepMove(direction) --- Method --- Move the focused window in the `direction` by on step. The step scale equals to the width/height of one gridpart. --- --- Parameters: --- * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`. function obj:stepMove(direction) local cwin = hs.window.focusedWindow() if cwin then local cscreen = cwin:screen() local cres = cscreen:frame() local stepw = cres.w / obj.gridparts local steph = cres.h / obj.gridparts local wtopleft = cwin:topLeft() if direction == "left" then cwin:setTopLeft({ x = wtopleft.x - stepw, y = wtopleft.y }) elseif direction == "right" then cwin:setTopLeft({ x = wtopleft.x + stepw, y = wtopleft.y }) elseif direction == "up" then cwin:setTopLeft({ x = wtopleft.x, y = wtopleft.y - steph }) elseif direction == "down" then cwin:setTopLeft({ x = wtopleft.x, y = wtopleft.y + steph }) else hs.alert.show("Unknown direction: " .. direction) end else hs.alert.show("No focused window!") end end --- WinWin:stepResize(direction) --- Method --- Resize the focused window in the `direction` by on step. --- --- Parameters: --- * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`. function obj:stepResize(direction) local cwin = hs.window.focusedWindow() if cwin then local cscreen = cwin:screen() local cres = cscreen:frame() local stepw = cres.w / obj.gridparts local steph = cres.h / obj.gridparts local wsize = cwin:size() if direction == "left" then cwin:setSize({ w = wsize.w - stepw, h = wsize.h }) elseif direction == "right" then cwin:setSize({ w = wsize.w + stepw, h = wsize.h }) elseif direction == "up" then cwin:setSize({ w = wsize.w, h = wsize.h - steph }) elseif direction == "down" then cwin:setSize({ w = wsize.w, h = wsize.h + steph }) else hs.alert.show("Unknown direction: " .. direction) end else hs.alert.show("No focused window!") end end local function windowStash(window) local winid = window:id() local winf = window:frame() if #obj.history > 50 then -- Make sure the history doesn't reach the maximum (50 items). table.remove(obj.history) -- Remove the last item end local winstru = {winid, winf} table.insert(obj.history, winstru) -- Insert new item of window history end --- WinWin:moveAndResize(option) --- Method --- Move and resize the focused window. --- --- Parameters: --- * option - A string specifying the option, valid strings are: --- `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `maximize`, `minimize`, `expand`, `shrink`. function obj:moveAndResize(option) local cwin = hs.window.focusedWindow() if cwin then local cscreen = cwin:screen() local cres = cscreen:frame() local stepw = cres.w / obj.gridparts local steph = cres.h / obj.gridparts local wf = cwin:frame() options = { halfleft = function() cwin:setFrame({ x = cres.x, y = cres.y, w = cres.w / 2, h = cres.h }) end, halfright = function() cwin:setFrame({ x = cres.x + cres.w / 2, y = cres.y, w = cres.w / 2, h = cres.h }) end, halfup = function() cwin:setFrame({ x = cres.x, y = cres.y, w = cres.w, h = cres.h / 2 }) end, halfdown = function() cwin:setFrame({ x = cres.x, y = cres.y + cres.h / 2, w = cres.w, h = cres.h / 2 }) end, cornerNW = function() cwin:setFrame({ x = cres.x, y = cres.y, w = cres.w / 2, h = cres.h / 2 }) end, cornerNE = function() cwin:setFrame({ x = cres.x + cres.w / 2, y = cres.y, w = cres.w / 2, h = cres.h / 2 }) end, cornerSW = function() cwin:setFrame({ x = cres.x, y = cres.y + cres.h / 2, w = cres.w / 2, h = cres.h / 2 }) end, cornerSE = function() cwin:setFrame({ x = cres.x + cres.w / 2, y = cres.y + cres.h / 2, w = cres.w / 2, h = cres.h / 2 }) end, fullscreen = function() cwin:setFullScreen(true) end, maximize = function() cwin:maximize() end, minimize = function() cwin:minimize() end, center = function() cwin:centerOnScreen() end, expand = function() cwin:setFrame({ x = wf.x - stepw, y = wf.y - steph, w = wf.w + (stepw * 2), h = wf.h + (steph * 2) }) end, shrink = function() cwin:setFrame({ x = wf.x + stepw, y = wf.y + steph, w = wf.w - (stepw * 2), h = wf.h - (steph * 2) }) end } if options[option] == nil then hs.alert.show("Unknown option: " .. option) else -- if the window is fullscreen, and that's not what the user wants, -- toggle fullscreen off before proceeding if option ~= "fullscreen" and cwin:isFullScreen() then cwin:setFullScreen(false) -- a sleep is required to let the window manager register the new state, -- otherwise the follow-up minimize() call doesn't work hs.timer.usleep(999999) end windowStash(cwin) options[option]() end else hs.alert.show("No focused window!") end end --- WinWin:moveToScreen(direction) --- Method --- Move the focused window between all of the screens in the `direction`. --- --- Parameters: --- * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`. function obj:moveToScreen(direction) local cwin = hs.window.focusedWindow() if cwin then local cscreen = cwin:screen() if direction == "up" then cwin:moveOneScreenNorth() elseif direction == "down" then cwin:moveOneScreenSouth() elseif direction == "left" then cwin:moveOneScreenWest() elseif direction == "right" then cwin:moveOneScreenEast() elseif direction == "next" then cwin:moveToScreen(cscreen:next()) else hs.alert.show("Unknown direction: " .. direction) end else hs.alert.show("No focused window!") end end --- WinWin:undo() --- Method --- Undo the last window manipulation. Only those "moveAndResize" manipulations can be undone. --- function obj:undo() local cwin = hs.window.focusedWindow() local cwinid = cwin:id() for idx, val in ipairs(obj.history) do -- Has this window been stored previously? if val[1] == cwinid then cwin:setFrame(val[2]) end end end --- WinWin:centerCursor() --- Method --- Center the cursor on the focused window. --- function obj:centerCursor() local cwin = hs.window.focusedWindow() local wf = cwin:frame() local cscreen = cwin:screen() local cres = cscreen:frame() if cwin then -- Center the cursor one the focused window hs.mouse.setAbsolutePosition({ x = wf.x + wf.w / 2, y = wf.y + wf.h / 2 }) else -- Center the cursor on the screen hs.mouse.setAbsolutePosition({ x = cres.x + cres.w / 2, y = cres.y + cres.h / 2 }) end end return obj ================================================ FILE: hammerspoon/.hammerspoon/countdown.lua ================================================ local remindTimer = nil local sound = hs.sound.getByName("Glass") function remindUser() hs.alert.show("Time is up!", 5) sound:play() remindTimer = nil -- set timer object to nil so that it can be restarted later end function parseTime(input) local totalSeconds = 0 for value, unit in input:gmatch("(%d+)([smh]?)") do value = tonumber(value) if unit == "s" or unit == "" then totalSeconds = totalSeconds + value elseif unit == "m" then totalSeconds = totalSeconds + value * 60 elseif unit == "h" then totalSeconds = totalSeconds + value * 60 * 60 end end return totalSeconds end function startRemindTimer() -- Ask the user for input local ok, result = hs.dialog.textPrompt("Remind Timer", "Enter the time (e.g. 5s, 10m, 1h, 1h3m4s):", "20m") if ok then -- Parse the user input local time = parseTime(result) if time ~= nil then -- Start the timer remindTimer = hs.timer.doAfter(time, remindUser) -- Wait for 300ms before focusing on the popup window hs.timer.doAfter(0.3, function() local dialogWindow = hs.window.find("Remind Timer") if dialogWindow then dialogWindow:focus() end end) else hs.alert.show("Invalid input, please enter a time in the format of 5s, 10m, or 1h3m4s.") end end end function stopRemindTimer() if remindTimer ~= nil then remindTimer:stop() hs.notify.new({ title = "Reminder", informativeText = "Timer Cancelled", soundName = "Glass" }):send() remindTimer = nil else hs.notify.new({ title = "Reminder", informativeText = "No Timer to cancel", soundName = "Glass" }):send() end end function formatTime(seconds) local hours = math.floor(seconds / 3600) local minutes = math.floor(seconds / 60 % 60) local remainingSeconds = math.floor(seconds % 60) local timeString = "" if hours > 0 then return tostring(hours) .. " hour" .. (hours > 1 and "s" or "") .. " " .. tostring(minutes) .. " minute" .. (minutes > 1 and "s" or "") .. " " .. tostring(remainingSeconds) .. " second" .. (remainingSeconds ~= 1 and "s" or "") end if minutes > 0 then return tostring(minutes) .. " minute" .. (minutes > 1 and "s" or "") .. " " .. tostring(remainingSeconds) .. " second" .. (remainingSeconds ~= 1 and "s" or "") end return tostring(remainingSeconds) .. " second" .. (remainingSeconds ~= 1 and "s" or "") end function getRemainTime() if remindTimer ~= nil then local remainTime = remindTimer:nextTrigger() local timeString = formatTime(remainTime) hs.alert.show("Remaining time: " .. timeString) sound:play() else hs.alert.show("No timer is running") end end local hyperKey = { "shift", "alt", "ctrl", "cmd" } function showCurrentTime() local prettyNow = os.date("%A 📅%B %d %Y 🕐%I:%M:%S %p") hs.alert.show(prettyNow, hs.alert.defaultStyle, hs.screen.mainScreen(), 1.5) end hs.hotkey.bind(hyperKey, "T", showCurrentTime) -- Set a hotkey to get the remaining time of the timer hs.hotkey.bind({"cmd", "ctrl", "alt"}, "R", getRemainTime) -- Set a hotkey to start the timer hs.hotkey.bind({"cmd", "ctrl", "alt"}, "T", startRemindTimer) -- Set a hotkey to stop the timer hs.hotkey.bind({"cmd", "ctrl", "alt"}, "S", stopRemindTimer) ================================================ FILE: hammerspoon/.hammerspoon/init.lua ================================================ require("windows") -- require('scenarioShortcuts') require("countdown") require("switch-app") hs.loadSpoon("ReloadConfiguration") spoon.ReloadConfiguration:start() ================================================ FILE: hammerspoon/.hammerspoon/scenarioShortcuts.lua ================================================ local hyperKey = { "shift", "alt", "ctrl", "cmd" } local function remap(mods, key, pressFn) return hs.hotkey.bind(mods, key, pressFn, nil, pressFn) end function showFocusAlert(content) hs.alert.show(content, hs.alert.defaultStyle, hs.screen.mainScreen(), 0.5) end local hyperKey = { "shift", "alt", "ctrl", "cmd" } function showCurrentTime() local prettyNow = os.date("%A 📅%B %d %Y 🕐%I:%M:%S %p") hs.alert.show(prettyNow, hs.alert.defaultStyle, hs.screen.mainScreen(), 1.5) end remap(hyperKey, "t", showCurrentTime) local function keyStroke(mods, key) if key == nil then key = mods mods = {} end return function() hs.eventtap.keyStroke(mods, key, 1000) end end -- TODO 变成接受两个变量(from, to),变量的类型是 {keycode,mods} function tmuxCmdCtrlToPrefix(fromKey, mods, toKey) if mods == nil then mods = {} end if toKey == nil then toKey = fromKey end return remap({ "cmd", "ctrl" }, fromKey, function() hs.eventtap.keyStroke({ "ctrl" }, "b", 1000) hs.timer.doAfter(0.2, function() hs.eventtap.keyStroke(mods, toKey) end) end) end function tmuxHyperToPrefix(key) return remap(hyperKey, key, function() hs.eventtap.keyStroke({ "ctrl" }, "b", 1000) hs.timer.doAfter(0.2, function() hs.eventtap.keyStroke({}, key) end) end) end function tmuxSwitchWindow(windowNumber) return tmuxHyperToPrefix(windowNumber) end function terminalCommand(key, cmd) return remap({ "cmd", "ctrl" }, key, function() hs.eventtap.keyStrokes(cmd) hs.timer.doAfter(0.2, function() hs.eventtap.keyStroke({}, "return", 1000) end) end) end local allScenarios = { everEnable = "everEnable", firefox = "firefox", terminal = "terminal", joplin = "joplin", } local scenarioShortcuts = { [allScenarios.everEnable] = { toggleKeyboardCursor = remap(hyperKey, "c", keyStroke({ "alt", "cmd" }, "c")), }, [allScenarios.firefox] = { nextTab = remap({ "cmd", "ctrl" }, "l", keyStroke({ "ctrl" }, "tab")), prevTab = remap({ "cmd", "ctrl" }, "h", keyStroke({ "ctrl", "shift" }, "tab")), }, [allScenarios.terminal] = { showAllSessionWindowPane = tmuxCmdCtrlToPrefix("i", { }, "w"), -- tmux::session previousSession = tmuxCmdCtrlToPrefix("[", { "shift" }, "9"), nextSession = tmuxCmdCtrlToPrefix("]", { "shift" }, "0"), -- tmux::pane paneRight = tmuxCmdCtrlToPrefix("l"), paneLeft = tmuxCmdCtrlToPrefix("h"), paneUp = tmuxCmdCtrlToPrefix("k"), paneDown = tmuxCmdCtrlToPrefix("j"), switchToNextPane = tmuxCmdCtrlToPrefix("o", {}, "z"), maximizePane = tmuxCmdCtrlToPrefix("o", {}, "z"), switchToWindow1 = tmuxHyperToPrefix("1"), switchToWindow2 = tmuxHyperToPrefix("2"), switchToWindow3 = tmuxHyperToPrefix("3"), switchToWindow4 = tmuxHyperToPrefix("4"), closePane = tmuxHyperToPrefix("x"), }, [allScenarios.joplin] = {}, } local function enableScenarioShortcuts(scenario) for _, value in pairs(scenarioShortcuts[scenario]) do value:enable() end end local function disableScenarioShortcuts(scenario) for _, value in pairs(scenarioShortcuts[scenario]) do value:disable() end end local function isInTable(table, value) for k, v in pairs(table) do if v == value then return true end end return false end local function enableAndDisableScenarios(scenarios) scenarios = scenarios or {} for _, value in pairs(allScenarios) do if isInTable(scenarios, value) then enableScenarioShortcuts(value) else disableScenarioShortcuts(value) end end end function applicationWatcher(appName, eventType, appObject) if eventType == hs.application.watcher.activated then -- 初始化senarioShortcuts if appName == "Finder" then -- Bring all Finder windows forward when one gets activated appObject:selectMenuItem({ "Window", "Bring All to Front" }) end if appName == "Alacritty" then showFocusAlert("TERMINAL") enableAndDisableScenarios({ allScenarios.terminal, allScenarios.everEnable }) end if appName == "IntelliJ IDEA" then showFocusAlert("IDEA") enableAndDisableScenarios({ allScenarios.everEnable }) end if appName == "Firefox" then showFocusAlert("FIREFOX") enableAndDisableScenarios({ allScenarios.firefox, allScenarios.everEnable }) end if appName == "Joplin" then showFocusAlert("JOPLIN") enableAndDisableScenarios({ allScenarios.joplin, allScenarios.everEnable }) end end end appWatcher = hs.application.watcher.new(applicationWatcher) appWatcher:start() ================================================ FILE: hammerspoon/.hammerspoon/switch-app.lua ================================================ -- Define the keyboard shortcut to switch to Chrome local hyperKey = { "shift", "alt", "ctrl", "cmd" } local shortcuts = { ["Google Chat.app"] = "g", ["Google Chrome.app"] = "f", ["Obsidian"] = "j", ["wezTerm"] = "k", ["Finder"] = "l", ["Intellij IDEA"] = "i", ["Arc"] = "o", ["Excalidraw.app"] = "n", ["Visual Studio Code"] = "m", -- this is Visual Studio Code } local function switchTo(appName) local appRunning = hs.application.get(appName) if appRunning then -- If App is running, activate it appRunning:activate() else -- If App is not running, launch it hs.application.launchOrFocus(appName) end end for appName, shortcut in pairs(shortcuts) do hs.hotkey .new(hyperKey, shortcut, function() switchTo(appName) end) :enable() end ================================================ FILE: hammerspoon/.hammerspoon/windows.lua ================================================ local hyperKey = { "shift", "alt", "ctrl", "cmd" } hs.hotkey.bind(hyperKey, "a", function() hs.window.focusedWindow():moveToUnit({ 0, 0, 0.5, 1 }) end) hs.hotkey.bind(hyperKey, "d", function() hs.window.focusedWindow():moveToUnit({ 0.5, 0, 0.5, 1 }) end) hs.hotkey.bind(hyperKey, "w", function() hs.window.focusedWindow():moveToUnit({ 0, 0, 1, 0.5 }) end) hs.hotkey.bind(hyperKey, "s", function() hs.window.focusedWindow():moveToUnit({ 0, 0.5, 1, 0.5 }) end) -- full screen hs.hotkey.bind(hyperKey, "z", function() hs.window.focusedWindow():moveToUnit({ 0, 0, 1, 1 }) end) -- move to another screen hs.hotkey.bind(hyperKey, "r", function() -- get the focused window local win = hs.window.focusedWindow() -- get the screen where the focused window is displayed, a.k.a. current screen local screen = win:screen() -- compute the unitRect of the focused window relative to the current screen -- and move the window to the next screen setting the same unitRect win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) end) -- Toggle a window between its normal size, and being maximized local function toggle_window_full_screen() local win = hs.window.focusedWindow() if win ~= nil then win:setFullScreen(not win:isFullScreen()) end end hs.hotkey.bind(hyperKey, "e", toggle_window_full_screen) -- local switcher = hs.window.switcher.new(hs.window.filter.new():setCurrentSpace(true):setDefaultFilter({})) -- hs.hotkey.bind(hyperKey, "m", "Next window", function() -- switcher:next() -- end) -- hs.hotkey.bind(hyperKey, "n", "Previous window", function() -- switcher:previous() -- end) -- -- quarter of screen -- --[[ -- u i -- j k -- --]] -- hs.hotkey.bind({'ctrl', 'alt', 'cmd'}, 'u', function() hs.window.focusedWindow():moveToUnit({0, 0, 0.5, 0.5}) end) -- hs.hotkey.bind({'ctrl', 'alt', 'cmd'}, 'k', function() hs.window.focusedWindow():moveToUnit({0.5, 0.5, 0.5, 0.5}) end) -- hs.hotkey.bind({'ctrl', 'alt', 'cmd'}, 'i', function() hs.window.focusedWindow():moveToUnit({0.5, 0, 0.5, 0.5}) end) -- hs.hotkey.bind({'ctrl', 'alt', 'cmd'}, 'j', function() hs.window.focusedWindow():moveToUnit({0, 0.5, 0.5, 0.5}) end) ================================================ FILE: hammerspoon/.luarc.json ================================================ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "Lua.diagnostics.globals": [ "vim", "describe", "it", "before_each", "after_each", "hs" ] } ================================================ FILE: ideavim/.ideavimrc ================================================ " ================================================================================================ " = Extensions ===================================== " ================================================================================================ Plug 'tpope/vim-surround' Plug 'preservim/nerdtree' Plug 'terryma/vim-multiple-cursors' map map mx map mv " ================================================================================================ " = Basic settings ===================================== " ================================================================================================ set clipboard+=unnamed set ignorecase set scrolloff=30 set history=200 set number set relativenumber set incsearch set hlsearch set keep-english-in-normal " ================================================================================================ " = No Leader Keymaps ===================================== " ================================================================================================ nmap ge (GotoNextError) nmap gt (GotoTest) nmap gm (MethodUp) nmap ga (GotoImplementation) nmap go (GotoTypeDeclaration) " bookmark nmap mm (ToggleBookmark) nmap ma mA nmap 'a 'A nmap L (NextTab) nmap H (PreviousTab) " ================================================================================================ " = Leader Keymaps ===================================== " ================================================================================================ " leaderkey let mapleader=" " " ================================================================================================ " 👻👻👻 Which-Key 👻👻👻 " ================================================================================================ set which-key set notimeout " d: diff nmap dd (Vcs.ShowTabbedFileHistory) " f: Find/Format ⭐️ let g:WhichKeyDesc_FindOrFormat = "f FindOrFormat" let g:WhichKeyDesc_FindOrFormat_FindFile = "ff FindFile" nmap ff (GotoFile) let g:WhichKeyDesc_FindOrFormat_FindFileLocation = "fl FindFileLocation" nmap fl (SelectInProjectView) let g:WhichKeyDesc_FindOrFormat_FindText = "ft FindText" nmap ft (FindInPath) let g:WhichKeyDesc_FindOrFormat_Commands = "fc Commands" nmap fc (GotoAction) let g:WhichKeyDesc_FindOrFormat_OpenedProject = "fp OpenedProject" nmap fp (OpenProjectWindows) let g:WhichKeyDesc_FindOrFormat_Format = "fm Format" nmap fm (ReformatCode) \| (OptimizeImports) " g: Git ⭐️ let g:WhichKeyDesc_Git = "g Git" let g:WhichKeyDesc_Git_RollbackHunk = "gr RollbackHunk" nmap gr :action Vcs.RollbackChangedLines " i: Insert ⭐️ let g:WhichKeyDesc_InsertAfterBrackets = "i InsertAfterBrackets" nmap i f(a " j: add Semicolon and goto nextline⭐️ let g:WhichKeyDesc_InsertSemicolon = "j InsertSemicolon" nmap j A;o " l: lsp: Language server protocol (align with neovim)⭐️ let g:WhichKeyDesc_LSP = "l LSP" let g:WhichKeyDesc_LSP_Rename = "lr Rename" nmap lr (RenameElement) " n: No ⭐️ let g:WhichKeyDesc_No_Highlight = "nl NoHighlight" nmap nl :nohlsearch " s: Show ⭐️ let g:WhichKeyDesc_Show = "s Show" let g:WhichKeyDesc_Show_FileStructure = "ss ShowFileStructure" nmap ss (FileStructurePopup) let g:WhichKeyDesc_Show_Bookmarks = "sb ShowBookmarks" nmap sb (ShowBookmarks) let g:WhichKeyDesc_Show_ParameterInfo = "sb ShowParameterInfo" nmap sp (ParameterInfo) " r: Run/Re ⭐️ let g:WhichKeyDesc_RunOrRe = "r RunOrRe" let g:WhichKeyDesc_RunOrRe_ReRun = "rr ReRun" nmap rr (Rerun) let g:WhichKeyDesc_RunOrRe_ReRunTests = "rt ReRunTests" nmap rt (RerunTests) let g:WhichKeyDesc_RunOrRe_Rename = "rn Rename" map rn (RenameElement) " w: Window ⭐️ let g:WhichKeyDesc_Windows = "w Windows" let g:WhichKeyDesc_Windows_maximize = "wo maximize" nmap wo (UnsplitAll) \| (HideAllWindows) let g:WhichKeyDesc_Windows_splitWindowVertically = "wl splitWindowVertically" nmap wl (Macro.SplitVertically) let g:WhichKeyDesc_Windows_closeActiveWindow = "wc closeActiveWindow" nmap wc c " z: zip(fold) ⭐️ let g:WhichKeyDesc_Zip = "z Zip" let g:WhichKeyDesc_Zip_unZipAll = "zo unZipAll" nmap zo (ExpandAllRegions) let g:WhichKeyDesc_Zip_ZipAll = "zc ZipAll" nmap zc (CollapseAllRegions) " c: Close ⭐️; let g:WhichKeyDesc_CloseBuffer = "c CloseBuffer" nmap c :q! " e: Toggle Explorer ⭐️ let g:WhichKeyDesc_ToggleExplorerOrExtract = "e ToggleExplorer" nmap e (ActivateProjectToolWindow) " e: Extract " extract method/function vmap em (ExtractMethod) " extract constant vmap ec (IntroduceConstant) " extract field vmap ef (IntroduceField) " extract variable vmap ev (IntroduceVariable) ================================================ FILE: karabiner/.config/karabiner/assets/complex_modifications/bring-back-grave-accent-and-tilde.json ================================================ { "title": "Bring back grave_accent_and_tilde back after ESC mapping", "rules": [ { "description": "R_Shift+ESC to Tilde", "manipulators": [ { "type": "basic", "from": { "key_code": "escape", "modifiers": { "mandatory": "right_shift", "optional": [ "any" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [ "left_shift" ] } ] } ] }, { "description": "Super_key+ESC to grave accent", "manipulators": [ { "type": "basic", "from": { "key_code": "escape", "modifiers": { "mandatory": [ "left_shift", "left_command", "left_control", "left_option" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [] } ] } ] } ] } ================================================ FILE: karabiner/.config/karabiner/assets/complex_modifications/hyper-key.json ================================================ { "title": "RightCommand : (HYPER) SHIFT+COMMAND+OPTION+CONTROL", "rules": [ { "description": "RightCommand : (HYPER) SHIFT+COMMAND+OPTION+CONTROL", "manipulators": [ { "from": { "key_code": "right_command", "modifiers": { "optional": ["any"] } }, "to": [ { "key_code": "left_shift", "modifiers": ["left_command", "left_control", "left_option"] } ], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+,", "from": { "key_code": "comma", "modifiers": { "mandatory": ["command", "shift", "option", "control"] } }, "to": [], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+.", "from": { "key_code": "period", "modifiers": { "mandatory": ["command", "shift", "option", "control"] } }, "to": [], "type": "basic" }, { "from": { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+/", "key_code": "slash", "modifiers": { "mandatory": ["command", "shift", "option", "control"] } }, "to": [], "type": "basic" } ] } ] } ================================================ FILE: karabiner/.config/karabiner/assets/complex_modifications/switch-option-and-cmd-when-wezterm.json ================================================ { "title": "WezTerm switch option with cmd", "rules": [ { "description": "WezTerm Left Option to Cmd", "manipulators": [ { "conditions": [ { "bundle_identifiers": ["^com\\.github\\.wez\\.wezterm$"], "type": "frontmost_application_if" } ], "from": { "key_code": "left_option", "modifiers": { "optional": ["any"] } }, "to": [ { "key_code": "left_command", "lazy": true } ], "type": "basic" } ] }, { "description": "WezTerm Left Cmd to Option", "manipulators": [ { "conditions": [ { "bundle_identifiers": ["^com\\.github\\.wez\\.wezterm$"], "type": "frontmost_application_if" } ], "from": { "key_code": "left_command", "modifiers": { "optional": ["any"] } }, "to": [ { "key_code": "left_option", "lazy": true } ], "type": "basic" } ] } ] } ================================================ FILE: karabiner/.config/karabiner/assets/complex_modifications/tab-only-keyboard-core.json ================================================ { "title": "Tab : use only keyboard core area", "rules": [ { "description": "Tab + number: F1 ~ F12", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "1", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f1" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "2", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f2" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "3", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f3" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "4", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f4" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "5", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f5" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "6", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f6" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "7", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f7" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "8", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f8" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "9", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f9" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "0", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f10" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "hyphen", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f11" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "equal_sign", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f12" } ], "type": "basic" } ] }, { "description": "Tab + backspace to delete", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "delete_or_backspace", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "delete_forward" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] }, { "description": "Tab + hjkl to arrow keys", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "j", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "down_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "k", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "up_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "h", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "l", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "right_arrow" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] }, { "description": "Tab + n/m --> HOME/END", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "n", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "home" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "m", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "end" } ], "type": "basic" } ] } ] } ================================================ FILE: karabiner/.config/karabiner/automatic_backups/karabiner_20230719.json ================================================ { "global": { "ask_for_confirmation_before_quitting": true, "check_for_updates_on_startup": true, "show_in_menu_bar": true, "show_profile_name_in_menu_bar": false, "unsafe_ui": false }, "profiles": [ { "complex_modifications": { "parameters": { "basic.simultaneous_threshold_milliseconds": 50, "basic.to_delayed_action_delay_milliseconds": 500, "basic.to_if_alone_timeout_milliseconds": 1000, "basic.to_if_held_down_threshold_milliseconds": 500, "mouse_motion_to_scroll.speed": 100 }, "rules": [] }, "devices": [ { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": false, "is_pointing_device": true, "product_id": 4161, "vendor_id": 1008 }, "ignore": true, "manipulate_caps_lock_led": false, "simple_modifications": [], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 13330, "vendor_id": 14 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [], "treat_as_built_in_keyboard": false } ], "fn_function_keys": [ { "from": { "key_code": "f1" }, "to": [ { "consumer_key_code": "display_brightness_decrement" } ] }, { "from": { "key_code": "f2" }, "to": [ { "consumer_key_code": "display_brightness_increment" } ] }, { "from": { "key_code": "f3" }, "to": [ { "apple_vendor_keyboard_key_code": "mission_control" } ] }, { "from": { "key_code": "f4" }, "to": [ { "apple_vendor_keyboard_key_code": "spotlight" } ] }, { "from": { "key_code": "f5" }, "to": [ { "consumer_key_code": "dictation" } ] }, { "from": { "key_code": "f6" }, "to": [ { "key_code": "f6" } ] }, { "from": { "key_code": "f7" }, "to": [ { "consumer_key_code": "rewind" } ] }, { "from": { "key_code": "f8" }, "to": [ { "consumer_key_code": "play_or_pause" } ] }, { "from": { "key_code": "f9" }, "to": [ { "consumer_key_code": "fast_forward" } ] }, { "from": { "key_code": "f10" }, "to": [ { "consumer_key_code": "mute" } ] }, { "from": { "key_code": "f11" }, "to": [ { "consumer_key_code": "volume_decrement" } ] }, { "from": { "key_code": "f12" }, "to": [ { "consumer_key_code": "volume_increment" } ] } ], "name": "Default profile", "parameters": { "delay_milliseconds_before_open_device": 1000 }, "selected": true, "simple_modifications": [], "virtual_hid_keyboard": { "country_code": 0, "indicate_sticky_modifier_keys_state": true, "mouse_key_xy_scale": 100 } } ] } ================================================ FILE: karabiner/.config/karabiner/automatic_backups/karabiner_20230814.json ================================================ { "global": { "ask_for_confirmation_before_quitting": true, "check_for_updates_on_startup": true, "show_in_menu_bar": true, "show_profile_name_in_menu_bar": false, "unsafe_ui": false }, "profiles": [ { "complex_modifications": { "parameters": { "basic.simultaneous_threshold_milliseconds": 50, "basic.to_delayed_action_delay_milliseconds": 500, "basic.to_if_alone_timeout_milliseconds": 1000, "basic.to_if_held_down_threshold_milliseconds": 500, "mouse_motion_to_scroll.speed": 100 }, "rules": [ { "description": "R_Shift+ESC to Tilde", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": "right_shift", "optional": [ "any" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [ "left_shift" ] } ], "type": "basic" } ] }, { "description": "Super_key+ESC to grave accent", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": [ "left_shift", "left_command", "left_control", "left_option" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [] } ], "type": "basic" } ] }, { "description": "RightCommand : (HYPER) SHIFT+COMMAND+OPTION+CONTROL", "manipulators": [ { "from": { "key_code": "right_command", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_shift", "modifiers": [ "left_command", "left_control", "left_option" ] } ], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+,", "from": { "key_code": "comma", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+.", "from": { "key_code": "period", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "from": { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+/", "key_code": "slash", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" } ] }, { "description": "Tab + number: F1 ~ F12", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "1", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f1" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "2", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f2" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "3", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f3" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "4", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f4" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "5", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f5" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "6", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f6" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "7", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f7" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "8", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f8" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "9", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f9" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "0", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f10" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "hyphen", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f11" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "equal_sign", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f12" } ], "type": "basic" } ] }, { "description": "Tab + backspace to delete", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "delete_or_backspace", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "delete_forward" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] }, { "description": "Tab + hjkl to arrow keys", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "j", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "down_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "k", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "up_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "h", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "l", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "right_arrow" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] } ] }, "devices": [ { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": false, "is_pointing_device": true, "product_id": 4161, "vendor_id": 1008 }, "ignore": true, "manipulate_caps_lock_led": false, "simple_modifications": [], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 13330, "vendor_id": 14 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] } ], "treat_as_built_in_keyboard": false } ], "fn_function_keys": [ { "from": { "key_code": "f1" }, "to": [ { "consumer_key_code": "display_brightness_decrement" } ] }, { "from": { "key_code": "f2" }, "to": [ { "consumer_key_code": "display_brightness_increment" } ] }, { "from": { "key_code": "f3" }, "to": [ { "apple_vendor_keyboard_key_code": "mission_control" } ] }, { "from": { "key_code": "f4" }, "to": [ { "apple_vendor_keyboard_key_code": "spotlight" } ] }, { "from": { "key_code": "f5" }, "to": [ { "consumer_key_code": "dictation" } ] }, { "from": { "key_code": "f6" }, "to": [ { "key_code": "f6" } ] }, { "from": { "key_code": "f7" }, "to": [ { "consumer_key_code": "rewind" } ] }, { "from": { "key_code": "f8" }, "to": [ { "consumer_key_code": "play_or_pause" } ] }, { "from": { "key_code": "f9" }, "to": [ { "consumer_key_code": "fast_forward" } ] }, { "from": { "key_code": "f10" }, "to": [ { "consumer_key_code": "mute" } ] }, { "from": { "key_code": "f11" }, "to": [ { "consumer_key_code": "volume_decrement" } ] }, { "from": { "key_code": "f12" }, "to": [ { "consumer_key_code": "volume_increment" } ] } ], "name": "Default profile", "parameters": { "delay_milliseconds_before_open_device": 1000 }, "selected": true, "simple_modifications": [], "virtual_hid_keyboard": { "country_code": 0, "indicate_sticky_modifier_keys_state": true, "mouse_key_xy_scale": 100 } } ] } ================================================ FILE: karabiner/.config/karabiner/automatic_backups/karabiner_20231011.json ================================================ { "global": { "ask_for_confirmation_before_quitting": true, "check_for_updates_on_startup": true, "show_in_menu_bar": true, "show_profile_name_in_menu_bar": false, "unsafe_ui": false }, "profiles": [ { "complex_modifications": { "parameters": { "basic.simultaneous_threshold_milliseconds": 50, "basic.to_delayed_action_delay_milliseconds": 500, "basic.to_if_alone_timeout_milliseconds": 1000, "basic.to_if_held_down_threshold_milliseconds": 500, "mouse_motion_to_scroll.speed": 100 }, "rules": [ { "description": "R_Shift+ESC to Tilde", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": "right_shift", "optional": [ "any" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [ "left_shift" ] } ], "type": "basic" } ] }, { "description": "Super_key+ESC to grave accent", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": [ "left_shift", "left_command", "left_control", "left_option" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [] } ], "type": "basic" } ] }, { "description": "RightCommand : (HYPER) SHIFT+COMMAND+OPTION+CONTROL", "manipulators": [ { "from": { "key_code": "right_command", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_shift", "modifiers": [ "left_command", "left_control", "left_option" ] } ], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+,", "from": { "key_code": "comma", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+.", "from": { "key_code": "period", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "from": { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+/", "key_code": "slash", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" } ] }, { "description": "Tab + number: F1 ~ F12", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "1", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f1" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "2", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f2" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "3", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f3" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "4", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f4" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "5", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f5" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "6", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f6" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "7", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f7" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "8", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f8" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "9", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f9" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "0", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f10" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "hyphen", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f11" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "equal_sign", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f12" } ], "type": "basic" } ] }, { "description": "Tab + backspace to delete", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "delete_or_backspace", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "delete_forward" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] }, { "description": "Tab + hjkl to arrow keys", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "j", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "down_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "k", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "up_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "h", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "l", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "right_arrow" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] } ] }, "devices": [ { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": false, "is_pointing_device": true, "product_id": 4161, "vendor_id": 1008 }, "ignore": true, "manipulate_caps_lock_led": false, "simple_modifications": [], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 13330, "vendor_id": 14 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] } ], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 8249, "vendor_id": 6785 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "grave_accent_and_tilde" }, "to": [ { "key_code": "escape" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] }, { "from": { "key_code": "left_control" }, "to": [ { "key_code": "caps_lock" } ] } ], "treat_as_built_in_keyboard": false } ], "fn_function_keys": [ { "from": { "key_code": "f1" }, "to": [ { "consumer_key_code": "display_brightness_decrement" } ] }, { "from": { "key_code": "f2" }, "to": [ { "consumer_key_code": "display_brightness_increment" } ] }, { "from": { "key_code": "f3" }, "to": [ { "apple_vendor_keyboard_key_code": "mission_control" } ] }, { "from": { "key_code": "f4" }, "to": [ { "apple_vendor_keyboard_key_code": "spotlight" } ] }, { "from": { "key_code": "f5" }, "to": [ { "consumer_key_code": "dictation" } ] }, { "from": { "key_code": "f6" }, "to": [ { "key_code": "f6" } ] }, { "from": { "key_code": "f7" }, "to": [ { "consumer_key_code": "rewind" } ] }, { "from": { "key_code": "f8" }, "to": [ { "consumer_key_code": "play_or_pause" } ] }, { "from": { "key_code": "f9" }, "to": [ { "consumer_key_code": "fast_forward" } ] }, { "from": { "key_code": "f10" }, "to": [ { "consumer_key_code": "mute" } ] }, { "from": { "key_code": "f11" }, "to": [ { "consumer_key_code": "volume_decrement" } ] }, { "from": { "key_code": "f12" }, "to": [ { "consumer_key_code": "volume_increment" } ] } ], "name": "Default profile", "parameters": { "delay_milliseconds_before_open_device": 1000 }, "selected": true, "simple_modifications": [], "virtual_hid_keyboard": { "country_code": 0, "indicate_sticky_modifier_keys_state": true, "mouse_key_xy_scale": 100 } } ] } ================================================ FILE: karabiner/.config/karabiner/karabiner.json ================================================ { "global": { "ask_for_confirmation_before_quitting": true, "check_for_updates_on_startup": true, "show_in_menu_bar": true, "show_profile_name_in_menu_bar": false, "unsafe_ui": false }, "profiles": [ { "complex_modifications": { "parameters": { "basic.simultaneous_threshold_milliseconds": 50, "basic.to_delayed_action_delay_milliseconds": 500, "basic.to_if_alone_timeout_milliseconds": 1000, "basic.to_if_held_down_threshold_milliseconds": 500, "mouse_motion_to_scroll.speed": 100 }, "rules": [ { "description": "R_Shift+ESC to Tilde", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": "right_shift", "optional": [ "any" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [ "left_shift" ] } ], "type": "basic" } ] }, { "description": "Super_key+ESC to grave accent", "manipulators": [ { "from": { "key_code": "escape", "modifiers": { "mandatory": [ "left_shift", "left_command", "left_control", "left_option" ] } }, "to": [ { "key_code": "grave_accent_and_tilde", "modifiers": [] } ], "type": "basic" } ] }, { "description": "RightCommand : (HYPER) SHIFT+COMMAND+OPTION+CONTROL", "manipulators": [ { "from": { "key_code": "right_command", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_shift", "modifiers": [ "left_command", "left_control", "left_option" ] } ], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+,", "from": { "key_code": "comma", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+.", "from": { "key_code": "period", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" }, { "from": { "description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+/", "key_code": "slash", "modifiers": { "mandatory": [ "command", "shift", "option", "control" ] } }, "to": [], "type": "basic" } ] }, { "description": "Tab + number: F1 ~ F12", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "1", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f1" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "2", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f2" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "3", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f3" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "4", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f4" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "5", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f5" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "6", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f6" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "7", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f7" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "8", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f8" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "9", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f9" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "0", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f10" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "hyphen", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f11" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "equal_sign", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "f12" } ], "type": "basic" } ] }, { "description": "Tab + backspace to delete", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "delete_or_backspace", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "delete_forward" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] }, { "description": "Tab + hjkl to arrow keys", "manipulators": [ { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "j", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "down_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "k", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "up_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "h", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_arrow" } ], "type": "basic" }, { "conditions": [ { "name": "tab pressed", "type": "variable_if", "value": 1 } ], "from": { "key_code": "l", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "right_arrow" } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "optional": [ "any" ] } }, "parameters": { "basic.to_if_alone_timeout_milliseconds": 250, "basic.to_if_held_down_threshold_milliseconds": 250 }, "to": [ { "set_variable": { "name": "tab pressed", "value": 1 } } ], "to_after_key_up": [ { "set_variable": { "name": "tab pressed", "value": 0 } } ], "to_if_alone": [ { "key_code": "tab" } ], "type": "basic" } ] } ] }, "devices": [ { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": false, "is_pointing_device": true, "product_id": 4161, "vendor_id": 1008 }, "ignore": true, "manipulate_caps_lock_led": false, "simple_modifications": [], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 13330, "vendor_id": 14 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] } ], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 8249, "vendor_id": 6785 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "grave_accent_and_tilde" }, "to": [ { "key_code": "escape" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "left_control" }, "to": [ { "key_code": "caps_lock" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] } ], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": false, "is_pointing_device": true, "product_id": 33382, "vendor_id": 9354 }, "ignore": true, "manipulate_caps_lock_led": false, "simple_modifications": [], "treat_as_built_in_keyboard": false }, { "disable_built_in_keyboard_if_exists": false, "fn_function_keys": [], "identifiers": { "is_keyboard": true, "is_pointing_device": false, "product_id": 41619, "vendor_id": 1241 }, "ignore": false, "manipulate_caps_lock_led": true, "simple_modifications": [ { "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] }, { "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "from": { "key_code": "right_option" }, "to": [ { "key_code": "right_command" } ] } ], "treat_as_built_in_keyboard": false } ], "fn_function_keys": [ { "from": { "key_code": "f1" }, "to": [ { "consumer_key_code": "display_brightness_decrement" } ] }, { "from": { "key_code": "f2" }, "to": [ { "consumer_key_code": "display_brightness_increment" } ] }, { "from": { "key_code": "f3" }, "to": [ { "apple_vendor_keyboard_key_code": "mission_control" } ] }, { "from": { "key_code": "f4" }, "to": [ { "apple_vendor_keyboard_key_code": "spotlight" } ] }, { "from": { "key_code": "f5" }, "to": [ { "consumer_key_code": "dictation" } ] }, { "from": { "key_code": "f6" }, "to": [ { "key_code": "f6" } ] }, { "from": { "key_code": "f7" }, "to": [ { "consumer_key_code": "rewind" } ] }, { "from": { "key_code": "f8" }, "to": [ { "consumer_key_code": "play_or_pause" } ] }, { "from": { "key_code": "f9" }, "to": [ { "consumer_key_code": "fast_forward" } ] }, { "from": { "key_code": "f10" }, "to": [ { "consumer_key_code": "mute" } ] }, { "from": { "key_code": "f11" }, "to": [ { "consumer_key_code": "volume_decrement" } ] }, { "from": { "key_code": "f12" }, "to": [ { "consumer_key_code": "volume_increment" } ] } ], "name": "Default profile", "parameters": { "delay_milliseconds_before_open_device": 1000 }, "selected": true, "simple_modifications": [], "virtual_hid_keyboard": { "country_code": 0, "indicate_sticky_modifier_keys_state": true, "mouse_key_xy_scale": 100 } } ] } ================================================ FILE: nvim/.config/nvim/.stylua.toml ================================================ column_width = 100 indent_type = "Spaces" indent_width = 2 [sort_requires] enabled = true ================================================ FILE: nvim/.config/nvim/READMD.md ================================================ ## 去 https://oatnil.top 看看我的配置解析 ## Go to https://oatnil.top to see my configuration explanation ================================================ FILE: nvim/.config/nvim/init.lua ================================================ require("config.options") require("config.keymaps") vim.g.config_utils = { opts_ensure_installed = function(opts, new_item) opts = opts or {} if type(opts.ensure_installed) == "table" then vim.list_extend(opts.ensure_installed, new_item) else opts.ensure_installed = new_item end end, } local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) -- NOTE: Here is where you install your plugins. require("lazy").setup({ spec = { { import = "plugins" } }, change_detection = { -- automatically check for config file changes and reload the ui enabled = false, notify = false, -- get a notification when changes are found }, }) ================================================ FILE: nvim/.config/nvim/lua/config/keymaps.lua ================================================ local command1 = "split" vim.keymap.set("n", "ws", "" .. command1 .. "") vim.api.nvim_create_user_command("SplitHorizotally", command1, {}) local command5 = "FzfLua live_grep" vim.keymap.set("n", "ff", "" .. command5 .. "") vim.api.nvim_create_user_command("LiveGrepInProject", command5, {}) local quitNvim = "qa!" vim.keymap.set("n", "", "" .. quitNvim .. "") vim.api.nvim_create_user_command("QuitNvim", quitNvim, {}) local no_highlight = "nohlsearch" vim.keymap.set("n", "nl", "" .. no_highlight .. "") local dont_replace_register = "P" vim.keymap.set("v", "p", dont_replace_register) local better_j = "gj" vim.keymap.set("n", "j", better_j) local better_k = "gk" vim.keymap.set("n", "k", better_k) local exit_alias = "" vim.keymap.set("i", "jk", exit_alias) local reload_buffer = "checktime" vim.api.nvim_create_user_command("ReloadBuffer", reload_buffer, {}) ================================================ FILE: nvim/.config/nvim/lua/config/options.lua ================================================ -- code is stolen from https://github.com/echasnovski/nvim/blob/master/lua/ec/settings.lua -- stylua: ignore start -- Leader key ================================================================= vim.g.mapleader = " " vim.g.maplocalleader = "," vim.g.autoformat = false local opt = vim.opt -- General ==================================================================== opt.backup = false -- Don't store backup opt.mouse = 'a' -- Enable mouse -- https://github.com/mfussenegger/nvim-dap/blob/master/doc/dap.txt -- error: Stopped at line 2 but `switchbuf` setting prevented jump to location. Target buffer 55 not open in any window? -- opt.switchbuf = 'usetab' -- Use already opened buffers when switching opt.writebackup = false -- Don't store backup opt.undofile = true -- Enable persistent undo opt.swapfile = false opt.guifont = 'FiraCode Nerd Font:h16' opt.cmdheight = 0 opt.clipboard = "" -- UI ========================================================================= opt.conceallevel = 0 opt.breakindent = true -- Indent wrapped lines to match line start opt.cursorline = true -- Enable highlighting of the current line opt.laststatus = 3 -- show statusline in last window opt.linebreak = true -- Wrap long lines at 'breakat' (if 'wrap' is set) opt.list = true -- Show helpful character indicators opt.relativenumber = true -- Show relative line numbers opt.number = true -- Show current line's real line number instead of 0 opt.pumblend = 0 -- Make builtin completion menus slightly transparent opt.pumheight = 10 -- Make popup menu smaller opt.ruler = false -- Don't show cursor position opt.shortmess = 'aoOWFc' -- Disable certain messages from |ins-completion-menu| opt.showmode = false -- Don't show mode in command line opt.signcolumn = 'yes' -- Always show signcolumn or it would frequently shift opt.splitbelow = true -- Horizontal splits will be below opt.splitright = true -- Vertical splits will be to the right opt.termguicolors = true -- Enable gui colors opt.winblend = 0 -- Make floating windows transparent opt.wrap = false -- Display long lines as just one line vim.o.fillchars = table.concat( { 'eob: ', 'fold:╌', 'horiz:═', 'horizdown:╦', 'horizup:╩', 'vert:║', 'verthoriz:╬', 'vertleft:╣', 'vertright:╠' }, ',' ) vim.o.listchars = table.concat( { 'extends:…', 'nbsp:␣', 'precedes:…', 'tab:> ' }, ',' ) opt.shortmess:append('C') -- Don't show "Scanning..." messages opt.splitkeep = 'screen' -- Reduce scroll during window split -- Editing ==================================================================== opt.autoindent = true -- Use auto indent opt.expandtab = true -- Convert tabs to spaces opt.formatoptions = 'rqnl1j' -- Improve comment editing opt.ignorecase = true -- Ignore case when searching (use `\C` to force not doing that) opt.incsearch = true -- Show search results while typing opt.infercase = true -- Infer letter cases for a richer built-in keyword completion opt.shiftwidth = 4 -- Use this number of spaces for indentation opt.smartcase = true -- Don't ignore case when searching if pattern has upper case opt.smartindent = true -- Make indenting smart opt.tabstop = 4 -- Insert 4 spaces for a tab opt.virtualedit = 'block' -- Allow going past the end of line in visual block mode opt.iskeyword:append('-') -- Treat dash separated words as a word text object opt.completeopt = 'menuone,noinsert,noselect' -- Customize completions -- Define pattern for a start of 'numbered' list. This is responsible for -- correct formatting of lists when using `gw`. This basically reads as 'at -- least one special character (digit, -, +, *) possibly followed some -- punctuation (. or `)`) followed by at least one space is a start of list -- item' opt.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]] --stylua: ignore end -- opt.clipboard = "unnamedplus" ================================================ FILE: nvim/.config/nvim/lua/features/readme.md ================================================ this folder won't be `imported` directly in `nvim-lintao/.config/nvim-lintao/init.lua:14:4` it will be use as an lib for the plugins configurations the function here usually stands for a feature that will appear in multiple places ================================================ FILE: nvim/.config/nvim/lua/features/terminal-and-run.lua ================================================ local editor = require("util.editor") local M = {} function M.run_current_line() local sys = require("util.base.sys") local stringUtil = require("util.base.strings") local currentLine = editor.buf.read.get_current_line() local stdout = vim.fn.system(currentLine) local result = stringUtil.split_into_lines(stdout) editor.buf.write.put_lines(result, "l", true, true) pcall(sys.copy_to_system_clipboard, stringUtil.join(result, "\n")) end return M ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/auto-close-pair.lua ================================================ return { { "windwp/nvim-autopairs", event = "InsertEnter", config = true, }, { "windwp/nvim-ts-autotag", config = function() require("nvim-ts-autotag").setup({ opts = { -- Defaults enable_close = true, -- Auto close tags enable_rename = true, -- Auto rename pairs of tags enable_close_on_slash = false, -- Auto close on trailing ", function() -- use wezterm remapping to "" require("context-menu").trigger_context_menu() end, {}) return { dir = "/Volumes/t7ex/Documents/oatnil/beta/context-menu.nvim", config = function() require("context-menu").setup({ close_menu = { "q", "", "" }, menu_items = { { order = 1, cmd = "Code Action", not_ft = { "markdown", "toggleterm" }, action = { type = "callback", callback = function(_) vim.cmd([[Lspsaga code_action]]) end, }, }, { order = 2, cmd = "Run Test", not_ft = { "markdown" }, filter_func = function(context) local a = context.filename if string.find(a, ".test.") or string.find(a, "spec.") then return true else return false end end, action = { type = "callback", callback = function(_) require("neotest").run.run() end, }, }, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/file-navi.lua ================================================ local function context_dir(state) -- return the directory of the current neo-tree node local node = state.tree:get_node() if node.type == "directory" then return node.path end return node.path:gsub("/[^/]*$", "") -- go up one level end local function open_mini_files() local cmd = function() require("mini.files").open(vim.api.nvim_buf_get_name(0), true) end vim.keymap.set("n", "e", cmd, { noremap = true, silent = true }) end open_mini_files() local function reveal_current_file() local command = "Neotree reveal reveal_force_cwd" vim.keymap.set("n", "fl", "" .. command .. "", { noremap = true, silent = true }) vim.api.nvim_create_user_command("LocateCurrentBuf", command, {}) end reveal_current_file() vim.keymap.set("n", "", "Neotree toggle", { desc = "ExplorerToggle" }) return { { -- https://github.com/linkarzu/dotfiles-latest/blob/64707e247c71a2536327e33effab57641c54d001/neovim/neobean/lua/plugins/mini-files.lua#L62 "echasnovski/mini.files", version = false, config = function() require("mini.files").setup({ -- General options mappings = { close = "q", -- Use this if you want to open several files -- go_in = "l", -- This opens the file, but quits out of mini.files (default L) go_in_plus = "l", -- I swapped the following 2 (default go_out: h) -- go_out_plus: when you go out, it shows you only 1 item to the right -- go_out: shows you all the items to the right go_out = "H", go_out_plus = "h", -- Default reset = ",", -- Default @ reveal_cwd = ".", show_help = "g?", -- Default = synchronize = "s", trim_left = "<", trim_right = ">", }, windows = { preview = true, width_focus = 30, width_preview = 80, }, options = { -- Whether to delete permanently or move into module-specific trash permanent_delete = false, -- Whether to use for editing directories use_as_default_explorer = true, }, }) vim.api.nvim_set_hl(0, 'MiniFilesNormal', { bg = '#111111' }) vim.api.nvim_set_hl(0, 'MiniFilesBorder', { bg = '#111111' }) end, }, { "s1n7ax/nvim-window-picker", name = "window-picker", event = "VeryLazy", version = "2.*", config = function() require("window-picker").setup() end, }, { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "MunifTanjim/nui.nvim", }, config = function() require("neo-tree").setup({ source_selector = { sources = { -- table { source = "filesystem", -- string display_name = " 󰉓 Files ", -- string | nil }, { source = "git_status", -- string display_name = " 󰊢 Git ", -- string | nil }, }, }, window = { position = "left", -- width = 40, mapping_options = { noremap = true, nowait = true, }, mappings = { ["t"] = { function(state) local node = state.tree:get_node() vim.fn.jobstart({ "open", node.path }, { detach = true }) end, desc = "Open the current node by system default software", nowait = true, }, -- copy absolute path to clipboard ["Y"] = { function(state) local node = state.tree:get_node() local content = node.path vim.fn.setreg('"', content) vim.fn.setreg("1", content) vim.fn.setreg("+", content) end, desc = "copy absolute path", nowait = true, }, -- [""] = { -- function(state) -- local node = state.tree:get_node() -- vim.cmd("tabnew") -- vim.cmd("DiffviewOpen -- " .. node.path) -- end, -- desc = "Open file in diffview", -- nowait = true, -- }, -- open in telescope live grep [""] = { function(state) require("telescope.builtin").live_grep({ cwd = context_dir(state) }) end, desc = "live grep in current dir", nowait = true, }, [""] = { function(state) local node = state.tree:get_node() if node.type == "directory" then require("grug-far").grug_far({ prefills = { paths = node.path } }) else require("grug-far").grug_far({ prefills = { paths = context_dir(state) } }) end -- close neo-tree vim.cmd("Neotree close") end, desc = "replace in current dir", nowait = true, }, [""] = { "toggle_node", nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use }, ["o"] = "open", [""] = "cancel", -- close preview or floating neo-tree window ["P"] = { "toggle_preview", config = { use_float = true } }, ["l"] = "open_drop", ["S"] = "open_split", ["s"] = "open_vsplit", -- ["S"] = "split_with_window_picker", -- ["s"] = "vsplit_with_window_picker", -- ["t"] = "hello", -- [""] = "open_drop", -- ["t"] = "open_tab_drop", ["w"] = "open_with_window_picker", --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing ["x"] = "close_node", -- ['C'] = 'close_all_subnodes', ["z"] = "close_all_nodes", --["Z"] = "expand_all_nodes", ["a"] = { "add", -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details -- some commands may take optional config options, see `:h neo-tree-mappings` for details config = { show_path = "none", -- "none", "relative", "absolute" }, }, -- ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. ["D"] = "delete", ["r"] = "rename", ["y"] = "copy_to_clipboard", ["d"] = "cut_to_clipboard", ["p"] = "paste_from_clipboard", ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". ["q"] = "close_window", ["R"] = "refresh", ["?"] = "show_help", ["<"] = "prev_source", [">"] = "next_source", }, }, filesystem = { filtered_items = { visible = false, -- when true, they will just be displayed differently than normal items hide_dotfiles = false, hide_gitignored = false, hide_by_name = { --"node_modules" }, hide_by_pattern = { -- uses glob style patterns -- "._*", -- mac file info on exFat external disk --"*.meta", --"*/src/*/tsconfig.json", }, always_show = { -- remains visible even if other settings would normally hide it ".gitignored", ".dockerignore", }, never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show ".DS_Store", --"thumbs.db" }, never_show_by_pattern = { -- uses glob style patterns --".null-ls_*", }, }, follow_current_file = { enabled = false, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, group_empty_dirs = true, -- when true, empty folders will be grouped together hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree -- in whatever position is specified in window.position -- "open_current", -- netrw disabled, opening a directory opens within the -- window like netrw would, regardless of window.position -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes -- instead of relying on nvim autocmd events. window = { mappings = { [""] = "navigate_up", ["h"] = "navigate_up", ["."] = "set_root", ["H"] = "toggle_hidden", ["/"] = "fuzzy_finder", -- ["f"] = "fuzzy_finder_directory", ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm -- ["D"] = "fuzzy_sorter_directory", -- ["ff"] = "filter_on_submit", [""] = "clear_filter", [""] = function(state) -- get the current node local node = state.tree:get_node() -- if the node is not a directory, walk up the tree until we find one while node and node.type ~= "directory" do local parent_id = node:get_parent_id() if parent_id == nil then -- we must have reached the root node -- this should not happen because the root node is always a directory -- but just in case... node = nil break end node = state.tree:get_node(parent_id) end -- if we somehow didn't find a directory, just use the root node local path = node and node.path or state.path require("telescope.builtin").live_grep({ search_dirs = { path }, prompt_title = string.format("Grep in [%s]", vim.fs.basename(path)), }) end, }, fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode [""] = "move_cursor_down", [""] = "move_cursor_down", [""] = "move_cursor_up", [""] = "move_cursor_up", }, }, commands = { hello = function() print("Hello, neo-tree!") end, }, -- Add a custom command or override a global one using the same function name }, buffers = { follow_current_file = { enabled = true, -- This will find and focus the file in the active buffer every time -- -- the current file is changed while the tree is open. leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, group_empty_dirs = true, -- when true, empty folders will be grouped together show_unloaded = true, window = { mappings = { ["bd"] = "buffer_delete", [""] = "navigate_up", ["."] = "set_root", }, }, }, git_status = { window = { position = "float", mappings = { ["A"] = "git_add_all", ["u"] = "git_unstage_file", ["a"] = "git_add_file", ["r"] = "git_revert_file", ["c"] = "git_commit", ["gp"] = "git_push", ["gg"] = "git_commit_and_push", }, }, }, }) end, }, -- { -- "Bekaboo/dropbar.nvim", -- cond = function() -- return vim.fn.has("nvim-0.10") == 1 -- end, -- opts = function() -- local utils = require("dropbar.utils") -- return { -- menu = { -- -- When on, preview the symbol under the cursor on CursorMoved -- preview = true, -- -- When on, automatically set the cursor to the closest previous/next -- -- clickable component in the direction of cursor movement on CursorMoved -- quick_navigation = true, -- entry = { -- padding = { -- left = 1, -- right = 1, -- }, -- }, -- -- Menu scrollbar options -- scrollbar = { -- enable = true, -- -- The background / gutter of the scrollbar -- -- When false, only the scrollbar thumb is shown. -- background = true, -- }, -- ---@type table> -- keymaps = { -- ["q"] = "q", -- [""] = "q", -- ["h"] = "q", -- [""] = function() -- local menu = utils.menu.get_current() -- if not menu then -- return -- end -- local cursor = vim.api.nvim_win_get_cursor(menu.win) -- local component = menu.entries[cursor[1]]:first_clickable(cursor[2]) -- if component then -- menu:click_on(component, nil, 1, "l") -- end -- end, -- ["l"] = function() -- local menu = utils.menu.get_current() -- if not menu then -- return -- end -- local cursor = vim.api.nvim_win_get_cursor(menu.win) -- local component = menu.entries[cursor[1]]:first_clickable(cursor[2]) -- if component then -- menu:click_on(component, nil, 1, "l") -- end -- end, -- ["i"] = function() -- local menu = utils.menu.get_current() -- if not menu then -- return -- end -- menu:fuzzy_find_open() -- end, -- }, -- }, -- } -- end, -- }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/fuzzy-finders.lua ================================================ return { { "ibhagwan/fzf-lua", -- optional for icon support dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() -- calling `setup` is optional for customization require("fzf-lua").setup({}) end, }, { -- Fuzzy Finder (files, lsp, etc) "nvim-telescope/telescope.nvim", event = "VimEnter", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim", { -- If encountering errors, see telescope-fzf-native README for installation instructions "nvim-telescope/telescope-fzf-native.nvim", -- `build` is used to run some command when the plugin is installed/updated. -- This is only run then, not every time Neovim starts up. build = "make", -- `cond` is a condition used to determine whether this plugin should be -- installed and loaded. cond = function() return vim.fn.executable("make") == 1 end, }, { "nvim-telescope/telescope-ui-select.nvim" }, -- Useful for getting pretty icons, but requires a Nerd Font. { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, }, config = function() -- Two important keymaps to use while in Telescope are: -- - Insert mode: -- - Normal mode: ? require("telescope").setup({ -- You can put your default mappings / updates / etc. in here -- All the info you're looking for is in `:help telescope.setup()` -- -- defaults = { -- mappings = { -- i = { [''] = 'to_fuzzy_refine' }, -- }, -- }, -- pickers = {} defaults = { mappings = { i = { [""] = require("telescope.actions").close, }, n = { [""] = require("telescope.actions").close, }, }, layout_strategy = "horizontal", layout_config = { prompt_position = "top" }, sorting_strategy = "ascending", winblend = 0, }, extensions = { ["ui-select"] = { require("telescope.themes").get_dropdown(), }, }, }) -- Enable Telescope extensions if they are installed pcall(require("telescope").load_extension, "fzf") pcall(require("telescope").load_extension, "ui-select") end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/window-tab-management/tab.lua ================================================ local tabNext = "tabnext" vim.keymap.set("n", "tl", "" .. tabNext .. "") local tabPrevious = "tabprevious" vim.keymap.set("n", "th", "" .. tabPrevious .. "") local tabClose = "tabclose" vim.keymap.set("n", "tt", "" .. tabClose .. "") local find_tab = "FzfLua tabs" vim.keymap.set("n", "tk", ":" .. find_tab .. "") ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/window-tab-management/window.lua ================================================ local function split_vertically() local cmd = function() if vim.bo.buftype == "terminal" then local Terminal = require("toggleterm.terminal").Terminal Terminal:new({}):toggle() else vim.cmd("rightbelow vsplit") end end vim.keymap.set("n", "wl", cmd) vim.api.nvim_create_user_command("SplitVertically", cmd, {}) end split_vertically() local function split_horizontally() local cmd = "split" vim.api.nvim_create_user_command("SplitHorizontally", cmd, {}) end split_horizontally() local function close_window_or_buffer() local closeWindowOrBuffer = function() local isOk, _ = pcall(vim.cmd, "close") if not isOk then vim.cmd("bd") end end vim.keymap.set("n", "", closeWindowOrBuffer) end close_window_or_buffer() local maxmise_windows = function() require("util.editor").window.close_all_other_windows({ "filesystem", -- neo-tree "Trouble", "term", }) end vim.keymap.set("n", "wo", maxmise_windows) local function maxmise_windows_all() local cmd = function() require("util.editor").window.close_all_other_windows({}) end vim.keymap.set("n", "wO", cmd) end maxmise_windows_all() local popup_window = { cmd = function() local api = vim.api local buf = api.nvim_create_buf(false, true) local opts = { style = "minimal", relative = "editor", height = api.nvim_get_option("lines") - 2, width = api.nvim_get_option("columns") - 3, title = "Popup", row = 2, col = 3, border = "rounded", zindex = 20, } -- Create the floating window with the current buffer api.nvim_open_win(buf, true, opts) -- Set the buffer's modifiable option to true api.nvim_buf_set_option(buf, "modifiable", true) end, actions = function(cmd) vim.api.nvim_create_user_command("PopupWindow", cmd, {}) end, } popup_window.actions(popup_window.cmd) local open_in_popup_window = { cmd = function() popup_window.cmd() require("telescope").extensions.smart_open.smart_open({ cwd_only = true, filename_first = false, }) end, actions = function(cmd) vim.api.nvim_create_user_command("OpenInPopupWindow", cmd, {}) end, } open_in_popup_window.actions(open_in_popup_window.cmd) local function maxmise_windows_as_popup() local cmd = function() local api = vim.api -- Get the current buffer local current_buf = api.nvim_get_current_buf() -- Get the editor's dimensions local win_width = api.nvim_get_option("columns") local win_height = api.nvim_get_option("lines") -- Define the floating window options local opts = { style = "minimal", relative = "editor", height = win_height - 2, width = win_width - 3, row = 2, col = 3, border = "rounded", } -- Create the floating window with the current buffer api.nvim_open_win(current_buf, true, opts) -- Set the buffer's modifiable option to true api.nvim_buf_set_option(current_buf, "modifiable", true) end vim.keymap.set("n", "wp", cmd) vim.api.nvim_create_user_command("MaxmiseWindowsAsPopup", cmd, {}) end maxmise_windows_as_popup() --stylua: ignore start vim.keymap.set("n", "", "" .. "TmuxNavigateLeft" .. "") vim.keymap.set("n", "", "" .. "TmuxNavigateRight" .. "") vim.keymap.set("n", "", "" .. "TmuxNavigateDown" .. "") vim.keymap.set("n", "", "" .. "TmuxNavigateUp" .. "") local function resize_window() vim.keymap.set( "n", "", "vertical resize +5", { desc = "Increase window width" }) vim.keymap.set( "n", "", "vertical resize -5", { desc = "Decrease window width" }) vim.keymap.set("n", "", "resize -5", { desc = "Increase window height" }) vim.keymap.set("n", "", "resize +5", { desc = "Decrease window height" }) end resize_window() ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-core/window-tab-management.lua ================================================ require("plugins.editor-core.window-tab-management.window") require("plugins.editor-core.window-tab-management.tab") return { "christoomey/vim-tmux-navigator", event = "VeryLazy", } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/aerial.lua ================================================ (function() local command = "AerialToggle" vim.keymap.set("n", "ss", "" .. command .. "") vim.api.nvim_create_user_command("ToggleOutline", command, {}) end)() return { "stevearc/aerial.nvim", event = "VeryLazy", config = function() require("aerial").setup() end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/ai/avante.lua ================================================ return { "yetone/avante.nvim", -- enabled = false, event = "VeryLazy", build = "make", opts = { -- provider = "openai", -- Only recommend using Claude claude = { endpoint = "your_endpoint", model = "claude-3-5-sonnet-20240620", temperature = 0, max_tokens = 4096, }, mappings = { ask = "aa", edit = "ae", refresh = "ar", --- @class AvanteConflictMappings diff = { ours = "co", theirs = "ct", none = "c0", both = "cb", next = "]x", prev = "[x", }, jump = { next = "]]", prev = "[[", }, submit = { normal = "", insert = "", }, toggle = { debug = "ad", hint = "ah", }, }, }, dependencies = { "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons "stevearc/dressing.nvim", "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", --- The below is optional, make sure to setup it properly if you have lazy=true { "MeanderingProgrammer/render-markdown.nvim", opts = { file_types = { "markdown", "Avante" }, }, ft = { "markdown", "Avante" }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/ai/code-companion.lua ================================================ opts = { noremap = true, silent = true } vim.keymap.set({ "n", "v" }, "ac", "CodeCompanionChat", opts) vim.keymap.set({ "n", "v" }, "ak", "CodeCompanionActions", opts) vim.keymap.set({ "n", "v" }, "aj", "CodeCompanion", opts) return { "olimorris/codecompanion.nvim", -- dir ="/Volumes/t7ex/Documents/Github/codecompanion.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer "nvim-telescope/telescope.nvim", -- Optional: For using slash commands { "stevearc/dressing.nvim", opts = {} }, -- Optional: Improves the default Neovim UI }, config = function() require("codecompanion").setup({ adapters = { anthropic = function() return require("codecompanion.adapters").extend("anthropic", { url = "your_url", }) end, }, strategies = { chat = { adapter = "anthropic", }, inline = { adapter = "anthropic", }, agent = { adapter = "anthropic", }, }, prompt_library = { ["Commit Message for Staged Files"] = { strategy = "chat", description = "staged file commit messages", opts = { index = 9, default_prompt = true, mapping = "gm", slash_cmd = "commit-stage", auto_submit = true, }, prompts = { { role = "system", content = "You are an expert at following the Conventional Commit specification.", }, { role = "user", contains_code = true, content = function() return "Given the git diff listed below, please generate a commit message and put it inside a commit command for me:\n\n" .. "```\n" .. vim.fn.system("git diff --staged") .. "\n```" end, }, }, }, }, keymaps = { send = { modes = { n = { "", "" }, i = "", }, index = 1, callback = "keymaps.send", description = "Send", }, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/ai/gp.lua ================================================ return { "robitx/gp.nvim", config = function() local conf = { -- For customization, refer to Install > Configuration in the Documentation/Readme providers = { anthropic = { endpoint = "your_endpoint", secret = os.getenv("ANTHROPIC_API_KEY"), }, }, agents = { { provider = "anthropic", name = "ChatClaude-3-Haiku", chat = true, command = false, -- string with model name or table with model name and parameters model = { model = "claude-3-haiku-20240307", temperature = 0.8, top_p = 1 }, -- system prompt (use this to specify the persona/role of the AI) system_prompt = require("gp.defaults").chat_system_prompt, }, }, hooks = {}, } require("gp").setup(conf) -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/ai/supermaven-nvim.lua ================================================ return { "supermaven-inc/supermaven-nvim", config = function() require("supermaven-nvim").setup({ disable_keymaps = true, log_level = "error", }) local completion_preview = require("supermaven-nvim.completion_preview") vim.keymap.set( "i", "", completion_preview.on_accept_suggestion, { noremap = true, silent = true } ) vim.keymap.set( "i", "", completion_preview.on_accept_suggestion_word, { noremap = true, silent = true } ) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/ai.lua ================================================ return { { import = "plugins.editor-enhance.ai" }, { "LintaoAmons/context-menu.nvim", opts = function() require("context-menu").setup({ close_menu = { "q", "", "" }, menu_items = { { order = 1, cmd = "AI", keymap = "a", action = { type = "sub_cmds", sub_cmds = { { order = 1, keymap = "a", cmd = "New", action = { type = "callback", callback = function(_) vim.cmd([[GpChatNew]]) end, }, }, { order = 3, keymap = "p", cmd = "Append", action = { type = "callback", callback = function(_) vim.cmd([[GpAppend]]) end, }, }, { order = 2, cmd = "Find", keymap = "f", action = { type = "callback", callback = function(_) vim.cmd([[GpChatFinder]]) end, }, }, }, }, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/bookmarks.lua ================================================ vim.keymap.set("n", "mg", "" .. "BookmarksGotoRecent" .. "") vim.keymap.set("n", "mm", "" .. "BookmarksMark" .. "") vim.keymap.set("n", "ma", "" .. "BookmarksCommands" .. "") vim.keymap.set("n", "mo", "" .. "BookmarksGoto" .. "") return { { "LintaoAmons/bookmarks.nvim", -- branch = "dev", event = "VeryLazy", -- dir = "/Volumes/t7ex/Documents/oatnil/beta/bookmarks.nvim", dependencies = { { "nvim-neo-tree/neo-tree.nvim" }, { "ibhagwan/fzf-lua" }, }, config = function() require("bookmarks").setup({ json_db_path = vim.fn.stdpath("data") .. "/bookmarks.db.json", signs = { mark = { icon = "󰃁", color = "red", line_bg = "#572626" }, desc_format = function(desc) return desc end, }, picker = { -- choose built-in sort logic by name: string, find all the sort logics in `bookmarks.adapter.sort-logic` -- or custom sort logic: function(bookmarks: Bookmarks.Bookmark[]): nil sort_by = "created_at", }, treeview = { win_cmd = "left", -- "left", "right", "bottom" keymap = { quit = { "q", "" }, refresh = "R", create_folder = "a", tree_cut = "x", tree_paste = "p", collapse = "o", delete = "d", active = "s", copy = "c", }, }, hooks = { { callback = function(bookmark, projects) local project_path for _, p in ipairs(projects) do if p.name == bookmark.location.project_name then project_path = p.path end end if project_path then vim.cmd("cd " .. project_path) end end, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/comment.lua ================================================ return { { "folke/ts-comments.nvim", opts = {}, event = "VeryLazy", }, { "echasnovski/mini.comment", version = "*", opts = {} }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/copy.lua ================================================ --- Returns the absolute path of the current file relative to the project root, and the current line and column. --- @return string|nil local function copy_line_ref() local current_file_dir = vim.fn.expand("%:p:h") -- '%:p:h' expands to the directory of the current file -- Find the .git directory starting from the current file's directory and moving upwards local git_dir = vim.fn.finddir(".git", current_file_dir .. ";") -- If a .git directory is found, get the project root if git_dir ~= "" then local project_root = vim.fn.fnamemodify(git_dir, ":p:h:h") -- Get the project root directory -- Get the absolute path of the current file local current_file_absolute = vim.fn.expand("%:p") -- Calculate the relative path from the project root to the current file local relative_path = string.sub(current_file_absolute, string.len(project_root) + 2) -- Get the current line and column in the same line by unpacking the cursor position local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line_ref = relative_path .. ":" .. line .. ":" .. col vim.fn.setreg("+", line_ref) -- Return the reference path, line, and column return line_ref else return nil -- Return nil if no .git directory is found end end vim.api.nvim_create_user_command("CopyLineRef", copy_line_ref, {}) local function copy_buf_name() local buf_name = vim.fn.expand("%:p:t") vim.print(buf_name) vim.fn.setreg("+", buf_name) return buf_name end vim.api.nvim_create_user_command("CopyBufName", copy_buf_name, {}) local function copy_buf_abs_path() local abs_path = require("util.editor").buf.read.get_buf_abs_path() vim.print(abs_path) vim.fn.setreg("+", abs_path) return abs_path end vim.api.nvim_create_user_command("CopyBufAbsPath", copy_buf_abs_path, {}) local function copy_buf_abs_dir_path() local result = require("util.editor").buf.read.get_buf_abs_dir_path() vim.print(result) vim.fn.setreg("+", result) return result end vim.api.nvim_create_user_command("CopyBufAbsDirPath", copy_buf_abs_dir_path, {}) local function copy_buf_relative_dir_path() local result = require("util.editor").buf.read.get_buf_relative_dir_path() vim.print(result) vim.fn.setreg("+", result) return result end vim.api.nvim_create_user_command("CopyBufRelativeDirPath", copy_buf_relative_dir_path, {}) return { { "LintaoAmons/context-menu.nvim", opts = function(_) require("context-menu").setup({ menu_items = { { cmd = "Copy", keymap = "c", action = { type = "sub_cmds", sub_cmds = { { cmd = "Copy Line Ref", order = 91, action = { type = "callback", callback = function(_) copy_line_ref() end, }, }, { cmd = "Copy Buf Name", order = 92, action = { type = "callback", callback = function(_) copy_buf_name() end, }, }, { cmd = "Copy Buf Abs Path", order = 92, action = { type = "callback", callback = function(_) copy_buf_abs_path() end, }, }, { cmd = "Copy Buf Abs Dir Path", order = 92, action = { type = "callback", callback = function(_) copy_buf_abs_dir_path() end, }, }, { cmd = "Copy Buf Relative Dir Path", order = 92, action = { type = "callback", callback = function(_) copy_buf_relative_dir_path() end, }, }, }, }, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/duplicate.lua ================================================ vim.keymap.set("v", "", "VisualDuplicate +1", { desc = "Duplication" }) vim.keymap.set("v", "", "VisualDuplicate -1", { desc = "Duplication" }) return { "hinell/duplicate.nvim", event = "VeryLazy", } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/encode-decode.lua ================================================ --- Function to increment each character in the selected text, except blank characters (encode) local function encode_selected_chars() local start_pos = vim.fn.getpos("'<") local end_pos = vim.fn.getpos("'>") local start_line = start_pos[2] local start_col = start_pos[3] local end_line = end_pos[2] local end_col = end_pos[3] -- Iterate through each line in the selected region for line_num = start_line, end_line do local line = vim.fn.getline(line_num) local col_start = (line_num == start_line) and start_col or 1 local col_end = (line_num == end_line) and end_col or #line local new_line = line:sub(1, col_start - 1) -- Increment each character in the current line for col = col_start, col_end do local char = line:sub(col, col) if char and char ~= " " and char ~= "\t" then local new_char = string.char(char:byte() + 1) new_line = new_line .. new_char else new_line = new_line .. char end end new_line = new_line .. line:sub(col_end + 1) -- Replace the line in the buffer vim.fn.setline(line_num, new_line) end end --- Function to decrement each character in the selected text, except blank characters (decode) local function decode_selected_chars() local start_pos = vim.fn.getpos("'<") local end_pos = vim.fn.getpos("'>") local start_line = start_pos[2] local start_col = start_pos[3] local end_line = end_pos[2] local end_col = end_pos[3] -- Iterate through each line in the selected region for line_num = start_line, end_line do local line = vim.fn.getline(line_num) local col_start = (line_num == start_line) and start_col or 1 local col_end = (line_num == end_line) and end_col or #line local new_line = line:sub(1, col_start - 1) -- Decrement each character in the current line for col = col_start, col_end do local char = line:sub(col, col) if char and char ~= " " and char ~= "\t" then local new_char = string.char(char:byte() - 1) new_line = new_line .. new_char else new_line = new_line .. char end end new_line = new_line .. line:sub(col_end + 1) -- Replace the line in the buffer vim.fn.setline(line_num, new_line) end end vim.keymap.set({ "n", "v" }, "ie", encode_selected_chars) vim.keymap.set({ "n", "v" }, "id", decode_selected_chars) -- Revised Explanation: -- C-u in Keybinding: -- : clears any existing command-line input. This ensures a clean state before running the Lua function. -- This is especially useful when mapping functions to visual mode keybindings because Vim could otherwise append the function call to any existing text on the command line, leading to errors. -- vim.api.nvim_set_keymap("v", "ie", ":lua encode_selected_chars()", { noremap = true, silent = true }) -- vim.api.nvim_set_keymap("v", "id", ":lua decode_selected_chars()", { noremap = true, silent = true }) return {} ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/flash.lua ================================================ -- stylua: ignore start -- vim.keymap.set({ "n", "x", "o" }, "ss", function() require("flash").treesitter() end, {}) -- stylua: ignore end if true then return {} end return { "folke/flash.nvim", event = "VeryLazy", ---@type Flash.Config opts = { -- labels = "abcdefghijklmnopqrstuvwxyz", labels = "asdfghjklqwertyuiopzxcvbnm", search = { -- search/jump in all windows multi_window = true, -- search direction forward = true, -- when `false`, find only matches in the given direction wrap = true, ---@type Flash.Pattern.Mode -- Each mode will take ignorecase and smartcase into account. -- * exact: exact match -- * search: regular search -- * fuzzy: fuzzy search -- * fun(str): custom function that returns a pattern -- For example, to only match at the beginning of a word: -- mode = function(str) -- return "\\<" .. str -- end, mode = "exact", -- behave like `incsearch` incremental = false, -- Excluded filetypes and custom window filters ---@type (string|fun(win:window))[] exclude = { "notify", "cmp_menu", "noice", "flash_prompt", function(win) -- exclude non-focusable windows return not vim.api.nvim_win_get_config(win).focusable end, }, -- Optional trigger character that needs to be typed before -- a jump label can be used. It's NOT recommended to set this, -- unless you know what you're doing trigger = "", -- max pattern length. If the pattern length is equal to this -- labels will no longer be skipped. When it exceeds this length -- it will either end in a jump or terminate the search max_length = false, ---@type number|false }, jump = { -- save location in the jumplist jumplist = true, -- jump position pos = "start", ---@type "start" | "end" | "range" -- add pattern to search history history = false, -- add pattern to search register register = false, -- clear highlight after jump nohlsearch = false, -- automatically jump when there is only one match autojump = false, -- You can force inclusive/exclusive jumps by setting the -- `inclusive` option. By default it will be automatically -- set based on the mode. inclusive = nil, ---@type boolean? -- jump position offset. Not used for range jumps. -- 0: default -- 1: when pos == "end" and pos < current position offset = nil, ---@type number }, label = { -- allow uppercase labels uppercase = true, -- add any labels with the correct case here, that you want to exclude exclude = "", -- add a label for the first match in the current window. -- you can always jump to the first match with `` current = true, -- show the label after the match after = true, ---@type boolean|number[] -- show the label before the match before = false, ---@type boolean|number[] -- position of the label extmark style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline" -- flash tries to re-use labels that were already assigned to a position, -- when typing more characters. By default only lower-case labels are re-used. reuse = "lowercase", ---@type "lowercase" | "all" | "none" -- for the current window, label targets closer to the cursor first distance = true, -- minimum pattern length to show labels -- Ignored for custom labelers. min_pattern_length = 0, -- Enable this to use rainbow colors to highlight labels -- Can be useful for visualizing Treesitter ranges. rainbow = { enabled = false, -- number between 1 and 9 shade = 5, }, -- With `format`, you can change how the label is rendered. -- Should return a list of `[text, highlight]` tuples. ---@class Flash.Format ---@field state Flash.State ---@field match Flash.Match ---@field hl_group string ---@field after boolean ---@type fun(opts:Flash.Format): string[][] format = function(opts) return { { opts.match.label, opts.hl_group } } end, }, highlight = { -- show a backdrop with hl FlashBackdrop backdrop = true, -- Highlight the search matches matches = true, -- extmark priority priority = 5000, groups = { match = "FlashMatch", current = "FlashCurrent", backdrop = "FlashBackdrop", label = "FlashLabel", }, }, -- action to perform when picking a label. -- defaults to the jumping logic depending on the mode. ---@type fun(match:Flash.Match, state:Flash.State)|nil action = nil, -- initial pattern to use when opening flash pattern = "", -- When `true`, flash will try to continue the last search continue = false, -- Set config to a function to dynamically change the config config = nil, ---@type fun(opts:Flash.Config)|nil -- You can override the default options for a specific mode. -- Use it with `require("flash").jump({mode = "forward"})` ---@type table modes = { -- options used when flash is activated through -- a regular search with `/` or `?` search = { -- when `true`, flash will be activated during regular search by default. -- You can always toggle when searching with `require("flash").toggle()` enabled = false, highlight = { backdrop = false }, jump = { history = true, register = true, nohlsearch = true }, search = { -- `forward` will be automatically set to the search direction -- `mode` is always set to `search` -- `incremental` is set to `true` when `incsearch` is enabled }, }, -- options used when flash is activated through -- `f`, `F`, `t`, `T`, `;` and `,` motions char = { enabled = true, -- dynamic configuration for ftFT motions config = function(opts) -- autohide flash when in operator-pending mode opts.autohide = opts.autohide or (vim.fn.mode(true):find("no") and vim.v.operator == "y") -- disable jump labels when not enabled, when using a count, -- or when recording/executing registers opts.jump_labels = opts.jump_labels and vim.v.count == 0 and vim.fn.reg_executing() == "" and vim.fn.reg_recording() == "" -- Show jump labels only in operator-pending mode -- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o") end, -- hide after jump when not using jump labels autohide = false, -- show jump labels jump_labels = false, -- set to `false` to use the current line only multi_line = true, -- When using jump labels, don't use these keys -- This allows using those keys directly after the motion label = { exclude = "hjkliardc" }, -- by default all keymaps are enabled, but you can disable some of them, -- by removing them from the list. -- If you rather use another key, you can map them -- to something else, e.g., { [";"] = "L", [","] = H } keys = { "f", "F", "t", "T", ";", "," }, ---@alias Flash.CharActions table -- The direction for `prev` and `next` is determined by the motion. -- `left` and `right` are always left and right. char_actions = function(motion) return { [";"] = "next", -- set to `right` to always go right [","] = "prev", -- set to `left` to always go left -- clever-f style [motion:lower()] = "next", [motion:upper()] = "prev", -- jump2d style: same case goes next, opposite case goes prev -- [motion] = "next", -- [motion:match("%l") and motion:upper() or motion:lower()] = "prev", } end, search = { wrap = false }, highlight = { backdrop = true }, jump = { register = false, -- when using jump labels, set to 'true' to automatically jump -- or execute a motion when there is only one match autojump = false, }, }, -- options used for treesitter selections -- `require("flash").treesitter()` treesitter = { labels = "abcdefghijklmnopqrstuvwxyz", jump = { pos = "range", autojump = true }, search = { incremental = false }, label = { before = true, after = true, style = "inline" }, highlight = { backdrop = false, matches = false, }, }, treesitter_search = { jump = { pos = "range" }, search = { multi_window = true, wrap = true, incremental = false }, remote_op = { restore = true }, label = { before = true, after = true, style = "inline" }, }, -- options used for remote flash remote = { remote_op = { restore = true, motion = true }, }, }, -- options for the floating window that shows the prompt, -- for regular jumps -- `require("flash").prompt()` is always available to get the prompt text prompt = { enabled = true, prefix = { { "⚡", "FlashPromptIcon" } }, win_config = { relative = "editor", width = 1, -- when <=1 it's a percentage of the editor width height = 1, row = -1, -- when negative it's an offset from the bottom col = 0, -- when negative it's an offset from the right zindex = 1000, }, }, -- options for remote operator pending mode remote_op = { -- restore window views and cursor position -- after doing a remote operation restore = false, -- For `jump.pos = "range"`, this setting is ignored. -- `true`: always enter a new motion when doing a remote operation -- `false`: use the window's cursor position and jump target -- `nil`: act as `true` for remote windows, `false` for the current window motion = false, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/flatten.lua ================================================ return { -- Open files and command output from wezterm, kitty, and neovim terminals in your current neovim instance { "willothy/flatten.nvim", config = true, -- or pass configuration with opts = { window = { -- Options: -- current -> open in current window (default) -- alternate -> open in alternate window (recommended) -- tab -> open in new tab -- split -> open in split -- vsplit -> open in vsplit -- smart -> smart open (avoids special buffers) -- OpenHandler -> allows you to handle file opening yourself (see Types) -- open = "alternate", -- Options: -- vsplit -> opens files in diff vsplits -- split -> opens files in diff splits -- tab_vsplit -> creates a new tabpage, and opens diff vsplits -- tab_split -> creates a new tabpage, and opens diff splits -- OpenHandler -> allows you to handle file opening yourself (see Types) diff = "tab_vsplit", -- Affects which file gets focused when opening multiple at once -- Options: -- "first" -> open first file of new files (default) -- "last" -> open last file of new files focus = "first", }, }, -- Ensure that it runs first to minimize delay when opening file from terminal lazy = false, priority = 1001, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/fold.lua ================================================ return { -- UFO folding { "kevinhwang91/nvim-ufo", dependencies = { "kevinhwang91/promise-async", { "luukvbaal/statuscol.nvim", config = function() local builtin = require("statuscol.builtin") require("statuscol").setup({ relculright = true, segments = { { text = { builtin.foldfunc }, click = "v:lua.ScFa" }, { text = { "%s" }, click = "v:lua.ScSa" }, { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, }, }) end, }, }, event = "BufReadPost", opts = { provider_selector = function() return { "treesitter", "indent" } end, }, init = function() -- UFO folding vim.o.foldcolumn = "1" -- '0' is not bad vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.o.foldlevelstart = 99 vim.o.foldenable = true vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] vim.keymap.set("n", "zo", require("ufo").openAllFolds) vim.keymap.set("n", "zc", require("ufo").closeAllFolds) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/lazydev.lua ================================================ vim.api.nvim_create_user_command("PutMessage", function() vim.cmd([[put =execute('messages')]]) end, {}) return { { "folke/lazydev.nvim", ft = "lua", -- only load on lua files opts = { library = { -- Library items can be absolute paths -- "~/projects/my-awesome-lib", -- Or relative, which means they will be resolved as a plugin -- "LazyVim", -- When relative, you can also provide a path to the library in the plugin dir "luvit-meta/library", -- see below }, }, }, { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings { -- optional completion source for require statements and module annotations "hrsh7th/nvim-cmp", opts = function(_, opts) opts.sources = opts.sources or {} table.insert(opts.sources, { name = "lazydev", group_index = 0, -- set group index to 0 to skip loading LuaLS completions }) end, }, -- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/leap.lua ================================================ return { "ggandor/leap.nvim", config = function() -- Disable auto-jumping to the first match require("leap").opts.safe_labels = {} -- The below settings make Leap's highlighting closer to what you've been -- used to in Lightspeed. vim.api.nvim_set_hl(0, "LeapBackdrop", { link = "Comment" }) -- or some grey vim.api.nvim_set_hl(0, "LeapMatch", { -- For light themes, set to 'black' or similar. fg = "white", bold = true, nocombine = true, }) -- Deprecated option. Try it without this setting first, you might find -- you don't even miss it. require("leap").opts.highlight_unlabeled_phase_one_targets = true vim.keymap.set("n", "s", function() require("leap").leap({ target_windows = require("leap.user").get_focusable_windows(), }) end) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/multi-cursor.lua ================================================ return { -- Multi Cursor -- https://github.com/chrisgrieser/.config/blob/106d4eb2f039f1b9506fd5cfeed7e7d09f832e87/nvim/lua/plugins/bulk-processing.lua#L3C12-L3C12 "mg979/vim-visual-multi", event = "VeryLazy", init = function() -- Multi-Cursor https://github.com/mg979/vim-visual-multi/blob/master/doc/vm-mappings.txt -- vim.g.VM_leader = "\\" vim.g.VM_theme = "purplegray" vim.g.VM_maps = { -- TODO: fix mappings already been used to check project -- permanent mappings ["Find Under"] = "", ["Find Subword Under"] = "", -- select some text firstly , then -- ["Select Cursor Down"] = "", -- switch upper and lower window with jk -- ["Select Cursor Up"] = "", ["Select Cursor Down"] = "", -- ["Start Regex Search"] = "/", ["Visual All"] = "\\A", -- 1. selected some text in visual mode 2. press j to select all -- buffer mappings ["Switch Mode"] = "v", ["Skip Region"] = "q", ["Remove Region"] = "Q", ["Goto Next"] = "}", ["Goto Prev"] = "{", -- ["Duplicate"] = "d", ["Tools Menu"] = "\\t", ["Case Conversion Menu"] = "C", ["Align"] = "\\a", } -- https://github.com/mg979/vim-visual-multi/wiki/Mappings#full-mappings-list vim.g.VM_set_statusline = 0 -- already set via lualine component end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/preview-plantuml.lua ================================================ return { "https://gitlab.com/itaranto/plantuml.nvim", version = "*", config = function() require("plantuml").setup() end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/project.lua ================================================ vim.keymap.set({ "n", "v" }, "", "CdProject") return { { -- "LintaoAmons/cd-project.nvim", dir = "/Volumes/t7ex/Documents/oatnil/release/cd-project.nvim", init = function() require("cd-project").setup({ projects_config_filepath = vim.fn.stdpath("data") .. "/cd-project.nvim.json", project_dir_pattern = { ".git", ".gitignore", "Cargo.toml", "package.json", "go.mod" }, projects_picker = "telescope", -- optional, you can switch to `telescope` auto_register_project = true, format_json = true, hooks = { { trigger_point = "BEFORE_CD", callback = function(_) vim.print("before cd project") require("bookmarks").api.mark({name = "before cd project"}) end, }, { callback = function(_) require("telescope").extensions.smart_open.smart_open({ cwd_only = true, filename_first = false, }) end, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/scratch.lua ================================================ vim.keymap.set({ "n", "v", "i" }, "", "Scratch") vim.keymap.set({ "n", "v", "i" }, "", "ScratchOpen") return { "LintaoAmons/scratch.nvim", -- branch = "dev", -- dir = "/Volumes/t7ex/Documents/oatnil/release/scratch.nvim", config = function() require("scratch").setup({ scratch_file_dir = vim.fn.stdpath("cache") .. "/scratch.nvim", -- where your scratch files will be put filetypes = { "lua", "js", "sh", "ts", "md", "txt", "http", "html", "puml", "py" }, -- you can simply put filetype here hooks = { { callback = function() vim.print("hello") vim.api.nvim_buf_set_lines(0, 0, -1, false, { "hello", "world" }) end, }, }, filetype_details = { -- or, you can have more control here json = {}, -- empty table is fine ["project-name.md"] = { subdir = "project-name", -- group scratch files under specific sub folder }, ["yaml"] = {}, go = { requireDir = true, -- true if each scratch file requires a new directory filename = "main", -- the filename of the scratch file in the new directory content = { "package main", "", "func main() {", " ", "}" }, cursor = { location = { 4, 2 }, insert_mode = true, }, }, }, window_cmd = "edit", -- 'vsplit' | 'split' | 'edit' | 'tabedit' | 'rightbelow vsplit' file_picker = "fzflua", localKeys = { { filenameContains = { "sh" }, LocalKeys = { { cmd = "RunShellCurrentLine", key = "", modes = { "n", "i", "v" }, }, }, }, }, }) end, event = "VeryLazy", } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/show-color.lua ================================================ return { { "brenoprata10/nvim-highlight-colors", config = function() -- Ensure termguicolors is enabled if not already vim.opt.termguicolors = true require("nvim-highlight-colors").setup({}) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/smart-open.lua ================================================ local smart_open_cmd = function() require("telescope").extensions.smart_open.smart_open({ cwd_only = true, filename_first = false, }) end vim.keymap.set("n", "", smart_open_cmd, { silent = true }) local smart_open_all = function() require("telescope").extensions.smart_open.smart_open({ cwd_only = false, filename_first = false, }) end vim.keymap.set("n", "fp", smart_open_all) vim.api.nvim_create_user_command("SmartOpenAll", smart_open_all, {}) return { { "danielfalk/smart-open.nvim", branch = "0.2.x", config = function() require("telescope").load_extension("smart_open") end, dependencies = { "kkharji/sqlite.lua", -- Only required if using match_algorithm fzf { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, -- Optional. If installed, native fzy will be used when match_algorithm is fzy { "nvim-telescope/telescope-fzy-native.nvim" }, }, }, { "LintaoAmons/context-menu.nvim", opts = function() require("context-menu").setup({ close_menu = { "q", "", "" }, menu_items = { { order = 1, keymap = "o", cmd = "OpenFileInAllPlace", action = { type = "callback", callback = function(_) vim.cmd([[SmartOpenAll]]) end, }, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/surround.lua ================================================ return { -- { -- "NStefan002/visual-surround.nvim", -- opts = { -- surround_chars = { "[", "]", "(", ")", "'", '"', "`" }, -- }, -- }, { "kylechui/nvim-surround", event = "VeryLazy", config = function() require("nvim-surround").setup({}) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/switch-case.lua ================================================ vim.keymap.set({ "n", "x" }, "sc", "TextCaseOpenTelescope") return { { "johmsalas/text-case.nvim", dependencies = { "nvim-telescope/telescope.nvim" }, config = function() require("textcase").setup({}) require("telescope").load_extension("textcase") end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/terminal-and-run.lua ================================================ local log = require("util.log") local run_current_line = require("features.terminal-and-run").run_current_line vim.keymap.set({ "n", "v" }, "rl", run_current_line) vim.api.nvim_create_user_command("RunCurrentLine", run_current_line, {}) local run_selected = function() local editor = require("util.editor") local sys = require("util.base.sys") local stringUtil = require("util.base.strings") local selected = editor.buf.read.get_selected() local stdout, _, stderr = sys.run_sync(stringUtil.split_cmd_string(selected), ".") local result = stdout or stderr editor.buf.write.put_lines(result, "l", true, true) pcall(sys.copy_to_system_clipboard, stringUtil.join(result, "\n")) end vim.keymap.set({ "n", "v" }, "rk", run_selected) vim.api.nvim_create_user_command("RunSelected", run_selected, {}) local function cd_to_buffer_location() local editor = require("util.editor") local cmd = "cd " .. editor.buf.read.get_buf_abs_dir_path() local terminal = editor.get_first_visible_terminal() if not terminal then return log.error("No visible terminal found") end editor.buf.write.send_to_terminal_buf(terminal.id, cmd) vim.cmd([[TmuxNavigateDown]]) vim.cmd([[norm! i]]) end vim.keymap.set({ "n", "v" }, "si", cd_to_buffer_location) local function run_current_file() local cmd = function() if vim.bo.ft == "javascript" then vim.cmd([[!node %]]) elseif vim.bo.ft == "html" then vim.cmd([[!open %]]) end end vim.keymap.set({ "n", "v" }, "", cmd) vim.api.nvim_create_user_command("RunFile", cmd, {}) end run_current_file() -- local function popup_terminal() -- require("toggleterm.terminal").Terminal -- :new({ -- dir = "git_dir", -- direction = "float", -- float_opts = { -- border = "double", -- }, -- -- function to run on opening the terminal -- on_open = function(term) -- vim.cmd("startinsert!") -- vim.api.nvim_buf_set_keymap( -- term.bufnr, -- "n", -- "q", -- "close", -- { noremap = true, silent = true } -- ) -- vim.keymap.set({ "n", "v" }, "", function() -- term:shutdown() -- end, { noremap = true, silent = true, buffer = term.bufnr }) -- end, -- -- function to run on closing the terminal -- on_close = function(term) -- vim.api.nvim_buf_delete(term.bufnr, { force = true }) -- vim.cmd("startinsert!") -- end, -- }) -- :toggle() -- end -- -- REF: https://github.com/AstroNvim/astrocommunity/blob/d64d788e163f6d759e8a1adf4281dd5dd2841a78/lua/astrocommunity/terminal-integration/toggleterm-manager-nvim/init.lua -- if you only want these mappings for toggle term use term://*toggleterm#* instead function _G.set_terminal_keymaps() local opts = { buffer = 0 } vim.keymap.set("t", "", [[]], opts) vim.keymap.set("t", "", [[wincmd h]], opts) vim.keymap.set("t", "", [[wincmd j]], opts) vim.keymap.set("t", "", [[wincmd k]], opts) vim.keymap.set("t", "", [[wincmd l]], opts) vim.keymap.set("t", "", [[]], opts) vim.keymap.set("t", "", [[wincmd c]], opts) vim.keymap.set("t", "", [[]], opts) -- toggle disposable terminal end vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") return { { "LintaoAmons/context-menu.nvim", opts = function() require("context-menu").setup({ menu_items = { { cmd = "Run File", order = 1, not_ft = { "markdown", "toggleterm" }, action = { type = "callback", callback = function(context) if context.ft == "lua" then return vim.cmd([[source %]]) elseif context.ft == "javascript" then local stdout = vim.fn.system("node " .. vim.fn.expand("%:p")) local result = require("util.base.strings").split_into_lines(stdout) require("util.editor").split_and_write(result, {}) elseif context.ft == "typescript" then local stdout = vim.fn.system("ts-node " .. vim.fn.expand("%:p")) local result = require("util.base.strings").split_into_lines(stdout) require("util.editor").split_and_write(result, {}) end end, }, }, { cmd = "Close Terminal", order = 1, ft = { "toggleterm" }, action = { type = "callback", callback = function(context) vim.cmd("bd!") end, }, }, { cmd = "Terminal", keymap = "t", action = { type = "sub_cmds", sub_cmds = { { cmd = "Select Terminal", action = { type = "callback", callback = function(_) vim.cmd("TermSelect") end, }, }, { cmd = "New Terminal :: Tab", action = { type = "callback", callback = function(_) require("toggleterm.terminal").Terminal :new({ display_name = "Tab", direction = "tab", dir = vim.fn.expand("%:p:h"), auto_scroll = true, -- automatically scroll to the bottom on terminal output }) :toggle() end, }, }, { cmd = "Close Terminal", action = { type = "callback", callback = function(_) vim.cmd("bd!") end, }, }, }, }, }, -- { -- cmd = "Popup Terminal", -- order = 1, -- not_ft = { "markdown" }, -- action = { -- type = "callback", -- callback = function(_) -- popup_terminal() -- end, -- }, -- }, }, }) end, }, { "akinsho/toggleterm.nvim", version = "*", config = function() require("toggleterm").setup({ size = 20, }) -- init base terminal local new_base_term = function() return require("toggleterm.terminal").Terminal:new({ display_name = "Base", count = 1, direction = "horizontal", dir = vim.fn.expand("%:p:h"), auto_scroll = true, -- automatically scroll to the bottom on terminal output }) end new_base_term():spawn() local function toggle_term() local all = require("toggleterm.terminal").get_all(true) if #all == 0 then new_base_term():toggle() else vim.cmd("ToggleTermToggleAll") end end vim.keymap.set("n", "", toggle_term) vim.keymap.set("n", "sl", ":ToggleTermSendCurrentLine") vim.keymap.set("v", "sk", ":ToggleTermSendVisualSelection") end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/text-objects.lua ================================================ return { "echasnovski/mini.ai", version = "*", config = function() require("mini.ai").setup() end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/editor-enhance/trouble.lua ================================================ return { "folke/trouble.nvim", opts = {}, -- for default options, refer to the configuration section for custom setup. cmd = "Trouble", } ================================================ FILE: nvim/.config/nvim/lua/plugins/git/context-menu.lua ================================================ return { "LintaoAmons/context-menu.nvim", dependencies = { { "sindrets/diffview.nvim" }, { "lewis6991/gitsigns.nvim" }, { "isakbm/gitgraph.nvim" }, }, opts = function() require("context-menu").setup({ menu_items = { { cmd = "Git", keymap = "g", order = 85, action = { type = "sub_cmds", sub_cmds = { { cmd = "Git Status", action = { type = "callback", callback = function(_) vim.cmd([[DiffviewOpen]]) end, }, }, { cmd = "Branch History", action = { type = "callback", callback = function(_) vim.cmd([[DiffviewFileHistory]]) end, }, }, { cmd = "Current File Commit History", action = { type = "callback", callback = function(_) vim.cmd([[DiffviewFileHistory %]]) end, }, }, { cmd = "Commit Log Diagram", order = 86, action = { type = "callback", callback = function(_) require("gitgraph").draw({}, { all = true, max_count = 5000 }) end, }, }, { cmd = "Git :: Blame", order = 85, action = { type = "callback", callback = function(_) vim.cmd([[Gitsigns blame]]) end, }, }, { cmd = "Git :: Peek", order = 80, action = { type = "callback", callback = function(_) vim.cmd([[Gitsigns preview_hunk]]) end, }, }, { cmd = "Git :: Reset Hunk", order = 81, action = { type = "callback", callback = function(_) vim.cmd([[Gitsigns reset_hunk]]) end, }, }, { cmd = "Git :: Reset Buffer", order = 82, action = { type = "callback", callback = function(_) vim.cmd([[Gitsigns reset_buffer]]) end, }, }, { cmd = "Git :: Diff Current Buffer", order = 83, action = { type = "callback", callback = function(_) require("gitsigns").diffthis() end, }, }, }, }, }, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/git/diffview.lua ================================================ local gitStatus = "DiffviewOpen" vim.keymap.set("n", "", "" .. gitStatus .. "") vim.api.nvim_create_user_command("GitStatus", gitStatus, {}) return { { "sindrets/diffview.nvim", event = "VeryLazy", dependencies = "nvim-lua/plenary.nvim", config = function() local action = require("diffview.actions") require("diffview").setup({ keymaps = { view = { ["r"] = function() vim.cmd("GitResetHunk") vim.notify("Reset hunk") vim.cmd("DiffviewRefresh") end, ["gf"] = function() local diffview_tab = vim.api.nvim_get_current_tabpage() action.goto_file_edit() vim.api.nvim_command("tabclose " .. diffview_tab) end, }, file_history_panel = { { "n", "fa", "g!=a", { remap = true } }, { "n", "ff", "g!--", { remap = true } }, }, file_panel = { -- stash staged changes -- TODO: Add context menu -- ["S"] = function() -- vim.ui.input({ prompt = "Stash msg: " }, function(msg) -- local Job = require("plenary.job") -- local stderr = {} -- Job:new({ -- command = "git", -- args = { "stash", "-m", msg }, -- cwd = ".", -- on_stderr = function(_, data) -- table.insert(stderr, data) -- end, -- }):sync() -- end) -- end, ["c"] = function() vim.ui.input({ prompt = "Commit msg: " }, function(msg) local Job = require("plenary.job") local stderr = {} Job:new({ command = "git", args = { "commit", "-m", msg }, cwd = ".", on_stderr = function(_, data) table.insert(stderr, data) end, }):sync() end) end, ["p"] = function() vim.notify("Start to push") local Job = require("plenary.job") local stderr = {} Job:new({ command = "git", args = { "push" }, cwd = ".", on_stdout = function(_, data) vim.notify("Pushed to remote") end, on_stderr = function(_, data) table.insert(stderr, data) end, }):start() end, }, }, view = { default = { winbar_info = true, }, file_history = { winbar_info = true, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/git/gitgraph.lua ================================================ local function gitgraph() local cmd = function() require("gitgraph").draw({}, { all = true, max_count = 5000 }) end vim.keymap.set("n", "gl", cmd, { desc = "new git graph" }) end gitgraph() return { "isakbm/gitgraph.nvim", dependencies = { "sindrets/diffview.nvim" }, ---@type I.GGConfig opts = { symbols = { merge_commit = "M", commit = "*", }, format = { timestamp = "%H:%M:%S %d-%m-%Y", fields = { "hash", "timestamp", "author", "branch_name", "tag" }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/git/gitsign.lua ================================================ local prev_hunk = function() require("gitsigns").prev_hunk({ navigation_message = false }) vim.cmd([[normal! zz]]) end vim.keymap.set("n", "gk", prev_hunk) local next_hunk = function() require("gitsigns").next_hunk({ navigation_message = false }) vim.cmd([[normal! zz]]) end vim.keymap.set("n", "gj", next_hunk) return { -- git signs highlights text that has changed since the list -- git commit, and also lets you interactively stage & unstage -- hunks in a commit. { "lewis6991/gitsigns.nvim", opts = { signs = { add = { text = "▎" }, change = { text = "▎" }, delete = { text = "" }, topdelete = { text = "" }, changedelete = { text = "▎" }, untracked = { text = "▎" }, }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/git/neogit.lua ================================================ return { "NeogitOrg/neogit", dependencies = { "nvim-lua/plenary.nvim", -- required "sindrets/diffview.nvim", -- optional - Diff integration -- Only one of these is needed. "nvim-telescope/telescope.nvim", -- optional "ibhagwan/fzf-lua", -- optional "echasnovski/mini.pick", -- optional }, config = true } ================================================ FILE: nvim/.config/nvim/lua/plugins/init.lua ================================================ return { { import = "plugins.editor-core" }, { import = "plugins.lang-core" }, { import = "plugins.git" }, { import = "plugins.editor-enhance" }, { import = "plugins.lang" }, { import = "plugins.ui" }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/css.lua ================================================ return { "luckasRanarison/tailwind-tools.nvim", name = "tailwind-tools", build = ":UpdateRemotePlugins", dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-telescope/telescope.nvim", -- optional }, opts = {}, -- your configuration } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/go.lua ================================================ return { -- # Syntax hightlight { "nvim-treesitter/nvim-treesitter", -- use opts to extend the ensure_installed table opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "go", "gomod", "gowork", "gosum" }) end, }, -- # LSP -- ## ensure_install lang specfic LSP { "williamboman/mason.nvim", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "gopls" }) end, }, { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) -- ## extend the servers table opts.servers = opts.servers or {} opts.servers.lua_ls = { settings = { gopls = { gofumpt = true, codelenses = { gc_details = false, generate = true, regenerate_cgo = true, run_govulncheck = true, test = true, tidy = true, upgrade_dependency = true, vendor = true, }, hints = { assignVariableTypes = true, compositeLiteralFields = true, compositeLiteralTypes = true, constantValues = true, functionTypeParameters = true, parameterNames = true, rangeVariableTypes = true, }, analyses = { fieldalignment = true, nilness = true, unusedparams = true, unusedwrite = true, useany = true, }, usePlaceholders = true, completeUnimported = true, staticcheck = true, directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" }, semanticTokens = true, }, }, } end, }, -- Debug { "williamboman/mason.nvim", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "delve" }) end, }, { "nvimtools/none-ls.nvim", optional = true, dependencies = { { "williamboman/mason.nvim", opts = { ensure_installed = { "gomodifytags", "impl" } }, }, }, opts = function(_, opts) local nls = require("null-ls") opts.sources = vim.list_extend(opts.sources or {}, { nls.builtins.code_actions.gomodifytags, nls.builtins.code_actions.impl, nls.builtins.formatting.goimports, nls.builtins.formatting.gofumpt, }) end, }, { "stevearc/conform.nvim", optional = true, opts = { formatters_by_ft = { go = { "goimports", "gofumpt" }, }, }, }, { "mfussenegger/nvim-dap", optional = true, dependencies = { { "leoluz/nvim-dap-go", opts = {}, }, }, }, { "nvim-neotest/neotest", optional = true, dependencies = { "fredrikaverpil/neotest-golang", }, opts = { adapters = { ["neotest-golang"] = { -- Here we can set options for neotest-golang, e.g. -- go_test_args = { "-v", "-race", "-count=1", "-timeout=60s" }, dap_go_enabled = true, -- requires leoluz/nvim-dap-go }, }, }, }, -- Filetype icons { "echasnovski/mini.icons", opts = { file = { [".go-version"] = { glyph = "", hl = "MiniIconsBlue" }, }, filetype = { gotmpl = { glyph = "󰟓", hl = "MiniIconsGrey" }, }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/helm.lua ================================================ return { { "towolf/vim-helm", ft = "helm" }, { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "helm" }) end, }, { "neovim/nvim-lspconfig", opts = { servers = { helm_ls = {}, }, setup = { yamlls = function() vim.api.nvim_create_autocmd("LspAttach", { pattern = "*.helm", callback = function(args) local buffer = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) if client and client.name == "yamlls" then if vim.bo[buffer].filetype == "helm" then vim.schedule(function() vim.cmd("LspStop ++force yamlls") end) end end end, }) end, }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/http.lua ================================================ local group_name = "langHttp" vim.api.nvim_create_augroup(group_name, { clear = true }) -- Set indentation to 2 spaces vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { group = group_name, pattern = { "*.http", }, command = "setlocal ft=http", }) return { { "LintaoAmons/context-menu.nvim", dependencies = { "mistweaverco/kulala.nvim", }, opts = function() require("context-menu").setup({ menu_items = { { cmd = "Send HTTP Request", fix = 1, ft = { "http" }, action = { type = "callback", callback = function(_) require("kulala").run() end, }, }, { cmd = "HTTP", fix = 2, ft = { "http" }, action = { type = "sub_cmds", sub_cmds = { { cmd = "Re Run", fix = 1, action = { type = "callback", callback = function(_) require("kulala").replay() end, }, }, { cmd = "Copy Curl", fix = 1, action = { type = "callback", callback = function(_) require("kulala").copy() end, }, }, { cmd = "From Curl", fix = 1, action = { type = "callback", callback = function(_) require("kulala").from_curl() end, }, }, { cmd = "Set Env", action = { type = "callback", callback = function(_) require('kulala').set_selected_env() end, }, }, { cmd = "Get Current Env", action = { type = "callback", callback = function(_) require('kulala').get_selected_env() end, }, }, }, }, }, }, }) end, }, -- HTTP REST-Client Interface { "mistweaverco/kulala.nvim", config = function() -- -- Setup is required, even if you don't pass any options require("kulala").setup({ default_view = "headers_body", }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/json.lua ================================================ local jq_query = function() local sys = require("util.base.sys") local editor = require("util.editor") vim.ui.input({ prompt = 'Query pattern, e.g. `.[] | .["@message"].message` ' }, function(pattern) local absPath = editor.buf.read.get_buf_abs_path() local stdout, _, stderr = sys.run_sync({ "jq", pattern, absPath }, ".") local result = stdout or stderr editor.split_and_write(result, { vertical = true, ft = "json" }) end) end vim.keymap.set({ "n", "v" }, "rq", jq_query) return { -- # Syntax hightlight { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- ## use opts to extend the ensure_installed table vim.g.config_utils.opts_ensure_installed(opts, { "json", "jsonc" }) end, }, -- # Format { "stevearc/conform.nvim", opts = { formatters_by_ft = { json = { "jq", "prettierd", stop_after_first = true }, json5 = { "prettierd" }, jsonc = { "prettierd" }, }, }, }, { "LintaoAmons/context-menu.nvim", opts = function(_, opts) require("context-menu").setup({ menu_items = { { cmd = "Jq Query", ft = { "json" }, action = { type = "callback", callback = function(_) jq_query() end, }, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/jsts.lua ================================================ local group_name = "langJsTs" vim.api.nvim_create_augroup(group_name, { clear = true }) -- use as example to show how to automatically set the indentation of a specific filetype -- Set indentation to 2 spaces vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { group = group_name, pattern = { "*.js", "*.ts", }, command = "setlocal shiftwidth=2 tabstop=2", }) return { -- # Syntax hightlight { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "javascript", "typescript", "tsx", "jsdoc", "prisma", }) end, }, -- # LSP { "williamboman/mason-lspconfig.nvim", dependencies = { { -- NOTE: use vtsls instead of typescript-language-server "yioneko/nvim-vtsls", lazy = true, opts = {}, config = function() require("vtsls").config({}) end, }, }, opts = function(_, opts) -- ## ensure install lang specfic LSP vim.g.config_utils.opts_ensure_installed(opts, { "lua_ls" }) -- ## extend the servers table opts.servers = opts.servers or {} opts.servers.tsserver = { enabled = false, } opts.servers.vtsls = { -- explicitly add default filetypes, so that we can extend -- them in related extras filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", }, settings = { complete_function_calls = true, vtsls = { enableMoveToFileCodeAction = true, autoUseWorkspaceTsdk = true, experimental = { completion = { enableServerSideFuzzyMatch = true, }, }, }, typescript = { updateImportsOnFileMove = { enabled = "always" }, suggest = { completeFunctionCalls = true, }, inlayHints = { enumMemberValues = { enabled = true }, functionLikeReturnTypes = { enabled = true }, parameterNames = { enabled = "literals" }, parameterTypes = { enabled = true }, propertyDeclarationTypes = { enabled = true }, variableTypes = { enabled = false }, }, }, }, } end, }, -- # Format { "stevearc/conform.nvim", -- use opts to extend the formatters_by_ft table opts = function(_, opts) opts.formatters_by_ft["javascript"] = { "prettier" } opts.formatters_by_ft["typescript"] = { "prettier" } opts.formatters_by_ft["tsx"] = { "prettier" } opts.formatters_by_ft["jsx"] = { "prettier" } opts.formatters_by_ft["jsdoc"] = { "prettier" } end, }, -- # Debug { "microsoft/vscode-js-debug", build = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out", }, { "mxsdev/nvim-dap-vscode-js", config = function() require("dap-vscode-js").setup({ debugger_path = vim.fn.resolve(vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"), adapters = { "chrome", "pwa-node", "pwa-chrome", "pwa-msedge", "pwa-extensionHost" }, }) end, }, -- ## Parse launch.json { "Joakker/lua-json5", build = "./install.sh" }, { "mfussenegger/nvim-dap", optional = true, opts = function() local dap = require("dap") if not dap.adapters["pwa-node"] then require("dap").adapters["pwa-node"] = { type = "server", host = "localhost", port = "${port}", executable = { command = "node", -- 💀 Make sure to update this path to point to your installation args = { require("mason-registry").get_package("js-debug-adapter"):get_install_path() .. "/js-debug/src/dapDebugServer.js", "${port}", }, }, } end for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do dap.configurations[language] = { { type = "pwa-node", request = "launch", name = "Launch file", program = "${file}", cwd = "${workspaceFolder}", }, { type = "pwa-node", request = "launch", name = "Launch Current File (pwa-node with ts-node)", -- cwd = vim.fn.getcwd(), cwd = "${workspaceFolder}", -- runtimeArgs = { "--loader", "ts-node/esm" }, runtimeExecutable = "ts-node", args = { "${file}" }, sourceMaps = true, protocol = "inspector", skipFiles = { "/**", "node_modules/**" }, resolveSourceMapLocations = { "${workspaceFolder}/**", "!**/node_modules/**", }, }, { type = "pwa-node", request = "attach", name = "Attach", processId = require("dap.utils").pick_process, cwd = "${workspaceFolder}", }, } end end, }, } -- REFs: -- - https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/typescript.lua -- - https://github.com/AstroNvim/astrocommunity/blob/f219659b67b246584c421074d73db0a941af5cbd/lua/astrocommunity/pack/typescript/init.lua -- - https://github.com/anasrar/.dotfiles/blob/4c444c3ab2986db6ca7e2a47068222e47fd232e2/neovim/.config/nvim/lua/rin/DAP/languages/typescript.lua ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/lua-and-example.lua ================================================ vim.api.nvim_create_augroup("langLua", { clear = true }) -- Set indentation to 2 spaces vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { group = "langLua", pattern = { "*.lua", }, command = "setlocal shiftwidth=2 tabstop=2 expandtab", }) return { -- # Syntax hightlight { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- ## use opts to extend the ensure_installed table vim.g.config_utils.opts_ensure_installed(opts, { "lua", "luadoc", }) end, }, -- # LSP { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) -- ## ensure_install lang specfic LSP vim.g.config_utils.opts_ensure_installed(opts, { "lua_ls" }) -- ## extend the servers table opts.servers = opts.servers or {} opts.servers.lua_ls = { -- cmd = {...}, -- filetypes = { ...}, -- capabilities = {}, settings = { Lua = { completion = { callSnippet = "Replace", }, -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings -- diagnostics = { disable = { 'missing-fields' } }, }, }, } end, }, -- # Format { "stevearc/conform.nvim", -- use opts to extend the formatters_by_ft table opts = function(_, opts) opts.formatters_by_ft["lua"] = { "stylua" } end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/markdown.lua ================================================ return { -- # Syntax hightlight { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- ## use opts to extend the ensure_installed table vim.g.config_utils.opts_ensure_installed(opts, { "markdown", "markdown_inline", }) end, }, -- # LSP -- ## ensure_install lang specfic LSP { "williamboman/mason.nvim", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "marksman" }) end, }, { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) -- ## use opts to extend the ensure_installed table vim.g.config_utils.opts_ensure_installed(opts, { "marksman" }) end, }, -- # Format { "stevearc/conform.nvim", -- use opts to extend the formatters_by_ft table opts = function(_, opts) opts.formatters_by_ft["markdown"] = { "prettierd" } end, }, { -- dir = "/Volumes/t7ex/Documents/Github/markdown-toc.nvim", "LintaoAmons/markdown-toc.nvim", ft = "markdown", -- Lazy load on markdown filetype cmd = { "Mtoc" }, -- Or, lazy load on "Mtoc" command opts = { headings = { -- Include headings before the ToC (or current line for `:Mtoc insert`) before_toc = false, -- Either list of lua patterns, -- or a function that returns boolean (true means to EXCLUDE heading) exclude = {}, pattern = "^(#+)%s+(.+)$", }, }, }, { "MeanderingProgrammer/render-markdown.nvim", opts = { file_types = { "markdown", "Avante" }, }, ft = { "markdown", "Avante" }, }, { "LintaoAmons/context-menu.nvim", opts = function() require("context-menu").setup({ menu_items = { { cmd = "Toggle Markdown View", order = 1, ft = { "markdown" }, action = { type = "callback", callback = function(_) if vim.opt.conceallevel ~= 0 then vim.opt.conceallevel = 0 else vim.opt.conceallevel = 2 end vim.cmd([[Markview]]) end, }, }, { fix = 1, cmd = "Markdown Preview", ft = { "markdown" }, action = { type = "callback", callback = function(_) vim.cmd([[MarkdownPreview]]) end, }, }, { fix = 1, cmd = "Markdown TOC generation", ft = { "markdown" }, action = { type = "callback", callback = function(_) vim.cmd([[Mtoc]]) end, }, }, }, }) end, }, { "mzlogin/vim-markdown-toc", ft = { "markdown" }, -- GenTocGitLab, GenTocMarded }, { "HakonHarnes/img-clip.nvim", event = "BufEnter", branch = "fix/insert-base64-markup", opts = { filetypes = { markdown = { relative_to_current_file = true, dir_path = function() return "asset_" .. vim.fn.expand("%:t:r") end, }, }, default = { dir_path = "relative", -- directory path to save images to, can be relative (cwd or current file) or absolute file_name = "%Y-%m-%d-%H-%M-%S", -- file name format (see lua.org/pil/22.1.html) url_encode_path = false, -- encode spaces and special characters in file path use_absolute_path = false, -- expands dir_path to an absolute path relative_to_current_file = false, -- make dir_path relative to current file rather than the cwd relative_template_path = true, -- make file path in the template relative to current file rather than the cwd prompt_for_file_name = true, -- ask user for file name before saving, leave empty to use default show_dir_path_in_prompt = false, -- show dir_path in prompt when prompting for file name use_cursor_in_template = true, -- jump to cursor position in template after pasting insert_mode_after_paste = true, -- enter insert mode after pasting the markup code embed_image_as_base64 = true, -- paste image as base64 string instead of saving to file -- process_cmd = "convert -quality 25 - -", max_base64_size = 200, -- max size of base64 string in KB template = "$FILE_PATH", -- default template drag_and_drop = { enabled = true, -- enable drag and drop mode insert_mode = false, -- enable drag and drop in insert mode copy_images = false, -- copy images instead of using the original file download_images = true, -- download images and save them to dir_path instead of using the URL }, }, }, }, { "iamcco/markdown-preview.nvim", cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, ft = { "markdown" }, build = function() vim.fn["mkdp#util#install"]() end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/prisma.lua ================================================ vim.api.nvim_create_augroup("langPrisma", { clear = true }) vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { group = "langPrisma", pattern = { "*.prisma", }, command = "setlocal shiftwidth=2 tabstop=2", }) return {} ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/python.lua ================================================ return { { "stevearc/conform.nvim", opts = function(_, opts) opts.formatters_by_ft["python"] = { "ruff_format" } end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/sh.lua ================================================ return { -- # Format { "stevearc/conform.nvim", opts = function(_, opts) opts.formatters_by_ft["sh"] = { "shfmt" } opts.formatters_by_ft["zsh"] = { "shfmt" } end, }, { "LintaoAmons/context-menu.nvim", opts = function(_, opts) require("context-menu").setup({ menu_items = { { cmd = "RunCurrentLine", fix = 1, ft = { "sh" }, action = { type = "callback", callback = function(context) local stdout = vim.fn.system(context.line) local lines = require("util.base.strings").split_into_lines(stdout) vim.api.nvim_set_current_buf(context.buffer) vim.api.nvim_put(lines, "l", true, true) end, }, }, }, }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/terraform.lua ================================================ -- lang-core.formatting.lua conform.nvim -- lang-core.lint.lua nvim-lint.nvim -- lang-core.tresitter nvim-treesitter return { { "stevearc/conform.nvim", opts = { formatters_by_ft = { tf = { "terraform_fmt" }, terraform = { "terraform_fmt" }, ["terraform-vars"] = { "terraform_fmt" }, }, }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/test-menu.lua ================================================ return { "LintaoAmons/context-menu.nvim", dependencies = { { "sindrets/diffview.nvim" }, { "lewis6991/gitsigns.nvim" }, { "isakbm/gitgraph.nvim" }, }, opts = function() require("context-menu").setup({ menu_items = { { cmd = "Test", action = { type = "sub_cmds", sub_cmds = { { cmd = "Run Current File", action = { type = "callback", callback = function(_) require("neotest").run.run(vim.fn.expand("%")) end, }, }, { cmd = "Run Nearest", action = { type = "callback", callback = function(_) require("neotest").run.run() end, }, }, -- { -- cmd = "Debug Nearest", -- action = { -- type = "callback", -- callback = function(_) -- require("neotest").run.run({strategy = "dap"}) -- end, -- }, -- }, { cmd = "Run Last", action = { type = "callback", callback = function(_) require("neotest").run.run_last() end, }, }, { cmd = "Run Suite", action = { type = "callback", callback = function(_) require("neotest").run.run({ suite = true }) end, }, }, { cmd = "Stop Nearest", action = { type = "callback", callback = function(_) require("neotest").run.stop() end, }, }, { cmd = "Attach Nearest", action = { type = "callback", callback = function(_) require("neotest").run.attach() end, }, }, { cmd = "Output Panel", action = { type = "sub_cmds", sub_cmds = { { cmd = "Open", action = { type = "callback", callback = function(_) require("neotest").output_panel.open() end, }, }, { cmd = "Close", action = { type = "callback", callback = function(_) require("neotest").output_panel.close() end, }, }, { cmd = "Toggle", action = { type = "callback", callback = function(_) require("neotest").output_panel.toggle() end, }, }, { cmd = "Clear", action = { type = "callback", callback = function(_) require("neotest").output_panel.clear() end, }, }, }, }, }, { cmd = "Watch", action = { type = "sub_cmds", sub_cmds = { { cmd = "Toggle Current File", action = { type = "callback", callback = function(_) require("neotest").watch.toggle(vim.fn.expand("%")) end, }, }, { cmd = "Stop All", action = { type = "callback", callback = function(_) require("neotest").watch.stop() end, }, }, }, }, }, { cmd = "Summary", action = { type = "sub_cmds", sub_cmds = { { cmd = "Open", action = { type = "callback", callback = function(_) require("neotest").summary.open() end, }, }, { cmd = "Close", action = { type = "callback", callback = function(_) require("neotest").summary.close() end, }, }, { cmd = "Toggle", action = { type = "callback", callback = function(_) require("neotest").summary.toggle() end, }, }, }, }, }, }, }, }, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang/vim.lua ================================================ return { -- Syntax hightlight { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) vim.g.config_utils.opts_ensure_installed(opts, { "vim", "vimdoc", }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/cmp.lua ================================================ return { -- use CmpStatus to check the running cmp sources -- auto completion { "onsails/lspkind-nvim", event = "InsertEnter", config = function() local lspkind = require("lspkind") local cmp = require("cmp") cmp.setup({ formatting = { format = lspkind.cmp_format({ mode = "symbol", -- show only symbol annotations maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- can also be a function to dynamically calculate max width such as -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) show_labelDetails = true, -- show labelDetails in menu. Disabled by default symbol_map = { Supermaven = "" }, -- The function below will be called before any actual modifications from lspkind -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) }), }, }) end, }, { "hrsh7th/nvim-cmp", version = false, -- last release is way too old event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", }, opts = function() vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") local defaults = require("cmp.config.default")() return { completion = { completeopt = "menu,menuone,noinsert", }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. -- [""] = cmp.mapping.confirm({ -- behavior = cmp.ConfirmBehavior.Replace, -- select = true, -- }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. -- [""] = function(fallback) -- cmp.abort() -- fallback() -- end, }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "path" }, { name = "supermaven" }, }, { { name = "buffer" }, }), -- experimental = { -- ghost_text = { -- hl_group = "CmpGhostText", -- }, -- }, sorting = defaults.sorting, } end, ---@param opts cmp.ConfigSchema config = function(_, opts) for _, source in ipairs(opts.sources) do source.group_index = source.group_index or 1 end require("cmp").setup(opts) end, }, { "hrsh7th/cmp-cmdline", keys = { ":", "/", "?" }, -- lazy load cmp on more keys along with insert mode dependencies = { "hrsh7th/nvim-cmp" }, opts = function() local cmp = require("cmp") return { { type = "/", mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" }, }, }, { type = ":", mapping = cmp.mapping.preset.cmdline({ [""] = { c = function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() end end, }, [""] = { c = function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, }, [""] = { c = function(fallback) if cmp.visible() then cmp.select_next_item() cmp.select_prev_item() else fallback() end end, }, }), sources = cmp.config.sources({ { name = "path" }, }, { { name = "cmdline", option = { ignore_cmds = { "Man", "!" }, }, }, }), }, } end, config = function(_, opts) local cmp = require("cmp") vim.tbl_map(function(val) cmp.setup.cmdline(val.type, val) end, opts) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/debug.lua ================================================ local function setup_keybinding_and_commands() local toggle_debug_ui = function() require("dapui").toggle() end vim.api.nvim_create_user_command("ToggleDebugUI", toggle_debug_ui, {}) local eval = function() require("dapui").eval() end vim.keymap.set("n", "", eval) vim.api.nvim_create_user_command("DebugEval", eval, {}) local start_or_continue = function() if vim.fn.filereadable("./vscode/launch.json") then local dap_vscode = require("dap.ext.vscode") dap_vscode.load_launchjs(nil, {}) end require("dap").continue() end vim.keymap.set("n", "", start_or_continue) vim.api.nvim_create_user_command("DebugStartOrContinue", start_or_continue, {}) local step_over = function() require("dap").step_over() end vim.keymap.set("n", "", step_over) vim.api.nvim_create_user_command("DebugStepOver", step_over, {}) local step_into = function() require("dap").step_into() end vim.keymap.set("n", "", step_into) vim.api.nvim_create_user_command("DebugStepInto", step_into, {}) local terminate = function() require("dap").terminate() end vim.keymap.set("n", "", terminate) vim.api.nvim_create_user_command("DebugStop", terminate, {}) local toggle_break_point = function() require("dap").toggle_breakpoint() end vim.keymap.set("n", "", toggle_break_point) vim.api.nvim_create_user_command("DebugToggleBreakpoint", toggle_break_point, {}) end setup_keybinding_and_commands() return { -- fancy UI for the debugger { "rcarriga/nvim-dap-ui", dependencies = { "nvim-neotest/nvim-nio" }, config = function(_, opts) -- setup dap config by VsCode launch.json file -- require("dap.ext.vscode").load_launchjs() local dap = require("dap") local dapui = require("dapui") dapui.setup(opts) dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open({}) -- vim.g.is_debuging = true end end, }, { "theHamsta/nvim-dap-virtual-text", config = function() require("nvim-dap-virtual-text").setup({ enabled = true, -- enable this plugin (the default) enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) show_stop_reason = true, -- show stop reason when stopped for exceptions commented = false, -- prefix virtual text with comment string only_first_definition = true, -- only show virtual text at first definition (if there are multiple) all_references = false, -- show virtual text on all all references of the variable (not only definitions) clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping) --- A callback that determines how a variable is displayed or whether it should be omitted --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable --- @param buf number --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) --- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed display_callback = function(variable, buf, stackframe, node, options) -- by default, strip out new line characters if options.virt_text_pos == "inline" then return " = " .. variable.value:gsub("%s+", " ") else return variable.name .. " = " .. variable.value:gsub("%s+", " ") end end, -- position of virtual text, see `:h nvim_buf_set_extmark()`, default tries to inline the virtual text. Use 'eol' to set to end of line virt_text_pos = vim.fn.has("nvim-0.10") == 1 and "inline" or "eol", -- experimental features: all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) virt_text_win_col = nil, -- position the virtual text at a fixed window column (starting from the first text column) , -- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()` }) end, }, { "mfussenegger/nvim-dap", dependencies = { -- mason.nvim integration { "jay-babu/mason-nvim-dap.nvim", dependencies = "mason.nvim", cmd = { "DapInstall", "DapUninstall" }, opts = { -- Makes a best effort to setup the various debuggers with -- reasonable debug configurations automatic_installation = true, -- You can provide additional configuration to the handlers, -- see mason-nvim-dap README for more information handlers = {}, -- You'll need to check that you have the required things installed -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want }, }, }, }, config = function() -- stylua ignore vim.fn.sign_define("DapBreakpoint", { text = "🔴", linehl = "DapBreakpoint" }) vim.fn.sign_define("DapStopped", { text = "▶️", linehl = "DapBreakpointStopped" }) vim.fn.sign_define("DapBreakpointCondition", { text = " " }) vim.fn.sign_define("DapLogPoint", { text = ".>" }) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/find-and-replace.lua ================================================ vim.keymap.set({ "n", "v" }, "", function() require("grug-far").grug_far() end) return { "MagicDuck/grug-far.nvim", config = function() require("grug-far").setup({ wrap = false, keymaps = { replace = { n = "r" }, qflist = { n = "q" }, syncLocations = { n = "s" }, syncLine = { n = "l" }, close = { n = "c" }, historyOpen = { n = "t" }, historyAdd = { n = "a" }, refresh = { n = "f" }, openLocation = { n = "o" }, openNextLocation = { n = "" }, openPrevLocation = { n = "" }, gotoLocation = { n = "" }, pickHistoryEntry = { n = "" }, abort = { n = "b" }, help = { n = "g?" }, toggleShowCommand = { n = "p" }, swapEngine = { n = "e" }, previewLocation = { n = "i" }, swapReplacementInterpreter = { n = "x" }, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/formatting.lua ================================================ (function() local formatFunc = function(args) local range = nil if args and 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_fallback = true, range = range }) end vim.keymap.set("n", "fm", formatFunc) vim.api.nvim_create_user_command("Format", formatFunc, { range = true }) end)() local prettier_supported = { "css", "graphql", "handlebars", "html", "javascript", "javascriptreact", "json", "jsonc", "less", "markdown", "markdown.mdx", "scss", "typescript", "typescriptreact", "vue", "yaml", } return { "stevearc/conform.nvim", opts = { formatters_by_ft = { xml = { "xmlformat" }, }, }, config = function(_, opts) for _, ft in ipairs(prettier_supported) do opts.formatters_by_ft[ft] = { "prettier" } end require("conform").setup(opts) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/lint.lua ================================================ return { "mfussenegger/nvim-lint", config = function() -- TODO: find a way to modulize the config require("lint").linters_by_ft = { markdown = { "vale" }, tf = { "tfsec" }, terraform = { "tfsec" }, ["terraform-vars"] = { "tfsec" }, } end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/lsp.lua ================================================ local goto_definition = function() vim.cmd("Lspsaga goto_definition") vim.cmd([[normal! zz]]) end vim.keymap.set("n", "gd", goto_definition) vim.api.nvim_create_user_command("GotoDefinition", goto_definition, {}) local goto_function_name = "AerialPrev" vim.keymap.set("n", "gm", "" .. goto_function_name .. "") vim.api.nvim_create_user_command("GoToFunctionName", goto_function_name, {}) local function go_to_ref() local cmd = "Lspsaga finder" vim.keymap.set("n", "gr", "" .. cmd .. "") vim.api.nvim_create_user_command("GoToReference", cmd, {}) end go_to_ref() local function go_to_type_def() local cmd = "Lspsaga goto_type_definition" vim.keymap.set("n", "gt", "" .. cmd .. "") vim.api.nvim_create_user_command("GoToTypeDefinition", cmd, {}) end go_to_type_def() local function goto_error_then_hint() local pos_equal = function(p1, p2) local r1, c1 = unpack(p1) local r2, c2 = unpack(p2) return r1 == r2 and c1 == c2 end local cmd = function() local pos = vim.api.nvim_win_get_cursor(0) vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR, wrap = true }) local pos2 = vim.api.nvim_win_get_cursor(0) if pos_equal(pos, pos2) then vim.diagnostic.goto_next({ wrap = true }) end end vim.keymap.set("n", "]e", cmd) end goto_error_then_hint() local function rename() local cmd = "Lspsaga rename" vim.keymap.set("n", "rn", "" .. cmd .. "") end rename() local function goto_error_then_hint_prev() local pos_equal = function(p1, p2) local r1, c1 = unpack(p1) local r2, c2 = unpack(p2) return r1 == r2 and c1 == c2 end local cmd = function() local pos = vim.api.nvim_win_get_cursor(0) vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR, wrap = true }) local pos2 = vim.api.nvim_win_get_cursor(0) if pos_equal(pos, pos2) then vim.diagnostic.goto_prev({ wrap = true }) end end vim.keymap.set("n", "[e", cmd) end goto_error_then_hint_prev() -- This function gets run when an LSP attaches to a particular buffer. -- That is to say, every time a new file is opened that is associated with -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this -- function will be executed to configure the current buffer vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), callback = function(event) -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.server_capabilities.documentHighlightProvider then local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references, }) vim.api.nvim_create_autocmd("LspDetach", { group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), callback = function(event2) vim.lsp.buf.clear_references() vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf, }) end, }) end if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then vim.keymap.set("n", "th", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end, { desc = "[T]oggle Inlay [H]ints" }) end end, }) return { -- Mason install and manage LSP servers { "williamboman/mason.nvim", config = function(_, opts) require("mason").setup() end, }, -- mason-lspconfig.nvim closes some gaps that exist between mason.nvim and lspconfig. { "williamboman/mason-lspconfig.nvim", config = function(_, opts) -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- -- Add any additional override configuration in the following tables. Available keys are: -- - cmd (table): Override the default command used to start the server -- - filetypes (table): Override the default list of associated filetypes for the server -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = opts.servers or {} -- you can extend the servers table inside lang specific config -- for example, in ../lang/lua-and-example.lua -- servers.lua_ls = { -- -- cmd = {...}, -- -- filetypes = { ...}, -- -- capabilities = {}, -- settings = { -- Lua = { -- completion = { -- callSnippet = "Replace", -- }, -- -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings -- -- diagnostics = { disable = { 'missing-fields' } }, -- }, -- }, -- } -- TODO: put this in to config of `neovim/nvim-lspconfig` local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) local config = { ensure_installed = opts.ensure_installed, handlers = { function(server_name) local server = servers[server_name] or {} server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) require("lspconfig")[server_name].setup(server) end, }, } -- vim.print(config) -- uncommant this line to see the config require("mason-lspconfig").setup(config) end, }, -- LSP Configuration & Plugins { "neovim/nvim-lspconfig", dependencies = { -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { "j-hui/fidget.nvim", opts = {} }, }, config = function(_, opts) end, }, { "ray-x/lsp_signature.nvim", event = "VeryLazy", opts = {}, config = function() require("lsp_signature").setup({ floating_window = false, hint_prefix = "", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash -- or, provide a table with 3 icons -- hint_prefix = { -- above = "↙ ", -- when the hint is on the line above the current line -- current = "← ", -- when the hint is on the same line -- below = "↖ " -- when the hint is on the line below the current line -- } hint_scheme = "String", hint_inline = function() return false end, }) end, }, { "WhoIsSethDaniel/mason-tool-installer.nvim", optional = true, config = function() require("mason-tool-installer").setup({ -- a list of all tools you want to ensure are installed upon -- start ensure_installed = { -- you can pin a tool to a particular version -- { "golangci-lint", version = "v1.47.0" }, -- you can turn off/on auto_update per tool { "bash-language-server", auto_update = true }, -- frontend -- frontend.tailwindcss "tailwindcss-language-server", -- terraform "terraform-ls", "tflint", "tfsec", "lua-language-server", "vim-language-server", "stylua", "shellcheck", "editorconfig-checker", "impl", "json-to-struct", "luacheck", "misspell", "shellcheck", "shfmt", "staticcheck", -- golang -- "gopls", -- "gofumpt", -- "golines", -- "gomodifytags", -- "gotests", -- -- "revive", -- "vint", }, -- if set to true this will check each tool for updates. If updates -- are available the tool will be updated. This setting does not -- affect :MasonToolsUpdate or :MasonToolsInstall. -- Default: false auto_update = false, -- automatically install / update on startup. If set to false nothing -- will happen on startup. You can use :MasonToolsInstall or -- :MasonToolsUpdate to install tools and check for updates. -- Default: true run_on_start = true, -- set a delay (in ms) before the installation starts. This is only -- effective if run_on_start is set to true. -- e.g.: 5000 = 5 second delay, 10000 = 10 second delay, etc... -- Default: 0 start_delay = 3000, -- 3 second delay -- Only attempt to install if 'debounce_hours' number of hours has -- elapsed since the last time Neovim was started. This stores a -- timestamp in a file named stdpath('data')/mason-tool-installer-debounce. -- This is only relevant when you are using 'run_on_start'. It has no -- effect when running manually via ':MasonToolsInstall' etc.... -- Default: nil debounce_hours = 5, -- at least 5 hours between attempts to install/update -- By default all integrations are enabled. If you turn on an integration -- and you have the required module(s) installed this means you can use -- alternative names, supplied by the modules, for the thing that you want -- to install. If you turn off the integration (by setting it to false) you -- cannot use these alternative names. It also suppresses loading of those -- module(s) (assuming any are installed) which is sometimes wanted when -- doing lazy loading. integrations = { ["mason-lspconfig"] = true, ["mason-null-ls"] = true, ["mason-nvim-dap"] = true, }, }) end, }, { "nvimdev/lspsaga.nvim", config = function() require("lspsaga").setup({ -- symbol_in_winbar = { -- enable = false, -- }, lightbulb = { enable = false, enable_in_insert = false, -- sign = true, -- sign_priority = 40, -- virtual_text = false, }, outline = { auto_preview = false, }, definition = { keys = { edit = "o", }, }, }) end, event = "LspAttach", dependencies = { "nvim-treesitter/nvim-treesitter", -- optional "nvim-tree/nvim-web-devicons", -- optional }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/refactor.lua ================================================ -- vim.keymap.set({"n", "v"}, "ev", "Refactor extract_var", {}) return { { "ThePrimeagen/refactoring.nvim", dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", }, config = function() require("refactoring").setup({}) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/snippet.lua ================================================ return { { "L3MON4D3/LuaSnip", build = (not jit.os:find("Windows")) and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" or nil, dependencies = { { "rafamadriz/friendly-snippets", config = function() require("luasnip.loaders.from_vscode").lazy_load() end, }, { "nvim-cmp", dependencies = { "saadparwaiz1/cmp_luasnip", }, opts = function(_, opts) opts.snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, } table.insert(opts.sources, { name = "luasnip" }) end, }, }, opts = function(_, opts) local ls = require("luasnip") local types = require("luasnip.util.types") ls.setup({ keep_roots = true, link_roots = true, link_children = true, -- Update more often, :h events for more info. update_events = "TextChanged,TextChangedI", -- Snippets aren't automatically removed if their text is deleted. -- `delete_check_events` determines on which events (:h events) a check for -- deleted snippets is performed. -- This can be especially useful when `history` is enabled. delete_check_events = "TextChanged", ext_opts = { [types.choiceNode] = { active = { virt_text = { { "choiceNode", "Comment" } }, }, }, }, -- treesitter-hl has 100, use something higher (default is 200). ext_base_prio = 300, -- minimal increase in priority. ext_prio_increase = 1, enable_autosnippets = true, -- mapping for cutting selected text so it's usable as SELECT_DEDENT, -- SELECT_RAW or TM_SELECTED_TEXT (mapped via xmap). store_selection_keys = "", }) require("luasnip.loaders.from_lua").lazy_load({ paths = { vim.fn.stdpath("config") .. "/lua/snippets/lua_snippets" }, }) require("luasnip.loaders.from_vscode").lazy_load({ paths = { vim.fn.stdpath("config") .. "/lua/snippets" }, }) end, -- stylua: ignore keys = { { "", function() return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" end, expr = true, silent = true, mode = "i", }, { "", function() require("luasnip").jump(1) end, mode = "s" }, { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, }, }, -- snippets { "chrisgrieser/nvim-scissors", dependencies = { "L3MON4D3/LuaSnip", } }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/test.lua ================================================ local run_nearest = function() require("neotest").run.run() end vim.api.nvim_create_user_command("TestRunNearest", run_nearest, {}) local run_file = function() require("neotest").run.run(vim.fn.expand("%")) end vim.api.nvim_create_user_command("TestRunFile", run_file, {}) local summary_toggle = function() require("neotest").summary.toggle() end vim.api.nvim_create_user_command("TestSummaryToggle", summary_toggle, {}) local function debug_nearest() require("neotest").run.run({ strategy = "dap" }) end vim.api.nvim_create_user_command("TestDebugNearest", debug_nearest, {}) return { { "nvim-neotest/neotest", dependencies = { "nvim-neotest/nvim-nio", "nvim-neotest/neotest-jest", }, config = function() local neotest_ns = vim.api.nvim_create_namespace("neotest") vim.diagnostic.config({ virtual_text = { format = function(diagnostic) -- Replace newline and tab characters with space for more compact diagnostics local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") return message end, }, }, neotest_ns) require("neotest").setup({ adapters = { require("neotest-jest")({ jestCommand = "jest", jestConfigFile = "custom.jest.config.ts", env = { CI = true }, cwd = function(path) return vim.fn.getcwd() end, }), }, status = { virtual_text = true }, output = { open_on_run = true }, quickfix = { open = function() require("trouble").open({ mode = "quickfix", focus = false }) end, }, }) end, }, } -- keys = { -- {"t", "", desc = "+test"}, -- { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, -- { "tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" }, -- { "tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, -- { "tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, -- { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, -- { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, -- { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, -- { "tS", function() require("neotest").run.stop() end, desc = "Stop" }, -- { "tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch" }, -- }, -- { -- "mfussenegger/nvim-dap", -- optional = true, -- -- stylua: ignore -- keys = { -- { "td", function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" }, -- }, -- }, ================================================ FILE: nvim/.config/nvim/lua/plugins/lang-core/treesitter.lua ================================================ return { { "nvim-treesitter/nvim-treesitter-context", config = function() require("treesitter-context").setup({ enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. line_numbers = true, multiline_threshold = 20, -- Maximum number of lines to show for a single context trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' -- Separator between context and content. Should be a single character string, like '-'. -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. separator = nil, zindex = 20, -- The Z-index of the context window on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching }) end, }, { "nvim-treesitter/nvim-treesitter", config = function(_, opts) local config = { incremental_selection = { enable = true, keymaps = { node_incremental = "v", node_decremental = "V", }, }, ensure_installed = opts.ensure_installed, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, -- Automatically install missing parsers when entering buffer -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally auto_install = true, -- List of parsers to ignore installing (or "all") ignore_install = { "javascript" }, ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! highlight = { enable = true, -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is -- the name of the parser) -- list of language that will be disabled -- disable = { "c", "rust" }, -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files disable = function(lang, buf) if lang == "help" then return true end local max_filesize = 100 * 1024 -- 100 KB local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) if ok and stats and stats.size > max_filesize then return true end end, -- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- Using this option may slow down your editor, and you may see some duplicate highlights. -- Instead of true it can also be a list of languages additional_vim_regex_highlighting = false, }, } -- vim.print(config) -- uncomment to see the final config require("nvim-treesitter.configs").setup(config) end, dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects" }, { "windwp/nvim-ts-autotag" }, }, init = function() vim.cmd([[ set foldmethod=expr set foldexpr=nvim_treesitter#foldexpr() ]]) end, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/beacon.lua ================================================ return { "danilamihailov/beacon.nvim" } -- lazy calls setup() by itself ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/cursor-word.lua ================================================ return { "echasnovski/mini.cursorword", version = "*", config = function() require("mini.cursorword").setup() end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/dress.lua ================================================ return { 'stevearc/dressing.nvim', opts = {}, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/heirline.lua ================================================ -- thx: https://github.com/dragove/dotfiles/blob/54cd02ab2f749d6ffbb5cc473b44bafc09913be7/nvim/.config/nvim/lua/plugins/ui/heirline.lua#L2 return { 'rebelot/heirline.nvim', lazy = false, config = function() local utils = require('heirline.utils') local conditions = require('heirline.conditions') local catppuccin = require('catppuccin.palettes').get_palette('frappe') local Align = { provider = '%=' } local Space = { provider = ' ' } local colors = { bg = catppuccin.base, fg = catppuccin.text, red = catppuccin.red, green = catppuccin.green, yellow = catppuccin.yellow, blue = catppuccin.blue, magenta = catppuccin.peach, cyan = catppuccin.teal, dark = catppuccin.mantle, } require('heirline').load_colors(colors) local viMode = { init = function(self) self.mode = vim.fn.mode(1) end, static = { mode_names = { -- change the strings if you like it vvvvverbose! n = '󰭩 N', no = '󰭩 N?', nov = '󰭩 N?', noV = '󰭩 N?', ['no\22'] = '󰭩 N?', niI = '󰭩 Ni', niR = '󰭩 Nr', niV = '󰭩 Nv', nt = '󰭩 Nt', v = '󰉸 V', vs = '󰉸 Vs', V = '󰉸 V_', Vs = '󰉸 Vs', ['\22'] = '󰉸 ^V', ['\22s'] = '󰉸 ^V', s = '󰛔 S', S = '󰛔 S_', ['\19'] = '󰛔 ^S', i = ' I', ic = ' Ic', ix = ' Ix', R = ' R', Rc = ' Rc', Rx = ' Rx', Rv = ' Rv', Rvc = ' Rv', Rvx = ' Rv', c = ' C', cv = ' Ex', r = '...', rm = 'M', ['r?'] = '?', ['!'] = '!', t = ' T', }, mode_colors = { n = 'red', i = 'green', v = 'cyan', V = 'cyan', ['\22'] = 'cyan', c = 'orange', s = 'purple', S = 'purple', ['\19'] = 'purple', R = 'orange', r = 'orange', ['!'] = 'red', t = 'red', }, }, provider = function(self) return ' %2(' .. self.mode_names[self.mode] .. '%)' end, hl = function(self) local mode = self.mode:sub(1, 1) -- get only the first mode character return { fg = self.mode_colors[mode], bold = true } end, update = { 'ModeChanged', pattern = '*:*', callback = vim.schedule_wrap(function() vim.cmd('redrawstatus') end), }, } local FileNameBlock = { -- let's first set up some attributes needed by this component and it's children init = function(self) self.filename = vim.api.nvim_buf_get_name(0) end, } -- We can now define some children separately and add them later local FileIcon = { init = function(self) local filename = self.filename local extension = vim.fn.fnamemodify(filename, ':e') self.icon, self.icon_color = require('nvim-web-devicons').get_icon_color(filename, extension, { default = true }) end, provider = function(self) return self.icon and (self.icon .. ' ') end, hl = function(self) return { fg = self.icon_color } end, } local FileName = { provider = function(self) local filename = vim.fn.fnamemodify(self.filename, ':.') if filename == '' then return '[No Name]' end if not conditions.width_percent_below(#filename, 0.25) then filename = vim.fn.pathshorten(filename) end return filename end, hl = { fg = utils.get_highlight('Directory').fg }, } local FileFlags = { { condition = function() return vim.bo.modified end, provider = '[+]', hl = { fg = 'green' }, }, { condition = function() return not vim.bo.modifiable or vim.bo.readonly end, provider = '', hl = { fg = 'orange' }, }, } FileNameBlock = utils.insert(FileNameBlock, FileIcon, utils.insert(FileName), FileFlags, { provider = '%<' }) local MacroRec = { condition = function() return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0 end, provider = ' ', hl = { fg = 'orange', bold = true }, utils.surround({ '[', ']' }, nil, { provider = function() return vim.fn.reg_recording() end, hl = { fg = 'green', bold = true }, }), update = { 'RecordingEnter', 'RecordingLeave', }, } local SearchCount = { condition = function() return vim.v.hlsearch ~= 0 and vim.o.cmdheight == 0 end, init = function(self) local ok, search = pcall(vim.fn.searchcount) if ok and search.total then self.search = search end end, provider = function(self) local search = self.search return string.format('[%d/%d]', search.current, math.min(search.total, search.maxcount)) end, } local ShowCmd = { condition = function() return vim.o.cmdheight == 0 end, provider = '%2(%S%)', } local lspProgress = require('lsp-progress') local api = require('lsp-progress.api') lspProgress.setup({ client_format = function(_, spinner, series_messages) return #series_messages > 0 and (spinner .. ' ' .. table.concat(series_messages, ', ')) or nil end, format = function(client_messages) local names = {} local clients = api.lsp_clients() for _, server in pairs(clients) do table.insert(names, server.name) end local sign = '󰙴 ' if #client_messages > 0 then return sign .. ' ' .. table.concat(client_messages, ' ') end if #clients > 0 then return sign .. table.concat(names, ' ') end return '' end, }) local LSPActive = { condition = conditions.lsp_attached, update = { 'User', pattern = 'LspProgressStatusUpdated', callback = vim.schedule_wrap(function() vim.cmd('redrawstatus') end), }, provider = function() return lspProgress.progress() end, hl = { fg = 'green' }, } local Ruler = { provider = '%7(%l/%L%):%2c', } local Git = { condition = conditions.is_git_repo, init = function(self) self.status_dict = vim.b.gitsigns_status_dict self.has_changes = self.status_dict.added ~= 0 or self.status_dict.removed ~= 0 or self.status_dict.changed ~= 0 end, hl = { fg = 'magenta' }, { provider = function(self) return ' ' .. self.status_dict.head end, hl = { bold = true }, }, { condition = function(self) return self.has_changes end, provider = '(', }, { provider = function(self) local count = self.status_dict.added or 0 return count > 0 and ('+' .. count) end, hl = { fg = 'green' }, }, { provider = function(self) local count = self.status_dict.removed or 0 return count > 0 and ('-' .. count) end, hl = { fg = 'red' }, }, { provider = function(self) local count = self.status_dict.changed or 0 return count > 0 and ('~' .. count) end, hl = { fg = 'yellow' }, }, { condition = function(self) return self.has_changes end, provider = '%-3()%)', }, } require('heirline').setup({ statusline = { MacroRec, viMode, Space, FileNameBlock, SearchCount, ShowCmd, Align, LSPActive, Align, Ruler, Space, Git, }, }) end, dependencies = { { 'nvim-tree/nvim-web-devicons' }, { 'lewis6991/gitsigns.nvim' }, { 'catppuccin' }, { 'linrongbin16/lsp-progress.nvim' }, }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/hlchuck.lua ================================================ return { "shellRaining/hlchunk.nvim", event = { "BufReadPre", "BufNewFile" }, config = function() require("hlchunk").setup({ chunk = { enable = true, }, indent = { enable = true, }, line_num = { enable = true, } }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/noice.lua ================================================ return { "folke/noice.nvim", event = "VeryLazy", config = function() require("noice").setup({ views = { mini = { win_options = { winblend = 0, }, }, }, lsp = { override = { ["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.stylize_markdown"] = true, ["cmp.entry.get_documentation"] = true, }, signature = { enabled = false, }, }, messages = { enabled = false, -- enables the Noice messages UI }, notify = { -- Noice can be used as `vim.notify` so you can route any notification like other messages -- Notification messages have their level and other properties set. -- event is always "notify" and kind can be any log level as a string -- The default routes will forward notifications to nvim-notify -- Benefit of using Noice for this is the routing and consistent history view enabled = false, }, routes = { { filter = { event = "msg_show", any = { { find = "%d+L, %d+B" }, { find = "; after #%d+" }, { find = "; before #%d+" }, }, }, view = "mini", }, }, presets = { bottom_search = true, command_palette = true, long_message_to_split = true, inc_rename = true, }, }) end, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/nui-components.lua ================================================ return { enabled = false, "grapp-dev/nui-components.nvim", dependencies = { "MunifTanjim/nui.nvim", }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/themes.lua ================================================ -- vim.api.nvim_set_hl(0, "IncSearch", { bg = "#c14a4a" }) -- test color -- vim.api.nvim_set_hl(0, "Visual", { bg = "#c14a4a" }) -- test color return { -- "rktjmp/lush.nvim", -- { -- "ab-dx/ares.nvim", -- name = "ares", -- priority = 1000, -- init = function() -- vim.cmd.colorscheme("ares") -- end, -- }, { "catppuccin/nvim", name = "catppuccin", init = function() vim.cmd.colorscheme("catppuccin") end, priority = 1000, -- Thanks: https://github.com/catppuccin/nvim/discussions/323#discussioncomment-5287724 opts = function() return { background = { light = "latte", dark = "mocha", }, color_overrides = { latte = { rosewater = "#c14a4a", flamingo = "#c14a4a", red = "#c14a4a", maroon = "#c14a4a", pink = "#945e80", mauve = "#945e80", peach = "#c35e0a", yellow = "#b47109", green = "#6c782e", teal = "#4c7a5d", sky = "#4c7a5d", sapphire = "#4c7a5d", blue = "#45707a", lavender = "#45707a", text = "#654735", subtext1 = "#73503c", subtext0 = "#805942", overlay2 = "#8c6249", overlay1 = "#8c856d", overlay0 = "#a69d81", surface2 = "#bfb695", surface1 = "#d1c7a3", surface0 = "#e3dec3", base = "#f9f5d7", mantle = "#f0ebce", crust = "#e8e3c8", }, mocha = { rosewater = "#ea6962", flamingo = "#ea6962", red = "#ea6962", maroon = "#ea6962", pink = "#d3869b", mauve = "#d3869b", peach = "#e78a4e", yellow = "#d8a657", green = "#a9b665", teal = "#89b482", sky = "#89b482", sapphire = "#89b482", blue = "#7daea3", lavender = "#7daea3", text = "#ebdbb2", subtext1 = "#d5c4a1", subtext0 = "#bdae93", overlay2 = "#a89984", overlay1 = "#928374", overlay0 = "#595959", surface2 = "#4d4d4d", surface1 = "#404040", surface0 = "#292929", base = "#1d2021", mantle = "#191b1c", crust = "#141617", }, }, highlight_overrides = { all = function(colors) return { CurSearch = { bg = colors.rosewater }, IncSearch = { bg = colors.rosewater }, DashboardFooter = { fg = colors.overlay0 }, TreesitterContextBottom = { style = {} }, WinSeparator = { fg = colors.overlay0, style = { "bold" } }, Visual = { bg = "#BB4747", fg = "white" }, DapBreakpoint = { bg = "#552B24" }, DapBreakpointStopped = { bg = "#244C55" }, NeotestPassed = { fg = colors.green }, NeotestFailed = { fg = colors.red }, NeotestRunning = { fg = colors.yellow }, NeotestSkipped = { fg = colors.blue }, NeotestFile = { fg = colors.peach }, NeotestNamespace = { fg = colors.peach }, NeotestDir = { fg = colors.peach }, NeotestFocused = { fg = colors.mauve, bold = true, underline = true }, NeotestAdapterName = { fg = colors.red }, NeotestIndent = { fg = colors.yellow }, NeotestExpandMarker = { fg = colors.yellow }, NeotestWinSelect = { fg = colors.yellow, bold = true }, NeotestTest = { fg = colors.subtext2 }, TreesitterContext = { bg = "#2A1E39" }, CmpItemMenu = { fg = colors.surface2 }, CursorLine = { bg = "#261F1E" }, CursorLineNr = { fg = colors.text }, FloatBorder = { bg = colors.base, fg = colors.surface0 }, GitSignsChange = { fg = colors.peach }, LineNr = { fg = colors.overlay0 }, LspInfoBorder = { link = "FloatBorder" }, NeoTreeDirectoryIcon = { fg = colors.subtext1 }, NeoTreeDirectoryName = { fg = colors.subtext1 }, NeoTreeFloatBorder = { link = "TelescopeResultsBorder" }, NeoTreeGitConflict = { fg = colors.red }, NeoTreeGitDeleted = { fg = colors.red }, NeoTreeGitIgnored = { fg = colors.overlay0 }, NeoTreeGitModified = { fg = colors.peach }, NeoTreeGitStaged = { fg = colors.green }, NeoTreeGitUnstaged = { fg = colors.red }, NeoTreeGitUntracked = { fg = colors.green }, NeoTreeIndent = { fg = colors.surface1 }, NeoTreeNormal = { bg = colors.mantle }, NeoTreeNormalNC = { bg = colors.mantle }, NeoTreeRootName = { fg = colors.subtext1, style = { "bold" } }, NeoTreeTabActive = { fg = colors.text, bg = colors.mantle }, NeoTreeTabInactive = { fg = colors.surface2, bg = colors.crust }, NeoTreeTabSeparatorActive = { fg = colors.mantle, bg = colors.mantle }, NeoTreeTabSeparatorInactive = { fg = colors.crust, bg = colors.crust }, NeoTreeWinSeparator = { fg = colors.base, bg = colors.base }, NormalFloat = { bg = colors.base }, Pmenu = { bg = colors.mantle, fg = "" }, PmenuSel = { bg = colors.surface0, fg = "" }, TelescopePreviewBorder = { bg = colors.crust, fg = colors.crust }, TelescopePreviewNormal = { bg = colors.crust }, TelescopePreviewTitle = { fg = colors.crust, bg = colors.crust }, TelescopePromptBorder = { bg = colors.surface0, fg = colors.surface0 }, TelescopePromptCounter = { fg = colors.mauve, style = { "bold" } }, TelescopePromptNormal = { bg = colors.surface0 }, TelescopePromptPrefix = { bg = colors.surface0 }, TelescopePromptTitle = { fg = colors.surface0, bg = colors.surface0 }, TelescopeResultsBorder = { bg = colors.mantle, fg = colors.mantle }, TelescopeResultsNormal = { bg = colors.mantle }, TelescopeResultsTitle = { fg = colors.mantle, bg = colors.mantle }, TelescopeSelection = { bg = colors.surface0 }, VertSplit = { bg = colors.base, fg = colors.surface0 }, WhichKeyFloat = { bg = colors.mantle }, YankHighlight = { bg = colors.surface2 }, FidgetTask = { fg = colors.subtext2 }, FidgetTitle = { fg = colors.peach }, IblIndent = { fg = colors.surface0 }, IblScope = { fg = colors.overlay0 }, Boolean = { fg = colors.mauve }, Number = { fg = colors.mauve }, Float = { fg = colors.mauve }, PreProc = { fg = colors.mauve }, PreCondit = { fg = colors.mauve }, Include = { fg = colors.mauve }, Define = { fg = colors.mauve }, Conditional = { fg = colors.red }, Repeat = { fg = colors.red }, Keyword = { fg = colors.red }, Typedef = { fg = colors.red }, Exception = { fg = colors.red }, Statement = { fg = colors.red }, Error = { fg = colors.red }, StorageClass = { fg = colors.peach }, Tag = { fg = colors.peach }, Label = { fg = colors.peach }, Structure = { fg = colors.peach }, Operator = { fg = colors.peach }, Title = { fg = colors.peach }, Special = { fg = colors.yellow }, SpecialChar = { fg = colors.yellow }, Type = { fg = colors.yellow, style = { "bold" } }, Function = { fg = colors.green, style = { "bold" } }, Delimiter = { fg = colors.subtext2 }, Ignore = { fg = colors.subtext2 }, Macro = { fg = colors.teal }, TSAnnotation = { fg = colors.mauve }, TSAttribute = { fg = colors.mauve }, TSBoolean = { fg = colors.mauve }, TSCharacter = { fg = colors.teal }, TSCharacterSpecial = { link = "SpecialChar" }, TSComment = { link = "Comment" }, TSConditional = { fg = colors.red }, TSConstBuiltin = { fg = colors.mauve }, TSConstMacro = { fg = colors.mauve }, TSConstant = { fg = colors.text }, TSConstructor = { fg = colors.green }, TSDebug = { link = "Debug" }, TSDefine = { link = "Define" }, TSEnvironment = { link = "Macro" }, TSEnvironmentName = { link = "Type" }, TSError = { link = "Error" }, TSException = { fg = colors.red }, TSField = { fg = colors.blue }, TSFloat = { fg = colors.mauve }, TSFuncBuiltin = { fg = colors.green }, TSFuncMacro = { fg = colors.green }, TSFunction = { fg = colors.green }, TSFunctionCall = { fg = colors.green }, TSInclude = { fg = colors.red }, TSKeyword = { fg = colors.red }, TSKeywordFunction = { fg = colors.red }, TSKeywordOperator = { fg = colors.peach }, TSKeywordReturn = { fg = colors.red }, TSLabel = { fg = colors.peach }, TSLiteral = { link = "String" }, TSMath = { fg = colors.blue }, TSMethod = { fg = colors.green }, TSMethodCall = { fg = colors.green }, TSNamespace = { fg = colors.yellow }, TSNone = { fg = colors.text }, TSNumber = { fg = colors.mauve }, TSOperator = { fg = colors.peach }, TSParameter = { fg = colors.text }, TSParameterReference = { fg = colors.text }, TSPreProc = { link = "PreProc" }, TSProperty = { fg = colors.blue }, TSPunctBracket = { fg = colors.text }, TSPunctDelimiter = { link = "Delimiter" }, TSPunctSpecial = { fg = colors.blue }, TSRepeat = { fg = colors.red }, TSStorageClass = { fg = colors.peach }, TSStorageClassLifetime = { fg = colors.peach }, TSStrike = { fg = colors.subtext2 }, TSString = { fg = colors.teal }, TSStringEscape = { fg = colors.green }, TSStringRegex = { fg = colors.green }, TSStringSpecial = { link = "SpecialChar" }, TSSymbol = { fg = colors.text }, TSTag = { fg = colors.peach }, TSTagAttribute = { fg = colors.green }, TSTagDelimiter = { fg = colors.green }, TSText = { fg = colors.green }, TSTextReference = { link = "Constant" }, TSTitle = { link = "Title" }, TSTodo = { link = "Todo" }, TSType = { fg = colors.yellow, style = { "bold" } }, TSTypeBuiltin = { fg = colors.yellow, style = { "bold" } }, TSTypeDefinition = { fg = colors.yellow, style = { "bold" } }, TSTypeQualifier = { fg = colors.peach, style = { "bold" } }, TSURI = { fg = colors.blue }, TSVariable = { fg = colors.text }, TSVariableBuiltin = { fg = colors.mauve }, ["@annotation"] = { link = "TSAnnotation" }, ["@attribute"] = { link = "TSAttribute" }, ["@boolean"] = { link = "TSBoolean" }, ["@character"] = { link = "TSCharacter" }, ["@character.special"] = { link = "TSCharacterSpecial" }, ["@comment"] = { link = "TSComment" }, ["@conceal"] = { link = "Grey" }, ["@conditional"] = { link = "TSConditional" }, ["@constant"] = { link = "TSConstant" }, ["@constant.builtin"] = { link = "TSConstBuiltin" }, ["@constant.macro"] = { link = "TSConstMacro" }, ["@constructor"] = { link = "TSConstructor" }, ["@debug"] = { link = "TSDebug" }, ["@define"] = { link = "TSDefine" }, ["@error"] = { link = "TSError" }, ["@exception"] = { link = "TSException" }, ["@field"] = { link = "TSField" }, ["@float"] = { link = "TSFloat" }, ["@function"] = { link = "TSFunction" }, ["@function.builtin"] = { link = "TSFuncBuiltin" }, ["@function.call"] = { link = "TSFunctionCall" }, ["@function.macro"] = { link = "TSFuncMacro" }, ["@include"] = { link = "TSInclude" }, ["@keyword"] = { link = "TSKeyword" }, ["@keyword.function"] = { link = "TSKeywordFunction" }, ["@keyword.operator"] = { link = "TSKeywordOperator" }, ["@keyword.return"] = { link = "TSKeywordReturn" }, ["@label"] = { link = "TSLabel" }, ["@math"] = { link = "TSMath" }, ["@method"] = { link = "TSMethod" }, ["@method.call"] = { link = "TSMethodCall" }, ["@namespace"] = { link = "TSNamespace" }, ["@none"] = { link = "TSNone" }, ["@number"] = { link = "TSNumber" }, ["@operator"] = { link = "TSOperator" }, ["@parameter"] = { link = "TSParameter" }, ["@parameter.reference"] = { link = "TSParameterReference" }, ["@preproc"] = { link = "TSPreProc" }, ["@property"] = { link = "TSProperty" }, ["@punctuation.bracket"] = { link = "TSPunctBracket" }, ["@punctuation.delimiter"] = { link = "TSPunctDelimiter" }, ["@punctuation.special"] = { link = "TSPunctSpecial" }, ["@repeat"] = { link = "TSRepeat" }, ["@storageclass"] = { link = "TSStorageClass" }, ["@storageclass.lifetime"] = { link = "TSStorageClassLifetime" }, ["@strike"] = { link = "TSStrike" }, ["@string"] = { link = "TSString" }, ["@string.escape"] = { link = "TSStringEscape" }, ["@string.regex"] = { link = "TSStringRegex" }, ["@string.special"] = { link = "TSStringSpecial" }, ["@symbol"] = { link = "TSSymbol" }, ["@tag"] = { link = "TSTag" }, ["@tag.attribute"] = { link = "TSTagAttribute" }, ["@tag.delimiter"] = { link = "TSTagDelimiter" }, ["@text"] = { link = "TSText" }, ["@text.danger"] = { link = "TSDanger" }, ["@text.diff.add"] = { link = "diffAdded" }, ["@text.diff.delete"] = { link = "diffRemoved" }, ["@text.emphasis"] = { link = "TSEmphasis" }, ["@text.environment"] = { link = "TSEnvironment" }, ["@text.environment.name"] = { link = "TSEnvironmentName" }, ["@text.literal"] = { link = "TSLiteral" }, ["@text.math"] = { link = "TSMath" }, ["@text.note"] = { link = "TSNote" }, ["@text.reference"] = { link = "TSTextReference" }, ["@text.strike"] = { link = "TSStrike" }, ["@text.strong"] = { link = "TSStrong" }, ["@text.title"] = { link = "TSTitle" }, ["@text.todo"] = { link = "TSTodo" }, ["@text.todo.checked"] = { link = "Green" }, ["@text.todo.unchecked"] = { link = "Ignore" }, ["@text.underline"] = { link = "TSUnderline" }, ["@text.uri"] = { link = "TSURI" }, ["@text.warning"] = { link = "TSWarning" }, ["@todo"] = { link = "TSTodo" }, ["@type"] = { link = "TSType" }, ["@type.builtin"] = { link = "TSTypeBuiltin" }, ["@type.definition"] = { link = "TSTypeDefinition" }, ["@type.qualifier"] = { link = "TSTypeQualifier" }, ["@uri"] = { link = "TSURI" }, ["@variable"] = { link = "TSVariable" }, ["@variable.builtin"] = { link = "TSVariableBuiltin" }, ["@lsp.type.class"] = { link = "TSType" }, ["@lsp.type.comment"] = { link = "TSComment" }, ["@lsp.type.decorator"] = { link = "TSFunction" }, ["@lsp.type.enum"] = { link = "TSType" }, ["@lsp.type.enumMember"] = { link = "TSProperty" }, ["@lsp.type.events"] = { link = "TSLabel" }, ["@lsp.type.function"] = { link = "TSFunction" }, ["@lsp.type.interface"] = { link = "TSType" }, ["@lsp.type.keyword"] = { link = "TSKeyword" }, ["@lsp.type.macro"] = { link = "TSConstMacro" }, ["@lsp.type.method"] = { link = "TSMethod" }, ["@lsp.type.modifier"] = { link = "TSTypeQualifier" }, ["@lsp.type.namespace"] = { link = "TSNamespace" }, ["@lsp.type.number"] = { link = "TSNumber" }, ["@lsp.type.operator"] = { link = "TSOperator" }, ["@lsp.type.parameter"] = { link = "TSParameter" }, ["@lsp.type.property"] = { link = "TSProperty" }, ["@lsp.type.regexp"] = { link = "TSStringRegex" }, ["@lsp.type.string"] = { link = "TSString" }, ["@lsp.type.struct"] = { link = "TSType" }, ["@lsp.type.type"] = { link = "TSType" }, ["@lsp.type.typeParameter"] = { link = "TSTypeDefinition" }, ["@lsp.type.variable"] = { link = "TSVariable" }, } end, }, integrations = { telescope = { enabled = true, style = "nvchad", }, }, dim_inactive = { enabled = true, -- dims the background color of inactive window shade = "light", percentage = 0.5, -- percentage of the shade to apply to the inactive window }, } end, }, -- { -- "AlexvZyl/nordic.nvim", -- lazy = false, -- priority = 1000, -- init = function() -- vim.cmd.colorscheme("nordic") -- end, -- config = function() -- -- stylua ignore -- require("nordic").setup({ -- override = { -- Visual = { bg = "#BB4747", fg = "white" }, -- DapBreakpoint = { bg = "#552B24" }, -- DapBreakpointStopped = { bg = "#244C55" }, -- TreesitterContext = { bg = "#2A1E39" }, -- }, -- -- -- original palatte: https://github.com/AlexvZyl/nordic.nvim/blob/main/lua/nordic/colors/nordic.lua -- on_palette = function(palette) -- local custom_palette = { -- -- Blacks. Not in base Nord. -- black0 = "#30222A", -- cursorline color -- black1 = "#1E222A", -- telescope background color -- -- Slightly darker than bg. Very useful for certain popups -- black2 = "#222630", -- -- This color is used on their website's dark theme. -- gray0 = "#1D2026", -- bg -- -- 2B2E32 monokai -- -- Polar Night. -- gray1 = "#2E3440", -- gray2 = "#3B4252", -- gray3 = "#434C5E", -- gray4 = "#4C566A", -- } -- -- return vim.tbl_deep_extend("force", palette, custom_palette) -- end, -- }) -- end, -- }, -- { -- "malbernaz/monokai.nvim", -- lazy = false, -- priority = 1000, -- Make sure to load this before all the other start plugins. -- init = function() -- -- Load the colorscheme here. -- -- Like many other themes, this one has different styles, and you could load -- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- vim.cmd.colorscheme("monokai") -- end, -- -- config = function() -- require("monokai").setup({ -- custom_hlgroups = { -- FlashCurrent = { fg = "#FF0000", bg = "#FF0000" }, -- FlashLabel = { fg = "#FBF3CB", bg = "#FF007C" }, -- FlashMatch = { fg = "#000000", bg = "#000000" }, -- }, -- }) -- end, -- }, } ================================================ FILE: nvim/.config/nvim/lua/plugins/ui/todo-comments.lua ================================================ return { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = { -- your configuration comes here -- or leave it empty to use the default settings -- refer to the configuration section below }, } ================================================ FILE: nvim/.config/nvim/lua/util/base/fs.lua ================================================ local create_file = function(abspath) local open_mode = vim.loop.constants.O_CREAT + vim.loop.constants.O_WRONLY + vim.loop.constants.O_TRUNC local fd = vim.loop.fs_open(abspath, "w", open_mode) if not fd then vim.notify("create file failed") else vim.loop.fs_chmod(abspath, 420) vim.loop.fs_close(fd) end end local Fs = { create_file = create_file, } return Fs ================================================ FILE: nvim/.config/nvim/lua/util/base/git.lua ================================================ --- local function get_current_version() local result, _ = vim.fn.system("git rev-parse --short HEAD"):gsub("\n", "") return result end return { get_current_version = get_current_version, } ================================================ FILE: nvim/.config/nvim/lua/util/base/strings.lua ================================================ local function ReplacePattern(str, pattern, replacement) return string.gsub(str, pattern, replacement) end local function trim(input) return input:gsub("^%s*(.-)%s*$", "%1") end local function contains(str, char) return str:find(char, 1, true) ~= nil end local function EndsWithSuffix(str, suffix) local len = #suffix return str:sub(-len) == suffix end ---@param i string ---@return string[] local function split_into_lines(i) local lines = {} for line in i:gmatch("([^\n]*)\n?") do if line ~= "" then table.insert(lines, line) end end return lines end ---@param stringList string[] ---@param delimiter string ---@return string local function join(stringList, delimiter) local str = "" for i, s in ipairs(stringList) do str = str .. s if i ~= #stringList then str = str .. delimiter end end return str end local function splitCmdString(cmd) local t = {} local inQuotes = false local currentQuoteChar = nil local currentWord = "" for i = 1, #cmd do local c = cmd:sub(i, i) if c == " " and not inQuotes then if #currentWord > 0 then table.insert(t, currentWord) currentWord = "" end elseif c == "'" or c == '"' then if inQuotes and currentQuoteChar == c then inQuotes = false currentQuoteChar = nil elseif not inQuotes then inQuotes = true currentQuoteChar = c else currentWord = currentWord .. c end else currentWord = currentWord .. c end end if #currentWord > 0 then table.insert(t, currentWord) end return t end ---split the string by delimiter ---@param inputStr string ---@param delimiter string ---@return string[] local function split(inputStr, delimiter) local t = {} local pattern = "([^" .. delimiter .. "]+)" for str in string.gmatch(inputStr, pattern) do table.insert(t, str) end return t end local M = { replace_pattern = ReplacePattern, trim = trim, split = split, contains = contains, ends_with_suffix = EndsWithSuffix, split_into_lines = split_into_lines, join = join, split_cmd_string = splitCmdString, } return M ================================================ FILE: nvim/.config/nvim/lua/util/base/sys.lua ================================================ local Job = require("plenary.job") ---@param cmd string[] ---@param cwd string ---@return table ---@return unknown ---@return table local run_sync = function(cmd, cwd) if type(cmd) ~= "table" then print("cmd has to be a table") return {}, nil, {} end local command = table.remove(cmd, 1) local stderr = {} local stdout, ret = Job:new({ command = command, args = cmd, cwd = cwd, on_stderr = function(_, data) table.insert(stderr, data) end, }):sync() return stdout, ret, stderr end ---@param content string local copy_to_system_clipboard = function(content) local copy_cmd = "pbcopy" -- Copy the absolute path to the clipboard if vim.fn.has("mac") or vim.fn.has("macunix") then copy_cmd = "pbcopy" elseif vim.fn.has("win32") or vim.fn.has("win64") then copy_cmd = "clip" elseif vim.fn.has("unix") then copy_cmd = "xclip -selection clipboard" else print("Unsupported operating system") return end vim.fn.system(copy_cmd, content) end ---@class runOpts ---@field header string ---run command in a job and print the output to the buffer ---@param cmd string commands to run ---@param buf_nr number buffer number ---@param opts runOpts options ---@return number returns the job id local run_async = function(cmd, buf_nr, opts) -- print the prompt header local header = {} if opts and opts.header then header = vim.split(opts.header, "\n") table.insert(header, "----------------------------------------") vim.api.nvim_buf_set_lines(buf_nr, 0, -1, false, header) end vim.api.nvim_buf_set_lines(buf_nr, 0, -1, false, header) local line = vim.tbl_count(header) + 1 local words = {} -- start the async job return vim.fn.jobstart(cmd, { on_stdout = function(_, data, _) for i, token in ipairs(data) do if i > 1 then -- if returned data array has more than one element, a line break occured. line = line + 1 words = {} end table.insert(words, token) vim.api.nvim_buf_set_lines(buf_nr, line, line + 1, false, { table.concat(words, "") }) end end, }) end ---@class Sys local Sys = { copy_to_system_clipboard = copy_to_system_clipboard, run_sync = run_sync, run_async = run_async, } return Sys ================================================ FILE: nvim/.config/nvim/lua/util/base/table.lua ================================================ local M = {} M.table_length = function(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end function M.findIndex(tbl, element) for i = 1, #tbl do if tbl[i] == element then return i end end return nil end ---@param element any ---@param table any ---@return boolean function M.isElementInTable(element, table) for _, value in ipairs(table) do if value == element then return true end end return false end ---comment ---@param array1 table ---@param array2 table ---@return table function M.getDifferenceSet(array1, array2) local differenceSet = {} for _, value in ipairs(array1) do if not M.isElementInTable(value, array2) then table.insert(differenceSet, value) end end return differenceSet end return M ================================================ FILE: nvim/.config/nvim/lua/util/editor.lua ================================================ ---@alias Position {row: number, col: number} ---comment ---@return Position local get_cursor_position = function() local _, row, col, _ = unpack(vim.fn.getpos(".")) return { row, col } end ---@return {row: number, col: number} local get_visual_selection_start_position = function() local _, row, col, _ = unpack(vim.fn.getpos("'<")) return { row, col } end local function replaceSelectedTextWithClipboard() vim.cmd([[normal! gv"_dP]]) end local function exit_current_mode() local esc = vim.api.nvim_replace_termcodes("", true, false, true) vim.api.nvim_feedkeys(esc, "x", false) end ---@return Position[] local function get_selected_positions() -- this will exit visual mode -- use 'gv' to reselect the text local _, csrow, cscol, cerow, cecol local mode = vim.fn.mode() if mode == "v" or mode == "V" or mode == "" then -- if we are in visual mode use the live position _, csrow, cscol, _ = unpack(vim.fn.getpos(".")) _, cerow, cecol, _ = unpack(vim.fn.getpos("v")) if mode == "V" then -- visual line doesn't provide columns cscol, cecol = 0, 999 end exit_current_mode() else -- otherwise, use the last known visual position _, csrow, cscol, _ = unpack(vim.fn.getpos("'<")) _, cerow, cecol, _ = unpack(vim.fn.getpos("'>")) end -- swap vars if needed if cerow < csrow then csrow, cerow = cerow, csrow end if cecol < cscol then cscol, cecol = cecol, cscol end return { { row = csrow, col = cscol }, { row = cerow, col = cecol }, } end -- Copy from https://github.com/ibhagwan/fzf-lua local function getSelectedText() -- this will exit visual mode -- use 'gv' to reselect the text local _, csrow, cscol, cerow, cecol local mode = vim.fn.mode() if mode == "v" or mode == "V" or mode == "" then -- if we are in visual mode use the live position _, csrow, cscol, _ = unpack(vim.fn.getpos(".")) _, cerow, cecol, _ = unpack(vim.fn.getpos("v")) if mode == "V" then -- visual line doesn't provide columns cscol, cecol = 0, 999 end exit_current_mode() else -- otherwise, use the last known visual position _, csrow, cscol, _ = unpack(vim.fn.getpos("'<")) _, cerow, cecol, _ = unpack(vim.fn.getpos("'>")) end -- swap vars if needed if cerow < csrow then csrow, cerow = cerow, csrow end if cecol < cscol then cscol, cecol = cecol, cscol end local lines = vim.fn.getline(csrow, cerow) local tableUtil = require("util.base.table") local n = tableUtil.table_length(lines) if n <= 0 then return "" end lines[n] = string.sub(lines[n], 1, cecol) lines[1] = string.sub(lines[1], cscol) return table.concat(lines, "\n") end ---@return {row: number, col: number} local get_visual_selection_end_position = function() local _, row, col, _ = unpack(vim.fn.getpos("'>")) return { row, col } end local ESC_FEEDKEY = vim.api.nvim_replace_termcodes("", true, false, true) --- @return string local get_visual_lines = function(bufnr) vim.api.nvim_feedkeys(ESC_FEEDKEY, "n", true) vim.api.nvim_feedkeys("gv", "x", false) vim.api.nvim_feedkeys(ESC_FEEDKEY, "n", true) local start_row, start_col = unpack(vim.api.nvim_buf_get_mark(bufnr, "<")) local end_row, end_col = unpack(vim.api.nvim_buf_get_mark(bufnr, ">")) local lines = vim.api.nvim_buf_get_lines(bufnr, start_row - 1, end_row, false) if start_row == 0 then lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) start_row = 1 start_col = 0 end_row = #lines end_col = #lines[#lines] end start_col = start_col + 1 end_col = math.min(end_col, #lines[#lines] - 1) + 1 lines[#lines] = lines[#lines]:sub(1, end_col) lines[1] = lines[1]:sub(start_col) return table.concat(lines, "\n") end local countWindows = function() -- Get the current tabpage ID local tabpage_id = vim.api.nvim_get_current_tabpage() -- Get the list of window handles for all windows in the current tabpage local windows = vim.api.nvim_tabpage_list_wins(tabpage_id) -- Return the count of windows return #windows end ---@alias SplitMode "virtical" | "horizontal" ---@param splitMode SplitMode local splitWindow = function(splitMode) if splitMode == "virtical" then vim.api.nvim_exec2("wincmd v", { output = false }) elseif splitMode == "horizontal" then vim.api.nvim_exec2("wincmd s", { output = false }) else vim.print("Not supported mode") end end ---@return string local function get_current_line() return vim.api.nvim_get_current_line() end local function is_homedir(path) local home_dir = vim.loop.os_homedir() return path == home_dir end local function contains_marker_file(path) local marker_files = vim.g.easy_command_project_root_dir_marker_files or { ".git", ".gitignore" } -- list of marker files for _, file in ipairs(marker_files) do local full_path = path .. "/" .. file if vim.fn.filereadable(full_path) == 1 or vim.fn.isdirectory(full_path) == 1 then return true end end return false end ---@param ignore_patterns string[]|nil local function close_all_other_windows(ignore_patterns) -- Get the current window ID local current_win = vim.api.nvim_get_current_win() -- Get the list of all window IDs local windows = vim.api.nvim_list_wins() -- Function to check if the buffer name matches any pattern in the list local function should_ignore(buf_name) for _, pattern in ipairs(ignore_patterns or { "filesystem", -- neo-tree "Trouble", "term", }) do if string.find(buf_name, pattern) then return true end end return false end -- Close all windows except the current one and those matching ignore patterns for _, win in ipairs(windows) do if win ~= current_win then -- Get the buffer ID for the window local buf = vim.api.nvim_win_get_buf(win) -- Get the name of the buffer local buf_name = vim.api.nvim_buf_get_name(buf) -- Check if the buffer's name should be ignored if not should_ignore(buf_name) then vim.api.nvim_win_close(win, false) end end end end ---@return string local function get_buf_name() local bufnr = vim.api.nvim_get_current_buf() return vim.api.nvim_buf_get_name(bufnr) end local get_buf_filetype = function() return vim.bo.ft end --- Get current buffer size ---@return {width: number, height: number} local function get_buf_size() local cbuf = vim.api.nvim_get_current_buf() local bufinfo = vim.tbl_filter(function(buf) return buf.bufnr == cbuf end, vim.fn.getwininfo(vim.api.nvim_get_current_win()))[1] if bufinfo == nil then return { width = -1, height = -1 } end return { width = bufinfo.width, height = bufinfo.height } end local function get_buf_filename() return vim.fn.expand("%:t") end local function get_buf_abs_path() return vim.fn.expand("%:p") end ---@return string local function get_buf_abs_dir_path() return vim.fn.expand("%:p:h") end ---@return string|nil local function find_project_path() for i = 1, 30, 1 do local dir = vim.fn.expand("%:p" .. string.rep(":h", i)) if contains_marker_file(dir) then return dir end if is_homedir(dir) then return nil end end return nil end local function find_project_name() local project_path = find_project_path() if project_path then return vim.fn.fnamemodify(project_path, ":t") end return "" end local function get_buf_relative_path() local buf_path = get_buf_abs_path() local project_path = find_project_path() or "" return string.sub(buf_path, string.len(project_path) + 2, string.len(buf_path)) end local function get_buf_relative_dir_path() local buf_path = get_buf_abs_path() local project_path = find_project_path() or "" return string.sub(buf_path, string.len(project_path) + 2, string.len(buf_path)) end -- Puts text at cursor, in any mode. -- -- Compare |:put| and |p| which are always linewise. -- -- Attributes: ~ -- not allowed when |textlock| is active -- -- Parameters: ~ -- • {lines} |readfile()|-style list of lines. |channel-lines| -- • {type} Edit behavior: any |getregtype()| result, or: -- • "b" |blockwise-visual| mode (may include width, e.g. "b3") -- • "c" |charwise| mode -- • "l" |linewise| mode -- • "" guess by contents, see |setreg()| -- • {after} If true insert after cursor (like |p|), or before (like -- |P|). -- • {follow} If true place cursor at end of inserted text. --- @param lines string[] --- @param type string --- @param after boolean --- @param follow boolean local function put_lines(lines, type, after, follow) vim.api.nvim_put(lines, type, after, follow) end --- Create a new horizontal splitted buffer --- and write the content into the buffer ---@param content string[] ---@param opts? {vertical?: boolean, ft?: string} local function split_and_write(content, opts) opts = opts or {} if opts.vertical then vim.cmd("vnew") else vim.cmd("new") end -- Get the current buffer local buf = vim.api.nvim_get_current_buf() -- Clear the buffer vim.api.nvim_buf_set_lines(buf, 0, -1, false, {}) -- Write the content into the buffer put_lines(content, "", true, true) -- Set the buffer as unmodified vim.cmd("setlocal nomodified") if opts.ft then vim.bo.ft = opts.ft end end ---@param terminal_chan number ---@param term_cmd_text string local send_to_terminal_buf = function(terminal_chan, term_cmd_text) vim.api.nvim_chan_send(terminal_chan, term_cmd_text .. "\n") end --- Get the channel of the first terminal --- channel structure can be find at --- https://neovim.io/doc/user/api.html#nvim_get_chan_info() ---@return any? local function get_first_terminal() local terminal_chans = {} for _, chan in pairs(vim.api.nvim_list_chans()) do if chan["mode"] == "terminal" and chan["pty"] ~= "" then table.insert(terminal_chans, chan) end end table.sort(terminal_chans, function(left, right) return left["buffer"] < right["buffer"] end) if #terminal_chans == 0 then return nil end return terminal_chans[1] end --- Check if the channel's buffer visible --- You can get the buffer number by `vim.api.nvim_list_chans()` ---@param channel_buffer_number number this is the chan buffer number not chan id ---@return boolean local function is_visible(channel_buffer_number) for _, win in ipairs(vim.api.nvim_list_wins()) do if vim.api.nvim_win_get_buf(win) == channel_buffer_number then return true end end return false end ---@return any? local function get_first_visible_terminal() local terminal_chans = {} for _, chan in pairs(vim.api.nvim_list_chans()) do if chan["mode"] == "terminal" and chan["pty"] ~= "" and is_visible(chan.buffer) then table.insert(terminal_chans, chan) end end table.sort(terminal_chans, function(left, right) return left["buffer"] < right["buffer"] end) if #terminal_chans == 0 then return nil end return terminal_chans[1] end ---@param popup_content string[] ---@return {buf: integer, win: integer} local function new_popup_window(popup_content) local popup_buf = vim.api.nvim_create_buf(false, true) vim.api.nvim_buf_set_lines(popup_buf, 0, -1, false, popup_content) vim.api.nvim_buf_set_option(popup_buf, "filetype", "sh") local width = vim.fn.strdisplaywidth(table.concat(popup_content, "\n")) local height = #popup_content local opts = { relative = "cursor", row = 0, col = 0, width = width + 4, height = height + 2, style = "minimal", border = "single", } local win = vim.api.nvim_open_win(popup_buf, true, opts) return { buf = popup_buf, win = win, } end local M = { selections = { getCursorPosition = getCursorPosition, get_positions = get_selected_positions, get_visual_selection_start_position = get_visual_selection_start_position, get_visual_selection_end_position = get_visual_selection_end_position, getVisualLines = get_visual_lines, get_selected = getSelectedText, }, tab = { countWindows = countWindows, }, window = { close_all_other_windows = close_all_other_windows, splitWindow = splitWindow, new_popup_window = new_popup_window, }, buf = { read = { get_buf_name = get_buf_name, get_buf_filetype = get_buf_filetype, get_buf_size = get_buf_size, get_buf_filename = get_buf_filename, get_buf_abs_path = get_buf_abs_path, get_buf_abs_dir_path = get_buf_abs_dir_path, get_buf_relative_path = get_buf_relative_path, get_buf_relative_dir_path = get_buf_relative_dir_path, get_cursor_position = get_cursor_position, get_current_line = get_current_line, get_selected = getSelectedText, is_visible = is_visible, }, write = { put_lines = put_lines, send_to_terminal_buf = send_to_terminal_buf, }, }, get_first_terminal = get_first_terminal, get_first_visible_terminal = get_first_visible_terminal, split_and_write = split_and_write, find_project_path = find_project_path, find_project_name = find_project_name, replaceSelectedTextWithClipboard = replaceSelectedTextWithClipboard, -- TODO: refactor into selections group getSelectedText = getSelectedText, get_current_line = get_current_line, } return M ================================================ FILE: nvim/.config/nvim/lua/util/init.lua ================================================ local M = {} ---@filename string ---@return string function M.ReadFileAsString(filename) return table.concat(vim.fn.readfile(filename), "\n") end function M.ReplacePattern(str, pattern, replacement) return string.gsub(str, pattern, replacement) end -- TODO: deprecated function. M.getFiletype = function() return vim.bo.ft end ---@param cmd string ---@return string|nil ---@deprecated use run_sync in util.base.sys module function M.Call_sys_cmd(cmd) local handle = io.popen(cmd) local result = handle:read("*a") handle:close() -- TODO: get the error msg after failed to exec a command return result end -- TODO: deprecated -- Use the function in sys ---@param content string function M.copy_to_system_clipboard(content) local copy_cmd = "pbcopy" -- Copy the absolute path to the clipboard if vim.fn.has("mac") or vim.fn.has("macunix") then copy_cmd = "pbcopy" elseif vim.fn.has("win32") or vim.fn.has("win64") then copy_cmd = "clip" elseif vim.fn.has("unix") then copy_cmd = "xclip -selection clipboard" else print("Unsupported operating system") return end vim.fn.system(copy_cmd, content) end -- TODO: use the utli in editor function M.ExitCurrentMode() local esc = vim.api.nvim_replace_termcodes("", true, false, true) vim.api.nvim_feedkeys(esc, "x", false) end return M ================================================ FILE: nvim/.config/nvim/lua/util/lang.lua ================================================ local editor = require("easy-commands.impl.util.editor") ---@functionName string local call_language_specific_func = function(functionName) require("easy-commands.impl.lang." .. editor.buf.read.get_buf_filetype())[functionName]() -- local ok, _ = pcall(require("easy-commands.impl.lang." .. editor.getFiletype())[functionName]) -- if not ok then -- vim.notify("There's some error or may not be implemented yet for [" .. editor.getFiletype() .. "] type") -- end end local M = { call_language_specific_func = call_language_specific_func, } return M ================================================ FILE: nvim/.config/nvim/lua/util/log.lua ================================================ ---@param msg string local function notifyErr(msg) vim.notify("easy-comands.nvim: \n" .. msg, vim.log.levels.ERROR, { title = "easy-commands.nvim" }) end return { error = notifyErr, } ================================================ FILE: tmux/.tmux.conf ================================================ # REF: http://deanbodenham.com/learn/tmux-conf-file.html #-------------------------------------------------------# #-------------------------------------------------------# # General settings ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# #set mouse off/on - if off, forces you to use keyboard with prefix-[ set -g mouse on # start with window 1 (instead of 0) set -g base-index 1 # start with pane 1 set -g pane-base-index 1 # allow utf8 support set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) setw -q -g utf8 on # Or for tmux >= 2.6 set -sg escape-time 10 #-------------------------------------------------------# #-------------------------------------------------------# # PANE AND WINDOW NAVIGATION/MANAGEMENT ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# # splitting panes # use vim-like keys for splits and windows bind \\ split-window -h -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}" # Smart pane switching with awareness of Vim splits. # See: https://github.com/christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" bind-key -n 'C-e' display-popup -E "bash -c /Users/lintao/dotfiles/local-bin-scripts/.local/bin/tmux-window-switcher.sh" set-option repeat-time 2000 # pane resizing bind -r H resize-pane -L 3 bind -r J resize-pane -D 3 bind -r K resize-pane -U 3 bind -r L resize-pane -R 3 # next/prev window by `h/l` bind -r h prev bind -r l next # default pane layouts bind + select-layout main-horizontal bind = select-layout main-vertical # Rotate panes bind -r o rotate-window # ====================== My configs # set history set -g history-limit 10000 # boost history #-------------------------------------------------------# #-------------------------------------------------------# # Copy/Paste Vim mode ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# # Enable native Mac OS X copy/paste set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'" # use vi mode setw -g mode-keys vi set -g status-keys vi # bind bind [ copy-mode # Setup 'v' to begin selection as in Vim bind -T copy-mode-vi v send -X begin-selection bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" # Update default binding of `Enter` to also use copy-pipe unbind -T copy-mode-vi Enter bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" #-------------------------------------------------------# #-------------------------------------------------------# # Shortcuts ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf" bind d send-keys -R C-l \; clear-history # Toggle popup window with Alt-3 bind-key -n -N 'Toggle popup window' M-3 if-shell -F '#{==:#{session_name},popup}' { detach-client } { display-popup -d "#{pane_current_path}" -xC -yC -w 100% -h 100% -E 'tmux attach-session -t popup || tmux new-session -s popup' } # bind-key -n "M-8" run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/pane.sh switch" #-------------------------------------------------------# #-------------------------------------------------------# # NVim Requirement ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# set-option -g focus-events on ########################## 🔽 TPM 🔽 ########################### # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'sainnhe/tmux-fzf' TMUX_FZF_OPTIONS="-p -w 80% -h 76% -m" TMUX_FZF_LAUNCH_KEY="f" lMUX_FZF_ORDER="session|pane|command|keybinding|window" TMUX_FZF_PANE_FORMAT="#{p15:#{b:pane_current_path}} :: #{pane_current_command}" # press after add/delete plugin # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm' ########################## 🔼 TPM 🔼 ########################## #-------------------------------------------------------# #-------------------------------------------------------# # Styles ⬇️ ⬇️ ⬇️ #-------------------------------------------------------# #256 colours set -g default-terminal "screen-256color" set-option -ga terminal-overrides ",xterm-256color:Tc" # Segguested by neovim healthcheck set-option -sa terminal-overrides ',screen-256color:RGB' set-option -sa terminal-overrides ',XXX:RGB' # set inactive/active window(pane) styles set-window-option -t popup window-active-style "fg=colour250,bg=#332B28" set -g window-style 'fg=#7E7E7E,bg=#4B4B4B' set -g window-active-style 'fg=colour250,bg=black' set -g status-interval 1 set -g window-status-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F' set -g window-status-current-format '#I:#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F' ########################## 🔽 GRUVBOX DARK 🔽 ########################### set-option -g status-interval 3 set-option -g automatic-rename on set-option -g automatic-rename-format '#{b:pane_current_path} :: #{b:pane_current_command}' ## COLORSCHEME: gruvbox dark (medium) set-option -g status "on" # default statusbar color set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1 # default window title colors set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1 # default window with an activity alert set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3 # active window title colors set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1 # pane border set -g pane-active-border-style "bg=default fg=cyan" set -g pane-border-style "fg=#7E7E7E" set -g pane-border-lines heavy # message infos set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1 # writing commands inactive set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1 # pane number display set-option -g display-panes-active-colour colour250 #fg2 set-option -g display-panes-colour colour237 #bg1 # clock set-window-option -g clock-mode-colour colour109 #blue # bell set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg ## Theme settings mixed with colors (unfortunately, but there is no cleaner way) set-option -g status-justify "left" set-option -g status-left-style none set-option -g status-left-length "80" set-option -g status-right-style none set-option -g status-right-length "80" set-window-option -g window-status-separator "" set-option -g status-left "#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]" set-option -g status-right "#[bg=colour237,fg=colour239 nobold, nounderscore, noitalics]#[bg=colour239,fg=colour246] %Y-%m-%d  %H:%M #[bg=colour239,fg=colour248,nobold,noitalics,nounderscore]#[bg=colour248,fg=colour237] " set-window-option -g window-status-current-format "#[bg=colour214,fg=colour237,nobold,noitalics,nounderscore]#[bg=colour214,fg=colour239] #I #[bg=colour214,fg=colour239,bold] #{b:pane_current_path}#{?window_zoomed_flag,*Z,} :: #{pane_current_command} #[bg=colour237,fg=colour214,nobold,noitalics,nounderscore]" set-window-option -g window-status-format "#[bg=colour239,fg=colour237,noitalics]#[bg=colour239,fg=colour223] #I #[bg=colour239,fg=colour223] #{b:pane_current_path} #[bg=colour237,fg=colour239,noitalics]" ########################## 🔼 GRUVBOX DARK 🔼 ########################## ================================================ FILE: update.sh ================================================ #!/bin/bash # Change to the directory containing the script cd "$(dirname "$0")" || { echo "Error: Failed to change directory." exit 1 } # Source the paths of the configuration files if [[ -f .local/source-paths.sh ]]; then source .local/source-paths.sh else echo "Error: .local/source-paths.sh not found." exit 1 fi # Declare an associative array containing the tools and their configuration paths declare -A share_items=( [nvim]="$NVIM" ) # Iterate through the array and synchronize each configuration file for item in "${!share_items[@]}"; do if [[ -n "${share_items[$item]}" ]]; then rsync -avz --delete "${share_items[$item]}" "./$item" else echo "Warning: Path for $item is not set or is empty. Skipping synchronization." fi done ================================================ FILE: vscode-jupyter-notebook/vscode-jupyter-notebook.md ================================================ ## Vscode Jupyter Notebook with VIM - block - Insert block below: `b` - Insert block above: `a` - Copy block: `c` - Paste block: `v` - Cut block: `x` - Delete block: `dd` - Collaspes block: ??? - Movement - `j`, `k` - Go to the bottom `G` - Go to the top: `gg` - Convert to Code block: `y` - Convert to Markdown block: `m` - revert action: `z` ================================================ FILE: warpd/.config/warpd/config ================================================ hint_activation_key: A-M-j activation_key: C-M-' hint: f exit: q cursor_size: 13 ================================================ FILE: wezterm/.wezterm.lua ================================================ local wezterm = require("wezterm") local act = wezterm.action -- https://github.com/folke/zen-mode.nvim wezterm.on("user-var-changed", function(window, pane, name, value) local overrides = window:get_config_overrides() or {} if name == "ZEN_MODE" then local incremental = value:find("+") local number_value = tonumber(value) if incremental ~= nil then while number_value > 0 do window:perform_action(wezterm.action.IncreaseFontSize, pane) number_value = number_value - 1 end overrides.enable_tab_bar = false elseif number_value < 0 then window:perform_action(wezterm.action.ResetFontSize, pane) overrides.font_size = nil overrides.enable_tab_bar = true else overrides.font_size = number_value overrides.enable_tab_bar = false end end window:set_config_overrides(overrides) end) local function macCMDtoMeta() local keys = "abdefghijklmnopqrstuwxyz1234567890/" -- no c,v local keymappings = {} for i = 1, #keys do local c = keys:sub(i, i) -- CMD+key --> META+key table.insert(keymappings, { key = c, mods = "CMD", action = act.SendKey({ key = c, mods = "META", }), }) -- CMD+CTRL+key --> META+key table.insert(keymappings, { key = c, mods = "CMD|CTRL", action = act.SendKey({ key = c, mods = "META|CTRL", }), }) end return keymappings end local function generateKeyMappings() local keymappings = { { key = "n", mods = "SHIFT|CTRL", action = wezterm.action.SpawnWindow }, { key = "F2", mods = "CMD", action = act.SendKey({ key = "F2", mods = "META", }), }, } for _, v in ipairs(macCMDtoMeta()) do table.insert(keymappings, v) end return keymappings end return { font = wezterm.font_with_fallback({ -- "FiraMono Nerd Font Mono", "Hack Nerd Font Mono", }), color_scheme = "Gruvbox dark, medium (base16)", keys = generateKeyMappings(), font_size = 18.0, hide_tab_bar_if_only_one_tab = true, } ================================================ FILE: zsh/.zshrc ================================================ # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi ########################## 🔽 ENV 🔽 ########################### export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk11/Contents/Home" export M2_HOME="$HOME/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3" export GOPATH=$HOME/go export LANG=en_US.UTF-8 export EDITOR="nvim" export TMUX_TMPDIR=~/.tmux export GRAVEYARD="~/.local/share/Trash." # for rip command # History in cache directory: export HISTSIZE=10000 export SAVEHIST=10000 export HISTFILE=~/.zsh_history source ~/.secrets ########################## 🔼 ENV 🔼 ########################## ########################## 🔽 PATH 🔽 ########################### paths=( /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/Apple/usr/bin /opt/homebrew/bin /opt/homebrew/sbin /opt/local/bin /opt/local/sbin ${HOME}/.local/bin ${HOME}/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3/bin ${HOME}/go/bin ${HOME}/.cargo/bin /opt/local/lib/postgresql15/bin ${HOME}/Library/Python/3.9/bin ) join_by() { local separator="$1" shift printf '%s' "$1" "${@/#/$separator}" } path=$(join_by ":" "${paths[@]}") export PATH="$path" ########################## 🔼 PATH 🔼 ########################## autoload -U colors && colors ########################## 🔽 AUTO COMP 🔽 ########################### # Basic auto/tab complete: autoload bashcompinit && bashcompinit autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit # put the custom completions here: /usr/local/share/zsh/site-functions # Addtional completions can be found in: https://github.com/zsh-users/zsh-completions _comp_options+=(globdots) # Include hidden files. fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src fpath+=$HOME/.oh-my-zsh/custom/zsh-completions complete -C '/usr/local/bin/aws_completer' aws source <(kubectl completion zsh) ########################## 🔼 AUTO COMP 🔼 ########################### # vi mode bindkey -v export KEYTIMEOUT=1 ########################## 🔽 JUMP 🔽 ########################### eval "$(jump shell zsh)" __jump_chpwd() { jump chdir } jump_completion() { reply="'$(jump hint "$@")'" } j() { local dir="$(jump cd $@)" test -d "$dir" && cd "$dir" } typeset -gaU chpwd_functions chpwd_functions+=__jump_chpwd compctl -U -K jump_completion j ########################## 🔼 JUMP 🔼 ########################## ########################## 🔽 OH MY ZSH 🔽 ########################### # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" # source ~/powerlevel10k/powerlevel10k.zsh-theme ZSH_THEME="powerlevel10k/powerlevel10k" plugins=( git fzf-tab zsh-autosuggestions ) source $ZSH/oh-my-zsh.sh ########################## 🔼 OH MY ZSH 🔼 ########################## ########################## 🔽 LOAD OTHER CONFIGS 🔽 ########################### [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # this must put after oh-my-zsh plugins # to avoid unexpected overwrite bindkey "ç" fzf-cd-widget source "/opt/homebrew/Cellar/fzf/0.38.0/shell/key-bindings.zsh" # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh ########################## 🔼 LOAD OTHER CONFIGS 🔼 ########################## ########################## 🔽 NVM 🔽 ########################### # export NVM_DIR="$HOME/.nvm" # export PATH=$PATH:"$HOME/.nvm/versions/node/v14.16.0/bin" # source /opt/local/share/nvm/init-nvm.sh # nvm() { . "/usr/local/opt/nvm/nvm.sh"; nvm $@; } ########################## 🔼 NVM 🔼 ########################## ########################## 🔽 ALIAS 🔽 ########################### alias chat="nvim -c 'lua require(\"scratch\").scratchByType(\"gp4.md\")'" alias vim="nvim" alias gp!="git push --no-verify" alias v="lvim +\"Telescope oldfiles\"" alias glog="git log --pretty=format:'%C(auto)%h%C(blue) %<|(19)%as%C(auto)%d %s' --graph" alias kc="kubectl" alias python="python3" alias gitsync="$HOME/Documents/Git-Sync/sync.sh" alias df='vim +DiffviewOpen' alias lm="limactl" alias lt="lsgo | head -n 30" alias gonew="source go-new" alias awsprofileswither="source aws-profile-switcher" alias kl="minikube kubectl --" ########################## 🔼 ALIAS 🔼 ########################## ########################## 🔽 SHORTCUTS 🔽 ########################### lfcd () { tmp="$(mktemp)" lf -last-dir-path="$tmp" "$@" if [ -f "$tmp" ]; then dir="$(cat "$tmp")" rm -f "$tmp" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" fi } bindkey -s '^o' 'lfcd\n' # ctrl-u toggle lazygit bindkey -s '^u' 'lazygit\n' # Edit line in vim with ctrl-e: autoload edit-command-line; zle -N edit-command-line bindkey '^e' edit-command-line ########################## 🔼 SHORTCUTS 🔼 ########################## # Load zsh-syntax-highlighting; should be last. # source "$HOME/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh