Compare commits
18 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b7e1c79b4f |
|||
|
c51a0e0013 |
|||
|
e9922ed0e6 |
|||
|
b932bb8e04 |
|||
|
99999b577c |
|||
|
e7a7a638b5 |
|||
|
6469fd0c1e |
|||
|
1f522ecfa2 |
|||
|
b7ee223032 |
|||
|
a50642252d |
|||
|
6738902048 |
|||
|
eaf3ab0640 |
|||
|
87c04d870d |
|||
|
72b0111237 |
|||
|
c6d1b39c95 |
|||
|
f4b394f95c |
|||
|
26af2d22c1 |
|||
|
19722cc0fc |
49 changed files with 2895 additions and 1789 deletions
71
.forgejo/workflows/ci.yml
Executable file
71
.forgejo/workflows/ci.yml
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
nix-fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v6.0.1
|
||||
- name: install nix
|
||||
uses: https://github.com/cachix/install-nix-action@v31.8.4
|
||||
- name: set up nix
|
||||
run: |
|
||||
mkdir -p ~/.config/nix
|
||||
echo "experimental-features = nix-command flakes pipe-operators" >> ~/.config/nix/nix.conf
|
||||
nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgs
|
||||
nix-channel --update
|
||||
- name: restore and save nix store
|
||||
uses: https://github.com/nix-community/cache-nix-action@v6.1.3
|
||||
with:
|
||||
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
|
||||
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||
gc-max-store-size-linux: 1G
|
||||
purge: true
|
||||
purge-prefixes: nix-${{ runner.os }}-
|
||||
purge-created: 0
|
||||
purge-last-accessed: 0
|
||||
purge-primary-key: never
|
||||
- name: set up nix-community cachix
|
||||
uses: https://github.com/cachix/cachix-action@v16
|
||||
with:
|
||||
name: nix-community
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
- name: import gpg key
|
||||
env:
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
run: |
|
||||
echo "$GPG_PRIVATE_KEY" | gpg --batch --import || true
|
||||
echo "default-cache-ttl 3600" >> ~/.gnupg/gpg-agent.conf
|
||||
echo RELOADAGENT | gpg-connect-agent
|
||||
- name: setup git identity
|
||||
run: |
|
||||
git config --global user.name "forgejo-actions-bot"
|
||||
git config --global user.email "actions@forgejo.local"
|
||||
|
||||
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/{print $5;exit}')
|
||||
git config --global user.signingkey "$KEYID"
|
||||
git config --global commit.gpgsign true
|
||||
- name: run nix fmt
|
||||
run: nix fmt
|
||||
- name: check for changes
|
||||
id: git_status
|
||||
run: |
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "changed=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: commit and push changes
|
||||
if: steps.git_status.outputs.changed == 'true'
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ forgejo.token }}
|
||||
FORGEJO_REPOSITORY: ${{ forgejo.repository }}
|
||||
run: |
|
||||
git add -A
|
||||
git commit -S -m "style: autoformatting all files with treefmt"
|
||||
git push "https://${FORGEJO_TOKEN}@git.cpatino.com/${FORGEJO_REPOSITORY}.git" HEAD:main
|
||||
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
|
|
@ -1,19 +0,0 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ["v*.*.*"]
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
branches: ["*"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
format:
|
||||
uses: c4patino/actions/.github/workflows/format.yml@main
|
||||
with:
|
||||
language: nix
|
||||
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Created by https://www.toptal.com/developers/gitignore/api/direnv,vim
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=direnv,vim
|
||||
|
||||
### direnv ###
|
||||
.direnv
|
||||
.envrc
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
!*.svg # comment out if you don't need vector files
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/direnv,vim
|
||||
661
LICENSE
Normal file
661
LICENSE
Normal file
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
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 AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
92
README.md
Normal file
92
README.md
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# ゆめヴィム (yumevim-nix)
|
||||
|
||||
A modular, reproducible, and declarative Neovim configuration system powered by
|
||||
[Nix flakes](https://nixos.wiki/wiki/Flakes). yumevim is designed for users who
|
||||
want a maintainable, customizable, and portable Neovim setup, leveraging the
|
||||
power of Nix for plugin management, language tooling, and editor settings.
|
||||
|
||||
---
|
||||
|
||||
## ✨ Features
|
||||
- **Nix Flake-based**: Reproducible and declarative configuration using Nix
|
||||
flakes.
|
||||
- **Highly Modular**: Organized by feature (UI, navigation, language support,
|
||||
utilities, etc.) for easy customization.
|
||||
- **Plugin Management**: Cleanly integrates popular Neovim plugins via Nixvim.
|
||||
- **Language Support**: Built-in LSP, DAP, Treesitter, snippets, and formatting
|
||||
for many languages.
|
||||
- **Profiles**: Minimal and full profiles for different use cases.
|
||||
- **CI Formatting**: Enforced code style with treefmt and Alejandra.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
### Prerequisites
|
||||
- [Nix](https://nixos.org/download.html) (with flakes enabled)
|
||||
|
||||
### Clone the Repository
|
||||
```bash
|
||||
git clone https://github.com/c4patino/yumevim-nix.git
|
||||
cd yumevim-nix
|
||||
```
|
||||
|
||||
### Run Neovim with yumevim
|
||||
You can run Neovim using the provided flake outputs. For example:
|
||||
|
||||
```bash
|
||||
nix run . # minimal profile
|
||||
nix run .#full # full profile (with extra language/tools)
|
||||
nix run github:c4patino/yumevim # run without downloading
|
||||
```
|
||||
|
||||
Or build a package:
|
||||
```bash
|
||||
nix build .#default
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ Project Structure
|
||||
|
||||
```
|
||||
.github/ - CI workflows (GitHub Actions)
|
||||
config/ - Main configuration modules
|
||||
bundles/ - Bundled config sets (common, default)
|
||||
languages/ - Language support (LSP, DAP, snippets, treesitter, etc.)
|
||||
navigation/ - Navigation plugins (telescope, nvim-tree, harpoon)
|
||||
ui/ - UI plugins (lualine, alpha, notify, etc.)
|
||||
utils/ - Utility plugins (lazygit, obsidian, todo-comments, etc.)
|
||||
autocmds.nix - Neovim autocommands
|
||||
mappings.nix - Key mappings
|
||||
options.nix - Editor options
|
||||
lib/ - Custom Nix library extensions
|
||||
flake.nix - Flake entrypoint, defines outputs, packages, checks
|
||||
flake.lock - Flake dependency lock file
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Development & Contribution
|
||||
|
||||
### Formatting & Checks
|
||||
- Run formatting: `nix fmt`
|
||||
- CI will check formatting on push/PR.
|
||||
|
||||
### Customization
|
||||
- Edit or extend modules in `config/` to add plugins, languages, or settings.
|
||||
- Use the `full` profile for all features, or `default` for a minimal setup.
|
||||
|
||||
### Contributing
|
||||
- PRs and issues are welcome! Please keep code modular and well-documented.
|
||||
|
||||
---
|
||||
|
||||
## 👤 Authors
|
||||
- [@c4patino](https://github.com/c4patino)
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
This project is licensed under the GNU Affero General Public License v3.0
|
||||
(AGPL-3.0). See the [LICENSE](./LICENSE) file for details.
|
||||
51
config/bundles/common.nix
Normal file
51
config/bundles/common.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace enabled;
|
||||
base = "${namespace}.bundles.common";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "common bundle";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
${namespace} = {
|
||||
languages = {
|
||||
cmp = enabled;
|
||||
conform = enabled;
|
||||
dap = enabled;
|
||||
luasnip = enabled;
|
||||
treesitter = enabled;
|
||||
};
|
||||
|
||||
navigation = {
|
||||
harpoon = enabled;
|
||||
nvim-tree = enabled;
|
||||
telescope = enabled;
|
||||
};
|
||||
|
||||
ui = {
|
||||
alpha = enabled;
|
||||
fidget = enabled;
|
||||
indent-blankline = enabled;
|
||||
lualine = enabled;
|
||||
noice = enabled;
|
||||
nvim-notify = enabled;
|
||||
};
|
||||
|
||||
utils = {
|
||||
lazygit = enabled;
|
||||
todo-comments = enabled;
|
||||
toggleterm = enabled;
|
||||
undotree = enabled;
|
||||
which-key = enabled;
|
||||
zenmode = enabled;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
5
config/bundles/default.nix
Normal file
5
config/bundles/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{...} @ inputs: {
|
||||
imports = [
|
||||
(import ./common.nix inputs)
|
||||
];
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
{...} @ inputs: {
|
||||
imports = [
|
||||
./languages
|
||||
./navigation
|
||||
./ui
|
||||
./utils
|
||||
(import ./bundles inputs)
|
||||
|
||||
(import ./languages inputs)
|
||||
(import ./navigation inputs)
|
||||
(import ./ui inputs)
|
||||
(import ./utils inputs)
|
||||
|
||||
./autocmds.nix
|
||||
./mappings.nix
|
||||
|
|
|
|||
|
|
@ -1,55 +1,70 @@
|
|||
{
|
||||
plugins = {
|
||||
cmp = {
|
||||
enable = true;
|
||||
autoEnableSources = true;
|
||||
|
||||
settings = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
|
||||
mapping = {
|
||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-y>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
};
|
||||
|
||||
performance = {
|
||||
debounce = 60;
|
||||
fetching_timeout = 200;
|
||||
max_view_entries = 30;
|
||||
};
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
border = "rounded";
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
|
||||
};
|
||||
|
||||
documentation = {
|
||||
border = "rounded";
|
||||
};
|
||||
};
|
||||
|
||||
formatting = {
|
||||
fields = ["kind" "abbr" "menu"];
|
||||
expandable_indicator = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmp_luasnip.enable = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.languages.cmp";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "nvim-cmp";
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
kind_icons = {
|
||||
config = mkIf cfg.enable {
|
||||
plugins = {
|
||||
cmp = {
|
||||
enable = true;
|
||||
autoEnableSources = true;
|
||||
|
||||
settings = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
|
||||
mapping = {
|
||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-y>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
};
|
||||
|
||||
performance = {
|
||||
debounce = 60;
|
||||
fetching_timeout = 200;
|
||||
max_view_entries = 30;
|
||||
};
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
border = "rounded";
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
|
||||
};
|
||||
|
||||
documentation = {
|
||||
border = "rounded";
|
||||
};
|
||||
};
|
||||
|
||||
formatting = {
|
||||
fields = ["kind" "abbr" "menu"];
|
||||
expandable_indicator = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmp_luasnip.enable = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
|
|
@ -75,33 +90,34 @@
|
|||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
}
|
||||
|
||||
local cmp = require'cmp'
|
||||
local cmp = require'cmp'
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({'/', "?" }, {
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({'/', "?" }, {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' },
|
||||
{ name = 'cmp_git' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
})
|
||||
'';
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,104 +1,119 @@
|
|||
{lib, ...}: let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
inherit (lib.nixvim.utils) listToUnkeyedAttrs;
|
||||
base = "${namespace}.languages.conform";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = "<cmd>FormatToggle<cr>";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Conform Toggle autoformat";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = ["n" "v"];
|
||||
key = "<leader>f";
|
||||
action = "<cmd>lua require('conform').format({ lsp_format = \"fallback\" })<cr>";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Conform Format";
|
||||
};
|
||||
}
|
||||
];
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "conform";
|
||||
};
|
||||
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
notify_on_error = true;
|
||||
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback";
|
||||
};
|
||||
|
||||
formatters_by_ft = let
|
||||
mkFormatList = formatters:
|
||||
listToUnkeyedAttrs formatters
|
||||
// {
|
||||
stop_after_first = true;
|
||||
};
|
||||
in {
|
||||
astro = mkFormatList ["prettierd" "prettier"];
|
||||
cabal = mkFormatList ["ormolu"];
|
||||
haskell = mkFormatList ["ormolu"];
|
||||
java = mkFormatList ["google-java-format"];
|
||||
javascript = mkFormatList ["prettierd" "prettier"];
|
||||
javascriptreact = mkFormatList ["prettierd" "prettier"];
|
||||
lua = mkFormatList ["stylua"];
|
||||
nix = mkFormatList ["alejandra"];
|
||||
racket = mkFormatList ["raco_fmt"];
|
||||
typescript = mkFormatList ["prettierd" "prettier"];
|
||||
typescriptreact = mkFormatList ["prettierd" "prettier"];
|
||||
};
|
||||
|
||||
formatters = {
|
||||
raco_fmt = {
|
||||
command = "raco";
|
||||
args = ["fmt"];
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = "<cmd>FormatToggle<cr>";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Conform Toggle autoformat";
|
||||
};
|
||||
nix_fmt = {
|
||||
command = "nix";
|
||||
args = ["fmt"];
|
||||
}
|
||||
{
|
||||
mode = ["n" "v"];
|
||||
key = "<leader>f";
|
||||
action = "<cmd>lua require('conform').format({ lsp_format = \"fallback\" })<cr>";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Conform Format";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
notify_on_error = true;
|
||||
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback";
|
||||
};
|
||||
|
||||
formatters_by_ft = let
|
||||
mkFormatList = formatters:
|
||||
listToUnkeyedAttrs formatters
|
||||
// {
|
||||
stop_after_first = true;
|
||||
};
|
||||
in {
|
||||
astro = mkFormatList ["prettierd" "prettier"];
|
||||
cabal = mkFormatList ["ormolu"];
|
||||
haskell = mkFormatList ["ormolu"];
|
||||
java = mkFormatList ["google-java-format"];
|
||||
javascript = mkFormatList ["prettierd" "prettier"];
|
||||
javascriptreact = mkFormatList ["prettierd" "prettier"];
|
||||
lua = mkFormatList ["stylua"];
|
||||
nix = mkFormatList ["alejandra"];
|
||||
racket = mkFormatList ["raco_fmt"];
|
||||
typescript = mkFormatList ["prettierd" "prettier"];
|
||||
typescriptreact = mkFormatList ["prettierd" "prettier"];
|
||||
};
|
||||
|
||||
formatters = {
|
||||
raco_fmt = {
|
||||
command = "raco";
|
||||
args = ["fmt"];
|
||||
};
|
||||
nix_fmt = {
|
||||
command = "nix";
|
||||
args = ["fmt"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local conform = require("conform")
|
||||
local notify = require("notify")
|
||||
extraConfigLua = ''
|
||||
local conform = require("conform")
|
||||
local notify = require("notify")
|
||||
|
||||
conform.setup({
|
||||
conform.setup({
|
||||
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 { lsp_format = "fallback" }
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
local function show_notification(message, level)
|
||||
local function show_notification(message, level)
|
||||
notify(message, level, { title = "conform.nvim" })
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("FormatToggle", function(args)
|
||||
vim.api.nvim_create_user_command("FormatToggle", function(args)
|
||||
local is_global = not args.bang
|
||||
if is_global then
|
||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
if vim.g.disable_autoformat then
|
||||
show_notification("Autoformat-on-save disabled globally", "info")
|
||||
else
|
||||
show_notification("Autoformat-on-save enabled globally", "info")
|
||||
end
|
||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
if vim.g.disable_autoformat then
|
||||
show_notification("Autoformat-on-save disabled globally", "info")
|
||||
else
|
||||
show_notification("Autoformat-on-save enabled globally", "info")
|
||||
end
|
||||
else
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
if vim.b.disable_autoformat then
|
||||
show_notification("Autoformat-on-save disabled for this buffer", "info")
|
||||
else
|
||||
show_notification("Autoformat-on-save enabled for this buffer", "info")
|
||||
end
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
if vim.b.disable_autoformat then
|
||||
show_notification("Autoformat-on-save disabled for this buffer", "info")
|
||||
else
|
||||
show_notification("Autoformat-on-save enabled for this buffer", "info")
|
||||
end
|
||||
end
|
||||
end, { desc = "Toggle autoformat-on-save", bang = true })
|
||||
'';
|
||||
end, { desc = "Toggle autoformat-on-save", bang = true })
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,362 +1,379 @@
|
|||
{pkgs, ...}: {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>db";
|
||||
action.__raw = "function() require('dap').toggle_breakpoint() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle Breakpoint";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dB";
|
||||
action.__raw = "function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle Conditional Breakpoint";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dc";
|
||||
action.__raw = "function() require('dap').continue() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Continue";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>da";
|
||||
action.__raw = "function() require('dap').continue({ before = get_args }) end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run with Args";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dC";
|
||||
action.__raw = "function() require('dap').run_to_cursor() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run to cursor";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dg";
|
||||
action.__raw = "function() require('dap').goto_() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Go to line (no execute)";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>di";
|
||||
action.__raw = "function() require('dap').step_into() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step into";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dj";
|
||||
action.__raw = "function() require('dap').down() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Down";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dk";
|
||||
action.__raw = "function() require('dap').up() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Up";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dl";
|
||||
action.__raw = "function() require('dap').run_last() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run Last";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>do";
|
||||
action.__raw = "function() require('dap').step_out() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step Out";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dO";
|
||||
action.__raw = "function() require('dap').step_over() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step Over";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dp";
|
||||
action.__raw = "function() require('dap').pause() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Pause";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dr";
|
||||
action.__raw = "function() require('dap').repl.toggle() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle REPL";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ds";
|
||||
action.__raw = "function() require('dap').session() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Session";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dt";
|
||||
action.__raw = "function() require('dap').terminate() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Terminate";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>du";
|
||||
action.__raw = "function() require('dapui').toggle() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Dap UI";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = ["n" "v"];
|
||||
key = "<leader>de";
|
||||
action.__raw = "function() require('dapui').eval() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Eval";
|
||||
};
|
||||
}
|
||||
];
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.languages.dap";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "dap";
|
||||
};
|
||||
|
||||
plugins = {
|
||||
dap = {
|
||||
enable = true;
|
||||
adapters = {
|
||||
servers = {
|
||||
codelldb = {
|
||||
port = 13000;
|
||||
executable = {
|
||||
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||
args = ["--port" "13000"];
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>db";
|
||||
action.__raw = "function() require('dap').toggle_breakpoint() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle Breakpoint";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dB";
|
||||
action.__raw = "function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle Conditional Breakpoint";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dc";
|
||||
action.__raw = "function() require('dap').continue() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Continue";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>da";
|
||||
action.__raw = "function() require('dap').continue({ before = get_args }) end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run with Args";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dC";
|
||||
action.__raw = "function() require('dap').run_to_cursor() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run to cursor";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dg";
|
||||
action.__raw = "function() require('dap').goto_() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Go to line (no execute)";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>di";
|
||||
action.__raw = "function() require('dap').step_into() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step into";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dj";
|
||||
action.__raw = "function() require('dap').down() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Down";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dk";
|
||||
action.__raw = "function() require('dap').up() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Up";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dl";
|
||||
action.__raw = "function() require('dap').run_last() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Run Last";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>do";
|
||||
action.__raw = "function() require('dap').step_out() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step Out";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dO";
|
||||
action.__raw = "function() require('dap').step_over() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Step Over";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dp";
|
||||
action.__raw = "function() require('dap').pause() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Pause";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dr";
|
||||
action.__raw = "function() require('dap').repl.toggle() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Toggle REPL";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ds";
|
||||
action.__raw = "function() require('dap').session() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Session";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dt";
|
||||
action.__raw = "function() require('dap').terminate() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Terminate";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>du";
|
||||
action.__raw = "function() require('dapui').toggle() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Dap UI";
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = ["n" "v"];
|
||||
key = "<leader>de";
|
||||
action.__raw = "function() require('dapui').eval() end";
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Eval";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
plugins = {
|
||||
dap = {
|
||||
enable = true;
|
||||
adapters = {
|
||||
servers = {
|
||||
codelldb = {
|
||||
port = 13000;
|
||||
executable = {
|
||||
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||
args = ["--port" "13000"];
|
||||
};
|
||||
};
|
||||
};
|
||||
go = {
|
||||
port = 38697;
|
||||
executable = {
|
||||
command = "${pkgs.delve}/bin/dlv";
|
||||
args = ["dap" "-l" "127.0.0.1:38697"];
|
||||
go = {
|
||||
port = 38697;
|
||||
executable = {
|
||||
command = "${pkgs.delve}/bin/dlv";
|
||||
args = ["dap" "-l" "127.0.0.1:38697"];
|
||||
};
|
||||
};
|
||||
};
|
||||
pwa-node = {
|
||||
port = 9229;
|
||||
executable = {
|
||||
command = "${pkgs.vscode-js-debug}/bin/js-debug";
|
||||
args = ["9229" "127.0.0.1"];
|
||||
pwa-node = {
|
||||
port = 9229;
|
||||
executable = {
|
||||
command = "${pkgs.vscode-js-debug}/bin/js-debug";
|
||||
args = ["9229" "127.0.0.1"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
configurations = let
|
||||
exeConfigs = [
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
name = "exe";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
name = "exe:args";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end '';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
configurations = let
|
||||
exeConfigs = [
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
name = "exe";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
name = "exe:args";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end '';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "codelldb";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
|
||||
webConfigs = [
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "current";
|
||||
program = "\${file}";
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "current:args";
|
||||
program = "\${file}";
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "file";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "file:args";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
in {
|
||||
python = let
|
||||
findPython = ''
|
||||
function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "python3"
|
||||
end
|
||||
end
|
||||
'';
|
||||
in [
|
||||
{
|
||||
type = "python";
|
||||
request = "launch";
|
||||
name = "module";
|
||||
module.__raw = ''function() return vim.fn.input("Module: ") end '';
|
||||
pythonPath.__raw = findPython;
|
||||
}
|
||||
{
|
||||
type = "python";
|
||||
request = "launch";
|
||||
name = "module:args";
|
||||
module.__raw = ''function() return vim.fn.input("Module: ") end '';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
pythonPath.__raw = findPython;
|
||||
}
|
||||
];
|
||||
c = exeConfigs;
|
||||
cpp = exeConfigs;
|
||||
rust = exeConfigs;
|
||||
zig = exeConfigs;
|
||||
go = [
|
||||
{
|
||||
type = "go";
|
||||
request = "launch";
|
||||
name = "file";
|
||||
program = "\${file}";
|
||||
outputMode = "remote";
|
||||
}
|
||||
{
|
||||
type = "go";
|
||||
request = "launch";
|
||||
name = "file:args";
|
||||
program = "\${file}";
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
outputMode = "remote";
|
||||
}
|
||||
{
|
||||
type = "go";
|
||||
mode = "remote";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''
|
||||
webConfigs = [
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "current";
|
||||
program = "\${file}";
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "current:args";
|
||||
program = "\${file}";
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "file";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "launch";
|
||||
name = "file:args";
|
||||
program.__raw = ''function() return vim.fn.input("Executable: ", vim.fn.getcwd(), "file") end '';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
}
|
||||
{
|
||||
type = "pwa-node";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''function() return vim.fn.input("Host: ") end'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
in {
|
||||
python = let
|
||||
findPython = ''
|
||||
function()
|
||||
local input = vim.fn.input("Host: ")
|
||||
local host, port = string.match(input, "([^:]+):(%d+)")
|
||||
return { host = host, port = tonumber(port) }
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "python3"
|
||||
end
|
||||
end
|
||||
'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
in [
|
||||
{
|
||||
type = "python";
|
||||
request = "launch";
|
||||
name = "module";
|
||||
module.__raw = ''function() return vim.fn.input("Module: ") end '';
|
||||
pythonPath.__raw = findPython;
|
||||
}
|
||||
{
|
||||
type = "python";
|
||||
request = "launch";
|
||||
name = "module:args";
|
||||
module.__raw = ''function() return vim.fn.input("Module: ") end '';
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
pythonPath.__raw = findPython;
|
||||
}
|
||||
];
|
||||
c = exeConfigs;
|
||||
cpp = exeConfigs;
|
||||
rust = exeConfigs;
|
||||
zig = exeConfigs;
|
||||
go = [
|
||||
{
|
||||
type = "go";
|
||||
request = "launch";
|
||||
name = "file";
|
||||
program = "\${file}";
|
||||
outputMode = "remote";
|
||||
}
|
||||
{
|
||||
type = "go";
|
||||
request = "launch";
|
||||
name = "file:args";
|
||||
program = "\${file}";
|
||||
args.__raw = ''function() return vim.fn.split(vim.fn.input("Arguments: "), " ") end'';
|
||||
outputMode = "remote";
|
||||
}
|
||||
{
|
||||
type = "go";
|
||||
mode = "remote";
|
||||
request = "attach";
|
||||
name = "attach";
|
||||
connect.__raw = ''
|
||||
function()
|
||||
local input = vim.fn.input("Host: ")
|
||||
local host, port = string.match(input, "([^:]+):(%d+)")
|
||||
return { host = host, port = tonumber(port) }
|
||||
end
|
||||
'';
|
||||
cwd.__raw = ''function() return vim.fn.getcwd() end'';
|
||||
}
|
||||
];
|
||||
|
||||
javascript = webConfigs;
|
||||
javascriptreact = webConfigs;
|
||||
typescript = webConfigs;
|
||||
typescriptreact = webConfigs;
|
||||
};
|
||||
signs = {
|
||||
dapBreakpoint = {
|
||||
text = "●";
|
||||
texthl = "DapBreakpoint";
|
||||
javascript = webConfigs;
|
||||
javascriptreact = webConfigs;
|
||||
typescript = webConfigs;
|
||||
typescriptreact = webConfigs;
|
||||
};
|
||||
dapBreakpointCondition = {
|
||||
text = "⏹";
|
||||
texthl = "DapBreakpointCondition";
|
||||
};
|
||||
dapLogPoint = {
|
||||
text = "◆";
|
||||
texthl = "DapLogPoint";
|
||||
signs = {
|
||||
dapBreakpoint = {
|
||||
text = "●";
|
||||
texthl = "DapBreakpoint";
|
||||
};
|
||||
dapBreakpointCondition = {
|
||||
text = "⏹";
|
||||
texthl = "DapBreakpointCondition";
|
||||
};
|
||||
dapLogPoint = {
|
||||
text = "◆";
|
||||
texthl = "DapLogPoint";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dap-ui = {
|
||||
enable = true;
|
||||
dap-ui = {
|
||||
enable = true;
|
||||
|
||||
settings.floating.mappings = {
|
||||
close = ["<Esc>" "q"];
|
||||
settings.floating.mappings = {
|
||||
close = ["<Esc>" "q"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dap-python.enable = true;
|
||||
dap-lldb = {
|
||||
enable = true;
|
||||
settings.codelldb_path = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||
dap-python.enable = true;
|
||||
dap-lldb = {
|
||||
enable = true;
|
||||
settings.codelldb_path = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
{
|
||||
{...} @ inputs: {
|
||||
imports = [
|
||||
./cmp.nix
|
||||
./conform.nix
|
||||
./dap.nix
|
||||
./lsp.nix
|
||||
./lspkind.nix
|
||||
./lspsaga.nix
|
||||
./luasnip.nix
|
||||
./treesitter.nix
|
||||
(import ./lsp inputs)
|
||||
|
||||
(import ./cmp.nix inputs)
|
||||
(import ./conform.nix inputs)
|
||||
(import ./dap.nix inputs)
|
||||
(import ./luasnip.nix inputs)
|
||||
(import ./treesitter.nix inputs)
|
||||
];
|
||||
|
||||
plugins = {
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
plugins = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
capabilities = "offsetEncoding = 'utf-16'";
|
||||
servers = {
|
||||
astro.enable = true;
|
||||
clangd.enable = true;
|
||||
csharp_ls.enable = true;
|
||||
gopls.enable = true;
|
||||
hls = {
|
||||
enable = true;
|
||||
installGhc = false;
|
||||
package = pkgs.haskell-language-server.override {supportedGhcVersions = ["98" "910"];};
|
||||
};
|
||||
jdtls.enable = true;
|
||||
lua_ls.enable = true;
|
||||
nixd.enable = true;
|
||||
pylsp = {
|
||||
enable = true;
|
||||
settings.configurationSources = "pycodestyle";
|
||||
settings = {
|
||||
plugins = {
|
||||
pyflakes.enabled = true;
|
||||
mccabe.enabled = true;
|
||||
pycodestyle.enabled = true;
|
||||
pydocstyle.enabled = true;
|
||||
yapf.enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
sqls.enable = true;
|
||||
zls.enable = true;
|
||||
};
|
||||
};
|
||||
rustaceanvim.enable = true;
|
||||
typescript-tools.enable = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local _border = "rounded"
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = _border;
|
||||
}
|
||||
)
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = _border;
|
||||
}
|
||||
)
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = { border=_border };
|
||||
virtual_text = true;
|
||||
};
|
||||
|
||||
require('lspconfig.ui.windows').default_options = {
|
||||
border = _border;
|
||||
}
|
||||
'';
|
||||
}
|
||||
103
config/languages/lsp/default.nix
Normal file
103
config/languages/lsp/default.nix
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
pkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.languages.lsp";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
imports = [
|
||||
(import ./lspkind.nix inputs)
|
||||
(import ./lspsaga.nix inputs)
|
||||
];
|
||||
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "lsp";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
capabilities = "offsetEncoding = 'utf-16'";
|
||||
servers = {
|
||||
astro.enable = true;
|
||||
clangd.enable = true;
|
||||
csharp_ls.enable = true;
|
||||
gopls.enable = true;
|
||||
hls = {
|
||||
enable = true;
|
||||
installGhc = false;
|
||||
};
|
||||
jdtls = {
|
||||
enable = true;
|
||||
settings = {
|
||||
java.configuration.runtimes = [
|
||||
{
|
||||
name = "JavaSE-25";
|
||||
path = pkgs.openjdk25;
|
||||
}
|
||||
{
|
||||
name = "JavaSE-21";
|
||||
path = pkgs.openjdk21;
|
||||
}
|
||||
{
|
||||
name = "JavaSE-8";
|
||||
path = pkgs.openjdk8;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
lua_ls.enable = true;
|
||||
nixd.enable = true;
|
||||
pylsp = {
|
||||
enable = true;
|
||||
settings.configurationSources = "pycodestyle";
|
||||
settings = {
|
||||
plugins = {
|
||||
pyflakes.enabled = true;
|
||||
mccabe.enabled = true;
|
||||
pycodestyle.enabled = true;
|
||||
pydocstyle.enabled = true;
|
||||
yapf.enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
sqls.enable = true;
|
||||
zls.enable = true;
|
||||
};
|
||||
};
|
||||
rustaceanvim.enable = true;
|
||||
typescript-tools.enable = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local _border = "rounded"
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = _border;
|
||||
}
|
||||
)
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = _border;
|
||||
}
|
||||
)
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = { border=_border };
|
||||
virtual_text = true;
|
||||
};
|
||||
|
||||
require('lspconfig.ui.windows').default_options = {
|
||||
border = _border;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
20
config/languages/lsp/lspkind.nix
Executable file
20
config/languages/lsp/lspkind.nix
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace;
|
||||
cfg = getAttrByNamespace config "${namespace}.languages.lsp";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
plugins.lspkind = {
|
||||
enable = true;
|
||||
settings = {
|
||||
maxwidth = 50;
|
||||
ellipsis_char = "...";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
159
config/languages/lsp/lspsaga.nix
Executable file
159
config/languages/lsp/lspsaga.nix
Executable file
|
|
@ -0,0 +1,159 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace;
|
||||
cfg = getAttrByNamespace config "${namespace}.languages.lsp";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "gd";
|
||||
action = "<cmd>Lspsaga finder def<cr>";
|
||||
options = {
|
||||
desc = "Goto Definition";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gr";
|
||||
action = "<cmd>Lspsaga finder ref<cr>";
|
||||
options = {
|
||||
desc = "Goto References";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gI";
|
||||
action = "<cmd>Lspsaga finder imp<cr>";
|
||||
options = {
|
||||
desc = "Goto Implementation";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "gT";
|
||||
action = "<cmd>Lspsaga peek_type_definition<cr>";
|
||||
options = {
|
||||
desc = "Type Definition";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "K";
|
||||
action = "<cmd>Lspsaga hover_doc<cr>";
|
||||
options = {
|
||||
desc = "Hover";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>cw";
|
||||
action = "<cmd>Lspsaga outline<cr>";
|
||||
options = {
|
||||
desc = "Outline";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>cr";
|
||||
action = "<cmd>Lspsaga rename<cr>";
|
||||
options = {
|
||||
desc = "Rename";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ca";
|
||||
action = "<cmd>Lspsaga code_action<cr>";
|
||||
options = {
|
||||
desc = "Code Action";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
plugins.lspsaga = {
|
||||
enable = true;
|
||||
settings = {
|
||||
beacon = {
|
||||
enable = true;
|
||||
};
|
||||
ui = {
|
||||
border = "rounded";
|
||||
code_action = "💡";
|
||||
};
|
||||
hover = {
|
||||
open_cmd = "!floorp";
|
||||
open_link = "gx";
|
||||
};
|
||||
diagnostic = {
|
||||
border_follow = true;
|
||||
diagnostic_only_current = false;
|
||||
show_code_action = true;
|
||||
};
|
||||
symbol_in_winbar = {
|
||||
enable = true;
|
||||
};
|
||||
code_action = {
|
||||
extend_git_signs = false;
|
||||
show_server_name = true;
|
||||
only_in_cursor = true;
|
||||
num_shortcut = true;
|
||||
keys = {
|
||||
exec = "<cr>";
|
||||
quit = ["<Esc>" "q"];
|
||||
};
|
||||
};
|
||||
lightbulb = {
|
||||
enable = false;
|
||||
sign = false;
|
||||
virtual_text = true;
|
||||
};
|
||||
implement = {
|
||||
enable = false;
|
||||
};
|
||||
rename = {
|
||||
auto_save = false;
|
||||
keys = {
|
||||
exec = "<cr>";
|
||||
quit = ["<C-k>" "<Esc>"];
|
||||
select = "x";
|
||||
};
|
||||
};
|
||||
outline = {
|
||||
auto_close = true;
|
||||
auto_preview = true;
|
||||
close_after_jump = true;
|
||||
layout = "normal";
|
||||
win_position = "right";
|
||||
keys = {
|
||||
jump = "e";
|
||||
quit = "q";
|
||||
toggle_or_jump = "o";
|
||||
};
|
||||
};
|
||||
scroll_preview = {
|
||||
scroll_down = "<C-f>";
|
||||
scroll_up = "<C-b>";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
plugins.lspkind = {
|
||||
enable = true;
|
||||
extraOptions = {
|
||||
maxwidth = 50;
|
||||
ellipsis_char = "...";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "gd";
|
||||
action = "<cmd>Lspsaga finder def<cr>";
|
||||
options = {
|
||||
desc = "Goto Definition";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gr";
|
||||
action = "<cmd>Lspsaga finder ref<cr>";
|
||||
options = {
|
||||
desc = "Goto References";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gI";
|
||||
action = "<cmd>Lspsaga finder imp<cr>";
|
||||
options = {
|
||||
desc = "Goto Implementation";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "gT";
|
||||
action = "<cmd>Lspsaga peek_type_definition<cr>";
|
||||
options = {
|
||||
desc = "Type Definition";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "K";
|
||||
action = "<cmd>Lspsaga hover_doc<cr>";
|
||||
options = {
|
||||
desc = "Hover";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>cw";
|
||||
action = "<cmd>Lspsaga outline<cr>";
|
||||
options = {
|
||||
desc = "Outline";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>cr";
|
||||
action = "<cmd>Lspsaga rename<cr>";
|
||||
options = {
|
||||
desc = "Rename";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ca";
|
||||
action = "<cmd>Lspsaga code_action<cr>";
|
||||
options = {
|
||||
desc = "Code Action";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
plugins.lspsaga = {
|
||||
enable = true;
|
||||
beacon = {
|
||||
enable = true;
|
||||
};
|
||||
ui = {
|
||||
border = "rounded";
|
||||
codeAction = "💡";
|
||||
};
|
||||
hover = {
|
||||
openCmd = "!floorp";
|
||||
openLink = "gx";
|
||||
};
|
||||
diagnostic = {
|
||||
borderFollow = true;
|
||||
diagnosticOnlyCurrent = false;
|
||||
showCodeAction = true;
|
||||
};
|
||||
symbolInWinbar = {
|
||||
enable = true;
|
||||
};
|
||||
codeAction = {
|
||||
extendGitSigns = false;
|
||||
showServerName = true;
|
||||
onlyInCursor = true;
|
||||
numShortcut = true;
|
||||
keys = {
|
||||
exec = "<cr>";
|
||||
quit = ["<Esc>" "q"];
|
||||
};
|
||||
};
|
||||
lightbulb = {
|
||||
enable = false;
|
||||
sign = false;
|
||||
virtualText = true;
|
||||
};
|
||||
implement.enable = false;
|
||||
rename = {
|
||||
autoSave = false;
|
||||
keys = {
|
||||
exec = "<cr>";
|
||||
quit = ["<C-k>" "<Esc>"];
|
||||
select = "x";
|
||||
};
|
||||
};
|
||||
outline = {
|
||||
autoClose = true;
|
||||
autoPreview = true;
|
||||
closeAfterJump = true;
|
||||
layout = "normal";
|
||||
winPosition = "right";
|
||||
keys = {
|
||||
jump = "e";
|
||||
quit = "q";
|
||||
toggleOrJump = "o";
|
||||
};
|
||||
};
|
||||
scrollPreview = {
|
||||
scrollDown = "<C-f>";
|
||||
scrollUp = "<C-b>";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,182 +1,137 @@
|
|||
{
|
||||
plugins.luasnip = {
|
||||
enable = true;
|
||||
|
||||
# Basic LuaSnip settings
|
||||
settings = {
|
||||
history = true;
|
||||
updateevents = "TextChanged,TextChangedI";
|
||||
enable_autosnippets = true;
|
||||
};
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) readDir;
|
||||
inherit (lib) mkIf mkEnableOption filter match attrNames concatStringsSep;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.languages.luasnip";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "luasnip";
|
||||
};
|
||||
|
||||
# Add keymaps for snippet navigation
|
||||
keymaps = [
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-k>";
|
||||
action = "<cmd>lua require('luasnip').expand_or_jump()<CR>";
|
||||
options.desc = "Snippets Expand or jump forward";
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-j>";
|
||||
action = "<cmd>lua require('luasnip').jump(-1)<CR>";
|
||||
options.desc = "Snippets Jump backward";
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-l>";
|
||||
action = "<cmd>lua require('luasnip').change_choice(1)<CR>";
|
||||
options.desc = "Snippets Cycle choices";
|
||||
}
|
||||
];
|
||||
|
||||
# Core snippet configuration and definitions
|
||||
extraConfigLua = ''
|
||||
local ls = require("luasnip")
|
||||
local types = require("luasnip.util.types")
|
||||
|
||||
-- Add visual indicators for snippet nodes
|
||||
ls.config.set_config({
|
||||
ext_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
virt_text = {{"●", "GruvboxOrange"}}
|
||||
}
|
||||
},
|
||||
[types.insertNode] = {
|
||||
active = {
|
||||
virt_text = {{"●", "GruvboxBlue"}}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Common snippet creation utilities
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local rep = require("luasnip.extras").rep
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
|
||||
-- Function to generate namespace interpolation at runtime
|
||||
local function namespace_interp(suffix)
|
||||
-- Uses string.char to generate the namespace interpolation
|
||||
return string.char(36) .. string.char(123) .. "namespace" .. string.char(125) .. suffix
|
||||
end
|
||||
|
||||
-- Nix snippets
|
||||
local nix_snippets = {
|
||||
-- Module snippet
|
||||
module = s("module", {
|
||||
-- Opening
|
||||
t({
|
||||
"{",
|
||||
" config,",
|
||||
" lib,",
|
||||
" namespace,",
|
||||
" pkgs,",
|
||||
" ...",
|
||||
"}: let",
|
||||
" inherit (lib) mkIf mkEnableOption;",
|
||||
" inherit (lib."
|
||||
}),
|
||||
f(function() return namespace_interp("") end),
|
||||
t(") getAttrByNamespace mkOptionsWithNamespace;"),
|
||||
t({"", " base = \""}),
|
||||
f(function() return namespace_interp(".") end),
|
||||
i(1, "category"),
|
||||
t("."),
|
||||
i(2, "module"),
|
||||
t({
|
||||
"\";",
|
||||
" cfg = getAttrByNamespace config base;",
|
||||
"in {",
|
||||
" options = mkOptionsWithNamespace base {",
|
||||
" enable = mkEnableOption \""
|
||||
}),
|
||||
i(3, "description"),
|
||||
t({
|
||||
"\";",
|
||||
" };",
|
||||
"",
|
||||
" config = mkIf cfg.enable {",
|
||||
" "
|
||||
}),
|
||||
i(4, "# configuration"),
|
||||
t({"", " };", "}"}),
|
||||
}),
|
||||
|
||||
-- Bundle module
|
||||
bundle = s("bundle", {
|
||||
t({
|
||||
"{",
|
||||
" config,",
|
||||
" lib,",
|
||||
" namespace,",
|
||||
" ...",
|
||||
"}: let",
|
||||
" inherit (lib) mkIf mkEnableOption;",
|
||||
" inherit (lib."
|
||||
}),
|
||||
f(function() return namespace_interp("") end),
|
||||
t(") getAttrByNamespace mkOptionsWithNamespace enabled;"),
|
||||
t({"", " base = \""}),
|
||||
f(function() return namespace_interp(".bundles.") end),
|
||||
i(1, "name"),
|
||||
t({
|
||||
"\";",
|
||||
" cfg = getAttrByNamespace config base;",
|
||||
"in {",
|
||||
" options = mkOptionsWithNamespace base {",
|
||||
" enable = mkEnableOption \""
|
||||
}),
|
||||
i(2, "name"),
|
||||
t({
|
||||
" bundle\";",
|
||||
" };",
|
||||
"",
|
||||
" config = mkIf cfg.enable {",
|
||||
" "
|
||||
}),
|
||||
f(function() return namespace_interp("") end),
|
||||
t(" = {"),
|
||||
t({"", " "}),
|
||||
i(3, "# enabled modules"),
|
||||
t({"", " };", " };", "}"})
|
||||
}),
|
||||
|
||||
-- Simple patterns using formatted strings
|
||||
enable = s("enable", fmt([[
|
||||
{} = {{
|
||||
config = mkIf cfg.enable {
|
||||
plugins.luasnip = {
|
||||
enable = true;
|
||||
{}
|
||||
}};]], {
|
||||
i(1, "module.path"),
|
||||
i(2, "# configuration"),
|
||||
})),
|
||||
|
||||
enabled = s("enabled", fmt("{} = enabled;", {
|
||||
i(1, "module.path"),
|
||||
})),
|
||||
# Basic LuaSnip settings
|
||||
settings = {
|
||||
history = true;
|
||||
updateevents = "TextChanged,TextChangedI";
|
||||
enable_autosnippets = true;
|
||||
};
|
||||
};
|
||||
|
||||
home = s("home", fmt([[
|
||||
home = {{
|
||||
packages = with pkgs; [ {} ];
|
||||
{}
|
||||
}};]], {
|
||||
i(1, "# packages"),
|
||||
i(2, "# other home attributes"),
|
||||
})),
|
||||
# Add keymaps for snippet navigation
|
||||
keymaps = [
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-k>";
|
||||
action = "<cmd>lua require('luasnip').expand_or_jump()<CR>";
|
||||
options.desc = "Snippets Expand or jump forward";
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-j>";
|
||||
action = "<cmd>lua require('luasnip').jump(-1)<CR>";
|
||||
options.desc = "Snippets Jump backward";
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<C-l>";
|
||||
action = "<cmd>lua require('luasnip').change_choice(1)<CR>";
|
||||
options.desc = "Snippets Cycle choices";
|
||||
}
|
||||
];
|
||||
|
||||
extraConfigLua = let
|
||||
snippets =
|
||||
readDir ../languages/snippets
|
||||
|> attrNames
|
||||
|> filter (name: match ".*\\.nix$" name != null)
|
||||
|> map (name: ../languages/snippets + "/${name}")
|
||||
|> map (file: (import file).extraConfigLua)
|
||||
|> concatStringsSep "\n";
|
||||
in ''
|
||||
-- Get comment string for current filetype
|
||||
local function get_comment_string()
|
||||
local comment_string = vim.bo.commentstring
|
||||
if not comment_string or comment_string == "" then
|
||||
return "-- %s" -- Default to Lua style comments
|
||||
end
|
||||
return comment_string
|
||||
end
|
||||
|
||||
-- Get visual selection
|
||||
local function get_visual_selection()
|
||||
local visual_modes = {
|
||||
v = true,
|
||||
V = true,
|
||||
["\22"] = true -- CTRL+V
|
||||
}
|
||||
|
||||
-- Add snippets to filetypes
|
||||
ls.add_snippets("nix", nix_snippets)
|
||||
'';
|
||||
if not visual_modes[vim.api.nvim_get_mode().mode] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local _, ls, cs = unpack(vim.fn.getpos("v"))
|
||||
local _, le, ce = unpack(vim.fn.getpos("."))
|
||||
|
||||
-- Normalize positions
|
||||
if ls > le or (ls == le and cs > ce) then
|
||||
ls, le = le, ls
|
||||
cs, ce = ce, cs
|
||||
end
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(0, ls - 1, le, false)
|
||||
if #lines == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Adjust for partial lines
|
||||
lines[1] = string.sub(lines[1], cs, -1)
|
||||
if #lines > 1 then
|
||||
lines[#lines] = string.sub(lines[#lines], 1, ce)
|
||||
else
|
||||
lines[1] = string.sub(lines[1], 1, ce - cs + 1)
|
||||
end
|
||||
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
|
||||
-- Format date in various ways
|
||||
local function date_format(format)
|
||||
return os.date(format)
|
||||
end
|
||||
|
||||
-- Capture groups from regex matches
|
||||
local function capture_match(match, group)
|
||||
if match and #match > group then
|
||||
return match[group + 1]
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Check if the current buffer is a test file
|
||||
local function is_test_file()
|
||||
local filename = vim.fn.expand("%:t")
|
||||
return string.match(filename, "[tT]est") ~= nil or string.match(filename, "_test") ~= nil or string.match(filename, "spec") ~= nil
|
||||
end
|
||||
|
||||
-- Make these functions available to snippets
|
||||
_G.snippet_utils = {
|
||||
get_comment_string = get_comment_string,
|
||||
get_visual_selection = get_visual_selection,
|
||||
date_format = date_format,
|
||||
capture_match = capture_match,
|
||||
is_test_file = is_test_file
|
||||
}
|
||||
|
||||
${snippets}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
" ...",
|
||||
"}: let",
|
||||
" inherit (lib) mkIf mkEnableOption;",
|
||||
" inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;", -- literal ${namespace}
|
||||
" ${"inherit (lib.\${namespace}) getAttrByNamespace mkOptionsWithNamespace;"}",
|
||||
" base = \""
|
||||
}),
|
||||
i(1, "namespace"),
|
||||
t("${"\${namespace}"}"),
|
||||
t("."),
|
||||
i(2, "category"),
|
||||
t("."),
|
||||
|
|
@ -56,10 +56,10 @@
|
|||
" ...",
|
||||
"}: let",
|
||||
" inherit (lib) mkIf mkEnableOption;",
|
||||
" inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace enabled;",
|
||||
" ${"inherit (lib.\${namespace}) getAttrByNamespace mkOptionsWithNamespace enabled;"}",
|
||||
" base = \""
|
||||
}),
|
||||
i(1, "namespace"),
|
||||
t("${"\${namespace}"}"),
|
||||
t(".bundles."),
|
||||
i(2, "name"),
|
||||
t({"\";",
|
||||
123
config/languages/snippets/python.nix
Normal file
123
config/languages/snippets/python.nix
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
# Python-specific snippets
|
||||
extraConfigLua = ''
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local python_snippets = {
|
||||
-- Import statement
|
||||
s("imp", {
|
||||
t("import "),
|
||||
i(1, "module")
|
||||
}),
|
||||
|
||||
-- From import statement
|
||||
s("fimp", fmt("from {} import {}", {
|
||||
i(1, "module"),
|
||||
i(2, "name")
|
||||
})),
|
||||
|
||||
-- Class definition
|
||||
s("class", fmt([[
|
||||
class {}:
|
||||
"""{}"""
|
||||
|
||||
def __init__(self{}):
|
||||
{}
|
||||
]], {
|
||||
i(1, "ClassName"),
|
||||
i(2, "Class docstring"),
|
||||
i(3, ""),
|
||||
i(4, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- Function definition
|
||||
s("def", fmt([[
|
||||
def {}({}):
|
||||
"""{}
|
||||
|
||||
{}
|
||||
{}
|
||||
"""
|
||||
{}
|
||||
]], {
|
||||
i(1, "function_name"),
|
||||
i(2, ""),
|
||||
i(3, "Function docstring"),
|
||||
c(4, {
|
||||
t("Args:"),
|
||||
t("Parameters:"),
|
||||
}),
|
||||
i(5, " arg: Description"),
|
||||
i(6, " # Implementation"),
|
||||
})),
|
||||
|
||||
-- Main function
|
||||
s("main", fmt([[
|
||||
def main():
|
||||
{}
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
]], {
|
||||
i(1, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- Try/except block
|
||||
s("try", fmt([[
|
||||
try:
|
||||
{}
|
||||
except {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "# Try block"),
|
||||
i(2, "Exception"),
|
||||
i(3, "# Exception handling"),
|
||||
})),
|
||||
|
||||
-- Context manager (with statement)
|
||||
s("with", fmt([[
|
||||
with {} as {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "context_manager"),
|
||||
i(2, "variable"),
|
||||
i(3, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- List comprehension
|
||||
s("lc", fmt("[{} for {} in {}]", {
|
||||
i(1, "expression"),
|
||||
i(2, "item"),
|
||||
i(3, "iterable"),
|
||||
})),
|
||||
|
||||
-- Dictionary comprehension
|
||||
s("dc", fmt("{{{}: {} for {} in {}}}", {
|
||||
i(1, "key"),
|
||||
i(2, "value"),
|
||||
i(3, "item"),
|
||||
i(4, "iterable"),
|
||||
})),
|
||||
|
||||
-- Test function (pytest)
|
||||
s("test", fmt([[
|
||||
def test_{}():
|
||||
"""{}"""
|
||||
{}
|
||||
]], {
|
||||
i(1, "name"),
|
||||
i(2, "Test docstring"),
|
||||
i(3, "# Test implementation"),
|
||||
}))
|
||||
}
|
||||
|
||||
-- Add these snippets to Python files
|
||||
ls.add_snippets("python", python_snippets)
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,9 +1,25 @@
|
|||
{
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
folding = true;
|
||||
settings.highlight = {
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.languages.treesitter";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "treesitter";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
folding.enable = true;
|
||||
settings.highlight = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
{...} @ inputs: {
|
||||
imports = [
|
||||
./harpoon.nix
|
||||
./nvim-tree.nix
|
||||
./telescope.nix
|
||||
(import ./harpoon.nix inputs)
|
||||
(import ./nvim-tree.nix inputs)
|
||||
(import ./telescope.nix inputs)
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,60 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>a";
|
||||
action.__raw = "function() require'harpoon':list():add() end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-e>";
|
||||
action.__raw = "function() require'harpoon'.ui:toggle_quick_menu(require'harpoon':list()) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-j>";
|
||||
action.__raw = "function() require'harpoon':list():select(1) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-k>";
|
||||
action.__raw = "function() require'harpoon':list():select(2) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-l>";
|
||||
action.__raw = "function() require'harpoon':list():select(3) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-;>";
|
||||
action.__raw = "function() require'harpoon':list():select(4) end";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.navigation.harpoon";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "harpoon";
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup({ settings = { save_on_toggle = true }})
|
||||
'';
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>a";
|
||||
action.__raw = "function() require'harpoon':list():add() end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-e>";
|
||||
action.__raw = "function() require'harpoon'.ui:toggle_quick_menu(require'harpoon':list()) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-j>";
|
||||
action.__raw = "function() require'harpoon':list():select(1) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-k>";
|
||||
action.__raw = "function() require'harpoon':list():select(2) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-l>";
|
||||
action.__raw = "function() require'harpoon':list():select(3) end";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-;>";
|
||||
action.__raw = "function() require'harpoon':list():select(4) end";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup({ settings = { save_on_toggle = true }})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,75 +1,95 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pv";
|
||||
action = "<cmd>NvimTreeToggle<cr>";
|
||||
options.desc = "Toggle NvimTree";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.navigation.nvim-tree";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "nvim-tree";
|
||||
};
|
||||
|
||||
plugins.web-devicons.enable = true;
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pv";
|
||||
action = "<cmd>NvimTreeToggle<cr>";
|
||||
options.desc = "Toggle NvimTree";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.nvim-tree = {
|
||||
enable = true;
|
||||
plugins.web-devicons.enable = true;
|
||||
|
||||
disableNetrw = true;
|
||||
hijackNetrw = true;
|
||||
hijackCursor = true;
|
||||
hijackUnnamedBufferWhenOpening = true;
|
||||
syncRootWithCwd = true;
|
||||
|
||||
updateFocusedFile.enable = true;
|
||||
|
||||
sortBy = "case_sensitive";
|
||||
|
||||
filters = {
|
||||
custom = ["__pycache__"];
|
||||
exclude = [];
|
||||
};
|
||||
|
||||
git = {
|
||||
plugins.nvim-tree = {
|
||||
enable = true;
|
||||
ignore = true;
|
||||
};
|
||||
|
||||
view = {
|
||||
side = "right";
|
||||
width = 60;
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
preserveWindowProportions = true;
|
||||
};
|
||||
settings = {
|
||||
disable_netrw = true;
|
||||
hijack_cursor = true;
|
||||
hijack_netrw = true;
|
||||
hijack_unnamed_buffer_when_opening = true;
|
||||
sync_root_with_cwd = true;
|
||||
|
||||
renderer = {
|
||||
rootFolderLabel = false;
|
||||
indentWidth = 2;
|
||||
highlightGit = true;
|
||||
indentMarkers.enable = true;
|
||||
|
||||
groupEmpty = true;
|
||||
|
||||
icons.glyphs = {
|
||||
default = "";
|
||||
symlink = "";
|
||||
folder = {
|
||||
default = "";
|
||||
empty = "";
|
||||
emptyOpen = "";
|
||||
open = "";
|
||||
symlink = "";
|
||||
symlinkOpen = "";
|
||||
arrowOpen = "";
|
||||
arrowClosed = "";
|
||||
update_focused_file = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
sort_by = "case_sensitive";
|
||||
|
||||
filters = {
|
||||
custom = ["__pycache__"];
|
||||
exclude = [];
|
||||
};
|
||||
|
||||
git = {
|
||||
unstaged = "✗";
|
||||
staged = "✓";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
untracked = "★";
|
||||
deleted = "";
|
||||
ignored = "◌";
|
||||
enable = true;
|
||||
ignore = true;
|
||||
};
|
||||
|
||||
renderer = {
|
||||
root_folder_label = false;
|
||||
indent_width = 2;
|
||||
highlight_git = true;
|
||||
indent_markers.enable = true;
|
||||
|
||||
group_empty = true;
|
||||
|
||||
icons.glyphs = {
|
||||
default = "";
|
||||
symlink = "";
|
||||
folder = {
|
||||
default = "";
|
||||
empty = "";
|
||||
empty_open = "";
|
||||
open = "";
|
||||
symlink = "";
|
||||
symlink_open = "";
|
||||
arrow_open = "";
|
||||
arrow_closed = "";
|
||||
};
|
||||
git = {
|
||||
unstaged = "✗";
|
||||
staged = "✓";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
untracked = "★";
|
||||
deleted = "";
|
||||
ignored = "◌";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
view = {
|
||||
side = "right";
|
||||
width = 60;
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
preserve_window_proportions = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,91 +1,107 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pws";
|
||||
action.__raw = ''
|
||||
function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
require('telescope.builtin').grep_string({ search = word })
|
||||
end
|
||||
'';
|
||||
options.desc = "Telescope Live grep word under cursor";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pWs";
|
||||
action.__raw = ''
|
||||
function()
|
||||
local word = vim.fn.expand("cWORD")
|
||||
require('telescope.builtin').grep_string({ search = word })
|
||||
end
|
||||
'';
|
||||
options.desc = "Telecope Live grep WORD under cursor";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.navigation.telescope";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "telescope";
|
||||
};
|
||||
|
||||
plugins.telescope = {
|
||||
keymaps = {
|
||||
"<leader>pf" = {
|
||||
action = "find_files";
|
||||
options.desc = "Telescope Find project files";
|
||||
};
|
||||
"<leader>pa" = {
|
||||
action = "find_files follow=true no_ignore=true hidden=true";
|
||||
options.desc = "Telescope Find all files";
|
||||
};
|
||||
"<leader>pz" = {
|
||||
action = "current_buffer_fuzzy_find";
|
||||
options.desc = "Telescope Find in buffer";
|
||||
};
|
||||
"<leader>ps" = {
|
||||
action = "live_grep";
|
||||
options.desc = "Telescope Live grep";
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pws";
|
||||
action.__raw = ''
|
||||
function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
require('telescope.builtin').grep_string({ search = word })
|
||||
end
|
||||
'';
|
||||
options.desc = "Telescope Live grep word under cursor";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>pWs";
|
||||
action.__raw = ''
|
||||
function()
|
||||
local word = vim.fn.expand("cWORD")
|
||||
require('telescope.builtin').grep_string({ search = word })
|
||||
end
|
||||
'';
|
||||
options.desc = "Telecope Live grep WORD under cursor";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.telescope = {
|
||||
keymaps = {
|
||||
"<leader>pf" = {
|
||||
action = "find_files";
|
||||
options.desc = "Telescope Find project files";
|
||||
};
|
||||
"<leader>pa" = {
|
||||
action = "find_files follow=true no_ignore=true hidden=true";
|
||||
options.desc = "Telescope Find all files";
|
||||
};
|
||||
"<leader>pz" = {
|
||||
action = "current_buffer_fuzzy_find";
|
||||
options.desc = "Telescope Find in buffer";
|
||||
};
|
||||
"<leader>ps" = {
|
||||
action = "live_grep";
|
||||
options.desc = "Telescope Live grep";
|
||||
};
|
||||
|
||||
"ws" = {
|
||||
action = "lsp_document_symbols ignore_symbols='variable'";
|
||||
options.desc = "Telescope LSP Document symbols";
|
||||
};
|
||||
|
||||
"<leader>tt" = {
|
||||
action = "diagnostics";
|
||||
options.desc = "Telescope Diagnostics";
|
||||
};
|
||||
"<leader>tf" = {
|
||||
action = "diagnostics bufnr=0";
|
||||
options.desc = "Telescope Diagnostics in buffer";
|
||||
};
|
||||
|
||||
"<leader>:" = {
|
||||
action = "command_history";
|
||||
options.desc = "Telescope Command history";
|
||||
};
|
||||
};
|
||||
|
||||
"ws" = {
|
||||
action = "lsp_document_symbols ignore_symbols='variable'";
|
||||
options.desc = "Telescope LSP Document symbols";
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
fzf-native.enable = true;
|
||||
ui-select.settings.specific_opts.codeactions = true;
|
||||
undo.enable = true;
|
||||
};
|
||||
|
||||
"<leader>tt" = {
|
||||
action = "diagnostics";
|
||||
options.desc = "Telescope Diagnostics";
|
||||
};
|
||||
"<leader>tf" = {
|
||||
action = "diagnostics bufnr=0";
|
||||
options.desc = "Telescope Diagnostics in buffer";
|
||||
};
|
||||
settings = {
|
||||
defaults = {
|
||||
prompt_prefix = " ";
|
||||
selection_caret = " ";
|
||||
entry_prefix = " ";
|
||||
|
||||
"<leader>:" = {
|
||||
action = "command_history";
|
||||
options.desc = "Telescope Command history";
|
||||
};
|
||||
};
|
||||
sorting_strategy = "ascending";
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top";
|
||||
preview_width = 0.65;
|
||||
};
|
||||
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
fzf-native.enable = true;
|
||||
ui-select.settings.specific_opts.codeactions = true;
|
||||
undo.enable = true;
|
||||
};
|
||||
|
||||
settings = {
|
||||
defaults = {
|
||||
prompt_prefix = " ";
|
||||
selection_caret = " ";
|
||||
entry_prefix = " ";
|
||||
|
||||
sorting_strategy = "ascending";
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top";
|
||||
preview_width = 0.65;
|
||||
width = 0.75;
|
||||
height = 0.80;
|
||||
};
|
||||
|
||||
width = 0.75;
|
||||
height = 0.80;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
swapfile = false;
|
||||
backup = false;
|
||||
undodir = "/home/c4patino/.vim/undodir";
|
||||
undofile = true;
|
||||
|
||||
hlsearch = false;
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
# Import all snippet files here
|
||||
imports = [
|
||||
./utils.nix
|
||||
./languages/common.nix
|
||||
./languages/rust.nix
|
||||
./languages/python.nix
|
||||
./languages/nix.nix
|
||||
];
|
||||
|
||||
# This extra config will load all our snippets
|
||||
extraConfigLua = ''
|
||||
-- Ensure LuaSnip loads all snippet definitions
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
|
||||
-- This function lets us load snippets defined in Nix string
|
||||
function load_nix_snippets(snippets, filetypes)
|
||||
local ls = require("luasnip")
|
||||
|
||||
for _, ft in ipairs(filetypes) do
|
||||
ls.add_snippets(ft, snippets)
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
{
|
||||
# Python-specific snippets
|
||||
extraConfigLua = ''
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local python_snippets = {
|
||||
-- Import statement
|
||||
s("imp", {
|
||||
t("import "),
|
||||
i(1, "module")
|
||||
}),
|
||||
|
||||
-- From import statement
|
||||
s("fimp", fmt("from {} import {}", {
|
||||
i(1, "module"),
|
||||
i(2, "name")
|
||||
})),
|
||||
|
||||
-- Class definition
|
||||
s("class", fmt([[
|
||||
class {}:
|
||||
"""{}"""
|
||||
|
||||
def __init__(self{}):
|
||||
{}
|
||||
]], {
|
||||
i(1, "ClassName"),
|
||||
i(2, "Class docstring"),
|
||||
i(3, ""),
|
||||
i(4, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- Function definition
|
||||
s("def", fmt([[
|
||||
def {}({}):
|
||||
"""{}
|
||||
|
||||
{}
|
||||
{}
|
||||
"""
|
||||
{}
|
||||
]], {
|
||||
i(1, "function_name"),
|
||||
i(2, ""),
|
||||
i(3, "Function docstring"),
|
||||
c(4, {
|
||||
t("Args:"),
|
||||
t("Parameters:"),
|
||||
}),
|
||||
i(5, " arg: Description"),
|
||||
i(6, " # Implementation"),
|
||||
})),
|
||||
|
||||
-- Main function
|
||||
s("main", fmt([[
|
||||
def main():
|
||||
{}
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
]], {
|
||||
i(1, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- Try/except block
|
||||
s("try", fmt([[
|
||||
try:
|
||||
{}
|
||||
except {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "# Try block"),
|
||||
i(2, "Exception"),
|
||||
i(3, "# Exception handling"),
|
||||
})),
|
||||
|
||||
-- Context manager (with statement)
|
||||
s("with", fmt([[
|
||||
with {} as {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "context_manager"),
|
||||
i(2, "variable"),
|
||||
i(3, "# Implementation"),
|
||||
})),
|
||||
|
||||
-- List comprehension
|
||||
s("lc", fmt("[{} for {} in {}]", {
|
||||
i(1, "expression"),
|
||||
i(2, "item"),
|
||||
i(3, "iterable"),
|
||||
})),
|
||||
|
||||
-- Dictionary comprehension
|
||||
s("dc", fmt("{{{}: {} for {} in {}}}", {
|
||||
i(1, "key"),
|
||||
i(2, "value"),
|
||||
i(3, "item"),
|
||||
i(4, "iterable"),
|
||||
})),
|
||||
|
||||
-- Test function (pytest)
|
||||
s("test", fmt([[
|
||||
def test_{}():
|
||||
"""{}"""
|
||||
{}
|
||||
]], {
|
||||
i(1, "name"),
|
||||
i(2, "Test docstring"),
|
||||
i(3, "# Test implementation"),
|
||||
}))
|
||||
}
|
||||
|
||||
-- Add these snippets to Python files
|
||||
ls.add_snippets("python", python_snippets)
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
{
|
||||
extraConfigLua = ''
|
||||
-- Common utility functions for snippets
|
||||
|
||||
-- Get comment string for current filetype
|
||||
local function get_comment_string()
|
||||
local comment_string = vim.bo.commentstring
|
||||
if not comment_string or comment_string == "" then
|
||||
return "-- %s" -- Default to Lua style comments
|
||||
end
|
||||
return comment_string
|
||||
end
|
||||
|
||||
-- Get visual selection
|
||||
local function get_visual_selection()
|
||||
local visual_modes = {
|
||||
v = true,
|
||||
V = true,
|
||||
["\22"] = true -- CTRL+V
|
||||
}
|
||||
|
||||
if not visual_modes[vim.api.nvim_get_mode().mode] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local _, ls, cs = unpack(vim.fn.getpos("v"))
|
||||
local _, le, ce = unpack(vim.fn.getpos("."))
|
||||
|
||||
-- Normalize positions
|
||||
if ls > le or (ls == le and cs > ce) then
|
||||
ls, le = le, ls
|
||||
cs, ce = ce, cs
|
||||
end
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(0, ls - 1, le, false)
|
||||
if #lines == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Adjust for partial lines
|
||||
lines[1] = string.sub(lines[1], cs, -1)
|
||||
if #lines > 1 then
|
||||
lines[#lines] = string.sub(lines[#lines], 1, ce)
|
||||
else
|
||||
lines[1] = string.sub(lines[1], 1, ce - cs + 1)
|
||||
end
|
||||
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
|
||||
-- Format date in various ways
|
||||
local function date_format(format)
|
||||
return os.date(format)
|
||||
end
|
||||
|
||||
-- Capture groups from regex matches
|
||||
local function capture_match(match, group)
|
||||
if match and #match > group then
|
||||
return match[group + 1]
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
-- Check if the current buffer is a test file
|
||||
local function is_test_file()
|
||||
local filename = vim.fn.expand("%:t")
|
||||
return string.match(filename, "[tT]est") ~= nil or string.match(filename, "_test") ~= nil or string.match(filename, "spec") ~= nil
|
||||
end
|
||||
|
||||
-- Make these functions available to snippets
|
||||
_G.snippet_utils = {
|
||||
get_comment_string = get_comment_string,
|
||||
get_visual_selection = get_visual_selection,
|
||||
date_format = date_format,
|
||||
capture_match = capture_match,
|
||||
is_test_file = is_test_file
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,74 +1,97 @@
|
|||
{
|
||||
plugins.alpha = {
|
||||
enable = true;
|
||||
theme = null;
|
||||
layout = let
|
||||
mkPadding = val: {
|
||||
type = "padding";
|
||||
inherit val;
|
||||
};
|
||||
mkButton = label: shortcut: command: {
|
||||
type = "button";
|
||||
val = label;
|
||||
on_press.__raw = ''
|
||||
function()
|
||||
local key = vim.api.nvim_replace_termcodes("${shortcut}", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "n", false)
|
||||
end
|
||||
'';
|
||||
opts = {
|
||||
keymap = [
|
||||
"n"
|
||||
shortcut
|
||||
command
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.alpha";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "alpha";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins = {
|
||||
persistence.enable = true;
|
||||
|
||||
alpha = {
|
||||
enable = true;
|
||||
theme = null;
|
||||
|
||||
settings = {
|
||||
layout = let
|
||||
mkPadding = val: {
|
||||
type = "padding";
|
||||
inherit val;
|
||||
};
|
||||
mkButton = label: shortcut: command: {
|
||||
type = "button";
|
||||
val = label;
|
||||
on_press.__raw = ''
|
||||
function()
|
||||
local key = vim.api.nvim_replace_termcodes("${shortcut}", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "n", false)
|
||||
end
|
||||
'';
|
||||
opts = {
|
||||
keymap = [
|
||||
"n"
|
||||
shortcut
|
||||
command
|
||||
{
|
||||
noremap = true;
|
||||
silent = true;
|
||||
nowait = true;
|
||||
}
|
||||
];
|
||||
shortcut = shortcut;
|
||||
position = "center";
|
||||
cursor = 3;
|
||||
width = 38;
|
||||
align_shortcut = "right";
|
||||
hl_shortcut = "Keyword";
|
||||
};
|
||||
};
|
||||
in [
|
||||
(mkPadding 4)
|
||||
{
|
||||
noremap = true;
|
||||
silent = true;
|
||||
nowait = true;
|
||||
opts = {
|
||||
hl = "AlphaHeader";
|
||||
position = "center";
|
||||
};
|
||||
type = "text";
|
||||
val = [
|
||||
"▓██ ██▓ █ ██ ███▄ ▄███▓▓█████ ██▒ █▓ ██▓ ███▄ ▄███▓"
|
||||
" ▒██ ██▒ ██ ▓██▒▓██▒▀█▀ ██▒▓█ ▀▓██░ █▒▓██▒▓██▒▀█▀ ██▒"
|
||||
" ▒██ ██░▓██ ▒██░▓██ ▓██░▒███ ▓██ █▒░▒██▒▓██ ▓██░"
|
||||
" ░ ▐██▓░▓▓█ ░██░▒██ ▒██ ▒▓█ ▄ ▒██ █░░░██░▒██ ▒██ "
|
||||
" ░ ██▒▓░▒▒█████▓ ▒██▒ ░██▒░▒████▒ ▒▀█░ ░██░▒██▒ ░██▒"
|
||||
" ██▒▒▒ ░▒▓▒ ▒ ▒ ░ ▒░ ░ ░░░ ▒░ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░"
|
||||
" ▓██ ░▒░ ░░▒░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ░"
|
||||
" ▒ ▒ ░░ ░░░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ "
|
||||
" ░ ░ ░ ░ ░ ░ ░ ░ ░ "
|
||||
" "
|
||||
" git@github.com:c4patino "
|
||||
];
|
||||
}
|
||||
(mkPadding 2)
|
||||
(mkButton " Find File" "f" "<CMD>Telescope find_files<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " New File" "n" "<CMD>ene <BAR> startinsert<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Recent Files" "r" "<CMD>Telescope oldfiles<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Find Word" "g" "<CMD>Telescope live_grep<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Restore Session" "s" "<CMD>lua require('persistence').load()<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Quit Neovim" "q" "<CMD>qa<CR>")
|
||||
];
|
||||
shortcut = shortcut;
|
||||
position = "center";
|
||||
cursor = 3;
|
||||
width = 38;
|
||||
align_shortcut = "right";
|
||||
hl_shortcut = "Keyword";
|
||||
};
|
||||
};
|
||||
in [
|
||||
(mkPadding 4)
|
||||
{
|
||||
opts = {
|
||||
hl = "AlphaHeader";
|
||||
position = "center";
|
||||
};
|
||||
type = "text";
|
||||
val = [
|
||||
"▓██ ██▓ █ ██ ███▄ ▄███▓▓█████ ██▒ █▓ ██▓ ███▄ ▄███▓"
|
||||
" ▒██ ██▒ ██ ▓██▒▓██▒▀█▀ ██▒▓█ ▀▓██░ █▒▓██▒▓██▒▀█▀ ██▒"
|
||||
" ▒██ ██░▓██ ▒██░▓██ ▓██░▒███ ▓██ █▒░▒██▒▓██ ▓██░"
|
||||
" ░ ▐██▓░▓▓█ ░██░▒██ ▒██ ▒▓█ ▄ ▒██ █░░░██░▒██ ▒██ "
|
||||
" ░ ██▒▓░▒▒█████▓ ▒██▒ ░██▒░▒████▒ ▒▀█░ ░██░▒██▒ ░██▒"
|
||||
" ██▒▒▒ ░▒▓▒ ▒ ▒ ░ ▒░ ░ ░░░ ▒░ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░"
|
||||
" ▓██ ░▒░ ░░▒░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ░"
|
||||
" ▒ ▒ ░░ ░░░ ░ ░ ░ ░ ░ ░░ ▒ ░░ ░ "
|
||||
" ░ ░ ░ ░ ░ ░ ░ ░ ░ "
|
||||
" "
|
||||
" git@github.com:c4patino "
|
||||
];
|
||||
}
|
||||
(mkPadding 2)
|
||||
(mkButton " Find File" "f" "<CMD>Telescope find_files<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " New File" "n" "<CMD>ene <BAR> startinsert<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Recent Files" "r" "<CMD>Telescope oldfiles<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Find Word" "g" "<CMD>Telescope live_grep<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Restore Session" "s" "<CMD>lua require('persistence').load()<CR>")
|
||||
(mkPadding 1)
|
||||
(mkButton " Quit Neovim" "q" "<CMD>qa<CR>")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{pkgs, ...}: {
|
||||
{pkgs, ...} @ inputs: {
|
||||
imports = [
|
||||
./alpha.nix
|
||||
./fidget.nix
|
||||
./indent-blankline.nix
|
||||
./lualine.nix
|
||||
./noice.nix
|
||||
./nvim-notify.nix
|
||||
(import ./alpha.nix inputs)
|
||||
(import ./fidget.nix inputs)
|
||||
(import ./indent-blankline.nix inputs)
|
||||
(import ./lualine.nix inputs)
|
||||
(import ./noice.nix inputs)
|
||||
(import ./nvim-notify.nix inputs)
|
||||
];
|
||||
|
||||
colorschemes.tokyonight = {
|
||||
|
|
|
|||
|
|
@ -1,96 +1,112 @@
|
|||
{
|
||||
plugins.fidget = {
|
||||
enable = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.fidget";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "fidget";
|
||||
};
|
||||
|
||||
settings = {
|
||||
logger = {
|
||||
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
|
||||
float_precision = 0.01; # Limit the number of decimals displayed for floats
|
||||
};
|
||||
progress = {
|
||||
poll_rate = 0; # How and when to poll for progress messages
|
||||
suppress_on_insert = true; # Suppress new messages while in insert mode
|
||||
ignore_done_already = false; # Ignore new tasks that are already complete
|
||||
ignore_empty_message = false; # Ignore new tasks that don't contain a message
|
||||
# Clear notification group when LSP server detaches
|
||||
clear_on_detach = ''
|
||||
function(client_id)
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
return client and client.name or nil
|
||||
end
|
||||
'';
|
||||
# How to get a progress message's notification group key
|
||||
notification_group = ''
|
||||
function(msg) return msg.lsp_client.name end
|
||||
'';
|
||||
ignore = []; # List of LSP servers to ignore
|
||||
lsp = {
|
||||
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
|
||||
};
|
||||
display = {
|
||||
render_limit = 16; # How many LSP messages to show at once
|
||||
done_ttl = 3; # How long a message should persist after completion
|
||||
done_icon = "✔"; # Icon shown when all LSP progress tasks are complete
|
||||
done_style = "Constant"; # Highlight group for completed LSP tasks
|
||||
progress_ttl.__raw = "math.huge"; # How long a message should persist when in progress
|
||||
progress_icon = {
|
||||
pattern = "dots";
|
||||
period = 1;
|
||||
}; # Icon shown when LSP progress tasks are in progress
|
||||
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
|
||||
group_style = "Title"; # Highlight group for group name (LSP server name)
|
||||
icon_style = "Question"; # Highlight group for group icons
|
||||
priority = 30; # Ordering priority for LSP notification group
|
||||
skip_history = true; # Whether progress notifications should be omitted from history
|
||||
format_message = ''
|
||||
require ("fidget.progress.display").default_format_message
|
||||
''; # How to format a progress message
|
||||
format_annote = ''
|
||||
function (msg) return msg.title end
|
||||
''; # How to format a progress annotation
|
||||
format_group_name = ''
|
||||
function (group) return tostring (group) end
|
||||
''; # How to format a progress notification group's name
|
||||
overrides = {
|
||||
rust_analyzer = {
|
||||
name = "rust-analyzer";
|
||||
};
|
||||
}; # Override options from the default notification config
|
||||
};
|
||||
};
|
||||
notification = {
|
||||
poll_rate = 10; # How frequently to update and render notifications
|
||||
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
|
||||
history_size = 128; # Number of removed messages to retain in history
|
||||
override_vim_notify = true;
|
||||
config = mkIf cfg.enable {
|
||||
plugins.fidget = {
|
||||
enable = true;
|
||||
|
||||
redirect.__raw = ''
|
||||
function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
|
||||
settings = {
|
||||
logger = {
|
||||
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
|
||||
float_precision = 0.01; # Limit the number of decimals displayed for floats
|
||||
};
|
||||
progress = {
|
||||
poll_rate = 0; # How and when to poll for progress messages
|
||||
suppress_on_insert = true; # Suppress new messages while in insert mode
|
||||
ignore_done_already = false; # Ignore new tasks that are already complete
|
||||
ignore_empty_message = false; # Ignore new tasks that don't contain a message
|
||||
# Clear notification group when LSP server detaches
|
||||
clear_on_detach = ''
|
||||
function(client_id)
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
return client and client.name or nil
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
configs.default.__raw = "require('fidget.notification').default_config";
|
||||
|
||||
window = {
|
||||
normal_hl = "Comment";
|
||||
winblend = 0;
|
||||
border = "none"; # none, single, double, rounded, solid, shadow
|
||||
zindex = 45;
|
||||
max_width = 0;
|
||||
max_height = 0;
|
||||
x_padding = 1;
|
||||
y_padding = 0;
|
||||
align = "bottom";
|
||||
relative = "editor";
|
||||
'';
|
||||
# How to get a progress message's notification group key
|
||||
notification_group = ''
|
||||
function(msg) return msg.lsp_client.name end
|
||||
'';
|
||||
ignore = []; # List of LSP servers to ignore
|
||||
lsp = {
|
||||
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
|
||||
};
|
||||
display = {
|
||||
render_limit = 16; # How many LSP messages to show at once
|
||||
done_ttl = 3; # How long a message should persist after completion
|
||||
done_icon = "✔"; # Icon shown when all LSP progress tasks are complete
|
||||
done_style = "Constant"; # Highlight group for completed LSP tasks
|
||||
progress_ttl.__raw = "math.huge"; # How long a message should persist when in progress
|
||||
progress_icon = {
|
||||
pattern = "dots";
|
||||
period = 1;
|
||||
}; # Icon shown when LSP progress tasks are in progress
|
||||
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
|
||||
group_style = "Title"; # Highlight group for group name (LSP server name)
|
||||
icon_style = "Question"; # Highlight group for group icons
|
||||
priority = 30; # Ordering priority for LSP notification group
|
||||
skip_history = true; # Whether progress notifications should be omitted from history
|
||||
format_message = ''
|
||||
require ("fidget.progress.display").default_format_message
|
||||
''; # How to format a progress message
|
||||
format_annote = ''
|
||||
function (msg) return msg.title end
|
||||
''; # How to format a progress annotation
|
||||
format_group_name = ''
|
||||
function (group) return tostring (group) end
|
||||
''; # How to format a progress notification group's name
|
||||
overrides = {
|
||||
rust_analyzer = {
|
||||
name = "rust-analyzer";
|
||||
};
|
||||
}; # Override options from the default notification config
|
||||
};
|
||||
};
|
||||
view = {
|
||||
stack_upwards = true; # Display notification items from bottom to top
|
||||
icon_separator = " "; # Separator between group name and icon
|
||||
group_separator = "---"; # Separator between notification groups
|
||||
group_separator_hl = "Comment"; # Highlight group used for group separator
|
||||
notification = {
|
||||
poll_rate = 10; # How frequently to update and render notifications
|
||||
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
|
||||
history_size = 128; # Number of removed messages to retain in history
|
||||
override_vim_notify = true;
|
||||
|
||||
redirect.__raw = ''
|
||||
function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
configs.default.__raw = "require('fidget.notification').default_config";
|
||||
|
||||
window = {
|
||||
normal_hl = "Comment";
|
||||
winblend = 0;
|
||||
border = "none"; # none, single, double, rounded, solid, shadow
|
||||
zindex = 45;
|
||||
max_width = 0;
|
||||
max_height = 0;
|
||||
x_padding = 1;
|
||||
y_padding = 0;
|
||||
align = "bottom";
|
||||
relative = "editor";
|
||||
};
|
||||
view = {
|
||||
stack_upwards = true; # Display notification items from bottom to top
|
||||
icon_separator = " "; # Separator between group name and icon
|
||||
group_separator = "---"; # Separator between notification groups
|
||||
group_separator_hl = "Comment"; # Highlight group used for group separator
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,22 @@
|
|||
{
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
settings.scope.enabled = false;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.indent-blankline";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "indent-blankline";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins.indent-blankline = {
|
||||
enable = true;
|
||||
settings.scope.enabled = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,66 @@
|
|||
{
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.lualine";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "lualine";
|
||||
};
|
||||
|
||||
settings = {
|
||||
options = {
|
||||
globalstatus = true;
|
||||
always_divide_middle = true;
|
||||
theme = "auto";
|
||||
ignore_focus = ["nvim-tree"];
|
||||
config = mkIf cfg.enable {
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
|
||||
component_separators = {
|
||||
left = "|";
|
||||
right = "|";
|
||||
settings = {
|
||||
options = {
|
||||
globalstatus = true;
|
||||
always_divide_middle = true;
|
||||
theme = "auto";
|
||||
ignore_focus = ["nvim-tree"];
|
||||
|
||||
component_separators = {
|
||||
left = "|";
|
||||
right = "|";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extensions = ["fzf"];
|
||||
extensions = ["fzf"];
|
||||
|
||||
sections = {
|
||||
lualine_a = ["mode"];
|
||||
lualine_b = [
|
||||
{
|
||||
__unkeyed = "branch";
|
||||
icon = "";
|
||||
icons_enabled = true;
|
||||
}
|
||||
"diff"
|
||||
"diagnostics"
|
||||
];
|
||||
lualine_c = [
|
||||
"filename"
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
local rec = vim.fn.reg_recording()
|
||||
if rec ~= "" then
|
||||
return " @" .. rec
|
||||
end
|
||||
return ""
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
lualine_x = ["filetype"];
|
||||
lualine_y = ["location"];
|
||||
lualine_z = [''" " .. os.date("%R")''];
|
||||
sections = {
|
||||
lualine_a = ["mode"];
|
||||
lualine_b = [
|
||||
{
|
||||
__unkeyed = "branch";
|
||||
icon = "";
|
||||
icons_enabled = true;
|
||||
}
|
||||
"diff"
|
||||
"diagnostics"
|
||||
];
|
||||
lualine_c = [
|
||||
"filename"
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
local rec = vim.fn.reg_recording()
|
||||
if rec ~= "" then
|
||||
return " @" .. rec
|
||||
end
|
||||
return ""
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
lualine_x = ["filetype"];
|
||||
lualine_y = ["location"];
|
||||
lualine_z = [''" " .. os.date("%R")''];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,33 +1,49 @@
|
|||
{
|
||||
plugins.noice = {
|
||||
enable = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.noice";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "noice";
|
||||
};
|
||||
|
||||
settings = {
|
||||
notify.enabled = false;
|
||||
messages.enabled = true;
|
||||
config = mkIf cfg.enable {
|
||||
plugins.noice = {
|
||||
enable = true;
|
||||
|
||||
lsp = {
|
||||
message.enabled = true;
|
||||
progress = {
|
||||
enabled = false;
|
||||
view = "mini";
|
||||
settings = {
|
||||
notify.enabled = false;
|
||||
messages.enabled = true;
|
||||
|
||||
lsp = {
|
||||
message.enabled = true;
|
||||
progress = {
|
||||
enabled = false;
|
||||
view = "mini";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
popupmenu = {
|
||||
enabled = true;
|
||||
backend = "nui";
|
||||
};
|
||||
format = {
|
||||
filter = {
|
||||
pattern = [":%s*%%s*s:%s*" ":%s*%%s*s!%s*" ":%s*%%s*s/%s*" "%s*s:%s*" ":%s*s!%s*" ":%s*s/%s*"];
|
||||
icon = "";
|
||||
lang = "regex";
|
||||
popupmenu = {
|
||||
enabled = true;
|
||||
backend = "nui";
|
||||
};
|
||||
replace = {
|
||||
pattern = [":%s*%%s*s:%w*:%s*" ":%s*%%s*s!%w*!%s*" ":%s*%%s*s/%w*/%s*" "%s*s:%w*:%s*" ":%s*s!%w*!%s*" ":%s*s/%w*/%s*"];
|
||||
icon = "";
|
||||
lang = "regex";
|
||||
format = {
|
||||
filter = {
|
||||
pattern = [":%s*%%s*s:%s*" ":%s*%%s*s!%s*" ":%s*%%s*s/%s*" "%s*s:%s*" ":%s*s!%s*" ":%s*s/%s*"];
|
||||
icon = "";
|
||||
lang = "regex";
|
||||
};
|
||||
replace = {
|
||||
pattern = [":%s*%%s*s:%w*:%s*" ":%s*%%s*s!%w*!%s*" ":%s*%%s*s/%w*/%s*" "%s*s:%w*:%s*" ":%s*s!%w*!%s*" ":%s*s/%w*/%s*"];
|
||||
icon = "";
|
||||
lang = "regex";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,47 +1,63 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>un";
|
||||
action = ''
|
||||
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
|
||||
'';
|
||||
options = {desc = "Dismiss All Notifications";};
|
||||
}
|
||||
];
|
||||
|
||||
plugins.notify = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
background_color = "#000000";
|
||||
fps = 60;
|
||||
render = "default";
|
||||
timeout = 500;
|
||||
top_down = false;
|
||||
};
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.ui.nvim-notify";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "nvim-notify";
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local notify = require("notify")
|
||||
local filtered_message = { "No information available" }
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>un";
|
||||
action = ''
|
||||
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
|
||||
'';
|
||||
options = {desc = "Dismiss All Notifications";};
|
||||
}
|
||||
];
|
||||
|
||||
-- Override notify function to filter out messages
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.notify = function(message, level, opts)
|
||||
local merged_opts = vim.tbl_extend("force", {
|
||||
on_open = function(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
|
||||
end,
|
||||
}, opts or {})
|
||||
plugins.notify = {
|
||||
enable = true;
|
||||
|
||||
for _, msg in ipairs(filtered_message) do
|
||||
if message == msg then
|
||||
return
|
||||
end
|
||||
end
|
||||
return notify(message, level, merged_opts)
|
||||
end
|
||||
'';
|
||||
settings = {
|
||||
background_color = "#000000";
|
||||
fps = 60;
|
||||
render = "default";
|
||||
timeout = 500;
|
||||
top_down = false;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
local notify = require("notify")
|
||||
local filtered_message = { "No information available" }
|
||||
|
||||
-- Override notify function to filter out messages
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.notify = function(message, level, opts)
|
||||
local merged_opts = vim.tbl_extend("force", {
|
||||
on_open = function(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
|
||||
end,
|
||||
}, opts or {})
|
||||
|
||||
for _, msg in ipairs(filtered_message) do
|
||||
if message == msg then
|
||||
return
|
||||
end
|
||||
end
|
||||
return notify(message, level, merged_opts)
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
{...} @ inputs: {
|
||||
imports = [
|
||||
./lazygit.nix
|
||||
./obsidian.nix
|
||||
./todo-comments.nix
|
||||
./toggleterm.nix
|
||||
./undotree.nix
|
||||
./vimtex.nix
|
||||
./zenmode.nix
|
||||
(import ./lazygit.nix inputs)
|
||||
(import ./obsidian.nix inputs)
|
||||
(import ./todo-comments.nix inputs)
|
||||
(import ./toggleterm.nix inputs)
|
||||
(import ./undotree.nix inputs)
|
||||
(import ./vimtex.nix inputs)
|
||||
(import ./which-key.nix inputs)
|
||||
(import ./zenmode.nix inputs)
|
||||
];
|
||||
|
||||
plugins = {
|
||||
persistence.enable = true;
|
||||
which-key.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,30 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gg";
|
||||
action = "<cmd>LazyGit<cr>";
|
||||
options.desc = "LazyGit Toggle window";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.lazygit";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "lazygit";
|
||||
};
|
||||
|
||||
plugins = {
|
||||
lazygit.enable = true;
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gg";
|
||||
action = "<cmd>LazyGit<cr>";
|
||||
options.desc = "LazyGit Toggle window";
|
||||
}
|
||||
];
|
||||
|
||||
plugins = {
|
||||
lazygit.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,32 @@
|
|||
{
|
||||
plugins = {
|
||||
obsidian = {
|
||||
enable = true;
|
||||
settings = {
|
||||
workspaces = [
|
||||
{
|
||||
name = "obsidian";
|
||||
path = "~/Documents/obsidian";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.obsidian";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "obsidian";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins = {
|
||||
obsidian = {
|
||||
enable = true;
|
||||
settings = {
|
||||
legacy_commands = false;
|
||||
|
||||
workspaces = [
|
||||
{
|
||||
name = "obsidian";
|
||||
path = "~/Documents/obsidian";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,30 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tc";
|
||||
action = "<cmd>TodoTelescope<cr>";
|
||||
options.desc = "Telescope Find todo comments";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.todo-comments";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "todo-comments";
|
||||
};
|
||||
|
||||
plugins = {
|
||||
todo-comments.enable = true;
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tc";
|
||||
action = "<cmd>TodoTelescope<cr>";
|
||||
options.desc = "Telescope Find todo comments";
|
||||
}
|
||||
];
|
||||
|
||||
plugins = {
|
||||
todo-comments.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,30 @@
|
|||
{
|
||||
plugins.toggleterm = {
|
||||
enable = true;
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.toggleterm";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "toggleterm";
|
||||
};
|
||||
|
||||
settings = {
|
||||
open_mapping = "[[<A-i>]]";
|
||||
config = mkIf cfg.enable {
|
||||
plugins.toggleterm = {
|
||||
enable = true;
|
||||
|
||||
direction = "float";
|
||||
settings = {
|
||||
open_mapping = "[[<A-i>]]";
|
||||
|
||||
float_opts.border = "curved";
|
||||
winbar.enabled = true;
|
||||
direction = "float";
|
||||
|
||||
float_opts.border = "curved";
|
||||
winbar.enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,36 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>u";
|
||||
action = "<cmd>UndotreeToggle<cr>";
|
||||
options.desc = "Undotree Toggle window";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.undotree";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "undotree";
|
||||
};
|
||||
|
||||
plugins.undotree = {
|
||||
enable = true;
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>u";
|
||||
action = "<cmd>UndotreeToggle<cr>";
|
||||
options.desc = "Undotree Toggle window";
|
||||
}
|
||||
];
|
||||
|
||||
settings = {
|
||||
WindowLayout = 4;
|
||||
DiffpaneHeight = 15;
|
||||
SplitWidth = 40;
|
||||
plugins.undotree = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
WindowLayout = 4;
|
||||
DiffpaneHeight = 15;
|
||||
SplitWidth = 40;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,27 @@
|
|||
{pkgs, ...}: {
|
||||
plugins.vimtex = {
|
||||
enable = true;
|
||||
texlivePackage = pkgs.texliveFull;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.vimtex";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "vimtex";
|
||||
};
|
||||
|
||||
settings = {
|
||||
view_method = "zathura";
|
||||
config = mkIf cfg.enable {
|
||||
plugins.vimtex = {
|
||||
enable = true;
|
||||
texlivePackage = pkgs.texliveFull;
|
||||
|
||||
settings = {
|
||||
view_method = "zathura";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
21
config/utils/which-key.nix
Normal file
21
config/utils/which-key.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.which-key";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "which-key";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
plugins = {
|
||||
which-key.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,14 +1,30 @@
|
|||
{
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>zz";
|
||||
action = "<cmd>ZenMode<cr>";
|
||||
}
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.utils.zenmode";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "zenmode";
|
||||
};
|
||||
|
||||
plugins.zen-mode = {
|
||||
enable = true;
|
||||
settings.window.width = 150;
|
||||
config = mkIf cfg.enable {
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>zz";
|
||||
action = "<cmd>ZenMode<cr>";
|
||||
}
|
||||
];
|
||||
|
||||
plugins.zen-mode = {
|
||||
enable = true;
|
||||
settings.window.width = 150;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
138
flake.lock
generated
138
flake.lock
generated
|
|
@ -8,11 +8,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1753121425,
|
||||
"narHash": "sha256-TVcTNvOeWWk1DXljFxVRp+E0tzG1LhrVjOGGoMHuXio=",
|
||||
"lastModified": 1778716662,
|
||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "644e0fc48951a860279da645ba77fe4a6e814c5e",
|
||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -39,75 +39,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ixx": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1748294338,
|
||||
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "ixx",
|
||||
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"ref": "v0.0.8",
|
||||
"repo": "ixx",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1760862643,
|
||||
"narHash": "sha256-PXwG0TM7Ek87DNx4LbGWuD93PbFeKAJs4FfALtp7Wo0=",
|
||||
"owner": "nixos",
|
||||
"lastModified": 1780336545,
|
||||
"narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "33c6dca0c0cb31d6addcd34e90a63ad61826b28c",
|
||||
"rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1753432016,
|
||||
"narHash": "sha256-cnL5WWn/xkZoyH/03NNUS7QgW5vI7D1i74g48qplCvg=",
|
||||
"lastModified": 1780336545,
|
||||
"narHash": "sha256-vhVhuXzFrIOfcssC/9hDHx7MHzDKjF3keHuREOQqQiQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6027c30c8e9810896b92429f0092f624f7b1aace",
|
||||
"rev": "4df1b885d76a54e1aa1a318f8d16fd6005b6401f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -119,11 +71,11 @@
|
|||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1760596604,
|
||||
"narHash": "sha256-J/i5K6AAz/y5dBePHQOuzC7MbhyTOKsd/GLezSbEFiM=",
|
||||
"lastModified": 1770107345,
|
||||
"narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3cbe716e2346710d6e1f7c559363d14e11c32a43",
|
||||
"rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -137,15 +89,14 @@
|
|||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nuschtosSearch": "nuschtosSearch",
|
||||
"systems": "systems_3"
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1753878247,
|
||||
"narHash": "sha256-nxwVcC0ptpXenOWAyXTkYysbWAJPBIu2Mgp4XiFOfm4=",
|
||||
"lastModified": 1780235872,
|
||||
"narHash": "sha256-/TTVFhJQ5StCOrRFO+5NfSkYPSbAAekwymovcQzxNgE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "1729fe160872c9e53bd6977d92f53ef131606d4e",
|
||||
"rev": "e5c7b40dc569f5c97ba2182d409f0fb54c02d7c1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -154,29 +105,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nuschtosSearch": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"ixx": "ixx",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1753450833,
|
||||
"narHash": "sha256-Pmpke0JtLRzgdlwDC5a+aiLVZ11JPUO5Bcqkj0nHE/k=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "40987cc1a24feba378438d691f87c52819f7bd75",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
|
|
@ -202,30 +130,16 @@
|
|||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"lastModified": 1774449309,
|
||||
"narHash": "sha256-brhZ8DmuGtzkCYHJg4HEd602amKm89Y9ytsFZ5uWD1w=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"rev": "c29398b59d2048c4ab79345812849c9bd15e9150",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"ref": "future-26.11",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
@ -235,11 +149,11 @@
|
|||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760945191,
|
||||
"narHash": "sha256-ZRVs8UqikBa4Ki3X4KCnMBtBW0ux1DaT35tgsnB1jM4=",
|
||||
"lastModified": 1780220602,
|
||||
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "f56b1934f5f8fcab8deb5d38d42fd692632b47c2",
|
||||
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
79
flake.nix
79
flake.nix
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
|
@ -19,22 +18,6 @@
|
|||
system: let
|
||||
namespace = "yumevim";
|
||||
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
mergedLib = pkgs.lib.extend (final: prev: {${namespace} = import ./lib {lib = pkgs.lib;};});
|
||||
|
||||
nixvimLib = nixvim.lib.${system};
|
||||
nixvim' = nixvim.legacyPackages.${system};
|
||||
nixvimModule = {
|
||||
inherit pkgs;
|
||||
module = import ./config;
|
||||
extraSpecialArgs = {
|
||||
lib = mergedLib.extend nixvim.lib.overlay;
|
||||
namespace = namespace;
|
||||
};
|
||||
};
|
||||
|
||||
nvim = nixvim'.makeNixvimWithModule nixvimModule;
|
||||
|
||||
treefmtConfig = {...}: {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
|
|
@ -42,13 +25,65 @@
|
|||
};
|
||||
};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs (treefmtConfig {inherit pkgs;});
|
||||
in {
|
||||
checks = {
|
||||
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
|
||||
treefmt = treefmtEval.config.build.check self;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
mergedLib = pkgs.lib.extend (final: prev: {${namespace} = import ./lib {lib = pkgs.lib;};});
|
||||
|
||||
nixvimLib = nixvim.lib.${system};
|
||||
nixvim' = nixvim.legacyPackages.${system};
|
||||
mkNixvimProfile = custom: {
|
||||
module = {
|
||||
imports = [./config];
|
||||
|
||||
${namespace} = pkgs.lib.mkMerge [
|
||||
{
|
||||
bundles.common.enable = true;
|
||||
}
|
||||
custom
|
||||
];
|
||||
};
|
||||
|
||||
extraSpecialArgs = {
|
||||
inherit namespace pkgs;
|
||||
lib = mergedLib.extend nixvim.lib.overlay;
|
||||
};
|
||||
};
|
||||
|
||||
packages.default = nvim;
|
||||
minimal = mkNixvimProfile {};
|
||||
|
||||
default = mkNixvimProfile {
|
||||
languages = {
|
||||
lsp.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
full = mkNixvimProfile {
|
||||
languages = {
|
||||
lsp.enable = true;
|
||||
};
|
||||
utils = {
|
||||
obsidian.enable = true;
|
||||
vimtex.enable = true;
|
||||
};
|
||||
};
|
||||
in {
|
||||
checks = {
|
||||
treefmt = treefmtEval.config.build.check self;
|
||||
minimal = nixvimLib.check.mkTestDerivationFromNixvimModule minimal;
|
||||
};
|
||||
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
|
||||
packages =
|
||||
builtins.mapAttrs
|
||||
(name: config: nixvim'.makeNixvimWithModule config)
|
||||
{
|
||||
minimal = minimal;
|
||||
default = default;
|
||||
full = full;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue