This commit is contained in:
whoami 2025-01-15 16:24:39 +00:00
commit 61d3539d2a
108 changed files with 4775 additions and 1760 deletions

22
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Log
*.log
# Private Files
*private*
.private.env.*
@ -15,24 +18,9 @@ test.*
# Utils
xdg-ninja/
# nvim config cache
tools/nvim/tt.*
tools/nvim/.tests
tools/nvim/doc/tags
tools/nvim/debug
tools/nvim/.repro
tools/nvim/foo.*
tools/nvim/*.log
tools/nvim/data
tools/nvim/lazy-lock.json
tools/nvim/lazyvim.json
tools/nvim/lua/plugins/obsidian.lua
# Undone
# Windows PowerToys
PowerToys/
# Just Script
Justfile
# Nushell
tools/nushell/
# fzf
@ -43,6 +31,6 @@ common/fzfrc
.venv/
platforms/win/komorebi/applications.json
gitconfig
spacemacs/

View file

@ -30,4 +30,8 @@
".wslconfig": "properties",
"WindowsTerminal.json": "jsonc",
},
"[json]": {
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
}
}

15
Justfile Normal file
View file

@ -0,0 +1,15 @@
set shell := ["fish", "-c"]
set windows-shell := ["pwsh", "-c"]
pull:
git pull github master
git pull codeberg master
push:
git push github master
git push codeberg master
init:
git remote remove origin
git remote add github git@github.com:js0ny/dotfiles.git
git remote add codeberg git@codeberg.org:js0ny/dotfiles.git

692
LICENSE
View file

@ -1,44 +1,674 @@
Copyright (c) 2024-2024 js0ny
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
This dotfiles repository uses multiple licenses for different tools' configuration files:
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
1. **MIT License**
Unless otherwise specified, all files and directories in this repository are licensed
under the MIT License.
Preamble
See the full text of the MIT License below.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
2. **GNU General Public License v3 (GPLv3)**
Files under the following directory are licensed under the GNU GPLv3:
- `./platforms/mac/sketchybar/`
These files are based on or intended for use with `FelixKratz/SketchyBar`
See the `LICENSE` file within the directory for the full text of the GNU GPLv3 license.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Refer to individual directories or files for detailed license information
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
Full text of MIT License is below.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
=================================================================================
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
MIT License
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Copyright (c) 2024 js0ny
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The precise terms and conditions for copying, distribution and
modification follow.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

BIN
_assets/windows-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -16,10 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
# Set Environment Variables
# Use %PATH_EXT% to prevent PATH from being too long
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\citoy\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\jsony\AppData\Local\Go\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*%PATH_EXT%*") {
$currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%"
@ -36,8 +35,8 @@ if ($currentPath -notlike "*%PATH_EXT%*") {
# Simulate XDG Base Directory Specification
$Env:XDG_CONFIG_HOME = "$Env:AppData"
$Env:XDG_DATA_HOME = "$Env:LocalAppData"
$Env:XDG_CACHE_HOME = "$Env:LocalAppData\cache"
$Env:XDG_STATE_HOME = "$Env:LocalAppData\state"
$Env:XDG_CACHE_HOME = "$Env:LocalAppData\Cache"
$Env:XDG_STATE_HOME = "$Env:LocalAppData\State"
[System.Environment]::SetEnvironmentVariable("XDG_CONFIG_HOME", "$Env:XDG_CONFIG_HOME", "User")
[System.Environment]::SetEnvironmentVariable("XDG_DATA_HOME", "$Env:XDG_DATA_HOME", "User")
New-Item -ItemType Directory -Path "$Env:LocalAppData\cache" -Force

17
bootstrap/common-pm.txt Normal file
View file

@ -0,0 +1,17 @@
# nodejs
npm install -g typescript
npm install -g tsx
# dotnet
dotnet tool install -g dotnet-script
dotnet tool install -g dotnet-repl
# python
pip install neovim
pip install requests
pip install ipython
pip install jupyter
pip install numpy
pip install matplotlib
pip install pandas
pip install scipy

View file

@ -3,7 +3,7 @@
# Date: 2024-12-01
# Author: js0ny
# Set symbolic links for Unix-like systems
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython $XDG_CONFIG_HOME/lazygit
# Not support XDG_CONFIG_HOME but same directory
mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow
# mkdir -p $WAKATIME_HOME
@ -15,8 +15,9 @@ cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/lazygit.yaml $XDG_CONFIG_HOME/lazygit/config.yml
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
# ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
@ -37,5 +38,5 @@ if [ $(uname) = "Darwin" ]; then
ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc
ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc
else
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
ln -sf $DOTFILES/common/inputrc ~/.inputrc
fi

View file

@ -28,10 +28,15 @@ $linkDots = @{
"$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim"
}
# TODO: Auto create directories
foreach ($target in $linkDots.Keys) {
$path = $linkDots[$target]
# Auto create directories (Untested)
$dir = Split-Path $path
if (!(Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force
}
New-Item -ItemType SymbolicLink -Target $target -Path $path -Force
}

View file

@ -0,0 +1,12 @@
set -e
ZDOTDIR="${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}"
mkdir -p $ZDOTDIR/plugins
#plugins=(
# "zsh-autosuggestions"
# "zsh-syntax-highlighting"
# "zsh-history-substring-search"
#)
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting
git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search

View file

@ -0,0 +1,23 @@
# Run as Administrator
Set-MpPreference -EnableControlledFolderAccess 1
$protected = (Get-MpPreference).ControlledFolderAccessProtectedFolders
$protected += "$Env:UserProfile\.ssh"
$protected += "$Env:UserProfile\.config"
$protected += "$Env:UserProfile\Vault"
Set-MpPreference -ControlledFolderAccessProtectedFolders $protected
$apps = (Get-MpPreference).ControlledFolderAccessAllowedApplications
$apps += "$Env:Windir\System32\OpenSSH\ssh.exe"
$apps += "$Env:ProgramFiles\GPSoftware\Directory Opus\DOpus.exe"
$apps += (Get-Command -Name code).Source.Replace("bin\code.cmd", "Code.exe")
$apps += (Get-Command -Name pwsh).Source
$apps += (Get-Command -Name git).Source
Set-MpPreference -ControlledFolderAccessAllowedApplications $apps
$exclusion = (Get-MpPreference).ExclusionPath
$exclusion += "$env:ProgramFiles\JetBrains"
$exclusion += "$env:LocalAppData\JetBrains"
$exclusion += "D:\Source"
Set-MpPreference -ExclusionPath $exclusion

View file

@ -67,6 +67,11 @@ Plug 'easymotion/vim-easymotion'
""" Keybindings """
"" don't lose selection when indenting ""
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
"" edit ideavim config <leader>v + ""
nnoremap <leader>vv :e ~/.ideavimrc<CR>
nnoremap <leader>vr :source ~/.ideavimrc<CR>
@ -82,48 +87,7 @@ nmap S <Plug>(easymotion-F)
nmap f <Plug>(sneak-s)
nmap F <Plug>(sneak-S)
"" Miscs ""
nnoremap <leader>: :action GotoAction<CR>
"" AI Related <leader>a + ""
nnoremap <leader>ac :action copilot.chat.show<CR>
nnoremap <leader>ad :action copilot.disableCopilot<CR>
nnoremap <leader>ae :action copilot.enableCopilot<CR>
nnoremap <leader>ai :action copilot.openCopilot<CR>
"" Codes Action <leader>c + ""
nnoremap <leader>cf :action ReformatCode<CR>
nnoremap <leader>cs :action GotoSymbol<CR>
nnoremap <leader>c/ :action CommentByLineComment<CR>
"" Project Action <leader>p + ""
nnoremap <leader>pr :action Run<CR>
nnoremap <leader>pd :action Debug<CR>
nnoremap <leader>pb :action Build<CR>
"" Files Action <leader>f + ""
nnoremap <leader>fe :NERDTreeToggle<CR>
nnoremap <leader>ft :action ActivateTerminalToolWindow<CR>
"" Tab Actions <leader><tab> + ""
nnoremap <leader><tab><tab> :action Switcher<CR>
"" Collapse and Expand z + ""
nnoremap zi :action ExpandCollapseToggleAction<CR>
nnoremap zc :action CollapseRegion<CR>
nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zM :action CollapseAll<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap zO :action ExpandRegionRecursively<CR>
nnoremap zR :action ExpandAll<CR>
"" don't lose selection when indenting ""
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
nnoremap <leader>a :action FindInPath<CR>
"" Language Server Protocol ""
nnoremap gd :action GotoDeclaration<CR>
nnoremap gtd :action GotoTypeDeclaration<CR>
nnoremap gtD :action QuickTypeDefinition<CR>
@ -135,13 +99,82 @@ nnoremap ga :action
nnoremap gq :action ShowIntentionActions<CR>
nnoremap ge :action GotoNextError<CR>
nnoremap <C-p> :action ParameterInfo<CR>
inoremap <C-p> <C-o>:action ParameterInfo<CR>
"" Collapse and Expand z + ""
nnoremap zi :action ExpandCollapseToggleAction<CR>
nnoremap zc :action CollapseRegion<CR>
nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zM :action CollapseAll<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap zO :action ExpandRegionRecursively<CR>
nnoremap zR :action ExpandAll<CR>
"" Refractor <leader>r + ""
"" Miscs ""
nnoremap <leader>: :action GotoAction<CR>
nnoremap <leader><leader> :action GotoFile<CR>
nnoremap <leader>h :action PrevSplitter<CR>
nnoremap <leader>i :action NextSplitter<CR>
"" AI Related <leader>a + ""
nnoremap <leader>ac :action copilot.chat.show<CR>
nnoremap <leader>ad :action copilot.disableCopilot<CR>
nnoremap <leader>ae :action copilot.enableCopilot<CR>
nnoremap <leader>aa :action copilot.openCopilot<CR>
" <leader>b : +buffer
nnoremap <leader>bb :action Switcher<CR>
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
nnoremap <leader>cr :action Run<CR>
nnoremap <leader>cf :action ReformatCode<CR>
nnoremap <leader>cs :action GotoSymbol<CR>
nnoremap <leader>cS :action GotoSymbol<CR>
nnoremap <leader>cR :action RenameElement<CR>
""" Works for Rider only
nnoremap <leader>ce :action ReSharperGotoNextErrorInSolution<CR>
nnoremap <leader>cE :action ReSharperGotoPrevErrorInSolution<CR>
" <leader>d : +debug
" <leader>f : +file
nnoremap <leader>ff :action GotoFile<CR>
nnoremap <leader>fF :action TextSearchAction<CR>
nnoremap <leader>fc :action ShowSettings<CR>
nnoremap <leader>fC :action ShowSettings<CR>
nnoremap <leader>fe :NERDTreeToggle<CR>
nnoremap <leader>fo :OpenInAssociatedApplication<CR>
nnoremap <leader>ft :action ActivateTerminalToolWindow<CR>
nnoremap <leader>fx :action WelcomeScreen.Plugins<CR>
" <leader>g : +git
nnoremap <leader>gp :action Git.Pull<CR>
nnoremap <leader>gP :action Vcs.Push<CR>
nnoremap <leader>gb :action Git.Branches<CR>
nnoremap <leader>gR :action Git.Rebase<CR>
nnoremap <leader>gM :action Git.Merge<CR>
nnoremap <leader>gc :action CheckinProject<CR>
nnoremap <leader>gC :action Git.Clone<CR>
nnoremap <leader>gg :action ActivateVersionControlToolWindow<CR>
nnoremap <leader>gS :action Git.Stash<CR>
" <leader>h : +help
" <leader>p : +project
nnoremap <leader>pr :action Run<CR>
nnoremap <leader>pd :action Debug<CR>
nnoremap <leader>pb :action Build<CR>
" <leader>q : +quit
nnoremap <leader>qq :action Exit<CR>
nnoremap <leader>Q :action Exit<CR>
" <leader>r : +refactor
nnoremap <leader>ri :action Inline<CR>
nnoremap <leader>rr :action RenameElement<CR>
nnoremap <leader>rr :action RenamElement<CR>
nnoremap <leader>rev :action IntroduceVariable<CR>
vnoremap <leader>rev :action IntroduceVariable<CR>
nnoremap <leader>rem :action ExtractMethod<CR>
@ -150,6 +183,32 @@ nnoremap <leader>rm :action Move<CR>
nnoremap <leader>ro :action OptimizeImports<CR>
nnoremap <leader>rG :action Generate<CR>
" <leader>t : +test
nnoremap <leader>tt :action RiderUnitTestRunSolutionAction<CR>
nnoremap <leader>tT :action Rider.UnitTesting.MainMenu<CR>
" <leader>u : +ui
nnoremap <leader>ui :action ChangeLaf<CR>
nnoremap <leader>uw :action EditorToggleUseSoftWraps<CR>
" <leader>w : +write/window
nnoremap <leader>ww :write<CR>
nnoremap <leader>wa :wall<CR>
nnoremap <leader>wq :wq<CR>
nnoremap <leader>W :write<CR>
nnoremap <leader>wh :action PrevSplitter<CR>
nnoremap <leader>wi :action NextSplitter<CR>
nnoremap <leader>wH :action SplitHorizontally<CR>
nnoremap <leader>wI :action SplitHorizontally<CR>
nnoremap <leader>wN :action SplitVertically<CR>
nnoremap <leader>wE :action SplitVertically<CR>
nnoremap <leader>w- :action SplitHorizontally<CR>
nnoremap <leader>w| :action SplitVertically<CR>
nnoremap <leader>w\ :action SplitVertically<CR>
nnoremap <C-p> :action ParameterInfo<CR>
inoremap <C-p> <C-o>:action ParameterInfo<CR>
""" Handling Ctrls """
sethandler <C-C> i:ide

496
common/lazygit.yaml Normal file
View file

@ -0,0 +1,496 @@
# $DOTFILES/common/lazygit.yaml
# Date: 2024-12-22
# Author: js0ny
# Location:
# *nix: ~/.config/lazygit/config.yml
# Windows: %APPDATA%\lazygit\config.yml
# Linking:
# ln -sf ~/.dotfiles/common/lazygit.yaml ~/.config/lazygit/config.yml
yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
# Config relating to the Lazygit UI
gui:
# The number of lines you scroll by when scrolling the main window
scrollHeight: 2
# If true, allow scrolling past the bottom of the content in the main window
scrollPastBottom: true
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin
scrollOffMargin: 2
# One of: 'margin' (default) | 'jump'
scrollOffBehavior: margin
# If true, capture mouse events.
# When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
mouseEvents: true
# If true, do not show a warning when discarding changes in the staging view.
skipDiscardChangeWarning: false
# If true, do not show warning when applying/popping the stash
skipStashWarning: false
# If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files.
skipNoStagedFilesWarning: false
# If true, do not show a warning when rewording a commit via an external editor
skipRewordInEditorWarning: false
# Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section.
# Number from 0 to 1.0.
sidePanelWidth: 0.3333
# If true, increase the height of the focused side window; creating an accordion effect.
expandFocusedSidePanel: false
# The weight of the expanded side panel, relative to the other panels. 2 means
# twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true.
expandedSidePanelWeight: 2
# Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split.
# Options are:
# - 'horizontal': split the window horizontally
# - 'vertical': split the window vertically
# - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
mainPanelSplitMode: flexible
# How the window is split when in half screen mode (i.e. after hitting '+' once).
# Possible values:
# - 'left': split the window horizontally (side panel on the left, main view on the right)
# - 'top': split the window vertically (side panel on top, main view below)
enlargedSideViewLocation: left
# One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
language: auto
# Format used when displaying time e.g. commit time.
# Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
timeFormat: 02 Jan 06
# Format used when displaying time if the time is less than 24 hours ago.
# Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
shortTimeFormat: 3:04PM
# Config relating to colors and styles.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes
theme:
# Border color of focused window
activeBorderColor:
- green
- bold
# Border color of non-focused windows
inactiveBorderColor:
- default
# Border color of focused window when searching in that window
searchingActiveBorderColor:
- cyan
- bold
# Color of keybindings help text in the bottom line
optionsTextColor:
- blue
# Background color of selected line.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line
selectedLineBgColor:
- blue
# Background color of selected line when view doesn't have focus.
inactiveViewSelectedLineBgColor:
- bold
# Foreground color of copied commit
cherryPickedCommitFgColor:
- blue
# Background color of copied commit
cherryPickedCommitBgColor:
- cyan
# Foreground color of marked base commit (for rebase)
markedBaseCommitFgColor:
- blue
# Background color of marked base commit (for rebase)
markedBaseCommitBgColor:
- yellow
# Color for file with unstaged changes
unstagedChangesColor:
- red
# Default text color
defaultFgColor:
- default
# Config relating to the commit length indicator
commitLength:
# If true, show an indicator of commit message length
show: true
# If true, show the '5 of 20' footer at the bottom of list views
showListFooter: true
# If true, display the files in the file views as a tree. If false, display the files as a flat list.
# This can be toggled from within Lazygit with the '~' key, but that will not change the default.
showFileTree: true
# If true, show the number of lines changed per file in the Files view
showNumstatInFilesView: false
# If true, show a random tip in the command log when Lazygit starts
showRandomTip: true
# If true, show the command log
showCommandLog: true
# If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action.
showBottomLine: true
# If true, show jump-to-window keybindings in window titles.
showPanelJumps: true
# Deprecated: use nerdFontsVersion instead
showIcons: false
# Nerd fonts version to use.
# One of: '2' | '3' | empty string (default)
# If empty, do not show icons.
nerdFontsVersion: ""
# If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty.
showFileIcons: true
# Length of author name in (non-expanded) commits view. 2 means show initials only.
commitAuthorShortLength: 2
# Length of author name in expanded commits view. 2 means show initials only.
commitAuthorLongLength: 17
# Length of commit hash in commits view. 0 shows '*' if NF icons aren't on.
commitHashLength: 8
# If true, show commit hashes alongside branch names in the branches view.
showBranchCommitHash: false
# Whether to show the divergence from the base branch in the branches view.
# One of: 'none' | 'onlyArrow' | 'arrowAndNumber'
showDivergenceFromBaseBranch: none
# Height of the command log view
commandLogSize: 8
# Whether to split the main window when viewing file changes.
# One of: 'auto' | 'always'
# If 'auto', only split the main window when a file has both staged and unstaged changes
splitDiff: auto
# Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
# One of: 'normal' (default) | 'half' | 'full'
screenMode: normal
# Window border style.
# One of 'rounded' (default) | 'single' | 'double' | 'hidden'
border: rounded
# If true, show a seriously epic explosion animation when nuking the working tree.
animateExplosion: true
# Whether to stack UI components on top of each other.
# One of 'auto' (default) | 'always' | 'never'
portraitMode: auto
# How things are filtered when typing '/'.
# One of 'substring' (default) | 'fuzzy'
filterMode: substring
# Config relating to the spinner.
spinner:
# The frames of the spinner animation.
frames:
- "|"
- /
- "-"
- \
# The "speed" of the spinner in milliseconds.
rate: 50
# Status panel view.
# One of 'dashboard' (default) | 'allBranchesLog'
statusPanelView: dashboard
# If true, jump to the Files panel after popping a stash
switchToFilesAfterStashPop: true
# If true, jump to the Files panel after applying a stash
switchToFilesAfterStashApply: true
# If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead
switchTabsWithPanelJumpKeys: false
# Config relating to git
git:
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
paging:
# Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never'
colorArg: always
# e.g.
# diff-so-fancy
# delta --dark --paging=never
# ydiff -p cat -s --wrap --width={{columnWidth}}
pager: "delta --dark --paging=never"
# If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager).
useConfig: false
# e.g. 'difft --color=always'
externalDiffCommand: ""
# Config relating to committing
commit:
# If true, pass '--signoff' flag when committing
signOff: false
# Automatic WYSIWYG wrapping of the commit message as you type
autoWrapCommitMessage: true
# If autoWrapCommitMessage is true, the width to wrap to
autoWrapWidth: 72
# Config relating to merging
merging:
# If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang
# Only applicable to unix users.
manualCommit: false
# Extra args passed to `git merge`, e.g. --no-ff
args: ""
# The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders.
squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}}
# list of branches that are considered 'main' branches, used when displaying commits
mainBranches:
- master
- main
# Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP'
skipHookPrefix: WIP
# If true, periodically fetch from remote
autoFetch: true
# If true, periodically refresh files and submodules
autoRefresh: true
# If true, pass the --all arg to git fetch
fetchAll: true
# If true, lazygit will automatically stage files that used to have merge
# conflicts but no longer do; and it will also ask you if you want to
# continue a merge or rebase if you've resolved all conflicts. If false, it
# won't do either of these things.
autoStageResolvedConflicts: true
# Command used when displaying the current branch git log in the main window
branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --
# Command used to display git log of all branches in the main window.
# Deprecated: Use `allBranchesLogCmds` instead.
allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
# If true, do not spawn a separate process when using GPG
overrideGpg: false
# If true, do not allow force pushes
disableForcePushing: false
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
commitPrefix:
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
pattern: ""
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
replace: ""
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
branchPrefix: ""
# If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀
# (This should really be under 'gui', not 'git')
parseEmoji: false
# Config for showing the log in the commits view
log:
# One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default'
# 'topo-order' makes it easier to read the git log graph, but commits may not
# appear chronologically. See https://git-scm.com/docs/
#
# Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default).
order: topo-order
# This determines whether the git graph is rendered in the commits panel
# One of 'always' | 'never' | 'when-maximised'
#
# Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default).
showGraph: always
# displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
showWholeGraph: false
# When copying commit hashes to the clipboard, truncate them to this
# length. Set to 40 to disable truncation.
truncateCopiedCommitHashesTo: 12
# Periodic update checks
update:
# One of: 'prompt' (default) | 'background' | 'never'
method: prompt
# Period in days between update checks
days: 14
# Background refreshes
refresher:
# File/submodule refresh interval in seconds.
# Auto-refresh can be disabled via option 'git.autoRefresh'.
refreshInterval: 10
# Re-fetch interval in seconds.
# Auto-fetch can be disabled via option 'git.autoFetch'.
fetchInterval: 60
# If true, show a confirmation popup before quitting Lazygit
confirmOnQuit: false
# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close
quitOnTopLevelReturn: false
# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
os:
# Command for editing a file. Should contain "{{filename}}".
edit: ""
# Command for editing a file at a given line number. Should contain
# "{{filename}}", and may optionally contain "{{line}}".
editAtLine: ""
# Same as EditAtLine, except that the command needs to wait until the
# window is closed.
editAtLineAndWait: ""
# For opening a directory in an editor
openDirInEditor: ""
# A built-in preset that sets all of the above settings. Supported presets
# are defined in the getPreset function in editor_presets.go.
editPreset: ""
# Command for opening a file, as if the file is double-clicked. Should
# contain "{{filename}}", but doesn't support "{{line}}".
open: ""
# Command for opening a link. Should contain "{{link}}".
openLink: ""
# EditCommand is the command for editing a file.
# Deprecated: use Edit instead. Note that semantics are different:
# EditCommand is just the command itself, whereas Edit contains a
# "{{filename}}" variable.
editCommand: ""
# EditCommandTemplate is the command template for editing a file
# Deprecated: use EditAtLine instead.
editCommandTemplate: ""
# OpenCommand is the command for opening a file
# Deprecated: use Open instead.
openCommand: ""
# OpenLinkCommand is the command for opening a link
# Deprecated: use OpenLink instead.
openLinkCommand: ""
# CopyToClipboardCmd is the command for copying to clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
copyToClipboardCmd: ""
# ReadFromClipboardCmd is the command for reading the clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
readFromClipboardCmd: ""
# If true, don't display introductory popups upon opening Lazygit.
disableStartupPopups: false
# What to do when opening Lazygit outside of a git repo.
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
# - 'create': initialize a new repo
# - 'skip': open most recent repo
# - 'quit': exit Lazygit
notARepository: prompt
# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
promptToReturnFromSubprocess: true
# Keybindings
keybinding:
universal:
quit: q
quit-alt1: <c-c>
return: <esc>
quitWithoutChangingDirectory: Q
togglePanel: <tab>
prevItem: <up>
nextItem: <down>
prevItem-alt: e
nextItem-alt: "n"
prevPage: ","
nextPage: .
scrollLeft: H
scrollRight: L
gotoTop: <
gotoBottom: ">"
toggleRangeSelect: v
rangeSelectDown: <s-down>
rangeSelectUp: <s-up>
prevBlock: <left>
nextBlock: <right>
prevBlock-alt: h
nextBlock-alt: i
nextBlock-alt2: <tab>
prevBlock-alt2: <backtab>
jumpToBlock:
- "1"
- "2"
- "3"
- "4"
- "5"
nextMatch: "k"
prevMatch: "K"
startSearch: /
optionMenu: <disabled>
optionMenu-alt1: "?"
select: <space>
goInto: <enter>
confirm: <enter>
confirmInEditor: <a-enter>
remove: d
new: "n"
edit: l
openFile: o
scrollUpMain: <pgup>
scrollDownMain: <pgdown>
scrollUpMain-alt1: K
scrollDownMain-alt1: J
scrollUpMain-alt2: <c-u>
scrollDownMain-alt2: <c-d>
executeShellCommand: ":"
createRebaseOptionsMenu: m
# 'Files' appended for legacy reasons
pushFiles: P
# 'Files' appended for legacy reasons
pullFiles: p
refresh: R
createPatchOptionsMenu: <c-p>
nextTab: "]"
prevTab: "["
nextScreenMode: +
prevScreenMode: _
undo: z
redo: <c-z>
filteringMenu: <c-s>
diffingMenu: W
diffingMenu-alt: <c-e>
copyToClipboard: <c-o>
openRecentRepos: <c-r>
submitEditorText: <enter>
extrasMenu: "@"
toggleWhitespaceInDiffView: <c-w>
increaseContextInDiffView: "}"
decreaseContextInDiffView: "{"
increaseRenameSimilarityThreshold: )
decreaseRenameSimilarityThreshold: (
openDiffTool: <c-t>
status:
checkForUpdate: u
recentRepos: <enter>
allBranchesLogGraph: a
files:
commitChanges: c
commitChangesWithoutHook: w
amendLastCommit: A
commitChangesWithEditor: C
findBaseCommitForFixup: <c-f>
confirmDiscard: x
ignoreFile: i
refreshFiles: r
stashAllChanges: s
viewStashOptions: S
toggleStagedAll: a
viewResetOptions: D
fetch: f
toggleTreeView: "`"
openMergeTool: M
openStatusFilter: <c-b>
copyFileInfoToClipboard: "y"
branches:
createPullRequest: o
viewPullRequestOptions: O
copyPullRequestURL: <c-y>
checkoutBranchByName: c
forceCheckoutBranch: F
rebaseBranch: r
renameBranch: R
mergeIntoCurrentBranch: M
viewGitFlowOptions: i
fastForward: f
createTag: T
pushTag: P
setUpstream: u
fetchRemote: f
sortOrder: s
worktrees:
viewWorktreeOptions: w
commits:
squashDown: s
renameCommit: r
renameCommitWithEditor: R
viewResetOptions: g
markCommitAsFixup: f
createFixupCommit: F
squashAboveCommits: S
moveDownCommit: <c-j>
moveUpCommit: <c-k>
amendToCommit: A
resetCommitAuthor: a
pickCommit: p
revertCommit: t
cherryPickCopy: C
pasteCommits: V
markCommitAsBaseForRebase: B
tagCommit: T
checkoutCommit: <space>
resetCherryPick: <c-R>
copyCommitAttributeToClipboard: "y"
openLogMenu: <c-l>
openInBrowser: o
viewBisectOptions: b
startInteractiveRebase: i
amendAttribute:
resetAuthor: a
setAuthor: A
addCoAuthor: c
stash:
popStash: g
renameStash: r
commitFiles:
checkoutCommitFile: c
main:
toggleSelectHunk: a
pickBothHunks: b
editSelectHunk: E
submodules:
init: i
update: u
bulkMenu: b
commitMessage:
commitMenu: <c-o>

View file

@ -4,10 +4,12 @@
# Less the pager.
# Location:
# $XDG_CONFIG_HOME/lesskey
# Or specified by the environment variable $LESSKEYIN
# *nix: $XDG_CONFIG_HOME/lesskey (Or specified by the environment variable $LESSKEYIN)
# Windows: %LESSKEYIN% (environment variable, default: %UserProfile%/_lesskey)
# $Env:LESSKEYIN = $Env:AppData\less\lesskey
# Linking:
# ln -sf $DOTFILES/common/lesskey ~/.config/lesskey
# New-Item -ItemType SymbolicLink -Target $DOTFILES\common\lesskey -Path $Env:LESSKEYIN
# ===========================================================
# work for less -V > 582, for mac, use brew install less to override the system less
# In Windows (current version), the default pager is `more`, should be specifed to `less` by `$Env:Pager = less`

View file

@ -134,9 +134,7 @@ alias netl="netstat -tulnp"
alias apt="sudo apt"
alias apts="apt search"
alias apti="sudo apt install"
aptr() {
sudo apt remove $1 || sudo apt autoremove
}
alias aptr="sudo apt remove"
alias aptu="sudo apt upgrade && sudo apt update"
alias l="ls -lah"

View file

@ -0,0 +1,61 @@
// ~/.config/fastfetch/config.jsonc
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
// "type": "auto",
"source": "arch_small",
"padding": {
"top": 2,
"left": 1,
"right": 2
}
},
"general": {
"multithreading": true
},
"display": {
"separator": " ",
"key": {
"width": 10,
"paddingLeft": 2,
"type": "icon"
}
},
"modules": [
{
"type": "title",
"format": "{#1}───────────── {#}{user-name-colored}@{host-name-colored}"
},
{
"type": "colors",
"symbol": "diamond",
"paddingLeft": 15
},
"os",
// "host",
// "kernel",
// "uptime",
{
"type": "packages"
},
"shell",
"display",
// "de",
// "wm",
// "wmtheme",
// "theme",
// "icons",
// "font",
// "cursor",
"terminal",
// "terminalfont",
"cpu",
"gpu",
"memory",
// "swap",
"disk",
// "battery",
"poweradapter",
"locale"
]
}

View file

@ -62,7 +62,7 @@ $menu = wofi --show drun
# exec-once = $terminal
# exec-once = nm-applet &
exec-once = waybar & hyprpaper & mako & systemctl --user start hyprpolkitagent
exec-once = waybar & hyprpaper & mako & systemctl --user start hyprpolkitagent & fcitx5
#############################

View file

@ -8,5 +8,7 @@
# Linking:
# ln -sf $DOTFILES/platforms/linux/hyprland/code-flags.conf ~/.config/
--enable-features=UseOzonePlatform
--ozone-platform=wayland
# --enable-features=UseOzonePlatform
# --ozone-platform=wayland
--ozone-platform-hint=auto
--enable-wayland-ime

View file

@ -8,6 +8,8 @@
# Linking:
# ln -sf $DOTFILES/platforms/linux/hyprland/electron-flags.conf ~/.config/
--enable-features=UseOzonePlatform
--ozone-platform=wayland
--enable-icd
# --enable-features=UseOzonePlatform
# --ozone-platform=wayland
# --enable-icd
--ozone-platform-hint=auto
--enable-wayland-ime

View file

@ -8,6 +8,6 @@
if [ -n "$WAYLAND_DISPLAY" ]; then
alias clip="wl-copy"
alias paste="wl-paste"
else [ -n "$DISPLAY" ]; then
elif [ -n "$DISPLAY" ]; then
alias clip="xclip"
fi

View file

@ -6,8 +6,7 @@ $DOTFILES = "$HOME/.dotfiles"
### Load Configs ###
Get-ChildItem -Path $DOTFILES/powershell -Filter *.ps1 | ForEach-Object {. $_}
Get-ChildItem -Path $DOTFILES/powershell_private -Filter *.ps1 | ForEach-Object {. $_}
Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_}
## Aliases ###

View file

@ -11,20 +11,7 @@ Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 |
# Toggle Theme #
# TODO: Change to `bat` script implementation
# function Set-SystemTheme {
# $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
# $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme"
# if ($currentMode.AppsUseLightTheme -eq 1) {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0
# Write-Host "已切换到深色模式"
# }
# else {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1
# Write-Host "已切换到浅色模式"
# }
# }
# Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`)
Set-Alias "dark-mode" "$DOTFILES\platforms\win\cmd\dark-mode.bat" # Consistent with macOS (`dark-mode`)
# Miscs #
@ -67,10 +54,10 @@ $Env:VISUAL = "code --wait"
$Env:FILE_MANAGER = "dopus.exe"
${function:wsl2} = {wsl.exe --distribution Ubuntu}
${function:wsl2} = { wsl.exe --distribution kali-linux $args }
${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }
${function:killp} = {ps | ? ProcessName -like $args | kill -Force}
${function:pkill} = { ps *$args* | kill -Force }

114
platforms/win/ahk/Caps.ahk Normal file
View file

@ -0,0 +1,114 @@
#Requires AutoHotkey v2.0
#SingleInstance Force
; 全局变量声明
global g_LastCtrlKeyDownTime := 0
global g_AbortSendEsc := false
global g_ControlRepeatDetected := false
*CapsLock:: {
global g_ControlRepeatDetected
global g_LastCtrlKeyDownTime
global g_AbortSendEsc
if (g_ControlRepeatDetected) {
return
}
Send "{Ctrl down}"
g_LastCtrlKeyDownTime := A_TickCount
g_AbortSendEsc := false
g_ControlRepeatDetected := true
}
*CapsLock Up:: {
global g_ControlRepeatDetected
global g_LastCtrlKeyDownTime
global g_AbortSendEsc
Send "{Ctrl up}"
g_ControlRepeatDetected := false
if (g_AbortSendEsc) {
return
}
current_time := A_TickCount
time_elapsed := current_time - g_LastCtrlKeyDownTime
if (time_elapsed <= 250) {
SendInput "{Esc}"
}
}
; 组合所有 Ctrl 快捷键
#HotIf
~*^a::
~*^b::
~*^c::
~*^d::
~*^e::
~*^f::
~*^g::
~*^h::
~*^i::
~*^j::
~*^k::
~*^l::
~*^m::
~*^n::
~*^o::
~*^p::
~*^q::
~*^r::
~*^s::
~*^t::
~*^u::
~*^v::
~*^w::
~*^x::
~*^y::
~*^z::
~*^1::
~*^2::
~*^3::
~*^4::
~*^5::
~*^6::
~*^7::
~*^8::
~*^9::
~*^0::
~*^Space::
~*^Backspace::
~*^Delete::
~*^Insert::
~*^Home::
~*^End::
~*^PgUp::
~*^PgDn::
~*^Tab::
~*^Enter::
~*^,::
~*^.::
~*^/::
~*^;::
~*^'::
~*^[::
~*^]::
~*^\::
~*^-::
~*^=::
~*^`::
~*^F1::
~*^F2::
~*^F3::
~*^F4::
~*^F5::
~*^F6::
~*^F7::
~*^F8::
~*^F9::
~*^F10::
~*^F11::
~*^F12:: {
global g_AbortSendEsc
g_AbortSendEsc := true
}

View file

@ -0,0 +1,29 @@
#Requires AutoHotkey v2.0
q::q
w::w
e::f
r::p
t::g
y::j
u::l
i::u
o::y
p::;
a::a
s::r
d::s
f::t
g::d
h::h
j::n
k::e
l::i
`;::o
z::z
x::x
c::c
v::v
b::b
n::k
m::m

View file

@ -1,4 +1,4 @@
// ~\.config\fastfetch\config.jsonc
// %UserProfile%\.config\fastfetch\config.jsonc
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
@ -54,7 +54,6 @@
"memory",
"swap",
"disk",
"localip",
"battery",
"poweradapter",
"locale"

4
platforms/win/glzr/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force
boilerplate*
starter/
neobrutal/

View file

@ -0,0 +1,317 @@
# $DOTFILES/platforms/win/glzr/glazewm/config.yaml
# Date: 2025-01-05
# Author: js0ny
# Location:
# - %UserProfile%\.glzr\glazewm\config.yaml
# Linking: Link to whole directory
# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force
general:
# Commands to run when the WM has started. This is useful for running a
# script or launching another application.
# Example: The below command launches Zebar.
startup_commands: ["shell-exec zebar"]
# Commands to run just before the WM is shutdown.
# Example: The below command kills Zebar.
shutdown_commands: ["shell-exec taskkill /IM zebar.exe /F"]
# Commands to run after the WM config is reloaded.
config_reload_commands: []
# Whether to automatically focus windows underneath the cursor.
focus_follows_cursor: true
# Whether to switch back and forth between the previously focused
# workspace when focusing the current workspace.
toggle_workspace_on_refocus: false
cursor_jump:
# Whether to automatically move the cursor on the specified trigger.
enabled: true
# Trigger for cursor jump:
# - 'monitor_focus': Jump when focus changes between monitors.
# - 'window_focus': Jump when focus changes between windows.
trigger: "monitor_focus"
# How windows should be hidden when switching workspaces.
# - 'cloak': Recommended. Hides windows with no animation.
# - 'hide': Legacy method (v3.5 and earlier) that has a brief animation,
# but has stability issues with some apps.
hide_method: "cloak"
# Affects which windows get shown in the native Windows taskbar. Has no
# effect if `hide_method: 'hide'`.
# - 'true': Show all windows (regardless of workspace).
# - 'false': Only show windows from the currently shown workspaces.
show_all_in_taskbar: false
gaps:
# Whether to scale the gaps with the DPI of the monitor.
scale_with_dpi: true
# Gap between adjacent windows.
inner_gap: "5px"
# Gap between windows and the screen edge.
outer_gap:
top: "50px"
right: "5px"
bottom: "5px"
left: "5px"
window_effects:
# Visual effects to apply to the focused window.
focused_window:
# Highlight the window with a colored border.
# ** Exclusive to Windows 11 due to API limitations.
border:
enabled: true
color: "#f6a7ba"
# Remove the title bar from the window's frame. Note that this can
# cause rendering issues for some applications.
hide_title_bar:
enabled: false
# Change the corner style of the window's frame.
# ** Exclusive to Windows 11 due to API limitations.
corner_style:
enabled: false
# Allowed values: 'square', 'rounded', 'small_rounded'.
style: "square"
# Visual effects to apply to non-focused windows.
other_windows:
border:
enabled: false
color: "#a1a1a1"
hide_title_bar:
enabled: true
corner_style:
enabled: false
style: "square"
window_behavior:
# New windows are created in this state whenever possible.
# Allowed values: 'tiling', 'floating'.
initial_state: "tiling"
# Sets the default options for when a new window is created. This also
# changes the defaults for when the state change commands, like
# `set-floating`, are used without any flags.
state_defaults:
floating:
# Whether to center floating windows by default.
centered: true
# Whether to show floating windows as always on top.
shown_on_top: false
fullscreen:
# Maximize the window if possible. If the window doesn't have a
# maximize button, then it'll be fullscreen'ed normally instead.
maximized: false
# Whether to show fullscreen windows as always on top.
shown_on_top: false
workspaces:
- name: "1"
- name: "2"
- name: "3"
- name: "4"
- name: "5"
- name: "6"
- name: "7"
- name: "8"
- name: "9"
window_rules:
- commands: ["ignore"]
match:
# Ignores any Zebar windows.
- window_process: { equals: "zebar" }
- window_process: { equals: "WindowsTerminal" }
# Ignores picture-in-picture windows for browsers.
- window_title: { regex: "[Pp]icture.in.[Pp]icture" }
window_class: { regex: "Chrome_WidgetWin_1|MozillaDialogClass" }
# Ignore rules for various 3rd-party apps.
- window_process: { equals: "PowerToys" }
window_class: { regex: 'HwndWrapper\[PowerToys\.PowerAccent.*?\]' }
- window_process: { equals: "PowerToys" }
window_title: { regex: ".*? - Peek" }
- window_process: { equals: "Lively" }
window_class: { regex: "HwndWrapper" }
binding_modes:
# When enabled, the focused window can be resized via arrow keys or HJKL.
- name: "resize"
keybindings:
- commands: ["resize --width -2%"]
bindings: ["h", "left"]
- commands: ["resize --width +2%"]
bindings: ["i", "right"]
- commands: ["resize --height +2%"]
bindings: ["e", "up"]
- commands: ["resize --height -2%"]
bindings: ["n", "down"]
# Press enter/escape to return to default keybindings.
- commands: ["wm-disable-binding-mode --name resize"]
bindings: ["escape", "enter"]
keybindings:
# Shift focus in a given direction.
- commands: ["focus --direction left"]
bindings: ["lwin+h", "lwin+left"]
- commands: ["focus --direction right"]
bindings: ["lwin+i", "lwin+right"]
- commands: ["focus --direction up"]
bindings: ["lwin+e", "lwin+up"]
- commands: ["focus --direction down"]
bindings: ["lwin+n", "lwin+down"]
# Move focused window in a given direction.
- commands: ["move --direction left"]
bindings: ["lwin+shift+h", "lwin+shift+left"]
- commands: ["move --direction right"]
bindings: ["lwin+shift+i", "lwin+shift+right"]
- commands: ["move --direction up"]
bindings: ["lwin+shift+e", "lwin+shift+up"]
- commands: ["move --direction down"]
bindings: ["lwin+shift+n", "lwin+shift+down"]
# Resize focused window by a percentage or pixel amount.
- commands: ["resize --width -2%"]
bindings: ["alt+u"]
- commands: ["resize --width +2%"]
bindings: ["alt+p"]
- commands: ["resize --height +2%"]
bindings: ["alt+o"]
- commands: ["resize --height -2%"]
bindings: ["alt+i"]
# As an alternative to the resize keybindings above, resize mode enables
# resizing via arrow keys or HJKL. The binding mode is defined above with
# the name 'resize'.
- commands: ["wm-enable-binding-mode --name resize"]
bindings: ["lwin+shift+r"]
# Disables window management and all other keybindings until alt+shift+p
# is pressed again.
- commands: ["wm-toggle-pause"]
bindings: ["alt+shift+p"]
# Change tiling direction. This determines where new tiling windows will
# be inserted.
- commands: ["toggle-tiling-direction"]
bindings: ["lwin+v"]
# Change focus from tiling windows -> floating -> fullscreen.
# - commands: ["wm-cycle-focus"]
# bindings: ["alt+space"]
# Change the focused window to be floating.
- commands: ["toggle-floating --centered"]
bindings: ["alt+shift+space"]
# Change the focused window to be tiling.
- commands: ["toggle-tiling"]
bindings: ["lwin+t"]
# Change the focused window to be fullscreen.
# - commands: ["toggle-fullscreen"]
# bindings: ["lwin+f"]
- commands: ["shell-exec dopus.exe"]
bindings: ["lwin+f"]
# Minimize focused window.
- commands: ["toggle-minimized"]
bindings: ["lwin+m"]
# Close focused window.
- commands: ["close"]
bindings: ["lwin+q"]
# Kill GlazeWM process safely.
- commands: ["wm-exit"]
bindings: ["alt+shift+e"]
# Re-evaluate configuration file.
- commands: ["wm-reload-config"]
bindings: ["alt+shift+r"]
# Redraw all windows.
- commands: ["wm-redraw"]
bindings: ["alt+shift+w"]
# Launch CMD terminal. Alternatively, use `shell-exec wt` or
# `shell-exec %ProgramFiles%/Git/git-bash.exe` to start Windows
# Terminal and Git Bash respectively.
- commands: ["shell-exec wezterm-gui.exe start"]
bindings: ["lwin+r"]
# Focus the next/previous active workspace defined in `workspaces` config.
- commands: ["focus --next-active-workspace"]
bindings: ["alt+s"]
- commands: ["focus --prev-active-workspace"]
bindings: ["alt+a"]
# Focus the workspace that last had focus.
- commands: ["focus --recent-workspace"]
bindings: ["alt+d"]
# Change focus to a workspace defined in `workspaces` config.
- commands: ["focus --workspace 1"]
bindings: ["lwin+1"]
- commands: ["focus --workspace 2"]
bindings: ["lwin+2"]
- commands: ["focus --workspace 3"]
bindings: ["lwin+3"]
- commands: ["focus --workspace 4"]
bindings: ["lwin+4"]
- commands: ["focus --workspace 5"]
bindings: ["lwin+5"]
- commands: ["focus --workspace 6"]
bindings: ["lwin+6"]
- commands: ["focus --workspace 7"]
bindings: ["lwin+7"]
- commands: ["focus --workspace 8"]
bindings: ["lwin+8"]
- commands: ["focus --workspace 9"]
bindings: ["lwin+9"]
# Move the focused window's parent workspace to a monitor in a given
# direction.
- commands: ["move-workspace --direction left"]
bindings: ["alt+shift+a"]
- commands: ["move-workspace --direction right"]
bindings: ["alt+shift+f"]
- commands: ["move-workspace --direction up"]
bindings: ["alt+shift+d"]
- commands: ["move-workspace --direction down"]
bindings: ["alt+shift+s"]
# Move focused window to a workspace defined in `workspaces` config.
- commands: ["move --workspace 1", "focus --workspace 1"]
bindings: ["lwin+shift+1"]
- commands: ["move --workspace 2", "focus --workspace 2"]
bindings: ["lwin+shift+2"]
- commands: ["move --workspace 3", "focus --workspace 3"]
bindings: ["lwin+shift+3"]
- commands: ["move --workspace 4", "focus --workspace 4"]
bindings: ["lwin+shift+4"]
- commands: ["move --workspace 5", "focus --workspace 5"]
bindings: ["lwin+shift+5"]
- commands: ["move --workspace 6", "focus --workspace 6"]
bindings: ["lwin+shift+6"]
- commands: ["move --workspace 7", "focus --workspace 7"]
bindings: ["lwin+shift+7"]
- commands: ["move --workspace 8", "focus --workspace 8"]
bindings: ["lwin+shift+8"]
- commands: ["move --workspace 9", "focus --workspace 9"]
bindings: ["lwin+shift+9"]

View file

@ -0,0 +1,38 @@
# GlazeWM Setup
Link the whole `glzr` directory to the user's home directory.
```powershell
New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force
```
The Zebar config should be downloaded from [this repository](https://github.com/js0ny/neobrutal-zebar) and extracted to the `glzr\zebar` directory.
```powershell
Invoke-WebRequest -Uri "https://github.com/js0ny/neobrutal-zebar/releases/download/2/neobrutal.zip" -OutFile "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
Expand-Archive -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" -DestinationPath "$Env:UserProfile\.glzr\zebar"
Remove-Item -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
```
If `just` and `pwsh` are installed, you can build the config by running `just build-zebar`.
```powershell
git clone https://github.com/js0ny/neobrutal-zebar.git --depth 1
just init
just build
```
Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfigs.path` to `minimal/bar.zebar.json`.
```diff
{
"$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json",
"startupConfigs": [
{
- "path": "neobrutal/bar.zebar.json",
+ "path": "minimal/bar.zebar.json",
"preset": "default"
}
]
}
```

View file

@ -0,0 +1,22 @@
{
"$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/widget-schema.json",
"htmlPath": "./index.html",
"zOrder": "normal",
"shownInTaskbar": false,
"focused": false,
"resizable": false,
"transparent": true,
"presets": [
{
"name": "default",
"anchor": "top_left",
"offsetX": "0px",
"offsetY": "0px",
"width": "100%",
"height": "40px",
"monitorSelection": {
"type": "all"
}
}
]
}

View file

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Base styles for better consistency across platforms (aka. CSS reset). -->
<link rel="stylesheet" type="text/css" href="../normalize.css" />
<!-- Custom styles. -->
<link rel="stylesheet" type="text/css" href="./styles.css" />
<!-- Add empty favicon to suppress not found errors. -->
<link rel="icon" href="data:;" />
<!-- Allows React to be run buildless via "text/babel" script below. -->
<script
src="https://unpkg.com/@babel/standalone@7.25.6/babel.min.js"
integrity="sha256-aS0B0wnsaDByLfE16h4MDCP1fQFccysd1YWOcV+gbBo="
crossorigin="anonymous"
></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel" data-type="module" src="./scripts.jsx">
</script>
</body>
</html>

View file

@ -0,0 +1,197 @@
import React, {
useState,
useEffect,
} from 'https://esm.sh/react@18?dev';
import { createRoot } from 'https://esm.sh/react-dom@18/client?dev';
import * as zebar from 'https://esm.sh/zebar@2';
const providers = zebar.createProviderGroup({
// network: { type: 'network' },
glazewm: { type: 'glazewm' },
cpu: { type: 'cpu' },
date: { type: 'date', formatting: 'HH:mm:ss MMM月d日 EEE', locale: 'zh-CN' },
battery: { type: 'battery' },
memory: { type: 'memory' },
weather: { type: 'weather' },
});
function getNetworkIcon(networkOutput) {
switch (networkOutput.defaultInterface?.type) {
case 'ethernet':
return <i className="nf nf-md-ethernet_cable"></i>;
case 'wifi':
if (networkOutput.defaultGateway?.signalStrength >= 80) {
return <i className="nf nf-md-wifi_strength_4"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 65
) {
return <i className="nf nf-md-wifi_strength_3"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 40
) {
return <i className="nf nf-md-wifi_strength_2"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 25
) {
return <i className="nf nf-md-wifi_strength_1"></i>;
} else {
return <i className="nf nf-md-wifi_strength_outline"></i>;
}
default:
return (
<i className="nf nf-md-wifi_strength_off_outline"></i>
);
}
}
// Get icon to show for how much of the battery is charged.
function getBatteryIcon(batteryOutput) {
if (batteryOutput.chargePercent > 90)
return <i className="nf nf-fa-battery_4"></i>;
if (batteryOutput.chargePercent > 70)
return <i className="nf nf-fa-battery_3"></i>;
if (batteryOutput.chargePercent > 40)
return <i className="nf nf-fa-battery_2"></i>;
if (batteryOutput.chargePercent > 20)
return <i className="nf nf-fa-battery_1"></i>;
return <i className="nf nf-fa-battery_0"></i>;
}
// Get icon to show for current weather status.
function getWeatherIcon(weatherOutput) {
switch (weatherOutput.status) {
case 'clear_day':
return <i className="nf nf-weather-day_sunny"></i>;
case 'clear_night':
return <i className="nf nf-weather-night_clear"></i>;
case 'cloudy_day':
return <i className="nf nf-weather-day_cloudy"></i>;
case 'cloudy_night':
return <i className="nf nf-weather-night_alt_cloudy"></i>;
case 'light_rain_day':
return <i className="nf nf-weather-day_sprinkle"></i>;
case 'light_rain_night':
return <i className="nf nf-weather-night_alt_sprinkle"></i>;
case 'heavy_rain_day':
return <i className="nf nf-weather-day_rain"></i>;
case 'heavy_rain_night':
return <i className="nf nf-weather-night_alt_rain"></i>;
case 'snow_day':
return <i className="nf nf-weather-day_snow"></i>;
case 'snow_night':
return <i className="nf nf-weather-night_alt_snow"></i>;
case 'thunder_day':
return <i className="nf nf-weather-day_lightning"></i>;
case 'thunder_night':
return <i className="nf nf-weather-night_alt_lightning"></i>;
}
}
createRoot(document.getElementById('root')).render(<App />);
function App() {
const [output, setOutput] = useState(providers.outputMap);
useEffect(() => {
providers.onOutput(() => setOutput(providers.outputMap));
}, []);
return (
<div className="app">
<div className="left">
<i className="logo nf nf-custom-windows"></i>
{output.glazewm && (
<div className="workspaces">
{output.glazewm.currentWorkspaces.map(workspace => (
<button
className={`workspace ${workspace.hasFocus && 'focused'} ${workspace.isDisplayed && 'displayed'}`}
onClick={() =>
output.glazewm.runCommand(
`focus --workspace ${workspace.name}`,
)
}
key={workspace.name}
>
{workspace.displayName ?? workspace.name}
</button>
))}
</div>
)}
</div>
<div className="center">{output.date?.formatted}</div>
<div className="right">
{output.glazewm && (
<>
{output.glazewm.bindingModes.map(bindingMode => (
<button
className="binding-mode"
key={bindingMode.name}
onClick={() =>
output.glazewm.runCommand(
`wm-disable-binding-mode --name ${bindingMode.name}`,
)
}
>
{bindingMode.displayName ?? bindingMode.name}
</button>
))}
<button
className={`tiling-direction nf ${output.glazewm.tilingDirection === 'horizontal' ? 'nf-md-swap_horizontal' : 'nf-md-swap_vertical'}`}
onClick={() =>
output.glazewm.runCommand('toggle-tiling-direction')
}
></button>
</>
)}
{output.network && (
<div className="network">
{getNetworkIcon(output.network)}
{output.network.defaultGateway?.ssid}
</div>
)}
{output.memory && (
<div className="memory">
<i className="nf nf-fae-chip"></i>
{Math.round(output.memory.usage)}%
</div>
)}
{output.cpu && (
<div className="cpu">
<i className="nf nf-oct-cpu"></i>
{/* Change the text color if the CPU usage is high. */}
<span
className={output.cpu.usage > 85 ? 'high-usage' : ''}
>
{Math.round(output.cpu.usage)}%
</span>
</div>
)}
{output.battery && (
<div className="battery">
{/* Show icon for whether battery is charging. */}
{output.battery.isCharging && (
<i className="nf nf-md-power_plug charging-icon"></i>
)}
{getBatteryIcon(output.battery)}
{Math.round(output.battery.chargePercent)}%
</div>
)}
{output.weather && (
<div className="weather">
{getWeatherIcon(output.weather)}
{Math.round(output.weather.celsiusTemp)}°C
</div>
)}
</div>
</div>
);
}

