Merge branch 'main' of github.com:NotAShelf/neovim-flake into nim-lang

This commit is contained in:
raf 2024-02-07 20:04:00 +03:00
commit 38bf156537
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
74 changed files with 2027 additions and 1509 deletions

View file

@ -38,7 +38,7 @@ jobs:
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v13
- uses: cachix/cachix-action@v14
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community

View file

@ -39,8 +39,13 @@ jobs:
- name: Build documentation packages
run: nix build .#${{ matrix.package }} --print-build-logs
- name: Get current date
id: get-date
# output format: 2023-12-22-120000
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: doc
name: "${{ matrix.package }}"
path: result/share/doc/neovim-flake/

View file

@ -56,15 +56,8 @@ inputs: let
nix.enable = true;
html.enable = isMaximal;
clang = {
enable = isMaximal;
lsp.server = "clangd";
};
css.enable = isMaximal;
sql.enable = isMaximal;
rust = {
enable = isMaximal;
crates.enable = true;
};
java.enable = isMaximal;
ts.enable = isMaximal;
svelte.enable = isMaximal;
@ -72,10 +65,20 @@ inputs: let
zig.enable = isMaximal;
python.enable = isMaximal;
dart.enable = isMaximal;
elixir.enable = false;
elixir.enable = isMaximal;
bash.enable = isMaximal;
terraform.enable = isMaximal;
nim.enable = isMaximal;
tailwind.enable = isMaximal;
clang = {
enable = isMaximal;
lsp.server = "clangd";
};
rust = {
enable = isMaximal;
crates.enable = true;
};
};
vim.visuals = {
@ -233,17 +236,7 @@ inputs: let
};
vim.presence = {
presence-nvim = {
enable = true;
auto_update = true;
image_text = "The Superior Text Editor";
client_id = "793271441293967371";
main_image = "neovim";
show_time = true;
rich_presence = {
editing_text = "Editing %s";
};
};
neocord.enable = true;
};
};
};

View file

@ -2,6 +2,7 @@
pkgs,
lib ? import ../lib/stdlib-extended.nix pkgs.lib,
nmdSrc,
...
}: let
nmd = import nmdSrc {
inherit lib;
@ -29,6 +30,8 @@
];
};
dontCheckDefinitions = {_module.check = false;};
githubDeclaration = user: repo: subpath: let
urlRef = "main";
in {
@ -36,84 +39,88 @@
name = "<${repo}/${subpath}>";
};
dontCheckDefinitions = {_module.check = false;};
nvimPath = toString ./..;
buildOptionsDocs = args @ {
modules,
includeModuleSystemsOptions ? true,
includeModuleSystemOptions ? true,
...
}: let
options = (lib.evalModules {inherit modules;}).options;
inherit ((lib.evalModules {inherit modules;})) options;
in
pkgs.buildPackages.nixosOptionsDoc
({
pkgs.buildPackages.nixosOptionsDoc ({
options =
if includeModuleSystemsOptions
if includeModuleSystemOptions
then options
else builtins.removeAttrs (options ["_module"]);
else builtins.removeAttrs options ["_module"];
transformOptions = opt:
opt
// {
# Clean up declaration sites to not refer to local source tree
declarations =
map
(decl:
# Clean up declaration sites to not refer to the Home Manager
# source tree.
declarations = map (decl:
if lib.hasPrefix nvimPath (toString decl)
then
githubDeclaration "notashelf" "neovim-flake"
(lib.removePrefix "/" (lib.removePrefix nvimPath (toString decl)))
else if decl == "lib/modules.nix"
then
# TODO: handle this in a better way (may require upstream
# changes to nixpkgs)
githubDeclaration "NixOS" "nixpkgs" decl
else decl)
opt.declarations;
};
}
// builtins.removeAttrs args ["modules" "includeModuleSystemsOptions"]);
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
nvimModuleDocs = buildOptionsDocs {
modules =
import ../modules/modules.nix
{
inherit pkgs lib;
import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [scrubbedPkgsModule];
variablelistId = "neovim-flake-options";
};
docs = nmd.buildDocBookDocs {
pathName = "neovim-flake";
projectName = "neovim-flake";
modulesDocs = [
{
docBook = pkgs.linkFarm "nvim-module-docs-for-nmd" {
"nmd-result/neovim-flake-options.xml" = nvimModuleDocs.optionsDocBook;
};
}
];
documentsDirectory = ./.;
documentType = "book";
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-neovim-flake-manual">
<?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-options">
<?dbhtml filename="options.html"?>
</d:tocentry>
<d:tocentry linkend="ch-release-notes">
<?dbhtml filename="release-notes.html"?>
</d:tocentry>
</d:tocentry>
</toc>
release-config = builtins.fromJSON (builtins.readFile ../release.json);
revision = "release-${release-config.release}";
# Generate the `man home-configuration.nix` package
nvf-configuration-manual =
pkgs.runCommand "neovim-flake-reference-manpage" {
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
allowedReferences = ["out"];
} ''
# Generate manpages.
mkdir -p $out/share/man/man5
mkdir -p $out/share/man/man1
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${revision} \
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/neovim-flake.5
cp ${./neovim-flake.1} $out/share/man/man1/neovim-flake.1
'';
# Generate the HTML manual pages
neovim-flake-manual = pkgs.callPackage ./manual.nix {
inherit revision;
outputPath = "share/doc/neovim-flake";
nmd = nmdSrc;
options = {
neovim-flake = nvimModuleDocs.optionsJSON;
};
};
html = neovim-flake-manual;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
in {
options.json =
pkgs.runCommand "options.json"
# TODO: Use `nvimOptionsDoc.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable
{
meta.description = "List of neovim-flake options in JSON format";
inherit nmdSrc;
options = {
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
json =
pkgs.runCommand "options.json" {
meta.description = "List of Home Manager options in JSON format";
} ''
mkdir -p $out/{share/doc,nix-support}
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/neovim-flake
@ -124,8 +131,8 @@ in {
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/neovim-flake"
'';
};
inherit (docs) manPages;
manual = {inherit (docs) html htmlOpenTool;};
manPages = nvf-configuration-manual;
manual = {inherit html htmlOpenTool;};
}

3
docs/footer.5 Normal file
View file

@ -0,0 +1,3 @@
.SH "AUTHORS"
.PP
neovim-flake contributors

14
docs/header.5 Normal file
View file

@ -0,0 +1,14 @@
.TH "neovim-flake" "5" "01/01/1980" "neovim-flake"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" enable line breaks after slashes
.cflags 4 /
.SH "NAME"
neovim-flake configuration specification
.SH "OPTIONS"
.PP
You can use the following options in
home\-configuration\&.nix:
.PP

8
docs/highlight-style.css Normal file
View file

@ -0,0 +1,8 @@
pre {
padding: 0;
}
pre code.hljs {
border: none;
margin: 0;
}

43
docs/html-open-tool.nix Normal file
View file

@ -0,0 +1,43 @@
{
writeShellScriptBin,
makeDesktopItem,
symlinkJoin,
}: {
html,
pathName ? "neovim-flake",
projectName ? pathName,
name ? "${pathName}-help",
}: let
helpScript = writeShellScriptBin name ''
set -euo pipefail
if [[ ! -v BROWSER || -z $BROWSER ]]; then
for candidate in xdg-open open w3m; do
BROWSER="$(type -P $candidate || true)"
if [[ -x $BROWSER ]]; then
break;
fi
done
fi
if [[ ! -v BROWSER || -z $BROWSER ]]; then
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
fi
'';
desktopItem = makeDesktopItem {
name = "${pathName}-manual";
desktopName = "${projectName} Manual";
genericName = "View ${projectName} documentation in a web browser";
icon = "nix-snowflake";
exec = "${helpScript}/bin/${name}";
categories = ["System"];
};
in
symlinkJoin {
inherit name;
paths = [helpScript desktopItem];
}

View file

@ -1,50 +0,0 @@
<refentry xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refmeta>
<refentrytitle>neovim-flake configuration</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class="source">neovim-flake</refmiscinfo>
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
</refmeta>
<refnamediv>
<refname>neovim configuration</refname>
<refpurpose>neovim-flake configuration specification</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>
Custom configuration is done with the neovim-flake.lib.neovimConfiguration if home-manager module is not in use.
It takes in the configuration as a module.
<programlisting>
neovim-flake.lib.neovimConfiguration {
inherit pkgs;
modules = [{config = xxx;}];
};
</programlisting>
The output of the configuration function is an attrset.
</para>
<para>
In case of the home-manager module, all options will be available under programs.neovim-flake once the module has
been imported from the flake inputs.
<programlisting>
{
options = "The options that were available to configure";
config = "The outputted configuration";
pkgs = "The package set used to evaluate the module";
neovim = "The built neovim package";
}
</programlisting>
</para>
</refsection>
<refsection>
<title>Options</title>
<para>
You can use the following options in your neovim configuration.
</para>
<xi:include href="./nmd-result/neovim-flake-options.xml" xpointer="neovim-flake-options"/>
</refsection>
</refentry>

View file

@ -1,13 +0,0 @@
<reference xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>neovim-flake Reference Pages</title>
<info>
<author><personname>neovim-flake contributors</personname></author>
<copyright>
<year>2023</year>
<holder>neovim-flake contributors</holder>
</copyright>
</info>
<xi:include href="man-configuration.xml" />
</reference>

65
docs/manual.nix Normal file
View file

@ -0,0 +1,65 @@
{
stdenv,
lib,
documentation-highlighter,
nmd,
revision,
outputPath ? "share/doc/neovim-flake",
options,
nixos-render-docs,
}:
stdenv.mkDerivation {
name = "neovim-flake-manual";
src = ./manual;
nativeBuildInputs = [nixos-render-docs];
buildPhase = ''
mkdir -p out/media
mkdir -p out/highlightjs
cp -t out/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
substituteInPlace ./options.md \
--replace \
'@OPTIONS_JSON@' \
${options.neovim-flake}/share/doc/nixos/options.json
substituteInPlace ./manual.md \
--replace \
'@VERSION@' \
${revision}
cp -v ${nmd}/static/style.css out/style.css
cp -vt out/highlightjs ${nmd}/static/highlightjs/tomorrow-night.min.css
cp -v ${./highlight-style.css} out/highlightjs/highlight-style.css
cp -vr ${./release-notes} release-notes
nixos-render-docs manual html \
--manpage-urls ./manpage-urls.json \
--revision ${lib.trivial.revisionWithDefault revision} \
--stylesheet style.css \
--stylesheet highlightjs/tomorrow-night.min.css \
--stylesheet highlightjs/highlight-style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
out/index.xhtml
'';
installPhase = ''
dest="$out/${outputPath}"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}

View file

@ -1,31 +0,0 @@
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="book-neovim-flake-manual">
<info>
<title>neovim-flake Manual</title>
</info>
<preface>
<title>Preface</title>
<para>
If you believe your problem is caused by a bug in neovim-flake then please consider reporting it over
<link xlink:href="tps://github.com/notashelf/neovim-flake/issues">the neovim-flake issue tracker</link>.
Bugfixes, feature additions and upstream changes are welcome over
<link xlink:href="https://github.com/notashelf/neovim-flake/pulls">the neovim-flake pull requests tab</link>.
</para>
</preface>
<xi:include href="manual/try-it-out.xml"/>
<xi:include href="manual/default-configs.xml"/>
<xi:include href="manual/custom-configs.xml"/>
<xi:include href="manual/custom-package.xml"/>
<xi:include href="manual/custom-plugins.xml"/>
<xi:include href="manual/home-manager.xml"/>
<xi:include href="manual/languages.xml"/>
<xi:include href="manual/hacking.xml"/>
<appendix xml:id="ch-options">
<title>Configuration Options</title>
<xi:include href="nmd-result/neovim-flake-options.xml" xpointer="neovim-flake-options" />
</appendix>
<xi:include href="release-notes/release-notes.xml"/>
</book>

View file

@ -1,23 +1,20 @@
[[ch-custom-configuration]]
== Custom Configuration
# Custom Configuration {#ch-custom-configuration}
Custom configuration is done with the `neovimConfiguration` while using the flake as a standalone package.
It takes in the configuration as a module. The output of the configuration function is an attrset.
[source,nix]
----
```nix
{
options = "The options that were available to configure";
config = "The outputted configuration";
pkgs = "The package set used to evaluate the module";
neovim = "The built neovim package";
}
----
```
The following is an example of a barebones vim configuration with the default theme enabled.
[source,nix]
----
```nix
{
inputs.neovim-flake = {
url = "github:notashelf/neovim-flake";
@ -59,10 +56,8 @@ The following is an example of a barebones vim configuration with the default th
};
};
}
----
```
Your built neovim configuration can be exposed as a flake output, or be added to your system packages to make
it available across your system. You may also consider passing the flake output to home-manager to make it available
to a specific user *without* using the home-manager module.
to a specific user _without_ using the home-manager module.

View file

@ -1,14 +1,12 @@
[[ch-custom-package]]
== Custom Neovim Package
# Custom Neovim Package {#ch-custom-package}
As of v0.5, you may now specify the neovim package that will be wrapped with your configuration. This is done with the `vim.package` option.
[source,nix]
----
```nix
{inputs, pkgs, ...}: {
# using the neovim-nightly overlay
config.vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
}
----
```
The neovim-nightly-overlay always exposes an unwrapped package. If using a different source, you are highly recommended to get an "unwrapped" version of the neovim package,similar to `neovim-unwrapped` in nixpkgs.

View file

@ -1,74 +0,0 @@
[[ch-custom-plugins]]
== Custom Plugins
You can use custom plugins, before they are implemented in the flake.
To add a plugin, you need to add it to your config's `config.vim.startPlugins` array.
[[sec-new-method]]
=== New Method
As of version 0.5, we have a more extensive API for configuring plugins, under `vim.extraPlugins`.
Instead of using DAGs exposed by the library, you may use the extra plugin module as follows:
[source,nix]
----
{
config.vim.extraPlugins = with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = ''
require('aerial').setup {
-- some lua configuration here
}
'';
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"];
};
};
}
----
[[sec-old-method]]
=== Old Method
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 the plugins is determined by DAGs.
[source,nix]
----
{
# fetch plugin source from GitHub and add it to startPlugins
config.vim.startPlugins = [
(pkgs.fetchFromGitHub {
owner = "FrenzyExists";
repo = "aquarium-vim";
rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5";
sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs=";
})
];
}
----
However, just making the plugin available might not be enough. In that case, you can write custom vimscript
or lua config, using `config.vim.configRC` or `config.vim.luaConfigRC` respectively.
These options are attribute sets, and you need to give the configuration you're adding some name, like this:
[source,nix]
----
{
# this will create an "aquarium" section in your init.vim with the contents of your custom config
# which will be *appended* to the rest of your configuration, inside your init.vim
config.vim.configRC.aquarium = "colorscheme aquiarum";
}
----
Note: If your configuration needs to be put in a specific place in the config, you can use functions from
`inputs.neovim-flake.lib.nvim.dag` to order it.
Refer to https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix to find out more about
the DAG system.
Also, if you successfully made your plugin work, please make a PR to add it to the flake, or open an issue
with your findings so that we can make it available for everyone easily.

View file

@ -0,0 +1,10 @@
# Custom Plugins {#ch-custom-plugins}
You can use custom plugins, before they are implemented in the flake.
To add a plugin, you need to add it to your config's `config.vim.startPlugins` array.
```{=include=} sections
custom-plugins/new-method.md
custom-plugins/old-method.md
custom-plugins/configuring.md
```

View file

@ -0,0 +1,23 @@
# Configuring {#configuring-plugins}
Just making the plugin to your neovim configuration available might not always be enough.
In that case, you can write custom vimscript or lua config, using `config.vim.configRC` or `config.vim.luaConfigRC`
respectively. These options are attribute sets, and you need to give the configuration you're adding some name, like this:
```nix
{
# this will create an "aquarium" section in your init.vim with the contents of your custom config
# which will be *appended* to the rest of your configuration, inside your init.vim
config.vim.configRC.aquarium = "colorscheme aquiarum";
}
```
:::{.note}
If your configuration needs to be put in a specific place in the config, you can use functions from
`inputs.neovim-flake.lib.nvim.dag` to order it.
Refer to https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix to find out more about
the DAG system.
:::
Also, if you successfully made your plugin work, please make a PR to add it to the flake, or open an issue
with your findings so that we can make it available for everyone easily.

View file

@ -0,0 +1,26 @@
# New Method {#sec-new-method}
As of version 0.5, we have a more extensive API for configuring plugins, under `vim.extraPlugins`.
Instead of using DAGs exposed by the library, you may use the extra plugin module as follows:
```nix
{
config.vim.extraPlugins = with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = ''
require('aerial').setup {
-- some lua configuration here
}
'';
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"];
};
};
}
```

View file

@ -0,0 +1,18 @@
# Old Method {#sec-old-method}
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 the plugins is determined by DAGs.
```nix
{
# fetch plugin source from GitHub and add it to startPlugins
config.vim.startPlugins = [
(pkgs.fetchFromGitHub {
owner = "FrenzyExists";
repo = "aquarium-vim";
rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5";
sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs=";
})
];
}
```

View file

@ -1,36 +0,0 @@
[[ch-default-configs]]
== Default Configs
While you can configure neovim-flake yourself using the builder, here are a few default configurations you can use.
[[sec-default-tidal]]
=== Tidal Cycles
[source,console]
$ nix run github:notashelf/neovim-flake#tidal file.tidal
Utilizing https://github.com/tidalcycles/vim-tidal[vim-tidal] and mitchmindtree's fantastic https://github.com/mitchmindtree/tidalcycles.nix[tidalcycles.nix] start playing with tidal cycles in a single command.
In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter_. Super collider with superdirt, and a modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using pipewire, its as easy as setting `services.pipewire.jack.enable = true`.
[[sec-default-nix]]
=== Nix
[source,console]
$ nix run github:notashelf/neovim-flake#nix test.nix
Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.
[[sec-default-maximal]]
=== Maximal
[source,console]
$ nix shell github:notashelf/neovim-flake#maximal test.nix
It is the same fully configured neovim as with the <<sec-default-nix,Nix>> config, but with every supported language enabled.
[NOTE]
====
Running the maximal config will download *a lot* of packages as it is downloading language servers, formatters, and more.
====

View file

@ -0,0 +1,10 @@
# Default Configs {#ch-default-configs}
While you can configure neovim-flake yourself using the builder, you can also use the pre-built configs that are available.
Here are a few default configurations you can use.
```{=include=} sections
default-configs/maximal.md
default-configs/nix.md
default-configs/tidal.md
```

View file

@ -0,0 +1,13 @@
# Maximal {#sec-default-maximal}
```bash
$ nix shell github:notashelf/neovim-flake#maximal test.nix
```
It is the same fully configured neovim as with the [Nix](#sec-default-nix) config, but with every supported language enabled.
:::{.note}
Running the maximal config will download _a lot_ of packages as it is downloading language servers, formatters, and more.
:::

View file

@ -0,0 +1,7 @@
# Nix {#sec-default-nix}
```bash
$ nix run github:notashelf/neovim-flake#nix test.nix
```
Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.

View file

@ -0,0 +1,12 @@
# Tidal Cycles {#sec-default-tidal}
```bash
$ nix run github:notashelf/neovim-flake#tidal file.tidal
```
Utilizing [vim-tidal](https://github.com/tidalcycles/vim-tidal) and mitchmindtree's fantastic
[tidalcycles.nix](https://github.com/mitchmindtree/tidalcycles.nix) start playing with tidal cycles in a single command.
In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter_. Super collider with superdirt, and a
modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using
pipewire, its as easy as setting `services.pipewire.jack.enable = true` in your configuration.

View file

@ -1,412 +0,0 @@
[[ch-hacking]]
== Hacking neovim-flake
neovim-flake is designed for developers as much as it is for the end user. I would like any potential contributor
to be able to propagate their desired changes into the repository without the extra effort. As such, below are guides
(and guidelines) to streamline the contribution process and ensure that your valuable input seamlessly integrates
into neovim-flake's development without leaving question marks in your head.
:fork-a-repo: https://help.github.com/articles/fork-a-repo/
:open-issues: https://github.com/notashelf/neovim-flake/issues
:new-issue: https://github.com/notashelf/neovim-flake/issues/new
:seven-rules: https://cbea.ms/git-commit/#seven-rules
:example-commit-message: https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef
This section is mainly directed towards those who wish to contribute code into neovim-flake. If you wish to instead
report a bug or discuss a potential feature implementation, first look among the already {open-issues}[open issues] and
if no matching issue exists you may open a {new-issue}[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.
[[sec-contrib-getting-started]]
=== Getting started
You naturally would like to start by forking the repository. If you are new to git, have a look at GitHub's
{fork-a-repo}[Fork a repo guide] for instructions on how you can do this. Once you have a fork of neovim-flake
you should create a branch starting at the most recent `main` branch.
Give your branch a reasonably descriptive name, suffixed by its type - i.e `feature/debugger` or `fix/pesky-bug`.
Implement your changes and commit them to the newly created branch and when you are happy with the result and positive
that it fulfills <<sec-guidelines>>. Once you are confident everything is in order, push the branch to GitHub and
{create-a-pull-request}[create a pull request], following the template that you will be prompted to fill.
[[sec-guidelines]]
=== Guidelines
:assertions: https://nixos.org/manual/nixos/stable/index.html#sec-assertions
:discussions-tab: https://github.com/NotAShelf/neovim-flake/discussions
If your contribution tightly follows the guidelines, then there is a good chance it will be merged without too much
trouble. Some of the guidelines will be strictly enforced, others will remain as gentle nudges towards the correct
direction. As we have no automated system enforcing those guidelines, please try to double check your changes before
making your pull request in order to avoid "faulty" code slipping by.
If you are uncertain how these rules affect the change you would like to make then feel free to start a
discussion in the {discussions-tab}[discussions tab] ideally (but not necessarily) before you start developing.
[[sec-documentation]]
==== Add adequate documentation
:nixpkgs-markdown: https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup
:docbook: https://tdg.docbook.org/
:asciidoc: https://asciidoc.org/
Most, if not all, changes warrant changes to the documentation. Module options should be documented with
{nixpkgs-markdown}[Nixpkgs-flavoured Markdown], albeit with exceptions.
neovim-flake is itself documented using a combination of {docbook}[DocBook] and {asciidoc}[AsciiDoc] conventions.
The HTML version of this manual containing both the module option descriptions and the documentation of neovim-flake
(such as this page) can be generated and opened by typing the following in a shell within a clone of the
neovim-flake Git repository:
[source,console]
----
$ nix build .#docs-html
$ xdg-open ./result/share/doc/neovim-flake/index.html
----
[[sec-guidelines-code-style]]
==== Format your code
Make sure your code is formatted as described in <<sec-code-style>>. To maintain consistency throughout the project
you are encouraged to browse through existing code and adopt its style also in new code.
[[sec-guidelines-commit-message-style]]
==== Format your commit messages
Similar to <<sec-guidelines-code-style>> we encourage a consistent commit message format as described
in <<sec-commit-style>>.
[[sec-commit-style]]
==== Commits
The commits in your pull request should be reasonably self-contained. Which means each and every commit in
a pull request should make sense both on its own and in general context. That is, a second commit should not resolve
an issue that is introduced in an earlier commit. In particular, you will be asked to amend any commit that
introduces syntax errors or similar problems even if they are fixed in a later commit.
The commit messages should follow the {seven-rules}[seven rules], except for "Capitalize the subject line".
We also ask you to include the affected code component or module in the first line.
A commit message ideally, but not necessarily, follow the given template from home-manager's own documentation
----
{component}: {description}
{long description}
----
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief
description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if
there is no clear component, or your change affects many components, then the `{component}` part is optional.
See <<ex-commit-message>> for a commit message that fulfills these requirements.
[[ex-commit-message]]
.Compliant commit message
===============================================================================
The commit {example-commit-message}[69f8e47e9e74c8d3d060ca22e18246b7f7d988ef] contains the commit message
----
starship: allow running in Emacs if vterm is used
The vterm buffer is backed by libvterm and can handle Starship prompts
without issues.
----
===============================================================================
Long description can be ommitted if the change is too simple to warrant it. A minor fix in spelling or a formatting
change does not warrant long description, however, a module addition or removal does as you would like to provide the
relevant context for your changes.
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed commit format `foo: add module`.
You can, of course, still include a long description if you wish.
In case of nested modules, i.e `modules/languages/java.nix` you are recommended to contain the parent as well - for
example `languages/java: some major change`.
[[sec-code-style]]
==== Code Style
:alejandra: https://github.com/kamadorueda/alejandra
**Treewide**
Keep lines at a reasonable width, ideally 80 characters or less. This also applies to string literals and module
descriptions and documentation.
**Nix**
neovim-flake is formatted by the {alejandra}[alejandra] tool and the formatting is checked in the pull
request and push workflows. Run the `nix fmt` command inside the project repository before submitting your
pull request.
While Alejandra is mostly opinionated on how code looks after formatting, certain changes are done at the
user's discretion based on how the original code was structured.
Please use one line code for attribute sets that contain only one subset.
For example:
[source,nix]
----
# parent modules should always be unfolded
# which means module = { value = ... } instead of module.value = { ... }
module = {
value = mkEnableOption "some description" // { default = true; }; # merges can be done inline where possible
# same as parent modules, unfold submodules
subModule = {
# this is an option that contains more than one nested value
someOtherValue = mkOption {
type = lib.types.bool;
description = "Some other description"
default = true;
};
};
}
----
If you move a line down after the merge operator, Alejandra will automatically unfold the whole merged attrset
for you, which we **do not** want.
[source,nix]
----
module = {
key = mkEnableOption "some description" // {
default = true; # we want this to be inline
};
# ...
}
----
For lists, it is mostly up to your own discretion how you want to format them, but please try to unfold lists if
they contain multiple items and especially if they are to include comments.
[source,nix]
----
# this is ok
acceptableList = [
item1 # comment
item2
item3 # some other comment
item4
];
# this is not ok
listToBeAvoided = [item1 item2 /* comment */ item3 item4];
# this is ok
singleItemList = [item1];
----
[[sec-testing]]
=== Testing Your Changes
Once you have made your changes, you will need to test them throughly. If it is a module, add your module option to
`configuration.nix` (located in the root of this project) inside `neovimConfiguration`. Enable it, and then run the
maximal configuration with `nix run .#maximal -Lv` to check for build errors. If neovim opens in the current directory
without any error messages (you can check the output of `:messages` inside neovim to see if there are any errors), then
your changes are good to go. Open your pull request, and it will be reviewed as soon as posssible.
If it is not a new module, but a change to an existing one, then make sure the module you have changed is enabled in the
maximal configuration by editing `configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same procedure as
adding a new module will apply here.
[[sec-keybinds]]
=== Keybinds
As of 0.4, there exists an API for writing your own keybinds and a couple of useful utility functions are available in
the https://github.com/NotAShelf/neovim-flake/tree/main/lib[extended standard library]. The following section contains
a general overview to how you may utilize said functions.
[[sec-custom-key-mappings]]
==== Custom Key Mappings Support for a Plugin
:maps: https://notashelf.github.io/neovim-flake/options.html#opt-vim.maps.command._name_.action
To set a mapping, you should define it in `vim.maps.<<mode>>`.
The available modes are:
* normal
* insert
* select
* visual
* terminal
* normalVisualOp
* visualOnly
* operator
* insertCommand
* lang
* command
An example, simple keybinding, can look like this:
[source,nix]
----
{
vim.maps.normal = {
"<leader>wq" = {
action = ":wq<CR>";
silent = true;
desc = "Save file and quit";
};
};
}
----
There are many settings available in the options. Please refer to the {maps}[documentation] to see a list of them.
`neovim-flake` provides a list of helper commands, so that you don't have to write the mapping attribute sets every
time:
* `mkBinding = key: action: desc:` - makes a basic binding, with `silent` set to true.
* `mkExprBinding = key: action: desc:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
* `mkLuaBinding = key: action: desc:` - makes an expression binding, with `lua`, and `silent` set to true.
Note that the Lua in these bindings is actual Lua, not pasted into a `:lua` command.
Therefore, you either pass in a function like `require('someplugin').some_function`, without actually calling it,
or you define your own function, like `function() require('someplugin').some_function() end`.
Additionally, to not have to repeat the descriptions, there's another utility function with its own set of functions:
[source,nix]
----
# Utility function that takes two attrsets:
# { someKey = "some_value" } and
# { someKey = { description = "Some Description"; }; }
# and merges them into
# { someKey = { value = "some_value"; description = "Some Description"; }; }
addDescriptionsToMappings = actualMappings: mappingDefinitions:
----
This function can be used in combination with the same `mkBinding` functions as above, except they only take two
arguments - `binding` and `action`, and have different names:
* `mkSetBinding = binding: action:` - makes a basic binding, with `silent` set to true.
* `mkSetExprBinding = binding: action:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
* `mkSetLuaBinding = binding: action:` - makes an expression binding, with `lua`, and `silent` set to true.
You can read the source code of some modules to see them in action, but their usage should look something like this:
[source,nix]
----
# plugindefinition.nix
{lib, ...}:
with lib; {
options.vim.plugin = {
enable = mkEnableOption "Enable plugin";
# Mappings should always be inside an attrset called mappings
mappings = {
# mkMappingOption is a helper function from lib,
# that takes a description (which will also appear in which-key),
# and a default mapping (which can be null)
toggleCurrentLine = mkMappingOption "Toggle current line comment" "gcc";
toggleCurrentBlock = mkMappingOption "Toggle current block comment" "gbc";
toggleOpLeaderLine = mkMappingOption "Toggle line comment" "gc";
toggleOpLeaderBlock = mkMappingOption "Toggle block comment" "gb";
toggleSelectedLine = mkMappingOption "Toggle selected comment" "gc";
toggleSelectedBlock = mkMappingOption "Toggle selected block" "gb";
};
};
}
----
[source,nix]
----
# config.nix
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.plugin;
self = import ./plugindefinition.nix {inherit lib;};
mappingDefinitions = self.options.vim.plugin;
# addDescriptionsToMappings is a helper function from lib,
# that merges mapping values and their descriptions
# into one nice attribute set
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable) {
# ...
vim.maps.normal = mkMerge [
# mkSetBinding is another helper function from lib,
# that actually adds the mapping with a description.
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
(mkIf config.vim.lsp.enable (mkMerge [
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
]))
(
mkIf config.vim.treesitter.enable
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
)
];
# ...
};
}
----
[NOTE]
====
If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings,
don't be scared to implement a draft PR. We'll help you get it done.
====
[[sec-additional-plugins]]
=== Adding Plugins
To add a new neovim plugin, first add the source url in the inputs section of `flake.nix`
[source,nix]
----
{
inputs = {
# ...
neodev-nvim = {
url = "github:folke/neodev.nvim";
flake = false;
};
};
}
----
Then add the name of the plugin into the `availablePlugins` variable in `lib/types/plugins.nix`:
[source,nix]
----
# ...
availablePlugins = [
# ...
"neodev-nvim"
];
----
You can now reference this plugin using its string name:
[source,nix]
----
config.vim.startPlugins = ["neodev-nvim"];
----

21
docs/manual/hacking.md Normal file
View file

@ -0,0 +1,21 @@
# Hacking neovim-flake {#ch-hacking}
neovim-flake is designed for developers as much as it is for the end user. I would like any potential contributor
to be able to propagate their desired changes into the repository without the extra effort. As such, below are guides
(and guidelines) to streamline the contribution process and ensure that your valuable input seamlessly integrates
into neovim-flake's development without leaving question marks in your head.
This section is mainly directed towards those who wish to contribute code into neovim-flake. If you wish to instead
report a bug or discuss a potential feature implementation, first look among the
already [open issues](https://github.com/notashelf/neovim-flake/issues) and if no matching issue exists you may open
a [new issue](https://github.com/notashelf/neovim-flake/issues/new) 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.
```{=include=} sections
hacking/getting-started.md
hacking/guidelines.md
hacking/testing.md
hacking/keybinds.md
hacking/additional-plugins.md
```

View file

@ -0,0 +1,33 @@
# Adding Plugins {#sec-additional-plugins}
To add a new neovim plugin, first add the source url in the inputs section of `flake.nix`
```nix
{
inputs = {
# ...
neodev-nvim = {
url = "github:folke/neodev.nvim";
flake = false;
};
# ...
};
}
```
Then add the name of the plugin into the `availablePlugins` variable in `lib/types/plugins.nix`:
```nix
# ...
availablePlugins = [
# ...
"neodev-nvim"
];
```
You can now reference this plugin using its string name:
```nix
config.vim.startPlugins = ["neodev-nvim"];
```

View file

@ -0,0 +1,10 @@
# Getting Started {#sec-contrib-getting-started}
You naturally would like to start by forking the repository. If you are new to git, have a look at GitHub's
[Fork a repo guide](https://help.github.com/articles/fork-a-repo/) for instructions on how you can do this. Once you have a fork of neovim-flake
you should create a branch starting at the most recent `main` branch.
Give your branch a reasonably descriptive name, suffixed by its type - i.e `feature/debugger` or `fix/pesky-bug`.
Implement your changes and commit them to the newly created branch and when you are happy with the result and positive
that it fulfills [Guidelines](#sec-guidelines). Once you are confident everything is in order, push the branch to GitHub and
[create a pull request](https://help.github.com/articles/creating-a-pull-request), following the template that you will be prompted to fill.

View file

@ -0,0 +1,158 @@
# Guidelines {#sec-guidelines}
If your contribution tightly follows the guidelines, then there is a good chance it will be merged without too much
trouble. Some of the guidelines will be strictly enforced, others will remain as gentle nudges towards the correct
direction. As we have no automated system enforcing those guidelines, please try to double check your changes before
making your pull request in order to avoid "faulty" code slipping by.
If you are uncertain how these rules affect the change you would like to make then feel free to start a
discussion in the [discussions tab](https://github.com/NotAShelf/neovim-flake/discussions) ideally (but not necessarily)
before you start developing.
## Adding Documentation {#sec-guidelines-documentation}
Most, if not all, changes warrant changes to the documentation. Module options should be documented with
[Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup), albeit with exceptions.
:::{.note}
As of v0.5, neovim-flake is itself documented using full markdown in both module options and the manual. With
v0.6, this manual has also been converted to markdown in full.
:::
The HTML version of this manual containing both the module option descriptions and the documentation of neovim-flake
(such as this page) can be generated and opened by typing the following in a shell within a clone of the
neovim-flake Git repository:
```console
$ nix build .#docs-html
$ xdg-open $PWD/result/share/doc/neovim-flake/index.html
```
## Formatting Code {#sec-guidelines-formatting}
Make sure your code is formatted as described in [code-style section](#sec-guidelines-code-style). To maintain consistency throughout
the project you are encouraged to browse through existing code and adopt its style also in new code.
## Formatting Commits {#sec-guidelines-commit-message-style}
Similar to [code style guidelines](#sec-guidelines-code-style) we encourage a consistent commit message format as described
in [commit style guidelines](#sec-guidelines-commit-style).
## Commit Style {#sec-guidelines-commit-style}
The commits in your pull request should be reasonably self-contained. Which means each and every commit in
a pull request should make sense both on its own and in general context. That is, a second commit should not resolve
an issue that is introduced in an earlier commit. In particular, you will be asked to amend any commit that
introduces syntax errors or similar problems even if they are fixed in a later commit.
The commit messages should follow the [seven rules](https://chris.beams.io/posts/git-commit/#seven-rule),
except for "Capitalize the subject line". We also ask you to include the affected code component or module in
the first line. A commit message ideally, but not necessarily, follow the given template from home-manager's own documentation
```
{component}: {description}
{long description}
```
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief
description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if
there is no clear component, or your change affects many components, then the `{component}` part is optional.
See [example commit message](#sec-guidelines-ex-commit-message) for a commit message that fulfills these requirements.
## Example Commit {#sec-guidelines-ex-commit-message}
The commit [69f8e47e9e74c8d3d060ca22e18246b7f7d988ef](https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef) contains the commit message
```
starship: allow running in Emacs if vterm is used
The vterm buffer is backed by libvterm and can handle Starship prompts
without issues.
```
Long description can be ommitted if the change is too simple to warrant it. A minor fix in spelling or a formatting
change does not warrant long description, however, a module addition or removal does as you would like to provide the
relevant context for your changes.
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed commit format `foo: add module`.
You can, of course, still include a long description if you wish.
In case of nested modules, i.e `modules/languages/java.nix` you are recommended to contain the parent as well - for
example `languages/java: some major change`.
## Code Style {#sec-guidelines-code-style}
**Treewide**
Keep lines at a reasonable width, ideally 80 characters or less. This also applies to string literals and module
descriptions and documentation.
**Nix**
neovim-flake is formatted by the [alejandra](https://github.com/kamadorueda/alejandra) tool and the formatting is checked in the pull
request and push workflows. Run the `nix fmt` command inside the project repository before submitting your
pull request.
While Alejandra is mostly opinionated on how code looks after formatting, certain changes are done at the
user's discretion based on how the original code was structured.
Please use one line code for attribute sets that contain only one subset.
For example:
```nix
# parent modules should always be unfolded
# which means module = { value = ... } instead of module.value = { ... }
module = {
value = mkEnableOption "some description" // { default = true; }; # merges can be done inline where possible
# same as parent modules, unfold submodules
subModule = {
# this is an option that contains more than one nested value
someOtherValue = mkOption {
type = lib.types.bool;
description = "Some other description";
default = true;
};
};
}
```
If you move a line down after the merge operator, Alejandra will automatically unfold the whole merged attrset
for you, which we **do not** want.
```nix
module = {
key = mkEnableOption "some description" // {
default = true; # we want this to be inline
}; # ...
}
```
For lists, it is mostly up to your own discretion how you want to format them, but please try to unfold lists if
they contain multiple items and especially if they are to include comments.
```nix
# this is ok
acceptableList = [
item1 # comment
item2
item3 # some other comment
item4
];
# this is not ok
listToBeAvoided = [item1 item2 /* comment */ item3 item4];
# this is ok
acceptableList = [item1];
# this is not ok
listToBeAvoided = [
item1
];
```

View file

@ -0,0 +1,166 @@
# Keybinds {#sec-keybinds}
As of 0.4, there exists an API for writing your own keybinds and a couple of useful utility functions are available in
the [extended standard library](https://github.com/NotAShelf/neovim-flake/tree/main/lib). The following section contains
a general overview to how you may utilize said functions.
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
To set a mapping, you should define it in `vim.maps.<<mode>>`.
The available modes are:
- normal
- insert
- select
- visual
- terminal
- normalVisualOp
- visualOnly
- operator
- insertCommand
- lang
- command
An example, simple keybinding, can look like this:
```nix
{
vim.maps.normal = {
"<leader>wq" = {
action = ":wq<CR>";
silent = true;
desc = "Save file and quit";
};
};
}
```
There are many settings available in the options. Please refer to the
[documentation](https://notashelf.github.io/neovim-flake/options.html#opt-vim.maps.command._name_.action)
to see a list of them.
`neovim-flake` provides a list of helper commands, so that you don't have to write the mapping attribute sets every
time:
- `mkBinding = key: action: desc:` - makes a basic binding, with `silent` set to true.
- `mkExprBinding = key: action: desc:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
- `mkLuaBinding = key: action: desc:` - makes an expression binding, with `lua`, and `silent` set to true.
Note that the Lua in these bindings is actual Lua, not pasted into a `:lua` command.
Therefore, you either pass in a function like `require('someplugin').some_function`, without actually calling it,
or you define your own function, like `function() require('someplugin').some_function() end`.
Additionally, to not have to repeat the descriptions, there's another utility function with its own set of functions:
Utility function that takes two attrsets:
- `{ someKey = "some_value" }`
- `{ someKey = { description = "Some Description"; }; }`
and merges them into `{ someKey = { value = "some_value"; description = "Some Description"; }; }`
```
addDescriptionsToMappings = actualMappings: mappingDefinitions:
```
This function can be used in combination with the same `mkBinding` functions as above, except they only take two
arguments - `binding` and `action`, and have different names:
- `mkSetBinding = binding: action:` - makes a basic binding, with `silent` set to true.
- `mkSetExprBinding = binding: action:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
- `mkSetLuaBinding = binding: action:` - makes an expression binding, with `lua`, and `silent` set to true.
You can read the source code of some modules to see them in action, but their usage should look something like this:
```nix
# plugindefinition.nix
{lib, ...}: with lib; {
options.vim.plugin = {
enable = mkEnableOption "Enable plugin";
# Mappings should always be inside an attrset called mappings
mappings = {
# mkMappingOption is a helper function from lib,
# that takes a description (which will also appear in which-key),
# and a default mapping (which can be null)
toggleCurrentLine = mkMappingOption "Toggle current line comment" "gcc";
toggleCurrentBlock = mkMappingOption "Toggle current block comment" "gbc";
toggleOpLeaderLine = mkMappingOption "Toggle line comment" "gc";
toggleOpLeaderBlock = mkMappingOption "Toggle block comment" "gb";
toggleSelectedLine = mkMappingOption "Toggle selected comment" "gc";
toggleSelectedBlock = mkMappingOption "Toggle selected block" "gb";
};
};
}
```
```nix
# config.nix
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.plugin;
self = import ./plugindefinition.nix {inherit lib;};
mappingDefinitions = self.options.vim.plugin;
# addDescriptionsToMappings is a helper function from lib,
# that merges mapping values and their descriptions
# into one nice attribute set
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable) {
# ...
vim.maps.normal = mkMerge [
# mkSetBinding is another helper function from lib,
# that actually adds the mapping with a description.
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
(mkIf config.vim.lsp.enable (mkMerge [
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
]))
(
mkIf config.vim.treesitter.enable
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
)
];
# ...
};
}
```
:::{.note}
If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings,
don't be scared to implement a draft PR. We'll help you get it done.
:::

View file

@ -0,0 +1,11 @@
# Testing Changes {#sec-testing-changes}
Once you have made your changes, you will need to test them throughly. If it is a module, add your module option to
`configuration.nix` (located in the root of this project) inside `neovimConfiguration`. Enable it, and then run the
maximal configuration with `nix run .#maximal -Lv` to check for build errors. If neovim opens in the current directory
without any error messages (you can check the output of `:messages` inside neovim to see if there are any errors), then
your changes are good to go. Open your pull request, and it will be reviewed as soon as posssible.
If it is not a new module, but a change to an existing one, then make sure the module you have changed is enabled in the
maximal configuration by editing `configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same procedure as
adding a new module will apply here.

View file

@ -1,13 +1,11 @@
[[ch-hm-module]]
== Home Manager
# Home Manager {#ch-hm-module}
The Home Manager module allows us to customize the different `vim` options from inside the home-manager configuration
and it is the preferred way of configuring neovim-flake, both on NixOS and non-NixOS systems.
To use it, we first add the input flake.
[source,nix]
----
```nix
{
neovim-flake = {
url = github:notashelf/neovim-flake;
@ -17,22 +15,20 @@ To use it, we first add the input flake.
# i.e inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- obsidian nvim needs to be in your inputs
};
}
----
```
Followed by importing the home-manager module somewhere in your configuration.
[source,nix]
----
```nix
{
# assuming neovim-flake is in your inputs and inputs is in the argset
imports = [ inputs.neovim-flake.homeManagerModules.default ];
}
----
```
An example installation for standalone home-manager would look like this:
[source,nix]
----
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -52,14 +48,12 @@ An example installation for standalone home-manager would look like this:
};
};
}
----
```
Once the module is imported, we will be able to define the following options (and much more) from inside the
home-manager configuration.
[source,nix]
----
{
```nix{
programs.neovim-flake = {
enable = true;
@ -74,12 +68,8 @@ home-manager configuration.
};
};
}
----
[NOTE]
====
You may find all avaliable options in the https://notashelf.github.io/neovim-flake/options[appendix]
====
```
:::{.note}
You may find all avaliable options in the [appendix](https://notashelf.github.io/neovim-flake/options)
:::

View file

@ -1,40 +0,0 @@
[[ch-languages]]
== Language Support
Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details.
* Rust: <<opt-vim.languages.rust.enable>>
* Nix: <<opt-vim.languages.nix.enable>>
* SQL: <<opt-vim.languages.sql.enable>>
* C/C++: <<opt-vim.languages.clang.enable>>
* Typescript/Javascript: <<opt-vim.languages.ts.enable>>
* Python: <<opt-vim.languages.python.enable>>:
* Zig: <<opt-vim.languages.zig.enable>>
* Markdown: <<opt-vim.languages.markdown.enable>>
* HTML: <<opt-vim.languages.html.enable>>
* SQL: <<opt-vim.languages.sql.enable>>
* Dart: <<opt-vim.languages.dart.enable>>
* Go: <<opt-vim.languages.go.enable>>
* Lua: <<opt-vim.languages.lua.enable>>
* PHP: <<opt-vim.languages.php.enable>>
Adding support for more languages, and improving support for existing ones are great places
where you can contribute with a PR.
=== LSP Custom Packages/Command
In any of the `opt.languages.<language>.lsp.package` options you can provide your own LSP package, or provide
the command to launch the language server, as a list of strings.
You can use this to skip automatic installation of a language server, and instead
use the one found in your `$PATH` during runtime, for example:
[source,nix]
----
vim.languages.java = {
lsp = {
enable = true;
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
};
}
----

24
docs/manual/languages.md Normal file
View file

@ -0,0 +1,24 @@
# Language Support {#ch-languages}
Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details.
- Rust: [vim.languages.rust.enable](#opt-vim.languages.rust.enable)
- Nix: [vim.languages.nix.enable](#opt-vim.languages.nix.enable)
- SQL: [vim.languages.sql.enable](#opt-vim.languages.sql.enable)
- C/C++: [vim.languages.clang.enable](#opt-vim.languages.clang.enable)
- Typescript/Javascript: [vim.languages.ts.enable](#opt-vim.languages.ts.enable)
- Python: [vim.languages.python.enable](#opt-vim.languages.python.enable):
- Zig: [vim.languages.zig.enable](#opt-vim.languages.zig.enable)
- Markdown: [vim.languages.markdown.enable](#opt-vim.languages.markdown.enable)
- HTML: [vim.languages.html.enable](#opt-vim.languages.html.enable)
- Dart: [vim.languages.dart.enable](#opt-vim.languages.dart.enable)
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
Adding support for more languages, and improving support for existing ones are great places
where you can contribute with a PR.
```{=include=} sections
languages/lsp.md
```

View file

@ -0,0 +1,16 @@
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
In any of the `opt.languages.<language>.lsp.package` options you can provide your own LSP package, or provide
the command to launch the language server, as a list of strings.
You can use this to skip automatic installation of a language server, and instead
use the one found in your `$PATH` during runtime, for example:
```nix
vim.languages.java = {
lsp = {
enable = true;
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
};
}
```

View file

@ -0,0 +1,3 @@
{
"nix.conf(5)": "https://nixos.org/manual/nix/stable/command-ref/conf-file.html"
}

26
docs/manual/manual.md Normal file
View file

@ -0,0 +1,26 @@
# neovim-flake-manual {#neovim-flake-manual}
## Version @VERSION@
```{=include=} preface
preface.md
try-it-out.md
```
```{=include=} parts
custom-configs.md
custom-package.md
custom-plugins.md
default-configs.md
home-manager.md
languages.md
hacking.md
```
```{=include=} appendix html:into-file=//options.html
options.md
```
```{=include=} appendix html:into-file=//release-notes.html
release-notes/release-notes.md
```

7
docs/manual/options.md Normal file
View file

@ -0,0 +1,7 @@
# Neovim Flake Configuration Options {#ch-options}
```{=include=} options
id-prefix: opt-
list-id: neovim-flake-options
source: @OPTIONS_JSON@
```

6
docs/manual/preface.md Normal file
View file

@ -0,0 +1,6 @@
# Preface {#sec-preface}
If you noticed a bug caused by neovim-flake then please consider reporting it over
[the neovim-flake issue tracker](https://github.com/notashelf/neovim-flake/issues).
Bugfixes, feature additions and upstreamed changes are welcome over
[the neovim-flake pull requests tab](https://github.com/notashelf/neovim-flake/pulls).

View file

@ -1,53 +1,47 @@
[[ch-try-it-out]]
== Try it out
# Try it out {#ch-try-it-out}
Thanks to the portability of Nix, you can try out neovim-flake without actually 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, three
configurations are provided:
* Nix
* Tidal
* Maximal
- Nix
- Tidal
- Maximal
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
[source,console]
----
```console
$ cachix use neovim-flake # Optional: it'll save you CPU resources and time
$ nix run github:notashelf/neovim-flake#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
once you garbage collect. If you wish to install neovim-flake, please take a look at
<<ch-custom-configuration,custom-configuration>> or <<ch-hm-module,home-manager>> sections for installation
[custom-configuration](#ch-custom-configuration) or [home-manager](#ch-hm-module) sections for installation
instructions.
[[sec-using-prebuild-configs]]
=== Using Prebuilt Configs
## Using Prebuilt Configs {#sec-using-prebuild-configs}
[source,console]
----
```console
$ nix run github:notashelf/neovim-flake#nix
$ nix run github:notashelf/neovim-flake#tidal
$ nix run github:notashelf/neovim-flake#maximal
----
```
### Available Configs {#sec-available-configs}
[[sec-available-configs]]
=== Available Configs
==== Nix
#### Nix {#sec-configs-nix}
`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins.
By running `nix run .`, which is the default package, you will build Neovim with this config.
==== Tidal
#### Tidal {#sec-configs-tidal}
Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.
==== Maximal
#### Maximal {#sec-configs-maximal}
`Maximal` is the ultimate configuration that will enable support for more 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.
You are _strongly_ recommended to use the binary cache if you would like to try the Maximal configuration.

29
docs/neovim-flake.1 Normal file
View file

@ -0,0 +1,29 @@
.Dd January 1, 1980
.Dt neovim-flake 1
.Os neovim-flake
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" enable line breaks after slashes
.cflags 4 /
.Sh NAME
.Nm neovim-flake
.Nd a extensible and distro-agonistic Neovim configuration wrapper in Nix
.
.Sh BUGS
.Pp
Please report any bugs on the
\m[blue]\fBproject issue tracker\fR\m[]\&.
.Sh AUTHOR
.Pp
\fBneovim-flake contributors\fR
.RS 4
Author.
.RE
.Sh COPYRIGHT
.br
Copyright \(co 2017\(en2022 neovim-flake contributors
.br

View file

@ -1,14 +0,0 @@
[[ch-release-notes]]
[appendix]
== Release Notes
This section lists the release notes for tagged version of neovim-flake and current main.
:leveloffset: 1
include::rl-0.1.adoc[]
include::rl-0.2.adoc[]
include::rl-0.3.adoc[]
include::rl-0.4.adoc[]
include::rl-0.5.adoc[]
include::rl-0.6.adoc[]

View file

@ -0,0 +1,12 @@
# Release Notes {#ch-release-notes}
This section lists the release notes for tagged version of neovim-flake and current main.
```{=include=} chapters
rl-0.1.md
rl-0.2.md
rl-0.3.md
rl-0.4.md
rl-0.5.md
rl-0.6.md
```

View file

@ -1,32 +0,0 @@
[[sec-release-0.1]]
== Release 0.1
This is the current master branch and information here is not final. These are changes from the v0.01 tag.
Special thanks to https://github.com/nix-community/home-manager/[home-manager] for this release. Docs/manual generation, the new module evaluation system, and DAG implementation are from them.
[[sec-release-0.1-changelog]]
=== Changelog
https://github.com/jordanisaacs[jordanisaacs]:
* Removed hare language support (lsp/tree-sitter/etc). `vim.lsp.hare` is no longer defined. If you use hare and would like it added back, please file an issue.
* <<opt-vim.startPlugins>> & <<opt-vim.optPlugins>> are now an enum of `string` for options sourced from the flake inputs. Users can still provide vim plugin packages.
+
If you are contributing and adding a new plugin, add the plugin name to `availablePlugins` in https://github.com/jordanisaacs/neovim-flake/blob/20cec032bd74bc3d20ac17ce36cd84786a04fd3e/modules/lib/types-plugin.nix[types-plugin.nix].
* `neovimBuilder` has been removed for configuration. Using an overlay is no longer required. See the manual for the new way to configuration.
* Treesitter grammars are now configurable with <<opt-vim.treesitter.grammars>>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `vimPlugins.nvim-treesitter.builtGrammars` namespace.
* <<opt-vim.configRC>> and <<opt-vim.luaConfigRC>> are now of type DAG lines. This allows for ordering of the config. Usage is the same is in home-manager's `home.activation` option.
+
[source,nix]
----
vim.luaConfigRC = lib.nvim.dag.entryAnywhere "config here"
----
https://github.com/MoritzBoehme[MoritzBoehme]:
* `catppuccin` theme is now available as a neovim theme <<opt-vim.theme.style>> and lualine theme <<opt-vim.statusline.lualine.theme>>.

View file

@ -0,0 +1,40 @@
# Release 0.1 {#sec-release-0.1}
This is the current master branch and information here is not final. These are changes from the v0.01 tag.
Special thanks to [home-manager](https://github.com/nix-community/home-manager/) for this release.
Docs/manual generation, the new module evaluation system, and DAG implementation are from them.
## Changelog {#sec-release-0.1-changelog}
[jordanisaacs](https://github.com/jordanisaacs):
- Removed hare language support (lsp/tree-sitter/etc). `vim.lsp.hare` is no longer defined.
If you use hare and would like it added back, please file an issue.
- [vim.stratPlugins](opt-vim.startPlugins) & [vim.optPlugins](opt-vim.optPlugins) are now
an enum of `string` for options sourced from the flake inputs. Users can still provide vim
plugin packages.
- If you are contributing and adding a new plugin, add the plugin name to `availablePlugins` in
[types-plugin.nix](https://github.com/jordanisaacs/neovim-flake/blob/20cec032bd74bc3d20ac17ce36cd84786a04fd3e/modules/lib/types-plugin.nix).
- `neovimBuilder` has been removed for configuration. Using an overlay is no longer required.
See the manual for the new way to configuration.
- Treesitter grammars are now configurable with [vim.treesitter.grammars](opt-vim.treesitter.grammars).
Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions.
See [relevant discourse post](https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees)
for more information. Packages can be found under the `vimPlugins.nvim-treesitter.builtGrammars` namespace.
- [vim.configRC](opt-vim.configRC) and [vim.luaConfigRC](opt-vim.luaConfigRC) are now of type DAG lines.
This allows for ordering of the config. Usage is the same is in home-manager's `home.activation` option.
```nix
vim.luaConfigRC = lib.nvim.dag.entryAnywhere "config here"
```
[MoritzBoehme](https://github.com/MoritzBoehme):
- `catppuccin` theme is now available as a neovim theme [vim.theme.style](opt-vim.theme.style) and lualine theme
[vim.statusline.lualine.theme](opt-vim.statusline.lualine.theme).

View file

@ -1,46 +0,0 @@
[[sec-release-0.2]]
== Release 0.2
Release notes for release 0.2
[[sec-release-0.2-changelog]]
=== Changelog
https://github.com/notashelf[notashelf]:
* Added two minimap plugins under `vim.minimap`. `codewindow.nvim` is enabled by default, while `minimap.vim` is available with its code-minimap dependency.
* A complementary plugin, `obsidian.nvim` and the Neovim alternative for Emacs' orgmode with `orgmode.nvim` have been added. Both will be disabled by default.
* Smooth scrolling for ANY movement command is now available with `cinnamon.nvim`
* You will now notice a dashboard on startup. This is provided by the `alpha.nvim` plugin. You can use any of the three available dashboard plugins, or disable them entirely.
* There is now a scrollbar on active buffers, which can highlight errors by hooking to your LSPs. This is on by default, but can be toggled off under `vim.visuals` if seen necessary.
* Discord Rich Presence has been added through `presence.nvim` for those who want to flex that they are using the *superior* text editor.
* An icon picker is now available with telescope integration. You can use `:IconPickerInsert` or `:IconPickerYank` to add icons to your code.
* A general purpose cheatsheet has been added through `cheatsheet.nvim`. Forget no longer!
* `ccc.nvim` has been added to the default plugins to allow picking colors with ease.
* Most UI components of Neovim have been replaced through the help of `noice.nvim`. There are also notifications and custom UI elements available for Neovim messages and prompts.
* A (floating by default) terminal has been added through `toggleterm.nvim`.
* Harness the power of ethical (`tabnine.nvim`) and not-so-ethical (`copilot.lua`) AI by those new assistant plugins. Both are off by default, TabNine needs to be wrapped before it's working.
* Experimental mouse gestures have been addede through `gesture.nvim`. See plugin page and the relevant module for more details on how to use.
* Re-open last visited buffers via `nvim-session-manager`. Disabled by default as deleting buffers seems to be problematic at the moment.
* Most of NvimTree's configuration options have been changed with some options being toggled to off by default.
* Lualine had its configuration simplified and style toned down. Less color, more info.
* Modules where multiple plugin configurations were in the same directory have been simplified. Each plugin inside a single module gets its own directory to be imported.
* Separate config options with the same parent attribute have been merged into one for simplicity.

View file

@ -0,0 +1,53 @@
# Release 0.2 {#sec-release-0.2}
Release notes for release 0.2
## Changelog {#sec-release-0.2-changelog}
[notashelf](https://github.com/notashelf):
- Added two minimap plugins under `vim.minimap`. `codewindow.nvim` is enabled by default, while `minimap.vim` is
available with its code-minimap dependency.
- A complementary plugin, `obsidian.nvim` and the Neovim alternative for Emacs' orgmode with `orgmode.nvim` have been
added. Both will be disabled by default.
- Smooth scrolling for ANY movement command is now available with `cinnamon.nvim`
- You will now notice a dashboard on startup. This is provided by the `alpha.nvim` plugin. You can use any of the
three available dashboard plugins, or disable them entirely.
- There is now a scrollbar on active buffers, which can highlight errors by hooking to your LSPs. This is on by
default, but can be toggled off under `vim.visuals` if seen necessary.
- Discord Rich Presence has been added through `presence.nvim` for those who want to flex that they are using
the _superior_ text editor.
- An icon picker is now available with telescope integration. You can use `:IconPickerInsert` or `:IconPickerYank`
to add icons to your code.
- A general-purpose cheatsheet has been added through `cheatsheet.nvim`. Forget no longer!
- `ccc.nvim` has been added to the default plugins to allow picking colors with ease.
- Most UI components of Neovim have been replaced through the help of `noice.nvim`. There are also notifications
and custom UI elements available for Neovim messages and prompts.
- A (floating by default) terminal has been added through `toggleterm.nvim`.
- Harness the power of ethical (`tabnine.nvim`) and not-so-ethical (`copilot.lua`) AI by those new assistant plugins.
Both are off by default, TabNine needs to be wrapped before it's working.
- Experimental mouse gestures have been added through `gesture.nvim`. See plugin page and the relevant module for
more details on how to use.
- Re-open last visited buffers via `nvim-session-manager`. Disabled by default as deleting buffers seems to be
problematic at the moment.
- Most of NvimTree's configuration options have been changed with some options being toggled to off by default.
- Lualine had its configuration simplified and style toned down. Less color, more info.
- Modules where multiple plugin configurations were in the same directory have been simplified. Each plugin inside
a single module gets its directory to be imported.
- Separate config options with the same parent attribute have been merged into one for simplicity.

View file

@ -1,75 +0,0 @@
[[sec-release-0.3]]
== Release 0.3
Release 0.3 had to come out beore I wanted it to due to Neovim 0.9 dropping into nixpkgs-unstable. The treesitter changes
have prompted a treesitter rework, which was followed by reworking the languages system. Most of the changes to those are downstreamed
from the original repository. The feature requests that was originally planned for 0.3 have been moved to 0.4, which
should come out soon.
[[sec-release-0.3-changelog]]
=== Changelog
* We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure
is different than usual, but the functionality remains the same.
* We now provide a home-manager module. Do note that it is still far from perfect, but it works.
* `nodejs_16` is now bundled with `Copilot.lua` if the user has enabled Copilot assistant.
* which-key section titles have been fixed. This is to be changed once again in a possible keybind rewrite, but now it should
display the correct titles instad of `+prefix`
* Most of `presence.nvim`'s options have been made fully configurable through your configuration file.
* Most of the modules have been refactored to separate `config` and `options` attributes.
* Darwin has been deprecated as the zig package is marked as broken. We will attempt to use the zig overlay to return Darwin
support.
* `Fidget.nvim` has been added as a neat visual addition for LSP installations.
* `diffview.nvim` has been added to provide a convenient diff utility.
* Treesitter grammars are now configurable with <<opt-vim.treesitter.grammars>>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore: comment, toml, make, html, css, graphql, json.
* A new section has been added for language support: `vim.languages.<language>`. The options <<opt-vim.languages.enableLSP>>, <<opt-vim.languages.enableTreesitter>>, etc. will enable the respective section for all languages that have been enabled.
** All LSP languages have been moved here
** `plantuml` and `markdown` have been moved here
** A new section has been added for `html`. The old `vim.treesitter.autotagHtml` can be found at <<opt-vim.languages.html.treesitter.autotagHtml>>.
* <<opt-vim.git.gitsigns.codeActions>> has been added allowing you to turn on gitsigns codeactions.
* Removed the plugins document in the docs. Was too unwieldy to keep updated.
* `vim.visual.lspkind` has been moved to <<opt-vim.lsp.lspkind.enable>>
* Improved handling of completion formatting. When setting <<opt-vim.autocomplete.sources>>, can also include optional menu mapping. And can provide your own function with <<opt-vim.autocomplete.formatting.format>>.
* For <<opt-vim.visuals.indentBlankline.fillChar>> and <<opt-vim.visuals.indentBlankline.eolChar>> turning them off should use `null` rather than `""` now.
* Transparency has been made optional and has been disabled by default. <<opt-vim.theme.transparent>> option can be used to enable or
disable transparency for your configuration.
* Fixed deprecated configuration method for Tokyonight, and added new style "moon"
* Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart
language support.
* Elixir language support has been added through `elixir-tools.nvim`.
* `hop.nvim` and `leap.nvim` have been added for fast navigation.
* `modes.nvim` has been added to the UI plugins as a minor error highlighter.
* `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing
per-buftype column position and more.
* `project.nvim` has been added for better project management inside Neovim.
* More configuration options have been added to `nvim-session-manager`.
* Editorconfig support has been added to the core functionality, with an enable option.
* `venn-nvim` has been dropped due to broken keybinds.

View file

@ -0,0 +1,81 @@
# Release 0.3 {#sec-release-0.3}
Release 0.3 had to come out beore I wanted it to due to Neovim 0.9 dropping into nixpkgs-unstable.
The treesitter changes have prompted a treesitter rework, which was followed by reworking the languages system.
Most of the changes to those are downstreamed from the original repository. The feature requests that was originally
planned for 0.3 have been moved to 0.4, which should come out soon.
## Changelog {#sec-release-0.3-changelog}
- We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure
is different than usual, but the functionality remains the same.
- We now provide a home-manager module. Do note that it is still far from perfect, but it works.
- `nodejs_16` is now bundled with `Copilot.lua` if the user has enabled Copilot assistant.
- which-key section titles have been fixed. This is to be changed once again in a possible keybind rewrite, but now it should
display the correct titles instad of `+prefix`
- Most of `presence.nvim`'s options have been made fully configurable through your configuration file.
- Most of the modules have been refactored to separate `config` and `options` attributes.
- Darwin has been deprecated as the zig package is marked as broken. We will attempt to use the zig overlay to return Darwin
support.
- `Fidget.nvim` has been added as a neat visual addition for LSP installations.
- `diffview.nvim` has been added to provide a convenient diff utility.
- Treesitter grammars are now configurable with [vim.treesitter.grammars](vim.treesitter.grammars).
Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions.
See [discourse](https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees) for more information.
Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be
enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore:
**comment**, **toml**, **make**, **html**, **css**, **graphql**, **json**.
- A new section has been added for language support: `vim.languages.<language>`.
- The options [vim.languages.enableLSP](vim.languages.enableLSP), [vim.languages.enableTreesitter](vim.languages.enableTreesitter), etc.
will enable the respective section for all languages that have been enabled.
- All LSP languages have been moved here
- `plantuml` and `markdown` have been moved here
- A new section has been added for `html`. The old `vim.treesitter.autotagHtml` can be found at <<opt-vim.languages.html.treesitter.autotagHtml>>.
- [vim.git.gitsigns.codeActions](vim.git.gitsigns.codeActions) has been added allowing you to turn on gitsigns codeactions.
- Removed the plugins document in the docs. Was too unwieldy to keep updated.
- `vim.visual.lspkind` has been moved to [vim.lsp.lspkind.enable](vim.lsp.lspkind.enable)
- Improved handling of completion formatting. When setting [vim.autocomplete.sources](vim.autocomplete.sources), can also include optional menu mapping.
And can provide your own function with [vim.autocomplete.formatting.format](vim.autocomplete.formatting.format).
- For [vim.visuals.indentBlankline.fillChar](vim.visuals.indentBlankline.fillChar) and [vim.visuals.indentBlankline.eolChar](vim.visuals.indentBlankline.eolChar)
turning them off should use `null` rather than `""` now.
- Transparency has been made optional and has been disabled by default. [vim.theme.transparent](vim.theme.transparent) option can be used to enable or
disable transparency for your configuration.
- Fixed deprecated configuration method for Tokyonight, and added new style "moon"
- Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart
language support.
- Elixir language support has been added through `elixir-tools.nvim`.
- `hop.nvim` and `leap.nvim` have been added for fast navigation.
- `modes.nvim` has been added to the UI plugins as a minor error highlighter.
- `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing
per-buftype column position and more.
- `project.nvim` has been added for better project management inside Neovim.
- More configuration options have been added to `nvim-session-manager`.
- Editorconfig support has been added to the core functionality, with an enable option.
- `venn-nvim` has been dropped due to broken keybinds.

View file

@ -1,72 +0,0 @@
[[sec-release-0.4]]
== Release 0.4
Following the release of v0.3, I have decided to release v0.4 with a massive new change: customizable keybinds. As of the 0.4 release, keybinds will no longer be hardcoded and instead provided by each module's own keybinds section. The old keybind system (`vim.keybinds = {}`) is now considered deprecated and the new lib functions are recommended to be used for adding keybinds for new plugins, or adding keybinds to existing plugins.
Alongside customizable keybinds, there are a few quality of life updates, such as `lazygit` integration and the new experimental Lua loader of Neovim 0.9 thanks to our awesome contributors who made this update possible during my absence.
[[sec-release-0.4-changelog]]
=== Changelog
https://github.com/n3oney[n3oney]:
* Streamlined keybind adding process towards new functions in extended stdlib.
* Moved default keybinds into keybinds section of each module
* Simplified luaConfigRC and configRC setting - they can now just take strings
* Refactored the resolveDag function - you can just provide a string now, which will default to dag.entryAnywhere
* Fixed formatting sometimes removing parts of files
* Made formatting synchronous
* Gave null-ls priority over other formatters
https://github.com/horriblename[horriblename]:
* Added `clangd` as alternative lsp for C/++.
* Added `toggleterm` integration for `lazygit`.
* Added new option `enableluaLoader` to enable neovim's experimental module loader for faster startup time.
* Fixed bug where flutter-tools can't find `dart` LSP
* Added Debug Adapter (DAP) support for clang, rust, go, python and dart.
https://github.com/notashelf[notashelf]:
* Made Copilot's Node package configurable. It is recommended to keep as default, but providing a different NodeJS version is now possible.
* Added <<opt-vim.cursorlineOpt>> for configuring Neovim's cursorlineOpt.
* Added `filetree.nvimTreeLua.view.cursorline`, default false, to enable cursorline in nvimtre.
* Added Fidget.nvim support for the Catppuccin theme.
* Updated bundled NodeJS version used by `Copilot.lua`. v16 is now marked as insecure on Nixpkgs, and we updated to v18
* Enabled Catppuccin modules for plugins available by default.
* Added experimental Svelte support under `vim.languages`.
* Removed unnecessary scrollbar element from notifications and codeaction warning UI.
* `vim.utility.colorizer` has been renamed to `vim.utility.ccc` after the plugin it uses
* Color preview via `nvim-colorizer.lua`
* Updated Lualine statusline UI
* Added vim-illuminate for smart highlighting
* Added a module for enabling Neovim's spellchecker
* Added prettierd as an alternative formatter to prettier - currently defaults to prettier
* Fixed presence.nvim inheriting the wrong client id
* Cleaned up documentation

View file

@ -0,0 +1,73 @@
# Release 0.4 {#sec-release-0.4}
Following the release of v0.3, I have decided to release v0.4 with a massive new change: customizable keybinds.
As of the 0.4 release, keybinds will no longer be hardcoded and instead provided by each module's own keybinds section.
The old keybind system (`vim.keybinds = {}`) is now considered deprecated and the new lib functions are recommended to be
used for adding keybinds for new plugins, or adding keybinds to existing plugins.
Alongside customizable keybinds, there are a few quality of life updates, such as `lazygit` integration and the
new experimental Lua loader of Neovim 0.9 thanks to our awesome contributors who made this update possible during my absence.
## Changelog {#sec-release-0.4-changelog}
[n3oney](https://github.com/n3oney):
- Streamlined keybind adding process towards new functions in extended stdlib.
- Moved default keybinds into keybinds section of each module
- Simplified luaConfigRC and configRC setting - they can now just take strings
- Refactored the resolveDag function - you can just provide a string now, which will default to dag.entryAnywhere
- Fixed formatting sometimes removing parts of files
- Made formatting synchronous
- Gave null-ls priority over other formatters
[horriblename](https://github.com/horriblename):
- Added `clangd` as alternative lsp for C/++.
- Added `toggleterm` integration for `lazygit`.
- Added new option `enableluaLoader` to enable neovim's experimental module loader for faster startup time.
- Fixed bug where flutter-tools can't find `dart` LSP
- Added Debug Adapter (DAP) support for clang, rust, go, python and dart.
[notashelf](https://github.com/notashelf):
- Made Copilot's Node package configurable. It is recommended to keep as default, but providing a different NodeJS version is now possible.
- Added [vim.cursorlineOpt](vim.cursorlineOpt) for configuring Neovim's cursorlineOpt.
- Added `filetree.nvimTreeLua.view.cursorline`, default false, to enable cursorline in nvimtre.
- Added Fidget.nvim support for the Catppuccin theme.
- Updated bundled NodeJS version used by `Copilot.lua`. v16 is now marked as insecure on Nixpkgs, and we updated to v18
- Enabled Catppuccin modules for plugins available by default.
- Added experimental Svelte support under `vim.languages`.
- Removed unnecessary scrollbar element from notifications and codeaction warning UI.
- `vim.utility.colorizer` has been renamed to `vim.utility.ccc` after the plugin it uses
- Color preview via `nvim-colorizer.lua`
- Updated Lualine statusline UI
- Added vim-illuminate for smart highlighting
- Added a module for enabling Neovim's spellchecker
- Added prettierd as an alternative formatter to prettier - currently defaults to prettier
- Fixed presence.nvim inheriting the wrong client id
- Cleaned up documentation

View file

@ -1,104 +0,0 @@
[[sec-release-0.5]]
== Release 0.5
[[sec-release-0.5-changelog]]
=== Changelog
https://github.com/vagahbond[vagahbond]:
* Added phan language server for PHP
* Added phpactor language server for PHP
https://github.com/horriblename[horriblename]:
* Added transparency support for tokyonight theme
* Fixed a bug where cmp's close and scrollDocs mappings wasn't working
* Streamlined and simplified extra plugin API with the addition of <<opt-vim.extraPlugins>>
* Allow using command names in place of LSP packages to avoid automatic installation
* Add lua LSP and treesitter support, and neodev.nvim plugin support
* Add <<opt-vim.lsp.mappings.toggleFormatOnSave>> keybind
https://github.com/amanse[amanse]:
* Added daily notes options for obsidian plugin
* Added jdt-language-server for Java
https://github.com/yavko[yavko]:
* Added Deno Language Server for javascript/typescript
* Added support for multiple languages <<opt-vim.spellChecking.languages>>, and added vim-dirtytalk <<opt-vim.spellChecking.enableProgrammingWordList>>
https://github.com/FrothyMarrow[frothymarrow]:
* Renamed `vim.visuals.cursorWordline` to <<opt-vim.visuals.cursorline.enable>>
* Added <<opt-vim.visuals.cursorline.lineNumbersOnly>> to display cursorline only in the presence of line numbers
* Added Oxocarbon to the list of available themes.
https://github.com/notashelf[notashelf]:
* Added GitHub Copilot to nvim-cmp completion sources.
* Added <<opt-vim.ui.borders.enable>> for global and individual plugin border configuration.
* LSP integrated breadcrumbs with <<opt-vim.ui.breadcrumbs.enable>> through nvim-navic
* LSP navigation helper with nvim-navbuddy, depends on nvim-navic (automatically enabled)
* Addeed nvim-navic integration for catppuccin theme
* Fixed mismatching zig language description
* Added support for `statix` and `deadnix` through <<opt-vim.languages.nix.extraDiagnostics.types>>
* Added lsp_lines plugin for showing diagnostic messages
* Added a configuration option for choosing the leader key
* The package used for neovim is now customizable by the user, using <<opt-vim.package>>. For best results, always use an unwrapped package
* Added highlight-undo plugin for highlighting undo/redo targets
* Added bash LSP and formatter support
* Disabled Lualine LSP status indicator for toggleterm buffer
* Added `nvim-docs-view`, a plugin to display lsp hover documentation in a side panel
* Switched to `nixosOptionsDoc` in option documentation.
To quote home-manager commit: "Output is mostly unchanged aside from some minor typographical and
formatting changes, along with better source links."
* Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
https://github.com/jacekpoz[jacekpoz]:
* Fixed scrollOffset not being used
* Updated clangd to 16
* Disabled `useSystemClipboard` by default
https://github.com/ksonj[ksonj]:
* Add support to change mappings to utility/surround
* Add black-and-isort python formatter
* Removed redundant "Enable ..." in `mkEnableOption` descriptions
* Add options to modify LSP key bindings and add proper whichkey descriptions
* Changed type of `statusline.lualine.activeSection` and `statusline.lualine.inactiveSection` from `attrsOf str` to `attrsOf (listOf str)`
* Added `statusline.lualine.extraActiveSection` and `statusline.lualine.extraInactiveSection`

View file

@ -0,0 +1,107 @@
# Release 0.5 {#sec-release-0.5}
Release notes for release 0.5
## Changelog {#sec-release-0.5-changelog}
[vagahbond](https://github.com/vagahbond):
- Added phan language server for PHP
- Added phpactor language server for PHP
[horriblename](https://github.com/horriblename):
- Added transparency support for tokyonight theme
- Fixed a bug where cmp's close and scrollDocs mappings wasn't working
- Streamlined and simplified extra plugin API with the addition of [vim.extraPlugins](vim.extraPlugins)
- Allow using command names in place of LSP packages to avoid automatic installation
- Add lua LSP and treesitter support, and neodev.nvim plugin support
- Add [vim.lsp.mappings.toggleFormatOnSave](vim.lsp.mappings.toggleFormatOnSave) keybind
[amanse](https://github.com/amanse):
- Added daily notes options for obsidian plugin
- Added jdt-language-server for Java
[yavko](https://github.com/yavko):
- Added Deno Language Server for javascript/typescript
- Added support for multiple languages [vim.spellChecking.languages](vim.spellChecking.languages), and added
vim-dirtytalk through [vim.spellChecking.enableProgrammingWordList](vim.spellChecking.enableProgrammingWordList)
[frothymarrow](https://github.com/FrothyMarrow):
- Renamed `vim.visuals.cursorWordline` to [vim.visuals.cursorline.enable](vim.visuals.cursorline.enable)
- Added [vim.visuals.cursorline.lineNumbersOnly](vim.visuals.cursorline.lineNumbersOnly) to display cursorline
only in the presence of line numbers
- Added Oxocarbon to the list of available themes.
[notashelf](https://github.com/notashelf):
- Added GitHub Copilot to nvim-cmp completion sources.
- Added [vim.ui.borders.enable](vim.ui.borders.enable) for global and individual plugin border configuration.
- LSP integrated breadcrumbs with [vim.ui.breadcrumbs.enable](vim.ui.breadcrumbs.enable) through nvim-navic
- LSP navigation helper with nvim-navbuddy, depends on nvim-navic (automatically enabled if navic is enabled)
- Addeed nvim-navic integration for catppuccin theme
- Fixed mismatching zig language description
- Added support for `statix` and `deadnix` through [vim.languages.nix.extraDiagnostics.types](vim.languages.nix.extraDiagnostics.types)
- Added `lsp_lines` plugin for showing diagnostic messages
- Added a configuration option for choosing the leader key
- The package used for neovim is now customizable by the user, using [vim.package](vim.package).
For best results, always use an unwrapped package
- Added highlight-undo plugin for highlighting undo/redo targets
- Added bash LSP and formatter support
- Disabled Lualine LSP status indicator for toggleterm buffer
- Added `nvim-docs-view`, a plugin to display lsp hover documentation in a side panel
- Switched to `nixosOptionsDoc` in option documentation.
To quote home-manager commit: "Output is mostly unchanged aside from some minor typographical and
formatting changes, along with better source links."
- Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
[jacekpoz](https://github.com/jacekpoz):
- Fixed scrollOffset not being used
- Updated clangd to 16
- Disabled `useSystemClipboard` by default
[ksonj](https://github.com/ksonj):
- Add support to change mappings to utility/surround
- Add black-and-isort python formatter
- Removed redundant "Enable ..." in `mkEnableOption` descriptions
- Add options to modify LSP key bindings and add proper whichkey descriptions
- Changed type of `statusline.lualine.activeSection` and `statusline.lualine.inactiveSection`
from `attrsOf str` to `attrsOf (listOf str)`
- Added `statusline.lualine.extraActiveSection` and `statusline.lualine.extraInactiveSection`

View file

@ -1,12 +0,0 @@
[[sec-release-0.6]]
== Release 0.6
Release notes for release 0.6
[[sec-release-0.6-changelog]]
=== Changelog
https://github.com/ksonj[ksonj]:
* Add Terraform language support

View file

@ -0,0 +1,42 @@
# Release 0.6 {#sec-release-0.6}
Release notes for release 0.6
## Changelog {#sec-release-0.6-changelog}
[ksonj](https://github.com/ksonj):
- Add Terraform language support
[horriblename](https://github.com/horriblename):
- Fixed empty winbar when breadcrumbs are disabled
[donnerinoern](https://github.com/donnerinoern):
- Added Gruvbox theme
- Added marksman LSP for Markdown
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind
[notashelf](https://github.com/notashelf):
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
- Bumped plugin inputs to their latest versions
- Deprecated `presence.nvim` in favor of `neocord`. This means `vim.rich-presence.presence-nvim` is removed and will throw
a warning if used. You are recommended to rewrite your neocord config from scratch based on the
[official documentation](https://github.com/IogaMaster/neocord)
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes)
- Updated all plugin inputs to their latest versions (26.01.2024) - this brought minor color changess to the Catppuccin
theme

File diff suppressed because it is too large Load diff

View file

@ -63,7 +63,7 @@
# For generating documentation website
nmd = {
url = "github:horriblename/nmd";
url = "sourcehut:~rycee/nmd";
flake = false;
};
@ -262,9 +262,9 @@
};
# Presence
presence-nvim = {
url = "github:andweeb/presence.nvim";
flake = false;
neocord = {
url = "github:IogaMaster/neocord";
flake = false; # uses flake-utils, avoid the flake
};
# Autopairs
@ -341,6 +341,11 @@
flake = false;
};
gruvbox = {
url = "github:ellisonleao/gruvbox.nvim";
flake = false;
};
# Rust crates
crates-nvim = {
url = "github:Saecki/crates.nvim";

View file

@ -4,6 +4,6 @@
typesLanguage = import ./languages.nix {inherit lib;};
in {
inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption;
inherit (typesLanguage) diagnostics mkGrammarOption;
}

View file

@ -43,6 +43,7 @@ with lib; let
"catppuccin"
"dracula"
"oxocarbon"
"gruvbox"
"minimap-vim"
"dashboard-nvim"
"alpha-nvim"
@ -53,7 +54,7 @@ with lib; let
"cheatsheet-nvim"
"ccc"
"cellular-automaton"
"presence-nvim"
"neocord"
"icon-picker-nvim"
"dressing-nvim"
"orgmode-nvim"
@ -138,4 +139,25 @@ in {
inherit description default;
type = pluginsType;
};
# opts is a attrset of options, example:
# ```
# mkPluginSetupOption "telescope" {
# file_ignore_patterns = mkOption {
# description = "...";
# type = types.listOf types.str;
# default = [];
# };
# layout_config.horizontal = mkOption {...};
# }
# ```
mkPluginSetupOption = pluginName: opts:
mkOption {
description = "Option table to pass into the setup function of " + pluginName;
default = {};
type = types.submodule {
freeformType = with types; attrsOf anything;
options = opts;
};
};
}

74
modules/languages/css.nix Normal file
View file

@ -0,0 +1,74 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
cfg = config.vim.languages.css;
defaultServer = "vscode-langservers-extracted";
servers = {
vscode-langservers-extracted = {
package = pkgs.nodePackages.vscode-langservers-extracted;
lspConfig = ''
-- enable (broadcasting) snippet capability for completion
-- see <https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cssls>
local css_capabilities = vim.lsp.protocol.make_client_capabilities()
css_capabilities.textDocument.completion.completionItem.snippetSupport = true
-- cssls setup
lspconfig.cssls.setup {
capabilities = css_capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/vscode-css-language-server", "--stdio"}''
}
}
'';
};
};
in {
options.vim.languages.css = {
enable = mkEnableOption "CSS language support";
treesitter = {
enable = mkEnableOption "CSS treesitter" // {default = config.vim.languages.enableTreesitter;};
package = nvim.types.mkGrammarOption pkgs "css";
};
lsp = {
enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "CSS LSP server to use";
type = with types; enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "CSS LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
type = with types; either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.tailwindcss-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -2,27 +2,29 @@
inherit (lib.nvim.languages) mkEnable;
in {
imports = [
./markdown
./tidal
./bash
./dart
./elixir
./bash
./markdown
./tidal
./clang.nix
./css.nix
./go.nix
./nix.nix
./python.nix
./rust.nix
./sql.nix
./ts.nix
./zig.nix
./html.nix
./svelte.nix
./java.nix
./lua.nix
./nim.nix
./nix.nix
./php.nix
./python.nix
./rust.nix
./sql.nix
./svelte.nix
./tailwind.nix
./terraform.nix
./ts.nix
./zig.nix
];
options.vim.languages = {

View file

@ -4,7 +4,7 @@
lib,
...
}: let
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
cfg = config.vim.languages.java;
in {
@ -38,7 +38,7 @@ in {
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/jdt-language-server", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
else ''{"${getExe cfg.lsp.package}", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
},
}
'';

View file

@ -4,9 +4,29 @@
lib,
...
}: let
inherit (lib) nvim mkIf mkMerge;
inherit (lib) nvim mkIf mkMerge mkBinding isList;
cfg = config.vim.languages.markdown;
self = import ./markdown.nix {
inherit lib config pkgs;
};
mappings = self.options.vim.languages.markdown.glow.mappings;
servers = {
marksman = {
package = pkgs.marksman;
lspConfig = ''
lspconfig.marksman.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
},
}
'';
};
};
in {
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
@ -18,13 +38,21 @@ in {
(mkIf cfg.glow.enable {
vim.startPlugins = ["glow-nvim"];
vim.globals = {
"glow_binary_path" = "${pkgs.glow}/bin";
};
vim.maps.normal = mkMerge [
(mkBinding cfg.glow.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
];
vim.configRC.glow = nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>p :Glow<CR>
vim.luaConfigRC.glow = nvim.dag.entryAnywhere ''
require('glow').setup({
glow_path = "${pkgs.glow}/bin/glow"
});
'';
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -4,18 +4,41 @@
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types nvim;
inherit (builtins) attrNames;
inherit (lib) mkEnableOption mkMappingOption mkOption types nvim isList;
cfg = config.vim.languages.markdown;
defaultServer = "marksman";
servers = {
marksman = {
package = pkgs.marksman;
lspConfig = ''
lspconfig.marksman.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
},
}
'';
};
};
in {
options.vim.languages.markdown = {
enable = mkEnableOption "Markdown markup language support";
glow.enable = mkOption {
glow = {
enable = mkOption {
type = types.bool;
default = true;
description = "Enable markdown preview in neovim with glow";
};
mappings = {
openPreview = mkMappingOption "Open preview" "<leader>p";
};
};
treesitter = {
enable = mkOption {
@ -26,5 +49,22 @@ in {
mdPackage = nvim.types.mkGrammarOption pkgs "markdown";
mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline";
};
lsp = {
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Markdown LSP server to use";
type = with types; enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "Markdown LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
type = with types; either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
};
}

View file

@ -0,0 +1,57 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
cfg = config.vim.languages.tailwind;
defaultServer = "tailwindcss-language-server";
servers = {
tailwindcss-language-server = {
package = pkgs.tailwindcss-language-server;
lspConfig = ''
lspconfig.tailwindcss.setup {
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/tailwindcss-language-server", "--stdio"}''
}
}
'';
};
};
in {
options.vim.languages.tailwind = {
enable = mkEnableOption "Tailwindcss language support";
lsp = {
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Tailwindcss LSP server to use";
type = with types; enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "Tailwindcss LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
type = with types; either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.css-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -1,5 +1,5 @@
_: {
{
imports = [
./presence-nvim
./neocord
];
}

View file

@ -4,26 +4,30 @@
...
}: let
inherit (lib) mkIf nvim boolToString;
inherit (lib.nvim.lua) listToLuaTable;
inherit (lib.strings) escapeNixString;
inherit (builtins) toString;
cfg = config.vim.presence.presence-nvim;
cfg = config.vim.presence.neocord;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["presence-nvim"];
vim.startPlugins = ["neocord"];
vim.luaConfigRC.presence-nvim = nvim.dag.entryAnywhere ''
-- Description of each option can be found in https://github.com/andweeb/presence.nvim
require("presence").setup({
vim.luaConfigRC.neocord = nvim.dag.entryAnywhere ''
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
require("neocord").setup({
-- General options
auto_update = true,
neovim_image_text = "${cfg.image_text}",
logo = "${cfg.logo}",
logo_tooltip = "${cfg.logo_tooltip}",
main_image = "${cfg.main_image}",
client_id = "${cfg.client_id}",
log_level = nil,
debounce_timeout = 10,
enable_line_number = "${boolToString cfg.enable_line_number}",
blacklist = {},
buttons = "${boolToString cfg.buttons}",
file_assets = {},
log_level = ${
if cfg.log_level == null
then "nil"
else "${escapeNixString cfg.log_level}"
},
debounce_timeout = ${toString cfg.debounce_timeout},
blacklist = ${listToLuaTable cfg.blacklist},
show_time = "${boolToString cfg.show_time}",
-- Rich Presence text options
@ -34,6 +38,7 @@ in {
reading_text = "${cfg.rich_presence.reading_text}",
workspace_text = "${cfg.rich_presence.workspace_text}",
line_number_text = "${cfg.rich_presence.line_number_text}",
terminal_text = "${cfg.rich_presence.terminal_text}",
})
'';
};

View file

@ -1,6 +1,6 @@
_: {
{
imports = [
./config.nix
./presence-nvim.nix
./neocord.nix
];
}

View file

@ -1,31 +1,58 @@
{
config,
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types;
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule;
in {
options.vim.presence.presence-nvim = {
enable = mkEnableOption "presence.nvim plugin for discord rich presence";
imports = [
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
Options provided by the plugin remain mostly the same, but manual migration is required.
image_text = mkOption {
Please see neocord documentation and the neovim-flake options for more info
'')
];
options.vim.presence.neocord = {
enable = mkEnableOption "neocord plugin for discord rich presence";
logo = mkOption {
type = types.str; # TODO: can the default be documented better, maybe with an enum?
default = "auto";
description = ''
Logo to be displayed on the RPC item
This must be either "auto" or an URL to your image of choice
'';
};
logo_tooltip = mkOption {
type = types.str;
default = "The One True Text Editor";
description = "Text displayed when hovering over the Neovim image";
};
main_image = mkOption {
type = types.str;
default = "neovim";
type = types.enum ["language" "logo"];
default = "language";
description = "Main image to be displayed";
};
client_id = mkOption {
type = types.str;
default = "79327144129396737";
default = "1157438221865717891";
description = "Client ID of the application";
};
log_level = mkOption {
type = with types; nullOr (enum ["debug" "info" "warn" "error"]);
default = null;
description = "Log level to be used by the plugin";
};
debounce_timeout = mkOption {
type = types.int;
default = 10;
description = "Number of seconds to debounce events";
};
auto_update = mkOption {
type = types.bool;
default = true;
@ -38,18 +65,19 @@ in {
description = "Show line number on the RPC item";
};
buttons = mkOption {
type = types.bool;
default = true;
description = "Show buttons on the RPC item";
};
show_time = mkOption {
type = types.bool;
default = true;
description = "Show time on the RPC item";
};
blacklist = mkOption {
type = with types; listOf str;
default = [];
example = literalExpression ''["Alpha"]'';
description = "List of filetypes to ignore";
};
rich_presence = {
editing_text = mkOption {
type = types.str;
@ -92,6 +120,12 @@ in {
default = "Line %s out of %s";
description = "Text displayed when showing line number";
};
terminal_text = mkOption {
type = types.str;
default = "Working on the terminal";
description = "Text displayed when working on the terminal";
};
};
};
}

View file

@ -20,10 +20,10 @@ in {
theme = "${cfg.theme}",
component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"},
section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"},
disabled_filetypes = { 'alpha' },
always_divide_middle = true,
disabled_filetypes = ${nvim.lua.listToLuaTable cfg.disabledFiletypes},
always_divide_middle = ${boolToString cfg.alwaysDivideMiddle},
globalstatus = ${boolToString cfg.globalStatus},
ignore_focus = {'NvimTree'},
ignore_focus = ${nvim.lua.listToLuaTable cfg.ignoreFocus},
extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}},
refresh = {
statusline = ${toString cfg.refresh.statusline},
@ -31,6 +31,7 @@ in {
winbar = ${toString cfg.refresh.winbar},
},
},
-- active sections
sections = {
lualine_a = ${nvim.lua.luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)},
@ -40,7 +41,8 @@ in {
lualine_y = ${nvim.lua.luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)},
},
--
-- inactive sections
inactive_sections = {
lualine_a = ${nvim.lua.luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)},
lualine_b = ${nvim.lua.luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)},
@ -49,9 +51,12 @@ in {
lualine_y = ${nvim.lua.luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)},
lualine_z = ${nvim.lua.luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)},
},
-- tabline (currently unsupported)
tabline = {},
${optionalString (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") ''
-- enable winbar if nvim-navic is enabled
winbar = {
lualine_c = {
{

View file

@ -24,11 +24,13 @@ in {
description = "Refresh rate for lualine";
default = 1000;
};
tabline = mkOption {
type = types.int;
description = "Refresh rate for tabline";
default = 1000;
};
winbar = mkOption {
type = types.int;
description = "Refresh rate for winbar";
@ -42,6 +44,27 @@ in {
default = true;
};
alwaysDivideMiddle = mkOption {
type = types.bool;
description = "Always divide middle section";
default = true;
};
disabledFiletypes = mkOption {
type = with types; listOf str;
description = "Filetypes to disable lualine on";
default = ["alpha"];
};
ignoreFocus = mkOption {
type = with types; listOf str;
default = ["NvimTree"];
description = ''
If current filetype is in this list it'll always be drawn as inactive statusline
and the last window will be drawn as active statusline.
'';
};
theme = let
themeSupported = elem config.vim.theme.name supported_themes;
in
@ -175,6 +198,9 @@ in {
bg='${colorPuccin}',
fg='lavender'
},
separator = {
right = ''
},
}
''
];
@ -220,6 +246,9 @@ in {
end,
icon = ' ',
color = {bg='${colorPuccin}', fg='lavender'},
separator = {
left = '',
},
}
''
''

View file

@ -3,4 +3,5 @@
"onedark"
"catppuccin"
"oxocarbon"
"gruvbox"
]

View file

@ -92,4 +92,40 @@
'';
styles = ["dark" "light"];
};
gruvbox = {
setup = {
style ? "dark",
transparent ? false,
}: ''
-- Gruvbox theme
require("gruvbox").setup({
terminal_colors = true, -- add neovim terminal colors
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
emphasis = true,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true,
contrast = "",
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = ${lib.boolToString transparent},
})
vim.o.background = "${style}"
vim.cmd("colorscheme gruvbox")
'';
styles = ["dark" "light"];
};
}

4
release.json Normal file
View file

@ -0,0 +1,4 @@
{
"release": "v0.6",
"isReleaseBranch": false
}