Compare commits

...

36 commits

Author SHA1 Message Date
raf
a6ca5b7876
Merge 8f1b38ee81 into 250b503ef5 2024-11-17 18:00:42 +00:00
diniamo
250b503ef5 flake: update mnw 2024-11-17 17:00:29 +01:00
diniamo
8a827f92c9
Merge pull request #453 from diniamo/fix-trouble-binds
trouble: fix binds
2024-11-16 21:34:06 +01:00
diniamo
c99afe12c3 trouble: fix binds 2024-11-16 21:31:59 +01:00
diniamo
2bce0d957b
telescope: add missing mappings, cleanup (#469) 2024-11-15 08:17:54 +01:00
Ching Pei Yang
8099b9c821 lib/binds: update lzn bind functions 2024-11-15 09:40:06 +03:00
Ching Pei Yang
2df52f6ec4 lazy: remove unused imports 2024-11-15 09:40:06 +03:00
Ching Pei Yang
a79827f1f3 lazy: add key.mode example 2024-11-15 09:40:06 +03:00
Ching Pei Yang
22cfec78db lazy: re-order options for consistency 2024-11-15 09:40:06 +03:00
Ching Pei Yang
0b0bbfd348 lazy: add missing load() wrapper 2024-11-15 09:40:06 +03:00
Ching Pei Yang
2aad0fb838 lazy: remove defaults for keys 2024-11-15 09:40:06 +03:00
diniamo
7a5c75b865 nvim-cmp: fix use of mkDefault for borders 2024-11-13 20:46:33 +03:00
diniamo
1df720f86c nvim-cmp: use border style 2024-11-13 20:28:45 +03:00
diniamo
e39d469da9 nvim-cmp: allow passing null to format
Not adding special cases to where it's used shouldn't break anything.
2024-11-13 20:28:45 +03:00
diniamo
947cf90878 flake: provide dev package 2024-11-13 20:28:45 +03:00
Charlie Root
a07e113f3a theme/supported-themes.nix: fix themes
Make all themes work by adding `...` to every theme attrset.
2024-11-12 13:16:35 +03:00
8f1b38ee81
docs: compile stylesheet via rsass 2024-11-10 02:07:28 +03:00
c0d40cb75b
docs/installation: fix logical errors in standalone chapters 2024-11-09 23:58:51 +03:00
499d5c2679
docs: use the correct NVF_REPO url 2024-11-09 23:58:50 +03:00
8a98147d5b
docs: compile stylesheet via dart-sass 2024-11-09 23:58:49 +03:00
e89f074c09
docs: add anchors to individual headers
Taken from Nixpkgs manual derivation, neat.
2024-11-09 23:58:48 +03:00
969ab14046
docs/installation: connect custom-configuration section to the module chapters better 2024-11-09 23:58:47 +03:00
af07e1084a
docs/hacking: make preface more readable & friendly 2024-11-09 23:58:46 +03:00
84613262f0
docs/installation: un-linline section link 2024-11-09 23:58:45 +03:00
ffbcebbb4e
docs/options: include warning about option prefix 2024-11-09 23:58:44 +03:00
38f534f6d8
docs: use the correct path for quirks.md 2024-11-09 23:58:43 +03:00
bd66a784db
docs/preface: include project description in the preface 2024-11-09 23:58:42 +03:00
b5ea366433
docs/plugins: rename to 'quirks' to be more general 2024-11-09 23:58:41 +03:00
550cc787c5
docs/try-it-out: correct number of available configs; fix typos 2024-11-09 23:58:40 +03:00
119a902ddb
docs/custom-plugins: improve wording for DAG; link to local docs 2024-11-09 23:58:39 +03:00
71b1aa850c
docs/custom-plugins: better wording and edge cases in legacy-method.md 2024-11-09 23:58:38 +03:00
5745ff6bcd
docs: add preface to modules chapter 2024-11-09 23:58:37 +03:00
711de1179c
docs/installation: add standalone flake example 2024-11-09 23:58:36 +03:00
a8874e8855
docs: fix typo in standalone installation pages 2024-11-09 23:58:35 +03:00
f402e870eb
docs: clean up project README 2024-11-09 23:58:34 +03:00
b2dadb217a
flake: improve deprecation messages for old neovim-flake modules' 2024-11-09 23:58:33 +03:00
40 changed files with 539 additions and 1229 deletions

72
.github/README.md vendored
View file

@ -48,7 +48,7 @@
[Documentation]: #documentation [Documentation]: #documentation
[Help]: #help [Help]: #help
[Contribute]: #contributing [Contribute]: #contributing
[FAQ]: #faq [FAQ]: #frequently-asked-questions
[Credits]: #credits [Credits]: #credits
**[<kbd><br>Features <br></kbd>][Features]** **[<kbd><br>Features <br></kbd>][Features]**
@ -56,7 +56,7 @@
**[<kbd><br>Documentation<br></kbd>][Documentation]** **[<kbd><br>Documentation<br></kbd>][Documentation]**
**[<kbd><br>Help<br></kbd>][Help]** **[<kbd><br>Help<br></kbd>][Help]**
**[<kbd><br>Contribute<br></kbd>][Contribute]** **[<kbd><br>Contribute<br></kbd>][Contribute]**
**[<kbd><br>FAQ<br></kbd>][Faq]** **[<kbd><br>Credits<br></kbd>][Credits]** **[<kbd><br>FAQ<br></kbd>][FAQ]** **[<kbd><br>Credits<br></kbd>][Credits]**
</p></div> </p></div>
@ -64,12 +64,21 @@
## Features ## Features
[standalone]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-installation
[NixOS module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-nixos
[Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm
- **Simple**: One language to rule them all! Use Nix to configure everything,
with additional Lua Support
- **Reproducible**: Your configuration will behave the same _anywhere_. No - **Reproducible**: Your configuration will behave the same _anywhere_. No
surprises, promise! surprises, promise!
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No - **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
more global binaries! Works on all platforms, without hassle. more global binaries! Works on all platforms, without hassle.
- Options to install [standalone], [NixOS module] or [Home-Manager module].
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully - **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
customizable through the Nix module system. customizable through the Nix module system.
- Not comfortable with a full-nix config or want to bring your Lua config? You
can do just that, no unnecessary restrictions.
- **Well-documented**: Documentation is priority. You will _never_ face - **Well-documented**: Documentation is priority. You will _never_ face
undocumented, obscure behaviour. undocumented, obscure behaviour.
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and - **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
@ -120,7 +129,9 @@ instructions.
## Documentation ## Documentation
The _recommended_ way of installing **nvf** is using either the NixOS or the ### Installation
The _recommended_ way of installing nvf is using either the NixOS or the
Home-Manager module, though it is completely possible and no less supported to Home-Manager module, though it is completely possible and no less supported to
install **nvf** as a standalone package, or a flake output. install **nvf** as a standalone package, or a flake output.
@ -138,11 +149,13 @@ Please create an issue on the [issue tracker] if you find the documentation
lacking or confusing. Any improvements to the documentation through pull lacking or confusing. Any improvements to the documentation through pull
requests are also welcome, and appreciated. requests are also welcome, and appreciated.
## Help ## Getting Help
You can create an issue on the [issue tracker] to ask questions or report bugs. If you are confused, stuck or would like to ask a simple question; you may
I am not yet on spaces like matrix or IRC, so please use the issue tracker for create an issue on the [issue tracker] to ask questions or report bugs.
now.
We are not not yet on spaces like matrix or IRC, so please use the issue tracker
for now.
## Contributing ## Contributing
@ -152,7 +165,7 @@ submitting a pull request. You can also create an issue on the [issue tracker]
before submitting a pull request if you would like to discuss a feature or bug before submitting a pull request if you would like to discuss a feature or bug
fix. fix.
## FAQ ## Frequently Asked Questions
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose [appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
[list of branches]: https://github.com/NotAShelf/nvf/branches [list of branches]: https://github.com/NotAShelf/nvf/branches
@ -160,13 +173,15 @@ fix.
**Q**: What platforms are supported? **Q**: What platforms are supported?
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone <br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
Nix, NixOS or Home-Manager. Please take a look at the Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
installation instructions.
**Q**: Can you add _X_? **Q**: Can you add _X_?
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim <br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
plugin, however, I am always open to new modules and plugin setup additions to plugin, however, I am always open to new modules and plugin setup additions to
**nvf**. Use the [appropriate issue template] and I will consider a module **nvf**. Use the [appropriate issue template] and I will consider a module
addition. As mentioned before, PRs adding new features are also welcome. addition. As mentioned before, pull requests to add new features are also
welcome.
**Q**: A plugin I need is not available in **nvf**. What to do? **Q**: A plugin I need is not available in **nvf**. What to do?
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own <br/> **A**: **nvf** exposes several APIs for you to be able to add your own
@ -185,22 +200,26 @@ better prepare to breaking changes.
### Contributors ### Contributors
Special, heart-felt thanks to [mnw]: https://github.com/gerg-l/mnw
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts nvf would not be what it is today without the awesome people below. Special,
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to heart-felt thanks to
work
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts and
invaluable Nix assistance.
- [@FlafyDev](https://github.com/FlafyDev) - For getting home-manager module to
work and Nix assistance.
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally - [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
possible possible, and other module additions.
- [@horriblename](https://github.com/horriblename) - For actively implementing - [@horriblename](https://github.com/horriblename) - For actively implementing
planned features and quality of life updates planned features and quality of life updates.
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo - [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I - [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
could not could not.
- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull - [@Diniamo](https://github.com/Diniamo) - For actively submitting pull
requests and overall assistence requests, issues and assistance with maintenance of nvf.
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and - [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, [mnw],
occasional code improvements and occasional code improvements.
and everyone who has submitted issues or pull requests! and everyone who has submitted issues or pull requests!
@ -214,7 +233,7 @@ including:
is originally based on. is originally based on.
- [@sioodmy's](https://github.com/sioodmy) - [@sioodmy's](https://github.com/sioodmy)
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
choices. choices for UI and plugin defaults.
- [@wiltaylor's](https://github.com/wiltaylor) - [@wiltaylor's](https://github.com/wiltaylor)
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
design ideas. design ideas.
@ -229,10 +248,11 @@ recommend checking their work out.
## License ## License
Following the license of the Following the license of the
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf** [original neovim-flake](https://github.com/jordanisaacs/neovim-flake), nvf has
has been made available under the [**MIT License**](LICENSE). However, all been made available under the [**MIT License**](LICENSE). However, all assets
assets and documentation are published under the and documentation are published under the
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE). [**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE)
under explicit permission by the artist.
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6> <h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>

View file

@ -1,63 +1,112 @@
{ {
lib, lib,
stdenvNoCC, stdenvNoCC,
fetchzip,
runCommandLocal,
# build inputs # build inputs
nixos-render-docs, nixos-render-docs,
documentation-highlighter, documentation-highlighter,
dart-sass,
path, path,
# nrd configuration # nrd configuration
release, release,
optionsJSON, optionsJSON,
}: } @ args: let
stdenvNoCC.mkDerivation { manual-release = args.release or "unstable";
name = "nvf-manual";
src = builtins.path { scss-reset = fetchzip {
path = lib.sourceFilesBySuffices ./manual [".md"]; url = "https://github.com/Frontend-Layers/scss-reset/archive/refs/tags/1.4.2.zip";
name = "nvf-manual"; hash = "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=";
}; };
nativeBuildInputs = [nixos-render-docs]; compileStylesheet = runCommandLocal "compile-nvf-stylesheet" {} ''
mkdir -p $out
buildPhase = '' tmpfile=$(mktemp -d)
dest="$out/share/doc/nvf" trap "rm -r $tmpfile" EXIT
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,media}
cp -vt $dest/highlightjs \ ln -s "${scss-reset}/build" "$tmpfile/scss-reset"
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
substituteInPlace ./options.md \ ${dart-sass}/bin/sass --load-path "$tmpfile" \
--subst-var-by \ ${./static/style.scss} "$out/style.css"
OPTIONS_JSON \
${optionsJSON}/share/doc/nixos/options.json
substituteInPlace ./manual.md \ echo "Generated styles"
--subst-var-by \
NVF_VERSION \
${release}
# copy stylesheet
cp ${./static/style.css} "$dest/style.css"
# copy release notes
cp -vr ${./release-notes} release-notes
# generate manual from
nixos-render-docs manual html \
--manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault release} \
--stylesheet style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 2 \
--section-toc-depth 1 \
manual.md \
"$dest/index.xhtml"
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
''; '';
} in
stdenvNoCC.mkDerivation {
name = "nvf-manual";
src = builtins.path {
name = "nvf-manual-${manual-release}";
path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"];
};
strictDependencies = true;
nativeBuildInputs = [nixos-render-docs];
postPatch = ''
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
'';
buildPhase = ''
dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,script}
# Copy highlight scripts to /highlights in document root.
cp -vt $dest/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
# Copy anchor scripts to the script directory in document root.
cp -vt "$dest"/script \
${./static/script}/anchor-min.js \
${./static/script}/anchor-use.js
substituteInPlace ./options.md \
--subst-var-by OPTIONS_JSON ./config-options.json
substituteInPlace ./manual.md \
--subst-var-by NVF_VERSION ${manual-release}
substituteInPlace ./hacking/additional-plugins.md \
--subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"
# Move compiled stylesheet
cp -vt $dest \
${compileStylesheet}/style.css
# Move release notes
cp -vr ${./release-notes} release-notes
# Generate final manual from a set of parameters. Explanation of the CLI flags are
# as follows:
#
# 1. --manpage-urls will allow you to use manual pages as they are defined in
# the nixpkgs documentation.
# 2. --revision is the project revision as it is defined in 'release.json' in the
# repository root
# 3. --script will inject a given Javascript file into the resulting pages inside
# the <script> tag.
# 4. --toc-depth will determine the depth of the initial Table of Contents while
# --section-toc-depth will determine the depth of per-section Table of Contents
# sections.
nixos-render-docs manual html \
--manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault manual-release} \
--stylesheet "$dest"/style.css \
--script ./highlightjs/highlight.pack.js \
--script ./highlightjs/loader.js \
--script script/anchor-use.js \
--script script/anchor-min.js \
--toc-depth 2 \
--section-toc-depth 1 \
manual.md \
"$dest/index.xhtml"
# Hydra support. Probably not necessary.
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}

View file

@ -1,12 +1,13 @@
# Configuring {#sec-configuring-plugins} # Configuring {#sec-configuring-plugins}
Just making the plugin to your Neovim configuration available might not always be enough. In that Just making the plugin to your Neovim configuration available might not always
case, you can write custom lua config using either `config.vim.lazy.plugins.*.setupOpts` be enough. In that case, you can write custom lua config using either
`config.vim.extraPlugins.*.setup` or `config.vim.luaConfigRC`. `config.vim.lazy.plugins.*.setupOpts` `config.vim.extraPlugins.*.setup` or
`config.vim.luaConfigRC`.
The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule` and `setupOpt` can The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule`
be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise, the `before` and and `setupOpt` can be used if the plugin uses a `require('module').setup(...)`
`after` hooks should do what you need. pattern. Otherwise, the `before` and `after` hooks should do what you need.
```nix ```nix
{ {
@ -24,10 +25,11 @@ be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise,
} }
``` ```
The second option uses an attribute set, which maps DAG section names to a custom type, which has The second option uses an attribute set, which maps DAG section names to a
the fields `package`, `after`, `setup`. They allow you to set the package of the plugin, the custom type, which has the fields `package`, `after`, `setup`. They allow you to
sections its setup code should be after (note that the `extraPlugins` option has its own DAG set the package of the plugin, the sections its setup code should be after (note
scope), and the its setup code respectively. For example: that the `extraPlugins` option has its own DAG scope), and the its setup code
respectively. For example:
```nix ```nix
config.vim.extraPlugins = with pkgs.vimPlugins; { config.vim.extraPlugins = with pkgs.vimPlugins; {
@ -56,13 +58,17 @@ For example:
} }
``` ```
:::{.note} <!-- deno-fmt-ignore-start -->
If your configuration needs to be put in a specific place in the config, you
can use functions from `inputs.nvf.lib.nvim.dag` to order it. Refer to ::: {.note}
https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix One of the greatest strengths of nvf is the ability to order
snippets of configuration via the DAG system. It will allow specifying positions
of individual sections of configuration as needed. nvf provides helper functions
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
use.
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
to find out more about the DAG system. to find out more about the DAG system.
::: :::
If you successfully made your plugin work, please feel free to create a PR to <!-- deno-fmt-ignore-end -->
add it to **nvf** or open an issue with your findings so that we can make it
available for everyone easily.

View file

@ -1,6 +1,6 @@
# Legacy Method {#sec-legacy-method} # Legacy Method {#sec-legacy-method}
Prior to version 0.5, the method of adding new plugins was adding the plugin Prior to version v0.5, the method of adding new plugins was adding the plugin
package to `vim.startPlugins` and add its configuration as a DAG under one of package to `vim.startPlugins` and add its configuration as a DAG under one of
`vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or `vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or
prefer a more hands-on approach may use the old method where the load order of prefer a more hands-on approach may use the old method where the load order of
@ -8,13 +8,14 @@ the plugins is determined by DAGs.
## Adding plugins {#sec-adding-plugins} ## Adding plugins {#sec-adding-plugins}
To add a plugin to **nvf**'s runtime, you may add it To add a plugin not available in nvf as a module to your configuration, you may
add it to [](#opt-vim.startPlugins) in order to make it available to Neovim at
runtime.
```nix ```nix
{pkgs, ...}: { {pkgs, ...}: {
# add a package from nixpkgs to startPlugins # Add a Neovim plugin from Nixpkgs to the runtime.
vim.startPlugins = [ vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
pkgs.vimPlugins.aerial-nvim ];
} }
``` ```
@ -23,7 +24,9 @@ provide configuration as a DAG using the **nvf** extended library.
```nix ```nix
{inputs, ...}: let {inputs, ...}: let
# assuming you have an input called nvf pointing at the nvf repository # This assumes you have an input called 'nvf' in your flake inputs
# and 'inputs' in your specialArgs. In the case you have passed 'nvf'
# to specialArgs, the 'inputs' prefix may be omitted.
inherit (inputs.nvf.lib.nvim.dag) entryAnywhere; inherit (inputs.nvf.lib.nvim.dag) entryAnywhere;
in { in {
vim.luaConfigRC.aerial-nvim= entryAnywhere '' vim.luaConfigRC.aerial-nvim= entryAnywhere ''

View file

@ -1,16 +1,25 @@
# Hacking nvf {#ch-hacking} # Hacking nvf {#ch-hacking}
**nvf** is designed for developers as much as it is for the end user. I would like any potential contributor [open issues]: https://github.com/notashelf/nvf/issues
to be able to propagate their desired changes into the repository without the extra effort. As such, below are guides [new issue]: https://github.com/notashelf/nvf/issues/new
(and guidelines) to streamline the contribution process and ensure that your valuable input seamlessly integrates
into **nvf**'s development without leaving question marks in your head.
This section is mainly directed towards those who wish to contribute code into **nvf**. If you wish to instead nvf is designed for the developer as much as it is designed for the end-user. We
report a bug or discuss a potential feature implementation, first look among the would like for any contributor to be able to propagate their changes, or add new
already [open issues](https://github.com/notashelf/nvf/issues) and if no matching issue exists you may open features to the project with minimum possible friction. As such, below are the
a [new issue](https://github.com/notashelf/nvf/issues/new) and describe your problem/request. While creating an guides and guidelines written to streamline the contribution process and to
issue, please try to include as much information as you can, ideally also include relevant context in which an issue ensure that your valuable input integrates into nvf's development as seamlessly
occurs or a feature should be implemented. as possible without leaving any question marks in your head.
This section is directed mainly towards those who wish to contribute code into
the project. If you instead wish to report a bug, or discuss a potential new
feature implementation (which you do not wish to implement yourself) first look
among the already [open issues] and if no matching issue exists you may open a
[new issue] and describe your problem/request.
While creating an issue, please try to include as much information as you can,
ideally also include relevant context in which an issue occurs or a feature
should be implemented. If you wish to make a contribution, but feel stuck -
please do not be afraid to submit a pull request, we will help you get it in.
```{=include=} sections ```{=include=} sections
hacking/getting-started.md hacking/getting-started.md

View file

@ -1,10 +1,9 @@
# Adding Plugins {#sec-additional-plugins} # Adding Plugins {#sec-additional-plugins}
To add a new Neovim plugin, first add the source url in the inputs section of `flake.nix` To add a new Neovim plugin, first add the source url in the inputs section of
with the prefix `plugin-` `flake.nix` with the prefix `plugin-`
```nix ```nix
{ {
inputs = { inputs = {
# ... # ...
@ -17,13 +16,18 @@ with the prefix `plugin-`
} }
``` ```
Prepending `plugin-` to the name of the input will allow nvf to automatically
discover inputs that are marked as plugins, and make them available in
`vim.startPlugins` or other areas that require a very specific plugin type as it
is defined in `@NVF_REPO@/lib/types/plugins.nix`
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
input from the flake inputs automatically, allowing you to refer to it in areas input from the flake inputs automatically, allowing you to refer to it in areas
that require a very specific plugin type as defined in `lib/types/plugins.nix` that require a very specific plugin type as defined in `lib/types/plugins.nix`
You can now reference this plugin using its string name, the plugin will be You can now reference this plugin using its string name, the plugin will be
built with the name and source URL from the flake input, allowing you to built with the name and source URL from the flake input, allowing you to refer
refer to it as a **string**. to it as a **string**.
```nix ```nix
config.vim.startPlugins = ["neodev-nvim"]; config.vim.startPlugins = ["neodev-nvim"];
@ -33,11 +37,11 @@ config.vim.startPlugins = ["neodev-nvim"];
Most plugins is initialized with a call to `require('plugin').setup({...})`. Most plugins is initialized with a call to `require('plugin').setup({...})`.
We use a special function that lets you easily add support for such setup options in a modular way: We use a special function that lets you easily add support for such setup
`mkPluginSetupOption`. options in a modular way: `mkPluginSetupOption`.
Once you have added the source of the plugin as shown above, you can define the setup options like Once you have added the source of the plugin as shown above, you can define the
this: setup options like this:
```nix ```nix
# in modules/.../your-plugin/your-plugin.nix # in modules/.../your-plugin/your-plugin.nix
@ -86,7 +90,8 @@ require('plugin-name').setup({
}) })
``` ```
Now users can set any of the pre-defined option field, and can also add their own fields! Now users can set any of the pre-defined option field, and can also add their
own fields!
```nix ```nix
# in user's config # in user's config
@ -110,8 +115,8 @@ As you've seen above, `toLuaObject` is used to convert our nix attrSet
1. nix `null` converts to lua `nil` 1. nix `null` converts to lua `nil`
2. number and strings convert to their lua counterparts 2. number and strings convert to their lua counterparts
3. nix attrSet/list convert into lua tables 3. nix attrSet/list convert into lua tables
4. you can write raw lua code using `lib.generators.mkLuaInline`. This 4. you can write raw lua code using `lib.generators.mkLuaInline`. This function
function is part of nixpkgs. is part of nixpkgs.
Example: Example:
@ -127,8 +132,8 @@ vim.your-plugin.setupOpts = {
## Lazy plugins {#sec-lazy-plugins} ## Lazy plugins {#sec-lazy-plugins}
If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it. Lazy If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it.
plugins are managed by `lz.n`. Lazy plugins are managed by `lz.n`.
```nix ```nix
# in modules/.../your-plugin/config.nix # in modules/.../your-plugin/config.nix
@ -163,6 +168,7 @@ in {
``` ```
This results in the following lua code: This results in the following lua code:
```lua ```lua
require('lz.n').load({ require('lz.n').load({
{ {

View file

@ -1,9 +1,12 @@
# Installing nvf {#ch-installation} # Installing nvf {#ch-installation}
[module installation section]: #ch-module-installation
There are multiple ways of installing nvf on your system. You may either choose There are multiple ways of installing nvf on your system. You may either choose
the standalone installation method, which does not depend on a module system and may the standalone installation method, which does not depend on a module system and
be done on any system that has the Nix package manager or the appropriate modules may be done on any system that has the Nix package manager or the appropriate
for NixOS and home-manager as described in the [module installation section](#ch-module-installation) modules for NixOS and home-manager as described in the
[module installation section].
```{=include=} chapters ```{=include=} chapters
installation/custom-configuration.md installation/custom-configuration.md

View file

@ -1,8 +1,9 @@
# Standalone Installation {#ch-standalone-installation} # Standalone Installation {#ch-standalone-installation}
It is possible to install **nvf** without depending on NixOS or home-manager as the parent It is possible to install nvf without depending on NixOS or Home-Manager as the
module system, using the `neovimConfiguration` function exposed by **nvf** extended library. parent module system, using the `neovimConfiguration` function exposed in the
It takes in the configuration as a module, and returns an attribute set as a result. extended library. This function will take `modules` and `extraSpecialArgs` as
arguments, and return the following schema as a result.
```nix ```nix
{ {
@ -13,6 +14,55 @@ It takes in the configuration as a module, and returns an attribute set as a res
} }
``` ```
An example flake that exposes your custom Neovim configuration might look like
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nvf.url = "github:notashelf/nvf";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: {
packages."x86_64-linux" = let
neovimConfigured = (inputs.nvf.lib.neovimConfiguration {
inherit (nixpkgs.legacyPackages."x86_64-linux") pkgs;
modules = [{
config.vim = {
# Enable custom theming options
theme.enable = true;
# Enable Treesitter
tree-sitter.enable = true;
# Other options will go here. Refer to the config
# reference in Appendix B of the nvf manual.
# ...
};
}];
});
in {
# Set the default package to the wrapped instance of Neovim.
# This will allow running your Neovim configuration with
# `nix run` and in addition, sharing your configuration with
# other users in case your repository is public.
default = neovimConfigured.neovim;
};
};
}
```
<!-- TODO: mention the built-in flake template here when it is added -->
The above setup will allow to set up nvf as a standalone flake, which you can
build independently from your system configuration while also possibly sharing
it with others. The next two chapters will detail specific usage of such a setup
for a package output in the context of NixOS or Home-Manager installation.
```{=include=} chapters ```{=include=} chapters
standalone/nixos.md standalone/nixos.md
standalone/home-manager.md standalone/home-manager.md

View file

@ -1,5 +1,9 @@
# Module Installation {#ch-module-installation} # Module Installation {#ch-module-installation}
The below chapters will describe installing nvf as NixOS and Home-Manager
modules. Note that those methods are mutually exclusive, and will likely cause
path collisions if used simultaneously.
```{=include=} chapters ```{=include=} chapters
modules/nixos.md modules/nixos.md
modules/home-manager.md modules/home-manager.md

View file

@ -77,7 +77,9 @@ configure **nvf**.
``` ```
::: {.note} ::: {.note}
**nvf** exposes a lot of options, most of which are not referenced in the **nvf** exposes a lot of options, most of which are not referenced in the
installation sections of the manual. You may find all avaliable options installation sections of the manual. You may find all available options in the
in the [appendix](https://notashelf.github.io/nvf/options) [appendix](https://notashelf.github.io/nvf/options)
::: :::

View file

@ -76,7 +76,9 @@ configure **nvf**.
``` ```
::: {.note} ::: {.note}
**nvf** exposes a lot of options, most of which are not referenced in the **nvf** exposes a lot of options, most of which are not referenced in the
installation sections of the manual. You may find all avaliable options installation sections of the manual. You may find all available options in the
in the [appendix](https://notashelf.github.io/nvf/options) [appendix](https://notashelf.github.io/nvf/options)
::: :::

View file

@ -1,12 +1,12 @@
# Standalone Installation on Home-Manager {#ch-standalone-hm} # Standalone Installation on Home-Manager {#ch-standalone-hm}
Your built Neoevim configuration can be exposed as a flake output to make it Your built Neovim configuration can be exposed as a flake output to make it
easier to share across machines, repositories and so on. Or it can be added to easier to share across machines, repositories and so on. Or it can be added to
your system packages to make it available across your system. your system packages to make it available across your system.
The following is an example installation of `nvf` as a standalone package with The following is an example installation of `nvf` as a standalone package with
the default theme enabled. You may use other options inside `config.vim` in the default theme enabled. You may use other options inside `config.vim` in
`configModule`, but this example will not cover that. `configModule`, but this example will not cover that extensively.
```nix ```nix
{ {
@ -30,23 +30,22 @@ the default theme enabled. You may use other options inside `config.vim` in
}; };
customNeovim = nvf.lib.neovimConfiguration { customNeovim = nvf.lib.neovimConfiguration {
modules = [configModule];
inherit pkgs; inherit pkgs;
modules = [configModule];
}; };
in { in {
# this will make the package available as a flake input # This will make the package available as a flake output under 'packages'
packages.${system}.my-neovim = customNeovim.neovim; packages.${system}.my-neovim = customNeovim.neovim;
# this is an example home-manager configuration # Example Home-Manager configuration using the configured Neovim package
# using the built neovim package
homeConfigurations = { homeConfigurations = {
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
# ... # ...
modules = [ modules = [
./home.nix # This will make Neovim available to users using the Home-Manager
# configuration. To make the package available to all users, prefer
# this will make wrapped neovim available in your system packages # environment.systemPackages in your NixOS configuration.
{environment.systemPackages = [customNeovim.neovim];} {home.packages = [customNeovim.neovim];}
]; ];
# ... # ...
}; };

View file

@ -1,12 +1,12 @@
# Standalone Installation on NixOS {#ch-standalone-nixos} # Standalone Installation on NixOS {#ch-standalone-nixos}
Your built Neoevim configuration can be exposed as a flake output to make it Your built Neovim configuration can be exposed as a flake output to make it
easier to share across machines, repositories and so on. Or it can be added to easier to share across machines, repositories and so on. Or it can be added to
your system packages to make it available across your system. your system packages to make it available across your system.
The following is an example installation of `nvf` as a standalone package with The following is an example installation of `nvf` as a standalone package with
the default theme enabled. You may use other options inside `config.vim` in the default theme enabled. You may use other options inside `config.vim` in
`configModule`, but this example will not cover that. `configModule`, but this example will not cover that extensively.
```nix ```nix
{ {
@ -30,21 +30,19 @@ the default theme enabled. You may use other options inside `config.vim` in
}; };
customNeovim = nvf.lib.neovimConfiguration { customNeovim = nvf.lib.neovimConfiguration {
modules = [configModule];
inherit pkgs; inherit pkgs;
modules = [configModule];
}; };
in { in {
# this will make the package available as a flake input # This will make the package available as a flake output under 'packages'
packages.${system}.my-neovim = customNeovim.neovim; packages.${system}.my-neovim = customNeovim.neovim;
# this is an example nixosConfiguration using the built neovim package # Example nixosConfiguration using the configured Neovim package
nixosConfigurations = { nixosConfigurations = {
yourHostName = nixpkgs.lib.nixosSystem { yourHostName = nixpkgs.lib.nixosSystem {
# ... # ...
modules = [ modules = [
./configuration.nix # or whatever your configuration is # This will make wrapped neovim available in your system packages
# this will make wrapped neovim available in your system packages
{environment.systemPackages = [customNeovim.neovim];} {environment.systemPackages = [customNeovim.neovim];}
]; ];
# ... # ...

View file

@ -17,8 +17,8 @@ configuring.md
hacking.md hacking.md
``` ```
```{=include=} appendix html:into-file=//plugins.html ```{=include=} appendix html:into-file=//quirks.html
plugins.md quirks.md
``` ```
```{=include=} appendix html:into-file=//options.html ```{=include=} appendix html:into-file=//options.html

View file

@ -1,8 +1,14 @@
# Neovim Flake Configuration Options {#ch-options} # Neovim Flake Configuration Options {#ch-options}
Below are the options provided by nvf provided in no particular order. Below are the module options provided by nvf, in no particular order. Most
They may include useful comments and warnings, or examples on how a module option options will include useful comments, warnings or setup tips on how a module
is meant to be used. option is meant to be used as well as examples in complex cases.
<!--
In the manual, individual options may be referenced in Hyperlinks as follows:
[](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have
to be changed everywhere.
-->
```{=include=} options ```{=include=} options
id-prefix: opt- id-prefix: opt-

View file

@ -1,16 +0,0 @@
# Plugin specific quirks {#ch-plugins}
At times, certain plugins refuse to play nicely. Be it as a result of generating
lua from Nix, or the state of packaging. This page shall list any plugins that
are known to misbehave, and potential workarounds.
```{=include=} chapters
plugins/nodejs.md
```
<!--
If adding a new section, uncomment this part and add your page to
plugins/<page>.md
```{=include=} chapters
plugins/page.md
```
-->

View file

@ -1,7 +1,20 @@
# Preface {#ch-preface} # Preface {#ch-preface}
If you noticed a bug caused by **nvf** then please consider reporting it over ## What is nvf {#sec-what-is-it}
[the issue tracker](https://github.com/notashelf/nvf/issues).
Bugfixes, feature additions and upstreamed changes from your local configurations nvf is a highly modular, configurable, extensible and easy to use Neovim
are always welcome in the [the pull requests tab](https://github.com/notashelf/nvf/pulls). configuration in Nix. Designed for flexibility and ease of use, nvf allows you
to easily configure your fully featured Neovim instance with a few lines of Nix.
## Bugs & Suggestions {#sec-bugs-suggestions}
[issue tracker]: https://github.com/notashelf/nvf/issues
[discussions tab]: https://github.com/notashelf/nvf/discussions
[pull requests tab]: https://github.com/notashelf/nvf/pulls
If you notice any issues with nvf, or this documentation, then please consider
reporting them over at the [issue tracker]. Issues tab, in addition to the
[discussions tab] is a good place as any to request new features.
You may also consider submitting bugfixes, feature additions and upstreamed
changes that you think are critical over at the [pull requests tab].

13
docs/manual/quirks.md Normal file
View file

@ -0,0 +1,13 @@
# Known Issues and Quirks {#ch-known-issues-quirks}
At times, certain plugins and modules may refuse to play nicely with your setup,
be it a result of generating Lua from Nix, or the state of packaging. This page,
in turn, will list any known modules or plugins that are known to misbehave, and
possible workarounds that you may apply.
<!-- If adding a new known quirk, please create a new page in quirks/ and include
the name of the file here.-->
```{=include=} chapters
quirks/nodejs.md
```

View file

@ -1,16 +1,22 @@
# NodeJS {#ch-plugins-nodejs} # NodeJS {#ch-quirks-nodejs}
## eslint-plugin-prettier {#sec-eslint-plugin-prettier} ## eslint-plugin-prettier {#sec-eslint-plugin-prettier}
When working with NodeJS, everything works as expected, but some projects have settings that can fool nvf. When working with NodeJS, everything works as expected, but some projects have
settings that can fool nvf.
If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar is included, you might get a situation where your eslint configuration diagnoses your formatting according to its own config (usually `.eslintrc.js`). If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar
is included, you might get a situation where your eslint configuration diagnoses
your formatting according to its own config (usually `.eslintrc.js`).
The issue there is your formatting is made via prettierd. The issue there is your formatting is made via prettierd.
This results in auto-formating relying on your prettier config, while your eslint config diagnoses formatting [which it's not supposed to](https://prettier.io/docs/en/comparison.html)) This results in auto-formating relying on your prettier config, while your
eslint config diagnoses formatting
[which it's not supposed to](https://prettier.io/docs/en/comparison.html))
In the end, you get discrepancies between what your editor does and what it wants. In the end, you get discrepancies between what your editor does and what it
wants.
Solutions are: Solutions are:

View file

@ -1,25 +1,27 @@
# Try it out {#ch-try-it-out} # Try it out {#ch-try-it-out}
Thanks to the portability of Nix, you can try out nvf without actually installing it to your machine. Thanks to the portability of Nix, you can try out nvf without actually
Below are the commands you may run to try out different configurations provided by this flake. As of v0.5, three installing it to your machine. Below are the commands you may run to try out
different configurations provided by this flake. As of v0.5, two specialized
configurations are provided: configurations are provided:
- Nix - **Nix** - Nix language server + simple utility plugins
- Maximal - **Maximal** - Variable language servers + utility and decorative plugins
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed. You may try out any of the provided configurations using the `nix run` command
on a system where Nix is installed.
```console ```bash
$ cachix use nvf # Optional: it'll save you CPU resources and time $ cachix use nvf # Optional: it'll save you CPU resources and time
$ nix run github:notashelf/nvf#nix # will run the default minimal configuration $ nix run github:notashelf/nvf#nix # will run the default minimal configuration
``` ```
Do keep in mind that this is **susceptible to garbage collection** meaning it will be removed from your Nix store Do keep in mind that this is **susceptible to garbage collection** meaning it
once you garbage collect. will be removed from your Nix store once you garbage collect.
## Using Prebuilt Configs {#sec-using-prebuild-configs} ## Using Prebuilt Configs {#sec-using-prebuilt-configs}
```console ```bash
$ nix run github:notashelf/nvf#nix $ nix run github:notashelf/nvf#nix
$ nix run github:notashelf/nvf#maximal $ nix run github:notashelf/nvf#maximal
``` ```
@ -28,12 +30,19 @@ $ nix run github:notashelf/nvf#maximal
#### Nix {#sec-configs-nix} #### Nix {#sec-configs-nix}
`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins. `Nix` configuration by default provides LSP/diagnostic support for Nix alongside
By running `nix run .#`, which is the default package, you will build Neovim with this config. a set of visual and functional plugins. By running `nix run .#`, which is the
default package, you will build Neovim with this config.
#### Maximal {#sec-configs-maximal} #### Maximal {#sec-configs-maximal}
`Maximal` is the ultimate configuration that will enable support for more commonly used language as well as additional `Maximal` is the ultimate configuration that will enable support for more
complementary plugins. Keep in mind, however, that this will pull a lot of dependencies. commonly used language as well as additional complementary plugins. Keep in
mind, however, that this will pull a lot of dependencies.
You are _strongly_ recommended to use the binary cache if you would like to try the Maximal configuration. ::: {.tip}
You are _strongly_ recommended to use the binary cache if you would like to try
the Maximal configuration.
:::

10
docs/static/script/anchor-min.js vendored Normal file

File diff suppressed because one or more lines are too long

4
docs/static/script/anchor-use.js vendored Normal file
View file

@ -0,0 +1,4 @@
document.addEventListener('DOMContentLoaded', function(event) {
anchors.add('h1[id]:not(div.note h1, div.warning h1, div.tip h1, div.caution h1, div.important h1), h2[id]:not(div.note h2, div.warning h2, div.tip h2, div.caution h2, div.important h2), h3[id]:not(div.note h3, div.warning h3, div.tip h3, div.caution h3, div.important h3), h4[id]:not(div.note h4, div.warning h4, div.tip h4, div.caution h4, div.important h4), h5[id]:not(div.note h5, div.warning h5, div.tip h5, div.caution h5, div.important h5), h6[id]:not(div.note h6, div.warning h6, div.tip h6, div.caution h6, div.important h6)');
});

827
docs/static/style.css vendored

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,5 @@
@use "scss-reset/reset";
:root { :root {
--nmd-color0: #0a3e68; --nmd-color0: #0a3e68;
--nmd-color1: #268598; --nmd-color1: #268598;
@ -32,8 +34,6 @@ $color-blue-700: #1d4ed8;
$color-blue-800: #1e40af; $color-blue-800: #1e40af;
$color-blue-900: #1e3a8a; $color-blue-900: #1e3a8a;
@use "scss-reset/reset";
@mixin boxed { @mixin boxed {
background: $color-gray-50; background: $color-gray-50;
margin: 2rem 16px; margin: 2rem 16px;

View file

@ -4,99 +4,4 @@
License: ~ MIT (or more permissive) [via base16-schemes-source] License: ~ MIT (or more permissive) [via base16-schemes-source]
Maintainer: @highlightjs/core-team Maintainer: @highlightjs/core-team
Version: 2021.09.0 Version: 2021.09.0
*/ */pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#ccc;background:#2d2d2d}.hljs ::selection,.hljs::selection{background-color:#515151;color:#ccc}.hljs-comment{color:#999}.hljs-tag{color:#b4b7b4}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#ccc}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#f2777a}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#f99157}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#fc6}.hljs-strong{font-weight:700;color:#fc6}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#9c9}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#6cc}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#69c}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#c9c}.hljs-emphasis{color:#c9c;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#a3685a}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
}
code.hljs {
padding: 3px 5px;
}
.hljs {
color: #ccc;
background: #2d2d2d;
}
.hljs ::selection,
.hljs::selection {
background-color: #515151;
color: #ccc;
}
.hljs-comment {
color: #999;
}
.hljs-tag {
color: #b4b7b4;
}
.hljs-operator,
.hljs-punctuation,
.hljs-subst {
color: #ccc;
}
.hljs-operator {
opacity: 0.7;
}
.hljs-bullet,
.hljs-deletion,
.hljs-name,
.hljs-selector-tag,
.hljs-template-variable,
.hljs-variable {
color: #f2777a;
}
.hljs-attr,
.hljs-link,
.hljs-literal,
.hljs-number,
.hljs-symbol,
.hljs-variable.constant_ {
color: #f99157;
}
.hljs-class .hljs-title,
.hljs-title,
.hljs-title.class_ {
color: #fc6;
}
.hljs-strong {
font-weight: 700;
color: #fc6;
}
.hljs-addition,
.hljs-code,
.hljs-string,
.hljs-title.class_.inherited__ {
color: #9c9;
}
.hljs-built_in,
.hljs-doctag,
.hljs-keyword.hljs-atrule,
.hljs-quote,
.hljs-regexp {
color: #6cc;
}
.hljs-attribute,
.hljs-function .hljs-title,
.hljs-section,
.hljs-title.function_,
.ruby .hljs-property {
color: #69c;
}
.diff .hljs-meta,
.hljs-keyword,
.hljs-template-tag,
.hljs-type {
color: #c9c;
}
.hljs-emphasis {
color: #c9c;
font-style: italic;
}
.hljs-meta,
.hljs-meta .hljs-keyword,
.hljs-meta .hljs-string {
color: #a3685a;
}
.hljs-meta .hljs-keyword,
.hljs-meta-keyword {
font-weight: 700;
}

View file

@ -38,11 +38,11 @@
}, },
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1731182209, "lastModified": 1731821965,
"narHash": "sha256-yftvwv8bHEKjmSKREdkGLWTDhf7vA2Ssvl/XMpykigg=", "narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "0a5e50286ca9f1b70eb4fa29ce84304cad657700", "rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -21,6 +21,7 @@
./flake/legacyPackages.nix ./flake/legacyPackages.nix
./flake/overlays.nix ./flake/overlays.nix
./flake/packages.nix ./flake/packages.nix
./flake/develop.nix
]; ];
flake = { flake = {
@ -30,46 +31,29 @@
}; };
homeManagerModules = { homeManagerModules = {
nvf = import ./flake/modules/home-manager.nix self.packages lib;
default = self.homeManagerModules.nvf;
neovim-flake = neovim-flake =
lib.warn '' lib.warn ''
homeManagerModules.neovim-flake has been deprecated. 'homeManagerModules.neovim-flake' has been deprecated, and will be removed
Plese use the homeManagerModules.nvf instead in a future release. Please use 'homeManagerModules.nvf' instead.
'' ''
self.homeManagerModules.nvf; self.homeManagerModules.nvf;
nvf = import ./flake/modules/home-manager.nix self.packages lib;
default = self.homeManagerModules.nvf;
}; };
nixosModules = { nixosModules = {
nvf = import ./flake/modules/nixos.nix self.packages lib;
default = self.nixosModules.nvf;
neovim-flake = neovim-flake =
lib.warn '' lib.warn ''
nixosModules.neovim-flake has been deprecated. 'nixosModules.neovim-flake' has been deprecated, and will be removed
Please use the nixosModules.nvf instead in a future release. Please use 'nixosModules.nvf' instead.
'' ''
self.nixosModules.nvf; self.nixosModules.nvf;
nvf = import ./flake/modules/nixos.nix self.packages lib;
default = self.nixosModules.nvf;
}; };
}; };
perSystem = { perSystem = {pkgs, ...}: {
self',
config,
pkgs,
...
}: {
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
lsp = pkgs.mkShell {
packages = with pkgs; [nil statix deadnix alejandra];
};
};
# Provide the default formatter. `nix fmt` in project root # Provide the default formatter. `nix fmt` in project root
# will format available files with the correct formatter. # will format available files with the correct formatter.
# P.S: Please do not format with nixfmt! It messes with many # P.S: Please do not format with nixfmt! It messes with many

30
flake/develop.nix Normal file
View file

@ -0,0 +1,30 @@
{lib, ...}: {
perSystem = {
pkgs,
config,
self',
...
}: {
devShells = {
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
lsp = pkgs.mkShellNoCC {
packages = with pkgs; [nil statix deadnix alejandra];
};
};
# This package exists to make development easier by providing the place and
# boilerplate to build a test nvf configuration. Feel free to use this for
# testing, but make sure to discard the changes before creating a pull
# request.
packages.dev = let
configuration = {};
customNeovim = lib.nvim.neovimConfiguration {
inherit pkgs;
modules = [configuration];
};
in
customNeovim.neovim;
};
}

View file

@ -79,14 +79,14 @@
expr = true; expr = true;
}; };
mkSetLznBinding = binding: action: { mkSetLznBinding = mode: binding: action: {
inherit action; inherit action mode;
key = binding.value; key = binding.value;
desc = binding.description; desc = binding.description;
}; };
mkSetLuaLznBinding = binding: action: { mkSetLuaLznBinding = mode: binding: action: {
inherit action; inherit action mode;
key = binding.value; key = binding.value;
lua = true; lua = true;
desc = binding.description; desc = binding.description;

View file

@ -54,5 +54,10 @@ in {
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
(accidental) leaking of user configuration. (accidental) leaking of user configuration.
'') '')
(mkRemovedOptionModule ["vim" "lsp" "trouble" "mappings" "toggle"] ''
With Trouble having so many different modes, and breaking changes
upstream, it no longer makes sense, nor works, to toggle only Trouble.
'')
]; ];
} }

View file

@ -10,6 +10,8 @@
inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (builtins) attrNames typeOf tryEval concatStringsSep; inherit (builtins) attrNames typeOf tryEval concatStringsSep;
borders = config.vim.ui.borders.plugins.nvim-cmp;
cfg = config.vim.autocomplete.nvim-cmp; cfg = config.vim.autocomplete.nvim-cmp;
luasnipEnable = config.vim.snippets.luasnip.enable; luasnipEnable = config.vim.snippets.luasnip.enable;
getPluginName = plugin: getPluginName = plugin:
@ -81,10 +83,9 @@ in {
setupOpts = { setupOpts = {
sources = map (s: {name = s;}) (attrNames cfg.sources); sources = map (s: {name = s;}) (attrNames cfg.sources);
# TODO: try to get nvim-cmp to follow global border style window = mkIf borders.enable {
window = mkIf config.vim.ui.borders.enable { completion.border = borders.style;
completion = mkLuaInline "cmp.config.window.bordered()"; documentation.border = borders.style;
documentation = mkLuaInline "cmp.config.window.bordered()";
}; };
formatting.format = cfg.format; formatting.format = cfg.format;

View file

@ -72,7 +72,7 @@ in {
}; };
format = mkOption { format = mkOption {
type = luaInline; type = nullOr luaInline;
default = mkLuaInline '' default = mkLuaInline ''
function(entry, vim_item) function(entry, vim_item)
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name] vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]

View file

@ -60,7 +60,7 @@ in {
inherit (cfg.ui) setupOpts; inherit (cfg.ui) setupOpts;
keys = [ keys = [
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end") (mkSetLuaLznBinding "n" mappings.toggleDapUI "function() require('dapui').toggle() end")
]; ];
}; };

View file

@ -21,19 +21,18 @@ in {
cmd = "Trouble"; cmd = "Trouble";
keys = [ keys = [
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>") (mkSetLznBinding "n" mappings.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>")
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>") (mkSetLznBinding "n" mappings.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>")
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>") (mkSetLznBinding "n" mappings.lspReferences "<cmd>Trouble toggle lsp_references<CR>")
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>") (mkSetLznBinding "n" mappings.quickfix "<cmd>Trouble toggle quickfix<CR>")
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>") (mkSetLznBinding "n" mappings.locList "<cmd>Trouble toggle loclist<CR>")
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>") (mkSetLznBinding "n" mappings.symbols "<cmd>Trouble toggle symbols<CR>")
]; ];
}; };
binds.whichKey.register = pushDownDefault { binds.whichKey.register = pushDownDefault {
"<leader>l" = "Trouble";
"<leader>x" = "+Trouble"; "<leader>x" = "+Trouble";
"<leader>lw" = "Workspace"; "<leader>lw" = "+Workspace";
}; };
}; };
}; };

View file

@ -10,12 +10,12 @@ in {
setupOpts = mkPluginSetupOption "Trouble" {}; setupOpts = mkPluginSetupOption "Trouble" {};
mappings = { mappings = {
toggle = mkMappingOption "Toggle trouble [trouble]" "<leader>xx";
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd"; workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld"; documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr"; lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq"; quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
locList = mkMappingOption "LOCList [trouble]" "<leader>xl"; locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
symbols = mkMappingOption "Symbols [trouble]" "<leader>xs";
}; };
}; };
}; };

View file

@ -22,6 +22,7 @@ in {
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")] [(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
++ optional cfg.lazygit.enable { ++ optional cfg.lazygit.enable {
key = cfg.lazygit.mappings.open; key = cfg.lazygit.mappings.open;
mode = "n";
desc = lazygitMapDesc; desc = lazygitMapDesc;
}; };

View file

@ -93,6 +93,7 @@ in {
setup = { setup = {
style ? "dark", style ? "dark",
transparent ? false, transparent ? false,
...
}: let }: let
style' = style' =
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style; warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
@ -117,6 +118,7 @@ in {
setup = { setup = {
style ? "dark", style ? "dark",
transparent ? false, transparent ? false,
...
}: '' }: ''
-- Gruvbox theme -- Gruvbox theme
require("gruvbox").setup({ require("gruvbox").setup({
@ -152,6 +154,7 @@ in {
setup = { setup = {
style ? "main", style ? "main",
transparent ? false, transparent ? false,
...
}: '' }: ''
require("rose-pine").setup({ require("rose-pine").setup({
dark_variant = "${style}", -- main, moon, or dawn dark_variant = "${style}", -- main, moon, or dawn

View file

@ -34,36 +34,37 @@ in {
keys = keys =
[ [
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>") (mkSetLznBinding "n" mappings.findFiles "<cmd>Telescope find_files<CR>")
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>") (mkSetLznBinding "n" mappings.liveGrep "<cmd>Telescope live_grep<CR>")
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>") (mkSetLznBinding "n" mappings.buffers "<cmd>Telescope buffers<CR>")
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>") (mkSetLznBinding "n" mappings.helpTags "<cmd>Telescope help_tags<CR>")
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>") (mkSetLznBinding "n" mappings.open "<cmd>Telescope<CR>")
(mkSetLznBinding "n" mappings.resume "<cmd>Telescope resume<CR>")
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>") (mkSetLznBinding "n" mappings.gitCommits "<cmd>Telescope git_commits<CR>")
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>") (mkSetLznBinding "n" mappings.gitBufferCommits "<cmd>Telescope git_bcommits<CR>")
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>") (mkSetLznBinding "n" mappings.gitBranches "<cmd>Telescope git_branches<CR>")
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>") (mkSetLznBinding "n" mappings.gitStatus "<cmd>Telescope git_status<CR>")
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>") (mkSetLznBinding "n" mappings.gitStash "<cmd>Telescope git_stash<CR>")
] ]
++ (optionals config.vim.lsp.enable [ ++ (optionals config.vim.lsp.enable [
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>") (mkSetLznBinding "n" mappings.lspDocumentSymbols "<cmd>Telescope lsp_document_symbols<CR>")
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>") (mkSetLznBinding "n" mappings.lspWorkspaceSymbols "<cmd>Telescope lsp_workspace_symbols<CR>")
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>") (mkSetLznBinding "n" mappings.lspReferences "<cmd>Telescope lsp_references<CR>")
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>") (mkSetLznBinding "n" mappings.lspImplementations "<cmd>Telescope lsp_implementations<CR>")
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>") (mkSetLznBinding "n" mappings.lspDefinitions "<cmd>Telescope lsp_definitions<CR>")
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>") (mkSetLznBinding "n" mappings.lspTypeDefinitions "<cmd>Telescope lsp_type_definitions<CR>")
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>") (mkSetLznBinding "n" mappings.diagnostics "<cmd>Telescope diagnostics<CR>")
]) ])
++ ( ++ (
optionals config.vim.treesitter.enable [ optionals config.vim.treesitter.enable [
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>") (mkSetLznBinding "n" mappings.treesitter "<cmd>Telescope treesitter<CR>")
] ]
) )
++ ( ++ (
optionals config.vim.projects.project-nvim.enable [ optionals config.vim.projects.project-nvim.enable [
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>") (mkSetLznBinding "n" mappings.findProjects "<cmd>Telescope projects<CR>")
] ]
); );
}; };

View file

@ -9,7 +9,6 @@
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryBefore entryAfter;
cfg = config.vim.lazy; cfg = config.vim.lazy;
toLuaLznKeySpec = keySpec: toLuaLznKeySpec = keySpec:
@ -50,6 +49,16 @@
end end
''; '';
load =
if spec.load != null
then
mkLuaInline ''
funcion()
${spec.load}
end
''
else null;
keys = keys =
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set" if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys) then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)

View file

@ -22,21 +22,21 @@
''; '';
desc = mkOption { desc = mkOption {
description = "Description of the key map";
type = nullOr str; type = nullOr str;
default = null; default = null;
description = "Description of the key map";
}; };
ft = mkOption { ft = mkOption {
description = "TBD";
type = nullOr (listOf str); type = nullOr (listOf str);
default = null; default = null;
description = "TBD";
}; };
mode = mkOption { mode = mkOption {
description = "Modes to bind in";
type = either str (listOf str); type = either str (listOf str);
default = ["n" "x" "s" "o"]; example = ["n" "x" "o"];
description = "Modes to bind in";
}; };
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map."; silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
@ -48,6 +48,21 @@
}; };
}; };
lznEvent = submodule {
options = {
event = mkOption {
type = nullOr (either str (listOf str));
example = "BufEnter";
description = "Exact event name";
};
pattern = mkOption {
type = nullOr (either str (listOf str));
example = "BufEnter *.lua";
description = "Event pattern";
};
};
};
lznPluginType = submodule { lznPluginType = submodule {
options = { options = {
package = mkOption { package = mkOption {
@ -57,84 +72,67 @@
setupModule = mkOption { setupModule = mkOption {
type = nullOr str; type = nullOr str;
description = "Lua module to run setup function on.";
default = null; default = null;
description = "Lua module to run setup function on.";
}; };
setupOpts = mkOption { setupOpts = mkOption {
type = attrsOf anything; type = attrsOf anything;
description = "Options to pass to the setup function";
default = {}; default = {};
description = "Options to pass to the setup function";
}; };
# lz.n options # lz.n options
enabled = mkOption { enabled = mkOption {
type = nullOr (either bool str); type = nullOr (either bool str);
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
default = null; default = null;
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
}; };
beforeAll = mkOption { beforeAll = mkOption {
type = nullOr lines; type = nullOr lines;
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
default = null; default = null;
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
}; };
before = mkOption { before = mkOption {
type = nullOr lines; type = nullOr lines;
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
default = null; default = null;
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
}; };
after = mkOption { after = mkOption {
type = nullOr lines; type = nullOr lines;
default = null;
description = '' description = ''
Lua code to run after plugin is loaded. This will be wrapped in a function. Lua code to run after plugin is loaded. This will be wrapped in a function.
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`. If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
''; '';
default = null;
}; };
event = mkOption { event = mkOption {
description = "Lazy-load on event"; type = nullOr (oneOf [str (listOf str) lznEvent]);
default = null; default = null;
type = let description = "Lazy-load on event";
event = submodule {
options = {
event = mkOption {
type = nullOr (either str (listOf str));
description = "Exact event name";
example = "BufEnter";
};
pattern = mkOption {
type = nullOr (either str (listOf str));
description = "Event pattern";
example = "BufEnter *.lua";
};
};
};
in
nullOr (oneOf [str (listOf str) event]);
}; };
cmd = mkOption { cmd = mkOption {
description = "Lazy-load on command";
default = null;
type = nullOr (either str (listOf str)); type = nullOr (either str (listOf str));
default = null;
description = "Lazy-load on command";
}; };
ft = mkOption { ft = mkOption {
description = "Lazy-load on filetype";
default = null;
type = nullOr (either str (listOf str)); type = nullOr (either str (listOf str));
default = null;
description = "Lazy-load on filetype";
}; };
keys = mkOption { keys = mkOption {
description = "Lazy-load on key mapping";
default = null;
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]); type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
default = null;
example = '' example = ''
keys = [ keys = [
{ {
@ -152,20 +150,21 @@
} }
] ]
''; '';
description = "Lazy-load on key mapping";
}; };
colorscheme = mkOption { colorscheme = mkOption {
description = "Lazy-load on colorscheme.";
type = nullOr (either str (listOf str)); type = nullOr (either str (listOf str));
default = null; default = null;
description = "Lazy-load on colorscheme.";
}; };
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`."; lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
priority = mkOption { priority = mkOption {
type = nullOr int; type = nullOr int;
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
default = null; default = null;
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
}; };
load = mkOption { load = mkOption {
@ -183,20 +182,14 @@ in {
options.vim.lazy = { options.vim.lazy = {
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;}; enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
loader = mkOption { loader = mkOption {
description = "Lazy loader to use";
type = enum ["lz.n"]; type = enum ["lz.n"];
default = "lz.n"; default = "lz.n";
description = "Lazy loader to use";
}; };
plugins = mkOption { plugins = mkOption {
default = {};
type = attrsOf lznPluginType; type = attrsOf lznPluginType;
description = '' default = {};
Plugins to lazy load.
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
function this should be either the `package.pname` or `package.name`.
'';
example = '' example = ''
{ {
toggleterm-nvim = { toggleterm-nvim = {
@ -214,15 +207,21 @@ in {
}; };
} }
''; '';
description = ''
Plugins to lazy load.
The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
function this should be either the `package.pname` or `package.name`.
'';
}; };
enableLznAutoRequire = mkOption { enableLznAutoRequire = mkOption {
type = bool;
default = true;
description = '' description = ''
Enable lzn-auto-require. Since builtin plugins rely on this, only turn Enable lzn-auto-require. Since builtin plugins rely on this, only turn
off for debugging. off for debugging.
''; '';
type = bool;
default = true;
}; };
builtLazyConfig = mkOption { builtLazyConfig = mkOption {