View file

@ -0,0 +1,115 @@
/**
* Import the Nerdfonts icon font.
* Ref https://www.nerdfonts.com/cheat-sheet for a cheatsheet of available Nerdfonts icons.
*/
@import 'https://www.nerdfonts.com/assets/css/webfont.css';
i {
color: rgb(115 130 175 / 95%);
margin-right: 7px;
}
body {
color: rgb(255 255 255 / 90%);
font-family: "JetBrainsMono Nerd Font", "LXGW Wenkai", ui-monospace, monospace;
font-size: 12px;
overflow: hidden;
}
html,
body,
#root {
height: 100%;
}
#root {
border-bottom: 1px solid rgb(255 255 255 / 5%);
background: linear-gradient(rgb(0 0 0 / 90%), rgb(5 2 20 / 85%));
}
.app {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
align-items: center;
height: 100%;
padding: 4px 1.5vw;
}
.left,
.center,
.right {
display: flex;
align-items: center;
}
.center {
justify-self: center;
}
.right {
justify-self: end;
}
.logo,
.binding-mode,
.tiling-direction,
.network,
.memory,
.cpu,
.battery {
margin-right: 20px;
}
.workspaces {
display: flex;
align-items: center;
}
.workspace {
background: rgb(255 255 255 / 5%);
margin-right: 4px;
padding: 4px 8px;
color: rgb(255 255 255 / 90%);
border: none;
border-radius: 2px;
cursor: pointer;
&.displayed {
background: rgb(255 255 255 / 15%);
}
&.focused,
&:hover {
background: rgb(75 115 255 / 50%);
}
}
.binding-mode,
.tiling-direction {
background: rgb(255 255 255 / 15%);
color: rgb(255 255 255 / 90%);
border-radius: 2px;
line-height: 1;
padding: 4px 8px;
border: 0;
cursor: pointer;
}
.binding-mode {
margin-right: 4px;
}
.cpu .high-usage {
color: #900029;
}
.battery {
position: relative;
}
.battery .charging-icon {
position: absolute;
font-size: 7px;
left: -8px;
top: 3px;
}

204
platforms/win/glzr/zebar/normalize.css vendored Normal file
View file

@ -0,0 +1,204 @@
/**
* Base CSS styles for better consistency across platforms.
* Yoinked from: https://github.com/sindresorhus/modern-normalize
*/
/*
Document
========
*/
/**
Use a better box model (opinionated).
*/
*,
::before,
::after {
box-sizing: border-box;
}
html {
/* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */
font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji';
line-height: 1.15; /* 1. Correct the line height in all browsers. */
-webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */
tab-size: 4; /* 3. Use a more readable tab size (opinionated). */
}
/*
Sections
========
*/
body {
margin: 0; /* Remove the margin in all browsers. */
}
/*
Text-level semantics
====================
*/
/**
Add the correct font weight in Chrome and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
2. Correct the odd 'em' font sizing in all browsers.
*/
code,
kbd,
samp,
pre {
font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono',
Menlo, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/*
Tabular data
============
*/
/**
Correct table border color inheritance in Chrome and Safari. (https://issues.chromium.org/issues/40615503, https://bugs.webkit.org/show_bug.cgi?id=195016)
*/
table {
border-color: currentcolor;
}
/*
Forms
=====
*/
/**
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type='button'],
[type='reset'],
[type='submit'] {
-webkit-appearance: button;
}
/**
Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
*/
legend {
padding: 0;
}
/**
Add the correct vertical alignment in Chrome and Firefox.
*/
progress {
vertical-align: baseline;
}
/**
Correct the cursor style of increment and decrement buttons in Safari.
*/
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
/**
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/
[type='search'] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
Remove the inner padding in Chrome and Safari on macOS.
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to 'inherit' in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/*
Interactive
===========
*/
/*
Add the correct display in Chrome and Safari.
*/
summary {
display: list-item;
}

View file

@ -0,0 +1,9 @@
{
"$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json",
"startupConfigs": [
{
"path": "neobrutal/bar.zebar.json",
"preset": "default"
}
]
}

View file

@ -1,50 +1,82 @@
# Windows dotfiles
By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix:
![Windows](../../_assets/windows-1.png)
- `%APPDATA%` - `$XDG_CONFIG_HOME` (default: `%USERPROFILE%\AppData\Roaming`)
- Terminal Emulator: [WezTerm](../../tools/wezterm/)
- Tiling Window Manager: [GlazeWM](./glzr/glazewm/config.yaml)
- Status Bar: [Zebar](./glzr/zebar/settings.json)
- Quake Terminal: [Windows Terminal](./WindowsTerminal.json)
- Shell: [PowerShell Core](../../tools/powershell/readme.md)
- WSL1: [Arch Linux](https://github.com/yuk7/ArchWSL)
- WSL2: kali-linux
By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix, some of the software(like `wezterm`) will use these directories as the default configuration path:
| Windows Path | XDG-Equivalent | Default |
|------------|----------|----------|
| `%APPDATA%` | `$XDG_CONFIG_HOME` | `%USERPROFILE%\AppData\Roaming` |
| `%LOCALAPPDATA%` | `$XDG_DATA_HOME` | `%USERPROFILE%\AppData\Local` |
| `%LOCALAPPDATA%\Cache` | `$XDG_CACHE_HOME` | `%USERPROFILE%\AppData\Local\Cache` |
| `%LOCALAPPDATA%\State` | `$XDG_STATE_HOME` | `%USERPROFILE%\AppData\Local\State` |
An example bootstrap script is provided in [bootstrap/Windows.ps1](../../bootstrap/Windows.ps1), which will create necessary directories and link the files.
## PowerShell Profile
This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile.
This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile, which is faster(`powershell` vs `pwsh`, `pwsh` types 6 letters less lol), cross-platform and compatible with Unix.
By default, PowerShell profile is stored in `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`.
By default, PowerShell profile is stored in `%UserProfile%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`.
It is convenient to use `$PROFILE` to locate the profile file.
```pwsh
```powershell
Test-Path $PROFILE
```
Just like Unix Shell, there are configs work for different sessions. To locate them, use `select *` followed by `$PROFILE`.
If you want to change the `AllUsers` scoped profile, do not install `pwsh` via `winget`, use `scoop` instead, since `winget` will install `pwsh` to `%ProgramFiles%\PowerShell\7\pwsh.exe`, which is read-only even with Administrator privileges.
```powershell
PS > $PROFILE | Select *
AllUsersAllHosts : C:\Users\jsony\scoop\apps\pwsh\current\profile.ps1
AllUsersCurrentHost : C:\Users\jsony\scoop\apps\pwsh\current\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts : C:\Users\jsony\Documents\PowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\jsony\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Length : 68
```
Note that the variable `$PROFILE.*` are constants, the only way to change it is to compile your own `pwsh`
To link the profile file:
```pwsh
```powershell
New-Item -ItemType SymbolicLink -Path $PROFILE -Target "$DOTFILES\win\Microsoft.PowerShell_profile.ps1" -Force
```
I use [starship](https://starship.rs/) to customize the prompt, which is located in [`.dotfiles/.config/starship/starship_pwsh.toml`](../.config/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the promp to identify the shell.
I use [starship](https://starship.rs/) to customize the prompt, which is located in [`tools/starship/starship_pwsh.toml`](../../tools/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the prompt to identify the shell.
## `.wslconfig` - WSL Configuration
## `.wslconfig` - WSL2 Configuration
`.wslconfig` only supports `~/.wslconfig` as the configuration path
`.wslconfig` only supports `%UserProfile%\.wslconfig` as the configuration path
```pwsh
New-Item -ItemType SymbolicLink -Path "~\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force
```powershell
New-Item -ItemType SymbolicLink -Path "$Env:UserProfile\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force
```
<!--
## Windows Terminal
Use Hard Link to sync Windows Terminal Settings since it doesn't support symlink.
```pwsh
```powershell
New-Item -ItemType HardLink -Path "$Env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -Target "$DOTFILES\win\WindowsTerminal.json" -Force
```
-->
## Neovide
Neovide configuration is (only) stored in `%APPDATA%\neovide\config.toml`
```pwsh
```powershell
New-Item -ItemType SymbolicLink -Path "$Env:AppData\neovide\config.toml" -Target "$DOTFILES\win\neovide.toml" -Force
```

View file

@ -2,6 +2,10 @@
This repository contains dotfiles for multiple platforms, with _colemak_ as the default keyboard layout.
No rice, no Unixporn/NTporn, just a simple setup that works for me.
Works for Windows, Linux and MacOS.
## Structure
```shell
@ -15,3 +19,13 @@ This repository contains dotfiles for multiple platforms, with _colemak_ as the
├──  scripts # Scripts for various tasks
└──  tools # Multi-file configurations (shell, neovim etc)
```
## Keybindings
```
^
e
< h i >
n
v
```

View file

@ -1,9 +0,0 @@
function Invoke-Completion {
param ([string]$command)
switch ($command) {
'docker' { docker completion powershell | Out-String | Invoke-Expression }
'git' { Import-Module Posh-Git }
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
}
}

View file

@ -0,0 +1,43 @@
<#
.SYNOPSIS
Rename files with a specified extension in a folder, padding the numeric part with zeros.
.PARAMETER ext
The extension of the files to rename, without the dot. Default is "md".
.PARAMETER Numeral
If specified, the files will be renamed in the order of their numeric part.
.EXAMPLE
Rename-FilesWithZeroPadding.ps1 -ext "txt"
Renames all files with the extension "txt" in the current folder, padding the numeric part with zeros.
For example: '1.txt', '2.txt', ... '12.txt' -> '01.txt', '02.txt', ... '12.txt'.
.EXAMPLE
Rename-FilesWithZeroPadding.ps1 -Numeral # This set the Numeral switch to false
Renames all files with the default extension "md" in the current folder, in the order of their filenames.
For example: 'file1.md', 'file2.md', ... 'file12.md' -> '01.md', '02.md', ... '12.md'.
#>
param(
[string]$ext = "md",
[switch]$Numeral
)
if ($Numeral) {
$files = $files | Sort-Object { [int]($_.BaseName -replace '\D', '') }
}
else {
$files = Get-ChildItem -Filter "*.$ext" | Sort-Object Name
$fnamecnt = 1
}
$cnt = $files.Count
$paddingLength = $cnt.ToString().Length
foreach ($file in $files) {
if ($Numeral) {
$number = [int]($file.BaseName -replace '\D', '')
$newNumber = $number.ToString().PadLeft($paddingLength, '0')
$newName = "$newNumber.$ext"
}
else {
$newName = ($fnamecnt++).ToString().PadLeft($paddingLength, '0') + ".$ext"
}
Rename-Item -Path $file.FullName -NewName $newName
}

View file

@ -1,65 +0,0 @@
[colors.primary]
background = "#303446"
foreground = "#c6d0f5"
dim_foreground = "#838ba7"
bright_foreground = "#c6d0f5"
[colors.cursor]
text = "#303446"
cursor = "#f2d5cf"
[colors.vi_mode_cursor]
text = "#303446"
cursor = "#babbf1"
[colors.search.matches]
foreground = "#303446"
background = "#a5adce"
[colors.search.focused_match]
foreground = "#303446"
background = "#a6d189"
[colors.footer_bar]
foreground = "#303446"
background = "#a5adce"
[colors.hints.start]
foreground = "#303446"
background = "#e5c890"
[colors.hints.end]
foreground = "#303446"
background = "#a5adce"
[colors.selection]
text = "#303446"
background = "#f2d5cf"
[colors.normal]
black = "#51576d"
red = "#e78284"
green = "#a6d189"
yellow = "#e5c890"
blue = "#8caaee"
magenta = "#f4b8e4"
cyan = "#81c8be"
white = "#b5bfe2"
[colors.bright]
black = "#626880"
red = "#e78284"
green = "#a6d189"
yellow = "#e5c890"
blue = "#8caaee"
magenta = "#f4b8e4"
cyan = "#81c8be"
white = "#a5adce"
[[colors.indexed_colors]]
index = 16
color = "#ef9f76"
[[colors.indexed_colors]]
index = 17
color = "#f2d5cf"

View file

@ -1,149 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Themes/Win11Light.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="ItemBulletSelectedStyle"
BasedOn="{StaticResource ItemBulletSelectedStyle}"
TargetType="{x:Type Border}">
<Setter Property="Background" Value="#ca9ee6" />
</Style>
<Style
x:Key="ItemGlyph"
BasedOn="{StaticResource ItemGlyph}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#a5adce" />
</Style>
<Style
x:Key="QueryBoxStyle"
BasedOn="{StaticResource QueryBoxStyle}"
TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="#c6d0f5" />
<Setter Property="CaretBrush" Value="#c6d0f5" />
</Style>
<Style
x:Key="QuerySuggestionBoxStyle"
BasedOn="{StaticResource QuerySuggestionBoxStyle}"
TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="#a5adce" />
</Style>
<Style
x:Key="WindowBorderStyle"
BasedOn="{StaticResource WindowBorderStyle}"
TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="#414559" />
<Setter Property="Background" Value="#303446" />
</Style>
<!-- Item Style -->
<Style
x:Key="ItemTitleStyle"
BasedOn="{StaticResource ItemTitleStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#b5bfe2" />
</Style>
<Style
x:Key="ItemSubTitleStyle"
BasedOn="{StaticResource ItemSubTitleStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#a5adce" />
</Style>
<Style
x:Key="SeparatorStyle"
BasedOn="{StaticResource SeparatorStyle}"
TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="#626880" />
</Style>
<Style
x:Key="ItemTitleSelectedStyle"
BasedOn="{StaticResource ItemTitleSelectedStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#c6d0f5" />
</Style>
<Style
x:Key="ItemSubTitleSelectedStyle"
BasedOn="{StaticResource ItemSubTitleSelectedStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#b5bfe2" />
</Style>
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#414559</SolidColorBrush>
<!-- button style in the middle of the scrollbar -->
<Style
x:Key="ThumbStyle"
BasedOn="{StaticResource ThumbStyle}"
TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border
Background="#414559"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="2"
DockPanel.Dock="Right" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="SearchIconStyle"
BasedOn="{StaticResource SearchIconStyle}"
TargetType="{x:Type Path}">
<Setter Property="Fill" Value="#949cbb" />
</Style>
<Style x:Key="SearchIconPosition" BasedOn="{StaticResource SearchIconPosition}" TargetType="{x:Type Canvas}">
<Setter Property="Background" Value="#303446" />
</Style>
<Style x:Key="ItemHotkeyStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#737994" />
</Style>
<Style x:Key="ItemHotkeySelectedStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#ca9ee6" />
</Style>
<Style x:Key="ItemGlyphSelectedStyle" BasedOn="{StaticResource ItemGlyphSelectedStyle}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#c6d0f5" />
</Style>
<Style
x:Key="ClockBox"
BasedOn="{StaticResource ClockBox}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#a5adce" />
</Style>
<Style
x:Key="DateBox"
BasedOn="{StaticResource DateBox}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#a5adce" />
</Style>
<Style
x:Key="PreviewBorderStyle"
BasedOn="{StaticResource PreviewBorderStyle}"
TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="#303446" />
</Style>
<Style
x:Key="PreviewItemTitleStyle"
BasedOn="{StaticResource PreviewItemTitleStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#8caaee" />
</Style>
<Style
x:Key="PreviewItemSubTitleStyle"
BasedOn="{StaticResource PreviewItemSubTitleStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#51576d" />
</Style>
<Style
x:Key="PreviewGlyph"
BasedOn="{StaticResource PreviewGlyph}"
TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#8caaee" />
</Style>
</ResourceDictionary>

View file

@ -1,7 +1,6 @@
// Paste this into surfingkeys advanced settings
// or use:
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js
// TODO: Visual Mode
// #region Example
/** Examples
@ -23,406 +22,458 @@ api.unmap('<ctrl-i>');
// Settings
settings.language = "zh-CN";
settings.showModeStatus = false;
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
// #region Helper
const {
aceVimMap,
addVimMapKey,
mapkey,
imap,
imapkey,
getClickableElements,
vmapkey,
map,
unmap,
cmap,
addSearchAlias,
removeSearchAlias,
tabOpenLink,
readText,
Clipboard,
Front,
Hints,
Visual,
RUNTIME,
} = api;
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
const forward = {
add: function (key) { // 转发即将被 unmap 的键
return api.map(`for${key}`, key)
add: function (key) {
// 转发即将被 unmap 的键
return api.map(`for${key}`, key);
},
cancel: function (key) { // 删除转发生成的键
api.unmap(`for${key}`)
api.unmap(key)
cancel: function (key) {
// 删除转发生成的键
api.unmap(`for${key}`);
api.unmap(key);
},
use: function (key) {
return `for${key}`
}
}
return `for${key}`;
},
};
const colemak = {
forward: function (key) { // 转发即将被 unmap 的键
api.map(key, `col${key}`)
api.unmap(`col${key}`)
forward: function (key) {
// 转发即将被 unmap 的键
api.map(key, `col${key}`);
api.unmap(`col${key}`);
},
use: function (key) {
return `col${key}`
return `col${key}`;
},
map: function (a, b) {
api.map(colemak.use(a), forward.use(b))
}
}
api.map(colemak.use(a), forward.use(b));
},
};
const vForward = {
add: function (key) {
// 转发即将被 unmap 的键
return api.vmap(`vfor${key}`, key);
},
cancel: function (key) {
// 删除转发生成的键
api.vunmap(`vfor${key}`);
api.vunmap(key);
},
use: function (key) {
return `vfor${key}`;
},
};
const vColemak = {
forward: function (key) {
// 转发即将被 unmap 的键
api.vmap(key, `vcol${key}`);
api.vunmap(`vcol${key}`);
},
use: function (key) {
return `vcol${key}`;
},
map: function (a, b) {
api.vmap(vColemak.use(a), vForward.use(b));
},
};
const forwardFactory = {
push: function (mapLists) { // forward original keys
push: function (mapLists) {
// forward original keys
for (let key in mapLists) {
forward.add(mapLists[key])
forward.add(mapLists[key]);
}
},
map: function (mapLists) {
for (let key in mapLists) {
colemak.map(key, mapLists[key])
colemak.map(key, mapLists[key]);
}
},
pull: function (mapLists) {
for (let key in mapLists) {
forward.cancel(mapLists[key])
forward.cancel(mapLists[key]);
}
for (let key in mapLists) {
colemak.forward(key)
colemak.forward(key);
}
},
};
const vForwardFactory = {
push: function (mapLists) {
// forward original keys
for (let key in mapLists) {
vForward.add(mapLists[key]);
}
},
map: function (mapLists) {
for (let key in mapLists) {
vColemak.map(key, mapLists[key]);
}
},
pull: function (mapLists) {
for (let key in mapLists) {
vForward.cancel(mapLists[key]);
}
for (let key in mapLists) {
vColemak.forward(key);
}
},
};
const parseSearchResponse = function (response) {
const res = JSON.parse(response.text);
return res.map((r) => r.phrase);
};
const _addSearchAlias = function (
alias,
name,
searchUrl,
acUrl = "https://duckduckgo.com/ac/?q=",
searchPrefix = "s",
parseResponse = parseSearchResponse,
) {
api.addSearchAlias(
alias,
name,
searchUrl,
searchPrefix,
acUrl,
parseResponse,
);
};
// #endregion
// #region Keymap
const mapLists = {
/// scroll page
// Arrow
'n': 'j',
'e': 'k',
'i': 'l',
n: "j",
e: "k",
i: "l",
// l <-> i
'l': 'i',
'L': 'I',
l: "i",
L: "I",
// k <-> n
'k': 'n',
'K': 'N',
k: "n",
K: "N",
// j <-> e
'j': 'e',
j: "e",
// PrevTab < H - I > NextTab
'H': 'E',
'I': 'R',
H: "E",
I: "R",
// E,N -> Up/Down HalfPage
'N': 'd',
'E': 'e',
N: "d",
E: "e",
// F -> Open Link in New Tab
'F': 'af',
F: "af",
// oH -> Tab History
'oH': 'H',
oH: "H",
// gh/gi -> Prev/Next History
'gh': 'S',
'gi': 'D',
gh: "S",
gi: "D",
// t -> Open Link in New Tab
't': 'gf',
t: "gf",
// 缩放
'zu': 'zi',
'zo': 'ze',
'zz': 'zr',
}
zu: "zi",
zo: "ze",
zz: "zr",
};
const vmapLists = {
'n': 'j',
'N': 'J',
'e': 'k',
'E': 'K',
'i': 'l',
'I': 'L',
'j': 'e',
'J': 'E',
'k': 'n',
'K': 'N',
}
const vMapLists = {
n: "j",
N: "J",
e: "k",
E: "K",
i: "l",
I: "L",
j: "e",
J: "E",
k: "n",
K: "N",
};
forwardFactory.push(mapLists)
forwardFactory.map(mapLists)
forwardFactory.push(mapLists);
forwardFactory.map(mapLists);
vForwardFactory.push(vMapLists);
vForwardFactory.map(vMapLists);
// 鼠标点击
api.unmap('gi')
api.unmap('[[')
api.unmap(']]')
api.unmap(';m')
api.unmap(';fs')
api.unmap('O')
api.unmap('C')
api.map('g/', 'gU') // Goto Root Domain
forwardFactory.pull(mapLists)
api.unmap("gi");
api.unmap("[[");
api.unmap("]]");
api.unmap(";m");
api.unmap(";fs");
api.unmap("O");
api.unmap("C");
api.map("g/", "gU"); // Goto Root Domain
// p to site-specific
api.unmap("p");
api.unmap("<space>"); // Leader Key
forwardFactory.pull(mapLists);
vForwardFactory.pull(vMapLists);
// #endregion
// #region Search Alias
api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text);
return res.map(function (r) {
return r.phrase;
});
});
api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text);
return res.map(function (r) {
return r.phrase;
});
});
api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text);
return res.map(function (r) {
return r.phrase;
});
});
api.addSearchAlias('c', 'ChatGPT', 'https://chatgpt.com/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text);
return res.map(function (r) {
return r.phrase;
});
});
removeSearchAlias("s"); // StackOverflow
removeSearchAlias("d"); // DuckDuckGo
removeSearchAlias("g"); // Google
removeSearchAlias("b"); // Baidu
removeSearchAlias("w"); // Bing
removeSearchAlias("y"); // YouTube
/// Common
_addSearchAlias("dd", "DuckDuckGo", "https://duckduckgo.com/?q=");
_addSearchAlias("gg", "Google", "https://www.google.com/search?q=");
_addSearchAlias("bd", "Baidu", "https://www.baidu.com/s?wd=");
_addSearchAlias("bi", "Bing", "https://www.bing.com/search?q=");
_addSearchAlias(
"wk",
"Wikipedia",
"https://en.wikipedia.org/w/index.php?title=Special:Search&search=",
);
_addSearchAlias("re", "Reddit", "https://www.reddit.com/search?q=");
_addSearchAlias("st", "Steam", "https://store.steampowered.com/search/?term=");
_addSearchAlias(
"ud",
"UrbanDictionary",
"https://www.urbandictionary.com/define.php?term=",
);
_addSearchAlias("tw", "X", "https://twitter.com/search?q=");
_addSearchAlias("de", "Thesaurus", "https://www.onelook.com/?w=");
_addSearchAlias(
"ww",
"WantWords",
"https://www.shenyandayi.com/wantWordsResult?lang=zh&query=",
);
/// AI Search
_addSearchAlias("fe", "Felo", "https://felo.ai/search?q=");
_addSearchAlias("pp", "Perplexity", "https://www.perplexity.ai/?q=");
_addSearchAlias("cg", "ChatGPT", "https://chat.openai.com/?q=");
_addSearchAlias("mc", "Metacritic", "https://www.metacritic.com/search/");
/// EECS Related
_addSearchAlias(
"gh",
"GitHub",
"https://github.com/search?type=repositories&q=",
);
_addSearchAlias("so", "StackOverflow", "https://stackoverflow.com/search?q=");
_addSearchAlias("se", "StackExchange", "https://stackexchange.com/search?q=");
_addSearchAlias(
"aw",
"ArchWiki",
"https://wiki.archlinux.org/index.php?search=",
);
_addSearchAlias("wa", "WolframAlpha", "https://www.wolframalpha.com/input/?i=");
_addSearchAlias("eb", "ebay", "https://www.ebay.co.uk/sch/i.html?kw=");
// Programming language packages
_addSearchAlias("py", "pypi", "https://pypi.org/search/?q=");
_addSearchAlias("ng", "NuGet", "https://www.nuget.org/packages?q=");
_addSearchAlias("np", "npm", "https://www.npmjs.com/search?q=");
// Package Manager Search
_addSearchAlias("wg", "winget", "https://winget.ragerworks.com/search/all/");
_addSearchAlias("sc", "Scoop", "https://scoop.sh/#/apps?q=");
_addSearchAlias("br", "HomeBrew", "https://duckduckgo.com/?q=!brew ");
_addSearchAlias("au", "AUR", "https://aur.archlinux.org/packages?K=");
_addSearchAlias("pa", "Pacman", "https://archlinux.org/packages/?q=");
_addSearchAlias("ap", "APT", "https://packages.ubuntu.com/search?keywords=");
_addSearchAlias(
"a2",
"AlternativeTo",
"https://alternativeto.net/browse/search/?q=",
);
_addSearchAlias(
"cr",
"Chrome Web Store",
"https://chrome.google.com/webstore/search/",
);
/// Video
_addSearchAlias(
"yt",
"YouTube",
"https://www.youtube.com/results?search_query=",
);
_addSearchAlias("bl", "Bilibili", "https://search.bilibili.com/all?keyword=");
// #endregion
// #region Site-specific
// chatgpt.com
api.unmap('t', /chatgpt.com/);
api.mapkey('tn', 'New Chat', function () {
var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)')
const chatgptNewChat = function () {
var btn = document.querySelector(
"div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)",
);
btn.click();
}, { domain: /chatgpt.com/ });
api.mapkey('ts', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)');
};
const chatgptStartStop = function () {
var btn = document.querySelector("button.h-8:nth-child(2)");
btn.click();
}, { domain: /chatgpt.com/ });
api.mapkey('ts', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)');
btn.click();
}, { domain: /chatgpt.com/ });
api.mapkey('S', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)');
btn.click();
}, { domain: /chatgpt.com/ });
};
api.unmap("t", /chatgpt.com/);
api.mapkey("tn", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ });
api.mapkey("ts", "Start/Stop Generating", chatgptStartStop, {
domain: /chatgpt.com/,
});
api.mapkey("S", "Start/Stop Generating", chatgptStartStop, {
domain: /chatgpt.com/,
});
api.mapkey("an", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ });
api.mapkey("as", "Start/Stop Generating", chatgptStartStop, {
domain: /chatgpt.com/,
});
//api.mapkey('tm', 'Toggle Model', function () {
// var btn = document.querySelector('#radix -\: r2i\:');
// btn.click();
//}, { domain: /chatgpt.com/ });
// perplexity.ai
api.unmap("<Ctrl-i>", /perplexity.ai/); // allows to use perplexity web keybindings
api.mapkey("aB", "Add Perplexity Bookmark", function () {
// button.border:nth-child(2)
var btn = document.querySelector("button.border:nth-child(2)");
btn.click();
});
// #endregion
// #region Theme
// reference to https://github.com/Foldex/surfingkeys-config
// api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;');
// api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text");
// api.Visual.style('marks', 'background-color: #A3BE8C99;');
// api.Visual.style('cursor', 'background-color: #88C0D0;');
// settings.theme = `
// fg: #E5E9F0;
// bg: #3B4252;
// bg-dark: #2E3440;
// border: #4C566A;
// main-fg: #88C0D0;
// accent-fg: #A3BE8C;
// info-fg: #5E81AC;
// select: #4C566A;
// /* ---------- Generic ---------- */
// .sk_theme {
// background: var(--bg);
// color: var(--fg);
// background-color: var(--bg);
// border-color: var(--border);
// font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// }
// #region ACE Editor
addVimMapKey(
// Navigation
{
keys: "k",
type: "motion",
motion: "findNext",
motionArgs: { forward: true, toJumplist: true },
},
{
keys: "K",
type: "motion",
motion: "findNext",
motionArgs: { forward: false, toJumplist: true },
},
// input {
// font-family: var(--font);
// font-weight: var(--font-weight);
// }
// Word movement
{
keys: "j",
type: "motion",
motion: "moveByWords",
motionArgs: { forward: true, wordEnd: true, inclusive: true },
},
{
keys: "J",
type: "motion",
motion: "moveByWords",
motionArgs: {
forward: true,
wordEnd: true,
bigWord: true,
inclusive: true,
},
},
// .sk_theme tbody {
// color: var(--fg);
// }
// Insert mode entries
{
keys: "l",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "inplace" },
context: "normal",
},
{
keys: "gl",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "lastEdit" },
context: "normal",
},
{
keys: "L",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "firstNonBlank" },
context: "normal",
},
{
keys: "gL",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "bol" },
context: "normal",
},
{
keys: "L",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "startOfSelectedArea" },
context: "visual",
},
{
keys: "n",
type: "motion",
motion: "moveByLines",
motionArgs: { forward: true, linewise: true },
},
{
keys: "e",
type: "motion",
motion: "moveByLines",
motionArgs: { forward: false, linewise: true },
},
{
keys: "i",
type: "motion",
motion: "moveByCharacters",
motionArgs: { forward: true },
},
{
keys: "H",
type: "keyToKey",
toKeys: "^",
},
{
keys: "I",
type: "keyToKey",
toKeys: "$",
},
{
keys: "Y",
type: "keyToKey",
toKeys: "y$",
},
);
// .sk_theme input {
// color: var(--fg);
// }
// /* Hints */
// #sk_hints .begin {
// color: var(--accent-fg) !important;
// }
// #sk_tabs .sk_tab {
// background: var(--bg-dark);
// border: 1px solid var(--border);
// }
// #sk_tabs .sk_tab_title {
// color: var(--fg);
// }
// #sk_tabs .sk_tab_url {
// color: var(--main-fg);
// }
// #sk_tabs .sk_tab_hint {
// background: var(--bg);
// border: 1px solid var(--border);
// color: var(--accent-fg);
// }
// .sk_theme #sk_frame {
// background: var(--bg);
// opacity: 0.2;
// color: var(--accent-fg);
// }
// /* ---------- Omnibar ---------- */
// /* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */
// /* .sk_theme#sk_omnibar {
// width: 100%;
// left: 0;
// } */
// .sk_theme .title {
// color: var(--accent-fg);
// }
// .sk_theme .url {
// color: var(--main-fg);
// }
// .sk_theme .annotation {
// color: var(--accent-fg);
// }
// .sk_theme .omnibar_highlight {
// color: var(--accent-fg);
// }
// .sk_theme .omnibar_timestamp {
// color: var(--info-fg);
// }
// .sk_theme .omnibar_visitcount {
// color: var(--accent-fg);
// }
// .sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
// background: var(--bg-dark);
// }
// .sk_theme #sk_omnibarSearchResult ul li.focused {
// background: var(--border);
// }
// .sk_theme #sk_omnibarSearchArea {
// border-top-color: var(--border);
// border-bottom-color: var(--border);
// }
// .sk_theme #sk_omnibarSearchArea input,
// .sk_theme #sk_omnibarSearchArea span {
// font-size: var(--font-size);
// }
// .sk_theme .separator {
// color: var(--accent-fg);
// }
// /* ---------- Popup Notification Banner ---------- */
// #sk_banner {
// font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// background: var(--bg);
// border-color: var(--border);
// color: var(--fg);
// opacity: 0.9;
// }
// /* ---------- Popup Keys ---------- */
// #sk_keystroke {
// background-color: var(--bg);
// }
// .sk_theme kbd .candidates {
// color: var(--info-fg);
// }
// .sk_theme span.annotation {
// color: var(--accent-fg);
// }
// /* ---------- Popup Translation Bubble ---------- */
// #sk_bubble {
// background-color: var(--bg) !important;
// color: var(--fg) !important;
// border-color: var(--border) !important;
// }
// #sk_bubble * {
// color: var(--fg) !important;
// }
// #sk_bubble div.sk_arrow div:nth-of-type(1) {
// border-top-color: var(--border) !important;
// border-bottom-color: var(--border) !important;
// }
// #sk_bubble div.sk_arrow div:nth-of-type(2) {
// border-top-color: var(--bg) !important;
// border-bottom-color: var(--bg) !important;
// }
// /* ---------- Search ---------- */
// #sk_status,
// #sk_find {
// font-size: var(--font-size);
// border-color: var(--border);
// }
// .sk_theme kbd {
// background: var(--bg-dark);
// border-color: var(--border);
// box-shadow: none;
// color: var(--fg);
// }
// .sk_theme .feature_name span {
// color: var(--main-fg);
// }
// /* ---------- ACE Editor ---------- */
// #sk_editor {
// background: var(--bg-dark) !important;
// height: 50% !important;
// /* Remove this to restore the default editor size */
// }
// .ace_dialog-bottom {
// border-top: 1px solid var(--bg) !important;
// }
// .ace-chrome .ace_print-margin,
// .ace_gutter,
// .ace_gutter-cell,
// .ace_dialog {
// background: var(--bg) !important;
// }
// .ace-chrome {
// color: var(--fg) !important;
// }
// .ace_gutter,
// .ace_dialog {
// color: var(--fg) !important;
// }
// .ace_cursor {
// color: var(--fg) !important;
// }
// .normal-mode .ace_cursor {
// background-color: var(--fg) !important;
// border: var(--fg) !important;
// opacity: 0.7 !important;
// }
// .ace_marker-layer .ace_selection {
// background: var(--select) !important;
// }
// .ace_editor,
// .ace_dialog span,
// .ace_dialog input {
// font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// }`;
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
// #endregion
// #region Hints
// #endregion

View file

@ -31,6 +31,9 @@ else if test -d /home/linuxbrew/.linuxbrew/bin # Linux
set -gx PATH /home/linuxbrew/.linuxbrew/bin $PATH
end
if command -v brew > /dev/null
set -gx HOMEBREW_NO_ENV_HINTS
end
# Azure CLI
if command -v az > /dev/null
@ -102,6 +105,7 @@ if command -v gem > /dev/null
set -gx PATH $dir $PATH
end
end
set -gx PATH $HOME/.local/share/gem/ruby/3.3.0/bin $PATH
end
# Spacemacs
if command -v emacs > /dev/null
@ -135,3 +139,18 @@ if status is-interactive
set IPYTHONDIR $XDG_CONFIG_HOME/ipython
end
end
# Coursier: Scala dependency manager
if command -v coursier > /dev/null
set -gx PATH "$PATH:$XDG_DATA_HOME/coursier/bin"
end
# pnpm
set -gx PNPM_HOME "$XDG_DATA_HOME/pnpm"
if not string match -q -- $PNPM_HOME $PATH
set -gx PATH "$PNPM_HOME" $PATH
end
# pnpm end
test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish
test -f /opt/miniconda3/etc/fish/conf.d/conda.fish && source /opt/miniconda3/etc/fish/conf.d/conda.fish

View file

@ -69,4 +69,11 @@ if command -v pacman > /dev/null
abbr --add paci "sudo pacman -S"
abbr --add pacr "sudo pacman -R"
abbr --add pacu "sudo pacman -Syu"
abbr --add pacs "sudo pacman -Ss"
end
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
abbr --add icat "kitten icat"
else if test "$TERM_PROGRAM" = "WezTerm"
abbr --add icat "wezterm imgcat"
end

View file

@ -25,4 +25,4 @@ bind -M default 'i' forward-char
bind -M default -m insert l repaint-mode
bind -M default -m insert L beginning-of-line repaint-mode
# TODO: Add more key bindings here
fzf --fish | source

View file

@ -8,6 +8,6 @@
# ln -sf $DOTFILES/tools/fish ~/.config/fish
if command -v starship > /dev/null
set -gx STARSHIP_CONFIG $DOTFILES/tools/starship/starship_fish.toml
set -gx STARSHIP_CONFIG "~/.dotfiles/tools/starship/starship_fish.toml"
starship init fish | source
end

View file

@ -16,9 +16,22 @@ if status is-interactive
# macOS Specific
abbr --add clip pbcopy
abbr --add paste pbpaste
# Use GNU Coreutils
alias cp=gcp
alias ln=gln
alias mkdir=gmkdir
alias mv=gmv
alias rm=grm
alias rmdir=grmdir
alias touch=gtouch
case "Linux"
# Linux Specific
case '*'
# Default / Fallback case
end
end
# bun
set --export BUN_INSTALL "$HOME/.bun"
set --export PATH $BUN_INSTALL/bin $PATH

View file

@ -1 +0,0 @@
lazy-lock.json

View file

@ -5,24 +5,8 @@
@Date 2024-11-27
@Description neovim
]]
-- 针对特定文件类型设置快捷键
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown", -- 指定文件类型
callback = function()
vim.api.nvim_buf_set_keymap(0, "v", "`", "c`<C-r>\"`<Esc>", { noremap = true, silent = true, desc = "Wrap selection with backticks" })
end,
})
-- 加载配置
require("config.options")
-- 加载键位映射
require("config.keymaps")
-- 加载插件
require("config.plugins")
-- 加载主题
require("config.colorscheme")
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
require("config.keymaps")

47
tools/nvim/lazy-lock.json Normal file
View file

@ -0,0 +1,47 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
"auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" },
"betterTerm.nvim": { "branch": "main", "commit": "6f03af3a1ed4d054ecbcb0aa8266ddaf610aa657" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"code_runner.nvim": { "branch": "main", "commit": "65218f8f646fe61e506090522df357539642ae83" },
"conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" },
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"gitsigns.nvim": { "branch": "main", "commit": "76d88f3b584e1f83b2aa51663a32cc6ee8d97eff" },
"hover.nvim": { "branch": "main", "commit": "140c4d0ae9397b76baa46b87c574f5377de09309" },
"kanagawa.nvim": { "branch": "master", "commit": "988082eb00b845e4afbcaa4fd8e903da8a3ab3b9" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "cab134611eb755abe9ba95f5d86969f5cece448d" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" },
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
"nvim-treesitter": { "branch": "master", "commit": "f0c928dbe93533b7e35894a8f957f40150d1f663" },
"nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"onedarkpro.nvim": { "branch": "main", "commit": "0feb5f55dd777352f2dddd7478dd13d050864ee3" },
"orgmode": { "branch": "master", "commit": "4e4a14a7dd613953eddacbc0f0ff1583817d7de1" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"render-markdown.nvim": { "branch": "main", "commit": "f0eb5893556200e9f945c0f0ea3c83bbd20dd963" },
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
"vim-just": { "branch": "main", "commit": "ed67f198e981f555c0f9e9ed5b69b4b06543a9e1" },
"vim-wakatime": { "branch": "master", "commit": "cf51327a9e08935569614d1cb24e779ee9f45519" },
"vimtex": { "branch": "master", "commit": "c8412f444bfaf447981242d685c40e45b1c96b82" },
"which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" },
"winbar.nvim": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" },
"yanky.nvim": { "branch": "main", "commit": "f9b905994cccf3c55f41af3a0a1f4c76c844e411" }
}

View file

@ -1 +1 @@
vim.cmd.colorscheme("catppuccin")
vim.cmd.colorscheme("kanagawa")

View file

@ -1,2 +1 @@
require("keymaps")

View file

@ -25,6 +25,7 @@ opt.linebreak = true
-- Indentation
opt.expandtab = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.shiftround = true
-- Case
@ -36,8 +37,10 @@ opt.cursorline = true
opt.termguicolors = true
-- Fold
opt.foldlevel = 99
opt.foldmethod = "expr"
opt.foldexpr = "nvim_treesitter#foldexpr()"
opt.foldlevel = 99
opt.foldlevelstart = 1
-- Statusline
opt.laststatus = 0
@ -50,3 +53,5 @@ opt.scrolloff = 5
opt.sidescrolloff = 10
opt.conceallevel = 2
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"

View file

@ -3,20 +3,14 @@
--- for available server and name
local M = {}
M.servers = {
"arduino_language_server", -- Arduino
"bashls", -- Bash
"clangd", -- C/C++
-- "cmake", -- CMake
"eslint", -- JavaScript
"gopls", -- Go
"html", -- HTML
"julials", -- Julia
"lua_ls", -- Lua
"omnisharp", -- C# & F#
"powershell_es", -- PowerShell
"pyright", -- Python
"rust_analyzer", -- Rust
"taplo", -- TOML
"vimls", -- vimscript
}

View file

@ -1,20 +1,74 @@
local mode_arrow = { "n", "v", "o", "s", "x" }
local mode_arrow = { "n", "v", "s", "x" }
local keymaps_basic = { -- Modification of Original Keymap - Colemak
{ mode = mode_arrow, keys = "n", cmd = "j" },
{ mode = mode_arrow, keys = "e", cmd = "k" },
{ mode = mode_arrow, keys = "i", cmd = "l" },
{ keys = "H", cmd = ":bprevious<CR>" },
{ keys = "N", cmd = "J" },
{ keys = "E", cmd = "K" },
{ keys = "I", cmd = ":bnext<CR>" },
{ keys = "l", cmd = "i" },
{ keys = "L", cmd = "I" },
{ keys = "k", cmd = "n" },
{ keys = "K", cmd = "N" },
{ keys = "j", cmd = "e" },
{ keys = "J", cmd = "E" },
{ keys = "Y", cmd = "y$"},
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L8
{
mode = mode_arrow,
keys = "n",
cmd = "v:count == 0 ? 'gj' : 'j'",
opts = { desc = "Down", expr = true, silent = true },
},
{
mode = mode_arrow,
keys = "<Down>",
cmd = "v:count == 0 ? 'gj' : 'j'",
opts = { desc = "Down", expr = true, silent = true },
},
{
mode = mode_arrow,
keys = "e",
cmd = "v:count == 0 ? 'gk' : 'k'",
opts = { desc = "Up", expr = true, silent = true },
},
{
mode = mode_arrow,
keys = "<Up>",
cmd = "v:count == 0 ? 'gk' : 'k'",
opts = { desc = "Up", expr = true, silent = true },
},
{
mode = "o",
keys = "n",
cmd = "j",
opts = { desc = "Down", silent = true },
},
{
mode = "o",
keys = "<Down>",
cmd = "j",
opts = { desc = "Down", silent = true },
},
{
mode = "o",
keys = "e",
cmd = "k",
opts = { desc = "Up", silent = true },
},
{
mode = "o",
keys = "<Up>",
cmd = "k",
opts = { desc = "Up", silent = true },
},
{ mode = mode_arrow, keys = "h", cmd = "h", opts = { desc = "Left", silent = true } },
{ mode = mode_arrow, keys = "i", cmd = "l", opts = { desc = "Right", silent = true } },
{ keys = "H", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ keys = "I", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
{ keys = "N", cmd = "5k", opts = { desc = "Up 5 Lines" } },
{ keys = "E", cmd = "5j", opts = { desc = "Down 5 Lines" } },
{ keys = "Y", cmd = "y$", opts = { desc = "Yank to End of Line" } },
{ keys = "E", cmd = "5k" },
-- Text object implementation
{ mode = { "n", "o", "x" }, keys = "l", cmd = "i", opts = { desc = "Insert" } },
{ keys = "L", cmd = "I", opts = { desc = "Insert at Start of Line" } },
{ keys = "k", cmd = "n", opts = { desc = "Next Search" } },
{ keys = "K", cmd = "N", opts = { desc = "Previous Search" } },
{ keys = "j", cmd = "e", opts = { desc = "jump to end of word" } },
{ keys = "J", cmd = "E", opts = { desc = "jump to end of WORD" } },
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L60
{ keys = "<Esc>", cmd = "<Cmd>nohlsearch<Bar>diffupdate<CR>", opts = { desc = "Clear Search Highlight" } },
}
return keymaps_basic

View file

@ -0,0 +1,55 @@
local M = {}
--- buffer that doesn't act as an editor or common buffer.
--- Use `q` to close the buffer.
local tmp_buf = {
"qf", -- quickfix
"crunner", -- code runner
}
local term_buf = {
"floaterm",
"term",
}
local term_mode = {
"n",
"i",
"t",
}
local term_keymaps = {
{ mode = term_mode, keys = "<C-q>", cmd = ":FloatermToggle", desc = "Exit terminal mode" },
}
M.tmp_buf_keymaps = {
{ mode = "n", keys = "q", cmd = "<Cmd>q<CR>", desc = "Close buffer" },
}
for _, buf in ipairs(tmp_buf) do
vim.api.nvim_create_autocmd("FileType", {
pattern = buf,
callback = function()
for _, map in ipairs(M.tmp_buf_keymaps) do
local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {})
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
end
end,
})
end
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*",
callback = function()
-- 检查当前 buffer 的 buftype
local buftype = vim.bo.buftype
if buftype == "terminal" then
for _, map in ipairs(term_keymaps) do
local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {})
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
end
end
end,
})
return M

View file

@ -1,52 +1,48 @@
local M = {}
local global_default_opts = { noremap = true, silent = true }
local global_default_mode = { "n" }
-- local mode_arrow = { "n", "v", "o", "s", "x" }
local keymaps_user_command = require("keymaps.user-command")
local utils = require("keymaps.utils")
local function set_keymaps(maps, default_opts, default_mode)
for _, map in ipairs(maps) do
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
local mode = map.mode or default_mode
vim.keymap.set(mode, map.keys, map.cmd, opts)
end
end
local keymaps_basic = require("keymaps.basic")
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
local keymaps_leader = require("keymaps.leaders")
set_keymaps(keymaps_basic, global_default_opts, global_default_mode)
set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode)
set_keymaps(keymaps_leader, global_default_opts, global_default_mode)
local keymaps_general = vim.tbl_extend("force", {}, require("keymaps.leaders"), require("keymaps.lspkeys"))
-- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic`
local keymaps_basic = require("keymaps.basic")
local keymaps_buffer = require("keymaps.buffer")
-- local keymaps_leader = require("keymaps.leaders")
-- local keymaps_lsp = require("keymaps.lspkeys")
utils.set_keymaps(keymaps_general)
utils.set_keymaps(keymaps_basic)
utils.set_keymaps(keymaps_nvim_tree_general)
utils.set_keymaps(keymaps_buffer)
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
--- `map` default for `cmp.mapping`
function M.cmp_nvim_keymaps(map)
return {
{ keys = "<C-n>", cmd = map.select_next_item(), desc = "Select next completion item" },
{ keys = "<C-p>", cmd = map.select_prev_item(), desc = "Select previous completion item" },
{ keys = "<C-y>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
{ keys = "<Tab>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
{ keys = "<C-Space>", cmd = map.complete(), desc = "Trigger completion" },
{ keys = "<C-e>", cmd = map.abort(), desc = "Abort completion" },
{ keys = "<C-n>", cmd = map.select_next_item(), opts = { desc = "Select next completion item" } },
{ keys = "<C-p>", cmd = map.select_prev_item(), opts = { desc = "Select previous completion item" } },
{ keys = "<C-y>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<Tab>", cmd = map.confirm({ select = true }), opts = { desc = "Confirm completion" } },
{ keys = "<C-Space>", cmd = map.complete(), opts = { desc = "Trigger completion" } },
{ keys = "<C-e>", cmd = map.abort(), opts = { desc = "Abort completion" } },
}
end
local function set_markdown_keymaps(bufnr)
local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("v", "`", "c`<C-r>\"`<Esc>", opts)
end
-- local function set_markdown_keymaps(bufnr)
-- local opts = { noremap = true, silent = true, buffer = bufnr }
-- vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts)
-- end
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
set_markdown_keymaps(0)
end,
})
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "markdown",
-- callback = function()
-- set_markdown_keymaps(0)
-- end,
-- })
require("keymaps.language")
-- which-key.nvim
require("keymaps.which")
return M

View file

@ -1,6 +1,5 @@
local M = {}
-- Markdown
local function set_markdown_keymaps(bufnr)
@ -11,7 +10,6 @@ local function set_markdown_keymaps(bufnr)
end
end
M.markdown = {
{ mode = "v", keys = "`", cmd = "c`<Esc>pi`<Esc>", desc = "Wrap selection in ` for inline code" },
{ mode = "v", keys = "*", cmd = "c**<Esc>pi**<Esc>", desc = "Wrap selection in ** for bold" },

View file

@ -1,79 +1,135 @@
local M = {}
local leader_general = {
{ keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" },
{ keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
}
for _,map in ipairs(leader_general) do
map.keys = "<leader>" .. map.keys
table.insert(M, map)
local formatFx = function()
require("conform").format({ async = true })
end
local leader_q = { -- leader q: Quit
{ keys = "q", cmd = ":q<CR>", desc = "Quit" },
{ keys = "Q", cmd = ":qa!<CR>", desc = "Force Quit" },
{ keys = "w", cmd = ":wq<CR>", desc = "Write and Quit" },
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", desc = "Write all and Force Quit" },
}
local renameCurrentBuffer = function()
local old_name = vim.fn.expand("%:p")
local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/")
local leader_w = { -- leader w: Windows Management
{ keys = "h", cmd = "<C-w>h", desc = "Left Window" },
{ keys = "n", cmd = "<C-w>j", desc = "Down Window" },
{ keys = "e", cmd = "<C-w>k", desc = "Up Window" },
{ keys = "i", cmd = "<C-w>l", desc = "Right Window" },
{ keys = "-", cmd = ":split<CR>", desc = "Split to down" },
{ keys = "|", cmd = ":vsplit<CR>", desc = "Split to right" },
{ keys = "c", cmd = "<C-w>c", desc = "Close Window" },
{ keys = "o", cmd = "<C-w>o", desc = "Close Other Windows" },
{ keys = "r", cmd = "<C-w>r", desc = "Rotate Windows" },
{ keys = "R", cmd = "<C-w>R", desc = "Reverse Rotate Windows" },
{ keys = "t", cmd = "<C-w>T", desc = "Move Window to New Tab" },
{ keys = "H", cmd = ":vertical resize -5<CR>", desc = "Decrease Window Height" },
{ keys = "N", cmd = ":resize +5<CR>", desc = "Increase Window Height" },
{ keys = "E", cmd = ":vertical resize +5<CR>", desc = "Increase Window Width" },
{ keys = "I", cmd = ":resize -5<CR>", desc = "Decrease Window Width" },
}
local leader_f = { -- leader f: Files/Find
{ keys = "f", cmd = ":Telescope fd<CR>", desc = "Find Files"},
{ keys = "s", cmd = ":Telescope live_grep<CR>", desc = "Grep Files"},
{ keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers"},
{ keys = "e", cmd = ":NvimTreeToggle<CR>", desc = "Toggle File Explorer" },
}
local leader_p = { -- leader p: Project
}
local leader_b = { -- leader b: Buffer
{ keys = "d", cmd = ":bdelete<CR>", desc = "Delete Buffer" },
{ keys = "h", cmd = ":bprevious<CR>", desc = "Previous Buffer" },
{ keys = "i", cmd = ":bnext<CR>", desc = "Next Buffer" },
{ keys = "H", cmd = ":bfirst<CR>", desc = "First Buffer" },
{ keys = "I", cmd = ":blast<CR>", desc = "Last Buffer" },
{ keys = "0", cmd = ":bfirst<CR>", desc = "First Buffer" },
{ keys = "^", cmd = ":bfirst<CR>", desc = "First Buffer" },
{ keys = "$", cmd = ":blast<CR>", desc = "Last Buffer" },
}
for _, map in ipairs(leader_q) do
map.keys = "<leader>q" .. map.keys
table.insert(M, map)
if new_name == "" then
print("No new name provided")
return
elseif new_name == old_name then
return
end
for _, map in ipairs(leader_w) do
map.keys = "<leader>w" .. map.keys
table.insert(M, map)
vim.cmd("write")
local success, err = os.rename(old_name, new_name)
if not success then
print("Error renaming file: " .. err)
return
end
for _, map in ipairs(leader_f) do
map.keys = "<leader>f" .. map.keys
table.insert(M, map)
vim.cmd("edit " .. new_name)
vim.cmd("bdelete " .. old_name)
end
for _, map in ipairs(leader_b) do
map.keys = "<leader>b" .. map.keys
table.insert(M, map)
-- 通用映射函数
local function apply_mappings(maps, prefix)
for _, map in ipairs(maps) do
local new_map = {
keys = prefix .. map.keys,
cmd = map.cmd,
opts = map.opts,
}
table.insert(M, new_map)
end
end
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_mappings = {
general = {
{ keys = "<leader>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } },
{ keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "!", cmd = ":FloatermToggle<CR>", opts = { desc = "" } },
},
b = { -- +buffer
{ keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } },
{ keys = "b", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
-- { keys = "s", cmd = ":Telescope buffers<CR>", opts = { desc = "Search buffers" } },
},
c = { -- +code/compile
{ keys = "r", cmd = ":RunCode<CR>", opts = { desc = "Run code" } },
{ keys = "e", cmd = ":Telescope diagnostics<CR>", opts = { desc = "Navigate errors/warnings" } },
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
{ keys = "s", cmd = ":Telescope treesitter<CR>", opts = { desc = "Search symbols" } },
{ keys = "S", cmd = ":Telescope grep_string<CR>", opts = { desc = "Search current symbol" } },
},
f = { -- +file/find
{ keys = "f", cmd = ":Telescope fd<CR>", opts = { desc = "Find Files" } },
{ keys = "s", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
{ keys = "b", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
{ keys = "e", cmd = ":NvimTreeToggle<CR>", opts = { desc = "Toggle File Explorer" } },
{ keys = "t", cmd = ":FloatermToggle<CR>", opts = { desc = "toggle visibility of the float terminal" } },
{ keys = "T", cmd = ":FloatermNew<CR>", opts = { desc = "Spawn a float terminal" } },
{ keys = "h", cmd = ":Telescope oldfiles<CR>", opts = { desc = "Search history files" } },
{ keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim<CR>", opts = { desc = "Search Config" } },
{ keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
},
p = { -- +project
{ keys = "p", cmd = ":Telescope projects<CR>", opts = { desc = "List all Projects" } },
{ keys = "g", cmd = ":Telescope projects<CR>", opts = { desc = "List all Git Projects" } },
{ keys = "s", cmd = ":Telescope session-lens<CR>", opts = { desc = "List all sessions" } },
},
q = { -- +quit
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", opts = { desc = "Write all and Force Quit" } },
},
t = { -- +toggle
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
{ keys = "t", cmd = ":FloatermToggle<CR>", opts = { desc = "toggle visibility of the float terminal" } },
},
u = { -- +ui
{ keys = "i", cmd = ":Telescope colorscheme<CR>", opts = { desc = "Change colorscheme" } },
},
w = { -- +window
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
{ keys = "c", cmd = "<C-w>c", opts = { desc = "Close Window" } },
{ keys = "o", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
{ keys = "H", cmd = ":vertical resize -5<CR>", opts = { desc = "Decrease Window Height" } },
{ keys = "N", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Height" } },
{ keys = "E", cmd = ":vertical resize +5<CR>", opts = { desc = "Increase Window Width" } },
{ keys = "I", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Width" } },
},
}
for key, maps in pairs(leader_mappings) do
if key == "general" then
apply_mappings(maps, "<leader>")
else
apply_mappings(maps, "<leader>" .. key)
end
end
return M

View file

@ -0,0 +1,8 @@
local M = {
{ keys = "gd", cmd = vim.lsp.buf.definition, opts = { desc = "Goto Definition" } },
{ keys = "gD", cmd = vim.lsp.buf.declaration, opts = { desc = "Goto Declaration" } },
{ keys = "gr", cmd = vim.lsp.buf.references, opts = { desc = "Goto References" } },
{ keys = "gi", cmd = vim.lsp.buf.implementation, opts = { desc = "Goto Implementation" } },
}
return M

View file

@ -1,7 +1,8 @@
local M = {}
M.global = {
{ mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", keys = "<leader>E", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", keys = "<A-0>", cmd = ":NvimTreeFocus<CR>" },
}
function M.plugin(api, opts)
@ -55,6 +56,8 @@ function M.plugin(api, opts)
{ keys = "x", cmd = api.fs.cut, opts = opts("Cut") },
{ keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") },
{ keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") },
-- From Directory Opus
{ keys = "#", cmd = "<Cmd>set relativenumber!<CR>", opts = opts("Toggle Relative Number") },
-- Numeric 数字键
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
-- Non-Alphanumeric 非字母数字键
@ -72,6 +75,7 @@ function M.plugin(api, opts)
{ keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") },
{ keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") },
{ keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
{ keys = "<A-0>", cmd = ":b#<CR>", opts = opts("Focus to previous buffer") },
-- Mouse 鼠标键
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
{ keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") },

View file

@ -0,0 +1,30 @@
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
vim.api.nvim_create_user_command("FormatToggle", function(args)
local buffer_local = args.bang
if buffer_local then
-- Toggle buffer-local formatting
vim.b.disable_autoformat = not vim.b.disable_autoformat
else
-- Toggle global formatting
vim.g.disable_autoformat = not vim.g.disable_autoformat
end
-- Print current status
local scope = buffer_local and "buffer" or "global"
local status = buffer_local and vim.b.disable_autoformat or vim.g.disable_autoformat
print(string.format("Format-on-save %s: %s", scope, status and "disabled" or "enabled"))
end, {
desc = "Toggle autoformat-on-save (use ! for buffer-local)",
bang = true,
})

View file

@ -0,0 +1,33 @@
local M = {}
-- local mode_arrow = { "n", "v", "o", "s", "x" }
local default_opts = { noremap = true, silent = true }
local default_mode = { "n" }
M.set_keymaps = function(maps)
for _, map in ipairs(maps) do
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
local mode = map.mode or default_mode
vim.keymap.set(mode, map.keys, map.cmd, opts)
end
end
M.set_lang_keymaps = function(maps)
vim.api.create_autocmd("FileType", {
pattern = maps.filetype,
callback = function()
M.set_keymaps(maps.keymaps)
end,
})
end
M.set_buf_keymaps = function(maps)
vim.api.create_autocmd("BufEnter", {
pattern = maps.filetype,
callback = function()
M.set_keymaps(maps.keymaps)
end,
})
end
return M

View file

@ -0,0 +1,42 @@
local wk = require("which-key")
wk.add({
-- https://github.com/folke/which-key.nvim/tree/main?tab=readme-ov-file#%EF%B8%8F-mappings
{
-- Nested mappings are allowed and can be added in any order
-- Most attributes can be inherited or overridden on any level
-- There's no limit to the depth of nesting
mode = { "n" },
{ "<leader>b", group = "Buffer" }, -- no need to specify mode since it's inherited
{ "<leader>c", group = "Code/Compile" },
{ "<leader>f", group = "File" },
{ "<leader>p", group = "Project", icon = "" },
{ "<leader>q", group = "Quit" },
{ "<leader>t", group = "Toggle" },
{ "<leader>u", group = "UI" },
{ "<leader>w", group = "Window" },
},
{ -- https://github.com/folke/which-key.nvim/blob/1f8d414f61e0b05958c342df9b6a4c89ce268766/lua/which-key/plugins/presets.lua#L57-L98
-- text objects
mode = { "o", "x" },
{ "l", group = "inside" },
{ 'l"', desc = 'inner " string' },
{ "l'", desc = "inner ' string" },
{ "l(", desc = "inner [(])" },
{ "l)", desc = "inner [(])" },
{ "l<", desc = "inner <>" },
{ "l>", desc = "inner <>" },
{ "lB", desc = "inner [{]}" },
{ "lW", desc = "inner WORD" },
{ "l[", desc = "inner []" },
{ "l]", desc = "inner []" },
{ "l`", desc = "inner ` string" },
{ "lb", desc = "inner [(])" },
{ "lp", desc = "inner paragraph" },
{ "ls", desc = "inner sentence" },
{ "lt", desc = "inner tag block" },
{ "lw", desc = "inner word" },
{ "l{", desc = "inner [{]}" },
{ "l}", desc = "inner [{]}" },
{ "i", desc = "Right" },
},
})

View file

@ -1,9 +1,11 @@
return {
{ "catppuccin/nvim", name = "catppuccin" },
{ "olimorris/onedarkpro.nvim" },
{ "rebelot/kanagawa.nvim" },
{ "RRethy/vim-illuminate" },
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("plugins.mod.lualine")
end,
@ -18,7 +20,7 @@ return {
timer = 500,
},
})
end
end,
},
{ import = "plugins.mod.alpha-nvim" },
{ import = "plugins.mod.winbar-nvim" },

View file

@ -1,6 +1,55 @@
return {
{ import = "plugins.mod.auto-session" },
{ import = "plugins.mod.nvim-tree" },
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
{ import = "plugins.mod.projects" }
{ import = "plugins.mod.telescope" },
{ import = "plugins.mod.projects" },
{
"lewis6991/hover.nvim",
config = function()
require("hover").setup({
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
-- require('hover.providers.fold_preview')
require("hover.providers.diagnostic")
-- require('hover.providers.man')
-- require('hover.providers.dictionary')
end,
preview_opts = {
border = "single",
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
"LSP",
},
mouse_delay = 1000,
})
-- Setup keymaps
vim.keymap.set("n", "gE", require("hover").hover_select, { desc = "hover.nvim (select)" })
vim.keymap.set("n", "<C-p>", function()
require("hover").hover_switch("previous")
end, { desc = "hover.nvim (previous source)" })
vim.keymap.set("n", "<C-n>", function()
require("hover").hover_switch("next")
end, { desc = "hover.nvim (next source)" })
-- Mouse support
vim.keymap.set("n", "<MouseMove>", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" })
vim.o.mousemoveevent = true
end,
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end,
},
}

View file

@ -1,26 +1,2 @@
-- Entry point of the plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ import = "plugins.appearance" },
{ import = "plugins.completion" },
{ import = "plugins.fileutils" },
{ import = "plugins.lsp" },
{ import = "plugins.syntax" },
{ import = "plugins.misc" },
})
require("plugins.lazy-nvim")

View file

@ -0,0 +1,39 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins.appearance" },
{ import = "plugins.completion" },
{ import = "plugins.fileutils" },
{ import = "plugins.lsp" },
{ import = "plugins.syntax" },
{ import = "plugins.misc" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
-- automatically check for plugin updates
checker = { enabled = true },
})

View file

@ -1,17 +1,29 @@
return {
{ import = "plugins.mod.lspconfig" },
{ "MeanderingProgrammer/render-markdown.nvim" },
-- {
-- "OXY2DEV/markview.nvim",
-- lazy = false, -- Recommended
-- -- ft = "markdown" -- If you decide to lazy-load anyway
--
-- dependencies = {
-- "nvim-treesitter/nvim-treesitter",
-- "nvim-tree/nvim-web-devicons"
-- }
-- },
{
"neovim/nvim-lspconfig",
lazy = false,
},
{ import = "plugins.mod.render-markdown" },
-- { import = "plugins.mod.markview" },
{
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "sioyek"
end,
},
{
"iurimateus/luasnip-latex-snippets.nvim",
-- vimtex isn't required if using treesitter
requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
config = function()
require("luasnip-latex-snippets").setup()
-- or setup({ use_treesitter = true })
require("luasnip").config.setup({ enable_autosnippets = true })
end,
},
{ "williamboman/mason.nvim", config = true },
{
"williamboman/mason-lspconfig.nvim",
@ -27,6 +39,31 @@ return {
mason_lspconfig.setup({
ensure_installed = servers,
})
end
end,
},
{
"nvim-orgmode/orgmode",
event = "VeryLazy",
ft = { "org" },
config = function()
-- Setup orgmode
require("orgmode").setup({
org_agenda_files = "~/orgfiles/**/*",
org_default_notes_file = "~/orgfiles/refile.org",
})
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
-- add ~org~ to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
},
{ import = "plugins.mod.conform-nvim" },
{ "nvim-treesitter/nvim-treesitter-context" },
{
"NoahTheDuke/vim-just",
ft = { "just" },
},
}

View file

@ -1,26 +1,15 @@
return {
{ 'wakatime/vim-wakatime', lazy = false },
{ "wakatime/vim-wakatime", lazy = false },
{ "voldikss/vim-floaterm" },
{ "CRAG666/betterTerm.nvim", opts = {
position = "bot",
size = 15,
} },
{ "CRAG666/code_runner.nvim", config = true },
{ import = "plugins.mod.obsidian-nvim" },
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},
{ import = "plugins.mod.which-keys-nvim" },
{
"github/copilot.vim",
lazy = false,
}
},
}

View file

@ -1,14 +1,14 @@
-- alpha-nvim.lua
return {
{
'goolord/alpha-nvim',
"goolord/alpha-nvim",
dependencies = {
-- 'echasnovski/mini.icons',
-- 'nvim-lua/plenary.nvim'
},
config = function()
local alpha = require'alpha'
local dashboard = require'alpha.themes.dashboard'
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
" ",
"================= =============== =============== ======== ========",
@ -34,11 +34,11 @@ return {
dashboard.section.buttons.val.leader = "SPC"
dashboard.section.buttons.val = {
-- leader = "SPC",
dashboard.button('p', '󰈞 查找项目', ':Telescope projects<CR>'),
dashboard.button('h', ' 历史文件', ':Telescope oldfiles<CR>'),
dashboard.button('l', ' 加载会话', ':SessionSearch<CR>'),
dashboard.button('c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'),
dashboard.button('SPC q', '󱊷 退出', ':qa<CR>'),
dashboard.button("p", "󰈞 查找项目", ":Telescope projects<CR>"),
dashboard.button("h", " 历史文件", ":Telescope oldfiles<CR>"),
dashboard.button("l", " 加载会话", ":SessionSearch<CR>"),
dashboard.button("c", " 转到设置", ":Telescope find_files cwd=~/.config/nvim<CR>"),
dashboard.button("SPC q", "󱊷 退出", ":qa<CR>"),
}
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
@ -47,6 +47,6 @@ return {
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
alpha.setup(dashboard.config)
end
};
end,
},
}

View file

@ -1,15 +1,15 @@
---@diagnostic disable: undefined-doc-name
return {
{
'rmagatti/auto-session',
"rmagatti/auto-session",
lazy = false,
---enables autocomplete for opts
---@module "auto-session"
---@type AutoSession.Config
opts = {
suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' },
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
-- log_level = 'debug',
}
}
},
},
}

View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
opts = {
-- Define your formatters
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

@ -1,4 +1,4 @@
return {
"neovim/nvim-lspconfig",
lazy = false
lazy = false,
}

View file

@ -1,6 +1,6 @@
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
local lualine = require("lualine")
-- Color table for highlights
-- stylua: ignore
@ -20,14 +20,14 @@ local colors = {
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
@ -36,11 +36,11 @@ local conditions = {
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha" }
statusline = { "NvimTree", "alpha" },
},
-- Disable sections and component separators
component_separators = '',
section_separators = '',
component_separators = "",
section_separators = "",
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
@ -80,18 +80,18 @@ local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
ins_left({
function()
return ''
return ""
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
})
ins_left {
ins_left({
-- mode component
function()
return ''
return ""
end,
color = function()
-- auto change color according to neovims mode
@ -99,13 +99,13 @@ ins_left {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
[""] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
@ -113,14 +113,14 @@ ins_left {
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
})
-- ins_left {
-- -- filesize component
@ -134,42 +134,39 @@ ins_left {
-- color = { fg = colors.magenta, gui = 'bold' },
-- }
-- ins_left { 'location' }
ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_right({ "progress", color = { fg = colors.fg, gui = "bold" } })
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
ins_left({
"diagnostics",
sources = { "nvim_diagnostic" },
symbols = { error = "", warn = "", info = "" },
diagnostics_color = {
error = { fg = colors.red },
warn = { fg = colors.yellow },
info = { fg = colors.cyan },
},
}
})
ins_left {
ins_left({
function()
return vim.bo.filetype
end,
color = { fg = colors.blue, gui = 'bold' },
}
color = { fg = colors.blue, gui = "bold" },
})
ins_left {
ins_left({
function()
return vim.bo.shiftwidth .. " space"
end,
}
})
ins_left {
ins_left({
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 })
local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 })
local clients = vim.lsp.get_clients()
if next(clients) == nil then
return msg
@ -182,59 +179,58 @@ ins_left {
end
return msg
end,
icon = '',
color = { fg = '#ffffff', gui = 'bold' },
}
icon = "",
color = { fg = "#ffffff", gui = "bold" },
})
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
ins_left({
function()
return '%='
return "%="
end,
}
})
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
ins_right({
"o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
color = { fg = colors.green, gui = "bold" },
})
ins_right {
'fileformat',
ins_right({
"fileformat",
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
color = { fg = colors.green, gui = "bold" },
})
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right({
"branch",
icon = "",
color = { fg = colors.violet, gui = "bold" },
})
ins_right {
'diff',
ins_right({
"diff",
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '󰝤 ', removed = '' },
symbols = { added = "", modified = "󰝤 ", removed = "" },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
})
ins_right {
ins_right({
function()
return ''
return ""
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
})
-- Now don't forget to initialize lualine
lualine.setup(config)

View file

@ -0,0 +1,30 @@
return {
{
"OXY2DEV/markview.nvim",
lazy = false,
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
config = function()
local presets = require("markview.presets")
require("markview").setup({
checkboxes = presets.checkboxes.nerd,
headings = {
enable = true,
shift_width = 1,
heading_1 = {
style = "label",
hl = "MarkviewH1",
},
},
code_blocks = {
style = "language",
language_direction = "right",
hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo",
},
})
end,
},
}

View file

@ -1,6 +1,6 @@
local function my_on_attach(bufnr)
-- local keymaps = require("config.keymaps")
local api = require "nvim-tree.api"
local api = require("nvim-tree.api")
local default_mode = { "n" }
local keymaps = require("keymaps")
@ -8,7 +8,6 @@ local function my_on_attach(bufnr)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local function set_keymaps(maps)
for _, map in ipairs(maps) do
local mode = map.mode or default_mode
@ -28,10 +27,26 @@ return {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup {
require("nvim-tree").setup({
on_attach = my_on_attach,
sync_root_with_cwd = true,
respect_buf_cwd = true,
}
end
disable_netrw = true,
renderer = {
icons = {
glyphs = {
git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29
unmerged = "",
renamed = "",
deleted = "",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
},
},
},
},
})
end,
}

View file

@ -3,7 +3,7 @@ return {
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "markdown", "markdown_inline" },
ensure_installed = { "markdown", "markdown_inline", "latex", "python" },
highlight = { enable = true },
indent = { enable = true },
})

View file

@ -26,8 +26,11 @@ return {
},
completion = {
nvim_cmp = true,
min_chars = 2
}
min_chars = 2,
},
ui = {
enable = false,
},
-- see below for full list of options 👇
},
}

View file

@ -0,0 +1,74 @@
return {
{
"MeanderingProgrammer/render-markdown.nvim",
lazy = false,
config = function()
require("render-markdown").setup({
render_modes = { "n", "c", "t" },
latex = {
enabled = true,
converter = "latex2text",
highlight = "RenderMarkdownMath",
top_pad = 0,
bottom_pad = 0,
},
heading = {
sign = false,
position = "inline",
width = "block",
left_margin = 0.5,
left_pad = 0.2,
right_pad = 0.2,
},
link = {
custom = {
python = { pattern = "%.py", icon = "" },
lua = { pattern = "%.lua", icon = "" },
markdown = { pattern = "%.md", icon = "" },
},
},
bullet = {
icons = { "󰮯 ", "", "", "", "" },
},
checkbox = {
checked = { scope_highlight = "@markup.strikethrough" },
unchecked = { scope_highlight = "@comment.todo" },
},
code = {
position = "right",
width = "block",
right_pad = 10,
},
callout = {
note = { raw = "[!NOTE]", rendered = "󰋽 Note", highlight = "RenderMarkdownInfo" },
tip = { raw = "[!TIP]", rendered = "󰌶 Tip", highlight = "RenderMarkdownSuccess" },
important = { raw = "[!IMPORTANT]", rendered = "󰅾 Important", highlight = "RenderMarkdownHint" },
warning = { raw = "[!WARNING]", rendered = "󰀪 Warning", highlight = "RenderMarkdownWarn" },
caution = { raw = "[!CAUTION]", rendered = "󰳦 Caution", highlight = "RenderMarkdownError" },
abstract = { raw = "[!ABSTRACT]", rendered = "󰨸 Abstract", highlight = "RenderMarkdownInfo" },
summary = { raw = "[!SUMMARY]", rendered = "󰨸 Summary", highlight = "RenderMarkdownInfo" },
tldr = { raw = "[!TLDR]", rendered = "󰨸 Tldr", highlight = "RenderMarkdownInfo" },
info = { raw = "[!INFO]", rendered = "󰋽 Info", highlight = "RenderMarkdownInfo" },
todo = { raw = "[!TODO]", rendered = "󰗡 Todo", highlight = "RenderMarkdownInfo" },
hint = { raw = "[!HINT]", rendered = "󰌶 Hint", highlight = "RenderMarkdownSuccess" },
success = { raw = "[!SUCCESS]", rendered = "󰄬 Success", highlight = "RenderMarkdownSuccess" },
check = { raw = "[!CHECK]", rendered = "󰄬 Check", highlight = "RenderMarkdownSuccess" },
done = { raw = "[!DONE]", rendered = "󰄬 Done", highlight = "RenderMarkdownSuccess" },
question = { raw = "[!QUESTION]", rendered = "󰘥 Question", highlight = "RenderMarkdownWarn" },
help = { raw = "[!HELP]", rendered = "󰘥 Help", highlight = "RenderMarkdownWarn" },
faq = { raw = "[!FAQ]", rendered = "󰘥 Faq", highlight = "RenderMarkdownWarn" },
attention = { raw = "[!ATTENTION]", rendered = "󰀪 Attention", highlight = "RenderMarkdownWarn" },
failure = { raw = "[!FAILURE]", rendered = "󰅖 Failure", highlight = "RenderMarkdownError" },
fail = { raw = "[!FAIL]", rendered = "󰅖 Fail", highlight = "RenderMarkdownError" },
missing = { raw = "[!MISSING]", rendered = "󰅖 Missing", highlight = "RenderMarkdownError" },
danger = { raw = "[!DANGER]", rendered = "󱐌 Danger", highlight = "RenderMarkdownError" },
error = { raw = "[!ERROR]", rendered = "󱐌 Error", highlight = "RenderMarkdownError" },
bug = { raw = "[!BUG]", rendered = "󰨰 Bug", highlight = "RenderMarkdownError" },
example = { raw = "[!EXAMPLE]", rendered = "󰉹 Example", highlight = "RenderMarkdownHint" },
quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" },
cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" },
},
})
end,
},
}

View file

@ -0,0 +1,32 @@
return {
"nvim-telescope/telescope.nvim",
config = function()
require("telescope").setup({
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = {
["n"] = "move_selection_next",
["e"] = "move_selection_previous",
["w"] = "preview_scrolling_up",
["r"] = "preview_scrolling_down",
["a"] = "preview_scrolling_left",
["s"] = "preview_scrolling_right",
["q"] = require("telescope.actions").close,
},
},
},
})
end,
dependencies = { "nvim-lua/plenary.nvim" },
}

View file

@ -0,0 +1,18 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
}

View file

@ -7,33 +7,32 @@ return {
show_file_path = true,
show_symbols = true,
colors = {
path = '#9c1d91',
file_name = '',
symbols = '',
path = "#9c1d91",
file_name = "",
symbols = "",
},
icons = {
file_icon_default = '',
seperator = '>',
editor_state = '',
lock_icon = '',
file_icon_default = "",
seperator = ">",
editor_state = "",
lock_icon = "",
},
exclude_filetype = {
'help',
'startify',
'dashboard',
'packer',
'neogitstatus',
'NvimTree',
'Trouble',
'alpha',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'qf',
}
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"alpha",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"qf",
},
})
end,
},
}

View file

@ -1,9 +1,10 @@
return {
{ import = "plugins.mod.nvim-treesitter", },
{ 'echasnovski/mini.pairs', version = false,
{ import = "plugins.mod.nvim-treesitter" },
{
"echasnovski/mini.pairs",
version = false,
config = function()
require("mini.pairs").setup()
end,
},
}

View file

@ -0,0 +1,4 @@
(((
This is a playground file.
{(1 + 2) * 3}
)))

View file

@ -31,5 +31,6 @@ Set-Alias "py" "python"
Set-Alias "ipy" "ipython"
if ($isWindows) {
function kex { wsl -d kali-linux kex --sl -s }
# Debugging
# function kex { wsl -d kali-linux kex --sl -s }
}

View file

@ -0,0 +1,42 @@
function Invoke-Completion {
param ([string]$command)
switch ($command) {
'docker' { docker completion powershell | Out-String | Invoke-Expression }
'dotnet' {
# https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
dotnet complete --position $cursorPosition "$commandAst" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
}
'git' { Import-Module Posh-Git }
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
'rg' { rg --generate complete-powershell | Out-String | Invoke-Expression }
'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression }
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
'winget' {
# https://learn.microsoft.com/en-us/windows/package-manager/winget/tab-completion
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
$Local:word = $wordToComplete.Replace('"', '""')
$Local:ast = $commandAst.ToString().Replace('"', '""')
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
}
}
}
Set-Alias "icmp" "Invoke-Completion"
Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$cmds = @('docker', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget')
$cmds | Where-Object { $_ -like "$wordToComplete*" }
}

View file

@ -1,7 +1,8 @@
# Use XDG Base Directory Specification and its similar structure for Windows
# wget
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
# yarn v1
${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args}
if ($Env:WEZTERM) {
# Environment variable injected by wezterm/wezterm.lua
${function:icat} = { wezterm imgcat $args }
}
elseif ($Env:KITTY) {
${function:icat} = { kitty +kitten icat $args }
}

View file

@ -23,6 +23,9 @@ Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory
## Use <Tab> to Invoke MenuComplete
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

View file

@ -1,4 +1,4 @@
Import-Module -Name Terminal-Icons
# Import-Module -Name Terminal-Icons
Import-Module -Name CompletionPredictor
if ($IsWindows) {
# Chocolatey

View file

@ -4,92 +4,4 @@
# Use starship to set prompt
$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml"
# Invoke-Expression (&starship init powershell)
# Below is the backup of original prompt function
# $promptTime = $true
# # $promptWeather = $false
# function prompt {
# $prompt = "`e[35m"
# # Time
# if ($promptTime) {
# $promptTime = Get-Date -Format HH:mm
# $prompt += "`[$promptTime]"
# }
# # UserInfo
# $prompt += " $Env:Username @ $Env:Userdomain"
# # Directory
# $promptCurrentDirectory = $(PWD).Path
# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~")
# $prompt += "`e[0m in `e[33m$promptCurrentDirectory "
# # Git
# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") {
# $prompt += "`e[32m`u{e702} $(git branch --show-current)"
# }
# # Conda
# if ( $Env:CONDA_PROMPT_MODIFIER ) {
# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","")
# $pythonVersion = $(python --version).Split(" ")[1]
# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion"
# }
# # Programming Language (by Get-ChildItem)
# ## Python
# if (Test-Path -Path "$PWD\pyproject.toml") {
# $pythonVersion = $(python --version).Split(" ")[1]
# $prompt += " `e[33m`u{e73c} $pythonVersion"
# }
# ## Node.js
# if (Test-Path -Path "$PWD\package.json") {
# $nodeVersion = $(node --version)
# $prompt += " `e[32m`u{e3a0} $nodeVersion"
# # Locked
# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") {
# $prompt += "`u{f023}"
# }
# }
# ## .NET
# ### C Sharp
# if (Test-Path -Path "$PWD\*.csproj") {
# $dotnetVersion = $(dotnet --version)
# $prompt += " `e[34m`u{e648} $dotnetVersion"
# }
# ### F Sharp
# if (Test-Path -Path "$PWD\*.fsproj") {
# $dotnetVersion = $(dotnet --version)
# $prompt += " `e[35m`u{e65a} $dotnetVersion"
# }
# ## Rust
# if (Test-Path -Path "$PWD\Cargo.toml") {
# $rustVersion = $(cargo --version).Split(" ")[1]
# $prompt += " `e[31m`u{e7a8} $rustVersion"
# }
# ## Java
# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") {
# $javaVersion = $(java --version).Split(" ")[1]
# $prompt += " `e[31m`u{e738} $javaVersion"
# }
# ## Makefile
# if (Test-Path -Path "$PWD\Makefile") {
# $prompt += " `e[32m`u{e673}"
# }
# if (Test-Path -Path "$PWD\CMakeLists.txt") {
# $prompt += " `e[32m `u{e61d}"
# }
# # Docker
# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") {
# $prompt += " `e[33m`u{f21f}"
# }
# # Weather
# # if ( $global:promptWeather ) {
# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY)
# # }
# # Error on last command
# ## TODO: Seems does not work
# if ($?) {
# $prompt += "`n`e[32m PS > `e[0m"
# } else {
# $prompt += "`n`e[31m PS > `e[0m"
# }
# return $prompt
# }
Invoke-Expression (&starship init powershell)

View file

@ -20,3 +20,20 @@ This is the cross-platform PowerShell profile for PowerShell Core
| `^a` | To Beginning of Line | All |
| `^e` | To End of Line | All |
| `^[` | To Normal Mode | Insert |
## `Get-Command` vs `which.exe` under Windows
```powershell
PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10
Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which'
Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms]
Range (min … max): 150.0 ms … 155.3 ms 18 runs
Benchmark 2: pwsh.exe -NoProfile -Command 'which which'
Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms]
Range (min … max): 147.8 ms … 169.5 ms 19 runs
Summary
pwsh.exe -NoProfile -Command 'Get-Command which' ran
1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which'
```

View file

@ -1,202 +0,0 @@
# starship.toml
# ~/.config/starship.toml
format = '''$os$time $username @ $hostname $directory $all$character'''
add_newline = true
[time]
disabled = false
format = '[\[$time\]](purple)'
time_format = '%H:%M'
[username]
format = '[$user](bold)'
show_always = true
[hostname]
ssh_only = false
ssh_symbol = '󰞉 '
[directory]
truncation_length = 2
truncate_to_repo = true
read_only = " 󰌾"
style ="bold cyan"
truncation_symbol = ".../"
[directory.substitutions]
"~/Documents" = "󰈙 "
"~/Downloads" = " "
"~/Music" = " "
"~/Pictures" = " "
"Source" = " "
"src" = " "
[aws]
symbol = " "
[buf]
symbol = " "
[c]
symbol = " "
[conda]
symbol = " "
[crystal]
symbol = " "
[dart]
symbol = " "
[docker_context]
symbol = " "
[elixir]
symbol = " "
[elm]
symbol = " "
[fennel]
symbol = " "
[fossil_branch]
symbol = " "
[git_branch]
symbol = " "
[git_commit]
tag_symbol = '  '
[golang]
symbol = " "
[guix_shell]
symbol = " "
[haskell]
symbol = " "
[haxe]
symbol = " "
[hg_branch]
symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[kotlin]
symbol = " "
[lua]
symbol = " "
[memory_usage]
symbol = "󰍛 "
[meson]
symbol = "󰔷 "
[nim]
symbol = "󰆥 "
[nix_shell]
symbol = " "
[nodejs]
symbol = " "
[ocaml]
symbol = " "
[os]
disabled = false
[os.symbols]
Alpaquita = " "
Alpine = " "
AlmaLinux = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Kali = " "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
RockyLinux = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Void = " "
Windows = "󰍲 "
[package]
symbol = "󰏗 "
[perl]
symbol = " "
[php]
symbol = " "
[pijul_channel]
symbol = " "
[python]
symbol = " "
[rlang]
symbol = "󰟔 "
[ruby]
symbol = " "
[rust]
symbol = "󱘗 "
[scala]
symbol = " "
[swift]
symbol = " "
[zig]
symbol = " "
[gradle]
symbol = " "

View file

@ -1,208 +1,144 @@
# starship.toml
# ~/.config/starship.toml
format = '''$os$time $username @ $hostname $directory $all$character'''
continuation_prompt = "[r % ](bold cyan) " # Doesn't work in fish
format = """
[](#9A348E)\
$os\
$username\
[](bg:#DA627D fg:#9A348E)\
$directory\
[](fg:#DA627D bg:#FCA17D)\
$git_branch\
$git_status\
[](fg:#FCA17D bg:#86BBD8)\
$c\
$elixir\
$elm\
$golang\
$gradle\
$haskell\
$java\
$julia\
$nodejs\
$nim\
$rust\
$scala\
[](fg:#86BBD8 bg:#06969A)\
$docker_context\
[](fg:#06969A bg:#33658A)\
$time\
[ ](fg:#33658A)\
"""
add_newline = true
[time]
disabled = false
format = '[\[$time\]](purple)'
time_format = '%H:%M'
# Disable the blank line at the start of the prompt
# add_newline = false
# You can also replace your username with a neat symbol like  or disable this
# and use the os module below
[username]
format = '[$user](bold)'
show_always = true
style_user = "bg:#9A348E"
style_root = "bg:#9A348E"
format = '[$user ]($style)'
disabled = false
[hostname]
ssh_only = false
ssh_symbol = '󰞉 '
[character]
success_symbol = "[󰈺 >](bold green)"
error_symbol = "[󰈺 >](bold red)"
vimcmd_symbol = "[ <](bold green)"
# An alternative to the username module which displays a symbol that
# represents the current operating system
[os]
style = "bg:#9A348E"
disabled = true # Disabled by default
[directory]
truncation_length = 2
truncate_to_repo = true
read_only = " 󰌾"
style = "bold cyan"
truncation_symbol = ".../"
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"~/Documents" = "󰈙 "
"~/Downloads" = " "
"~/Music" = " "
"~/Pictures" = " "
"Source" = " "
"src" = " "
[aws]
symbol = " "
[buf]
symbol = " "
"Documents" = "󰈙 "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
# Keep in mind that the order matters. For example:
# "Important Documents" = " 󰈙 "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important 󰈙 " = " 󰈙 "
[c]
symbol = " "
[conda]
symbol = " "
[crystal]
symbol = " "
[dart]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[docker_context]
symbol = " "
style = "bg:#06969A"
format = '[ $symbol $context ]($style)'
[elixir]
symbol = " "
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[elm]
symbol = " "
[fennel]
symbol = " "
[fossil_branch]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[git_branch]
symbol = ""
style = "bg:#FCA17D"
format = '[ $symbol $branch ]($style)'
[git_commit]
tag_symbol = '  '
[git_status]
style = "bg:#FCA17D"
format = '[$all_status$ahead_behind ]($style)'
[golang]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[guix_shell]
symbol = " "
[gradle]
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[haskell]
symbol = " "
[haxe]
symbol = " "
[hg_branch]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[java]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[julia]
symbol = " "
[kotlin]
symbol = " "
[lua]
symbol = " "
[memory_usage]
symbol = "󰍛 "
[meson]
symbol = "󰔷 "
[nim]
symbol = "󰆥 "
[nix_shell]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nodejs]
symbol = ""
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[ocaml]
symbol = " "
[os]
disabled = false
[os.symbols]
Alpaquita = " "
Alpine = " "
AlmaLinux = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Kali = " "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
RockyLinux = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Void = " "
Windows = "󰍲 "
[package]
symbol = "󰏗 "
[perl]
symbol = " "
[php]
symbol = " "
[pijul_channel]
symbol = " "
[python]
symbol = " "
[rlang]
symbol = "󰟔 "
[ruby]
symbol = " "
[nim]
symbol = "󰆥 "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[rust]
symbol = "󱘗 "
symbol = ""
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[scala]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[swift]
symbol = " "
[zig]
symbol = " "
[gradle]
symbol = " "
[time]
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[ ♥ $time ]($style)'

View file

@ -380,37 +380,37 @@
// #region Terminal Control, use ^a as prefix / leader key
// tmux-like terminal control
{ // prefix + x : kill terminal
"key": "ctrl+a x",
"key": "ctrl+q x",
"command": "workbench.action.terminal.kill",
"when": "terminalFocus"
},
{ // prefix + c : create new terminal
"key": "ctrl+a c",
"key": "ctrl+q c",
"command": "workbench.action.terminal.new",
"when": "terminalFocus"
},
{ // prefix + | : split terminal vertically
"key": "ctrl+a shift+\\",
"key": "ctrl+q shift+\\",
"command": "workbench.action.terminal.split",
"when": "terminalFocus"
},
{ // prefix + \ : split terminal vertically
"key": "ctrl+a \\",
"key": "ctrl+q \\",
"command": "workbench.action.terminal.split",
"when": "terminalFocus"
},
{ // prefix + / : search
"key": "ctrl+a /",
"key": "ctrl+q /",
"command": "workbench.action.terminal.focusFind",
"when": "terminalFocus"
},
{ // prefix + t : toggle terminal
"key": "ctrl+a t",
"key": "ctrl+q t",
"command": "workbench.action.terminal.toggleTerminal",
"when": "terminalFocus"
},
{ // prefix + ^a: show information
"key": "ctrl+a ctrl+a",
"key": "ctrl+q ctrl+q",
"command": "workbench.action.terminal.focusHover",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
},
@ -420,22 +420,22 @@
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
},
{ // prefix + 1 : focus terminal 1
"key": "ctrl+a 1",
"key": "ctrl+q 1",
"command": "workbench.action.terminal.focusAtIndex1",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
},
{ // prefix + 2 : focus terminal 2
"key": "ctrl+a 2",
"key": "ctrl+q 2",
"command": "workbench.action.terminal.focusAtIndex2",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
},
{ // prefix + 3 : focus terminal 3
"key": "ctrl+a 3",
"key": "ctrl+q 3",
"command": "workbench.action.terminal.focusAtIndex3",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
},
{ // prefix + g : Go to recent directory
"key": "ctrl+a g",
"key": "ctrl+q g",
"command": "workbench.action.terminal.goToRecentDirectory",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
@ -445,42 +445,42 @@
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{ // prefix + d : detach terminal
"key": "ctrl+a d",
"key": "ctrl+q d",
"command": "workbench.action.terminal.detachSession",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{ // prefix + a : attach to session
"key": "ctrl+a a",
"key": "ctrl+q a",
"command": "workbench.action.terminal.attachToSession",
"when": "terminalFocus"
},
{
"key": "ctrl+a h",
"key": "ctrl+q h",
"command": "workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+a i",
"key": "ctrl+q i",
"command": "workbench.action.terminal.focusNextPane",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+a shift+H",
"key": "ctrl+q shift+H",
"command": "workbench.action.terminal.resizePaneLeft",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+a shift+N",
"key": "ctrl+q shift+N",
"command": "workbench.action.terminal.resizePaneDown",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+a shift+E",
"key": "ctrl+q shift+E",
"command": "workbench.action.terminal.resizePaneUp",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+a shift+I",
"key": "ctrl+q shift+I",
"command": "workbench.action.terminal.resizePaneRight",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}

View file

@ -0,0 +1,169 @@
" ~/.config/vscode/vscode.vimrc
" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc
" ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode/vscode.vimrc
" And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
" Arrow remap
noremap n j
noremap e k
noremap i l
" Switch between tabs
noremap H :bprevious<CR>
noremap I :bnext<CR>
noremap N 5j
noremap E 5k
" Similar position to i
" The `noremap` implements text-object-like behavior in VSCodeVim
noremap l i
noremap L I
" ne[k]st
noremap k n
noremap K N
" [j]ump
noremap j e
noremap J E
" Y to yank to end of line
noremap Y y$
" Define in settings.json, since this will remap <esc> under visual mode
" noremap <esc> :nohlsearch<CR>
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
" keep selection after indent (define in settings.json)
" voremap < <gv
" voremap > >gv
" lsp
noremap gi editor.action.goToImplementation
noremap gpi editor.action.peekImplementation
noremap gd editor.action.goToDefinition
noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover
noremap <leader><leader> workbench.action.quickOpen
noremap <leader>/ workbench.action.quickTextSearch
noremap <leader>: workbench.action.showCommands
noremap <leader>E workbench.view.explorer
noremap <leader>- workbench.action.splitEditorDown
noremap <leader>| workbench.action.splitEditorRight
noremap <leader>\ workbench.action.splitEditorRight
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
noremap <leader>ce editor.action.marker.next
noremap <leader>cE editor.action.marker.prev
noremap <leader>cg editor.action.dirtydiff.next
noremap <leader>cG editor.action.dirtydiff.previous
noremap <leader>cR editor.action.rename
" <leader>d : +debug
" <leader>f : +file
noremap <leader>ff workbench.action.quickOpen
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fo openInExternalApp.open
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
" Can only rename tracked files
noremap <leader>fR git.rename
" noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>h : +help
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>q : +quit
noremap <leader>qq :quit<CR>
noremap <leader>qQ :qall<CR>
noremap <leader>Q :quit<CR>
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>w : +write/window
noremap <leader>ww :write<CR>
noremap <leader>wa :wall<CR>
noremap <leader>wq :wq<CR>
noremap <leader>W :write<CR>
noremap <leader>wh workbench.action.focusLeftGroup
noremap <leader>wH workbench.action.splitEditorLeft
noremap <leader>wn workbench.action.focusBelowGroup
noremap <leader>wN workbench.action.splitEditorDown
noremap <leader>we workbench.action.focusAboveGroup
noremap <leader>wE workbench.action.splitEditorUp
noremap <leader>wi workbench.action.focusRightGroup
noremap <leader>wI workbench.action.splitEditorRight
noremap <leader>w- workbench.action.splitEditorDown
noremap <leader>w| workbench.action.splitEditorRight
noremap <leader>w\ workbench.action.splitEditorRight

View file

@ -4,6 +4,10 @@
" And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
" Use VSpaceCode instead of <leader>
noremap <space> vspacecode.space
" Arrow remap
noremap n j
noremap e k
@ -17,6 +21,7 @@ noremap N 5j
noremap E 5k
" Similar position to i
" The `noremap` implements text-object-like behavior in VSCodeVim
noremap l i
noremap L I
" ne[k]st
@ -29,9 +34,11 @@ noremap J E
" Y to yank to end of line
noremap Y y$
" Define in settings.json, since this will remap <esc> under visual mode
" noremap <esc> :nohlsearch<CR>
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" 由于 VSCode Vim 的限制递归解析存在缺陷目前这种情况2w 符合预期,但 dw 不符合预期
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
@ -48,98 +55,3 @@ noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover
noremap <leader><leader> workbench.action.quickOpen
noremap <leader>: workbench.action.showCommands
noremap <leader>E workbench.view.explorer
" <leader>q : +quit
noremap <leader>qq :quit<CR>
noremap <leader>qQ :qall<CR>
noremap <leader>Q :quit<CR>
" <leader>w : +write/window
noremap <leader>ww :write<CR>
noremap <leader>wa :wall<CR>
noremap <leader>wq :wq<CR>
noremap <leader>W :write<CR>
noremap <leader>wh workbench.action.focusLeftGroup
noremap <leader>wH workbench.action.splitEditorLeft
noremap <leader>wn workbench.action.focusBelowGroup
noremap <leader>wN workbench.action.splitEditorDown
noremap <leader>we workbench.action.focusAboveGroup
noremap <leader>wE workbench.action.splitEditorUp
noremap <leader>wi workbench.action.focusRightGroup
noremap <leader>wI workbench.action.splitEditorRight
" <leader>f : +find/file
noremap <leader>ff workbench.action.quickOpen
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
noremap <leader>fR workbench.action.openRecent
noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>d : +debug
" <leader>h : +help
" <leader>c : +code
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
" 中文分词测试用例

12
tools/wezterm/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
# $DOTFILES/tools/wezterm/
# Date: 2025-01-06
# Author: js0ny
# Location:
# $XDG_CONFIG_HOME/wezterm/wezterm.lua (works Windows)
# Linking: Link the whole directory
# ln -sf $DOTFILES/tools/wezterm $XDG_CONFIG_HOME/wezterm
# New-Item -ItemType SymbolicLink -Target $DOTFILES\tools\wezterm -Path $Env:XDG_CONFIG_HOME\wezterm
*.json
check_update

278
tools/wezterm/wezterm.lua Normal file
View file

@ -0,0 +1,278 @@
-- $DOTFILES/tools/wezterm/wezterm.lua
-- Date: 2024-12-22
-- Author: js0ny
--#region Import & Setup
local wezterm = require("wezterm")
local action = wezterm.action
local config = {}
--#endregion
--#region Helper
--[[
local function detect_os()
local detected_os = ""
if package.config:sub(1, 1) == "\\" then
-- Windows
detected_os = "Windows"
elseif package.config:sub(1, 1) == "/" then
-- Unix-like (Linux, macOS, etc.)
if os.getenv("HOME") then
detected_os = "Unix-like"
-- You can differentiate further by checking for macOS or Linux if needed
if os.getenv("XDG_SESSION_TYPE") then
-- Likely Linux
detected_os = "Linux"
elseif os.execute("uname -s | grep -i darwin") == 0 then
-- macOS
detected_os = "macOS"
end
end
end
return detected_os
end
--]]
--[[
wezterm.on("text-selection-callback", function(window, pane)
local text = window:get_selection_text_for_pane(pane)
end)
--]]
local function detect_os()
local os_type = ""
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
os_type = "Windows"
elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then
os_type = "Linux"
elseif wezterm.target_triple == "aarch64-apple-darwin" then
os_type = "macOS"
end
return os_type
end
-- OS light/dark theme detection
local function detect_theme() end
--#endregion
--#region Constant
local os_type = detect_os()
--#endregion
--#region Appearance
-- Font and color scheme
-- config.font = 'FiraCode Nerd Font'
config.max_fps = 120
config.font = wezterm.font({
family = "CaskaydiaCove Nerd Font",
})
config.color_scheme = "Catppuccin Frappe"
config.font_size = 12.0
config.front_end = "WebGpu"
config.webgpu_power_preference = "HighPerformance"
if os_type == "Windows" then
config.window_background_opacity = 0.7 -- Not working under WebGpu
config.win32_system_backdrop = "Mica"
end
-- Tab appearance
config.hide_tab_bar_if_only_one_tab = true
config.tab_bar_at_bottom = true
-- Cursor
-- config.animation_fps = 120
-- config.cursor_blink_ease_in = 'EaseOut'
-- config.cursor_blink_ease_out = 'EaseOut'
-- config.default_cursor_style = 'BlinkingBlock'
-- config.cursor_blink_rate = 650
-- Visual Bell
config.visual_bell = {
fade_in_function = "EaseIn",
fade_in_duration_ms = 250,
fade_out_function = "EaseOut",
fade_out_duration_ms = 250,
target = "CursorColor",
}
--#endregion
--#region Keybindings
config.leader = { key = "q", mods = "CTRL" }
config.keys = {
{
key = "q",
mods = "LEADER",
action = action.SendKey({ key = "q", mods = "CTRL" }),
},
-- Windows Management
{ -- leader keys
key = "|",
mods = "LEADER|SHIFT",
action = action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = "-",
mods = "LEADER",
action = action.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "h",
mods = "LEADER",
action = action.ActivatePaneDirection("Left"),
},
{
key = "n",
mods = "LEADER",
action = action.ActivatePaneDirection("Down"),
},
{
key = "e",
mods = "LEADER",
action = action.ActivatePaneDirection("Up"),
},
{
key = "i",
mods = "LEADER",
action = action.ActivatePaneDirection("Right"),
},
{
key = "H",
mods = "LEADER",
action = action.AdjustPaneSize({ "Left", 5 }),
},
{
key = "N",
mods = "LEADER",
action = action.AdjustPaneSize({ "Down", 5 }),
},
{
key = "E",
mods = "LEADER",
action = action.AdjustPaneSize({ "Up", 5 }),
},
{
key = "I",
mods = "LEADER",
action = action.AdjustPaneSize({ "Right", 5 }),
},
{
key = "/",
mods = "LEADER",
action = action.Search({ Regex = "" }),
},
{
key = "?",
mods = "LEADER|SHIFT",
action = action.Search({ CaseSensitiveString = "" }),
},
{
key = ";",
mods = "LEADER",
action = action.ShowLauncher,
},
{
key = ":",
mods = "LEADER|SHIFT",
action = action.ActivateCommandPalette,
},
{
key = "W",
mods = "CTRL",
action = action.CloseCurrentPane({ confirm = true }),
},
{ -- ^C to copy if selection is active, otherwise send signal
-- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection
key = "c",
mods = "CTRL",
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then
window:perform_action(action.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(action.ClearSelection, pane)
else
window:perform_action(action.SendKey({ key = "c", mods = "CTRL" }), pane)
end
end),
},
}
config.mouse_bindings = {
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = action.OpenLinkAtMouseCursor,
},
{
event = { Up = { streak = 1, button = "Left" } },
mods = "SUPER",
action = action.OpenLinkAtMouseCursor,
},
}
--#endregion
--#region Environment
config.set_environment_variables = {
}
--#endregion
--#region Launching
if os_type == "Windows" then
config.default_prog = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" }
config.launch_menu = {
{
label = "Local - PowerShell",
args = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" },
},
{
label = "Local - PowerShell Administator",
args = { "sudo.exe", "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" },
},
{
label = "WSL1 - Arch",
args = { "wsl.exe", "-d", "Arch" },
},
{
label = "WSL2 - kali-linux",
args = { "wsl.exe", "-d", "kali-linux" },
},
{
label = "Local - NuShell",
args = { "nu" },
},
{
label = "Local - Windows PowerShell",
args = { "powershell.exe" },
},
{
label = "Local - Command Prompt",
args = { "cmd.exe" },
},
{
label = "WSL1 - Arch Zsh",
args = { "wsl.exe", "-d", "Arch", "zsh" },
},
}
elseif os_type == "macOS" then
config.default_prog = { "/opt/homebrew/bin/fish", "-l"}
else
config.default_prog = { "fish" }
config.launch_menu = {
{
label = "Local - Fish",
args = { "fish", "-l" },
},
{
label = "Local - Zsh",
args = { "zsh", "-l" },
},
{
label = "Local - PowerShell",
args = { "pwsh", "-NoLogo", "-NoProfileLoadTime", "-Login" },
},
{
label = "Local - NuShell",
args = { "nu", "-l" },
},
}
end
--#endregion
return config

View file

@ -83,7 +83,7 @@ if command -v apt > /dev/null; then
alias apt="sudo apt"
alias apti="sudo apt install"
alias aptu="sudo apt update && sudo apt upgrade"
alias aptr="sudo apt autoremove && sudo apt remove"
alias aptr="sudo apt remove"
fi
if command -v brew > /dev/null; then

Some files were not shown because too many files have changed in this diff Show more