Merge branch 'main' into v0.7

This commit is contained in:
raf 2024-09-24 10:54:31 +00:00 committed by GitHub
commit 141a272747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 702 additions and 649 deletions

View file

@ -1,4 +1,5 @@
name: "Build and deploy documentation" name: "Build and deploy documentation"
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
@ -7,6 +8,7 @@ on:
paths: paths:
# build the manuals only when docs directory is updated # build the manuals only when docs directory is updated
- docs/** - docs/**
- modules/**
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions: permissions:
@ -20,23 +22,34 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4.1.7
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
publish: publish:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4.1.7
uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
- run: |
- name: Build nix build .#docs
run: |
nix build '.#docs'
cp -r result/share/doc/nvf public cp -r result/share/doc/nvf public
- uses: peaceiris/actions-gh-pages@v4
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public publish_dir: ./public

View file

@ -17,7 +17,6 @@ isMaximal: {
lspkind.enable = false; lspkind.enable = false;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = isMaximal;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
lsplines.enable = isMaximal; lsplines.enable = isMaximal;
@ -204,6 +203,7 @@ isMaximal: {
go = ["90" "130"]; go = ["90" "130"];
}; };
}; };
fastaction.enable = true;
}; };
assistant = { assistant = {

View file

@ -2,19 +2,24 @@
inputs, inputs,
pkgs, pkgs,
lib, lib,
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
...
}: let }: let
inherit (lib.modules) mkForce evalModules; inherit ((lib.importJSON ../release.json)) release;
inherit (lib.strings) hasPrefix removePrefix;
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
inherit (builtins) fromJSON readFile;
# release data nvimModuleDocs = pkgs.nixosOptionsDoc {
release-config = fromJSON (readFile ../release.json); variablelistId = "nvf-options";
revision = release-config.release; warningsAreErrors = true;
# From home-manager: inherit
(
(lib.evalModules {
modules =
import ../modules/modules.nix {
inherit lib pkgs;
}
++ [
(
let
# From nixpkgs:
# #
# Recursively replace each derivation in the given attribute set # Recursively replace each derivation in the given attribute set
# with the same derivation but with the `outPath` attribute set to # with the same derivation but with the `outPath` attribute set to
@ -28,131 +33,73 @@
# Caveat: even if the package is reached by a different means, the # Caveat: even if the package is reached by a different means, the
# path above will be shown and not e.g. # path above will be shown and not e.g.
# `${config.services.foo.package}`. # `${config.services.foo.package}`.
scrubDerivations = prefixPath: attrs: let scrubDerivations = namePrefix: pkgSet:
scrubDerivation = name: value: let builtins.mapAttrs (
pkgAttrName = prefixPath + "." + name; name: value: let
wholeName = "${namePrefix}.${name}";
in in
if isAttrs value if builtins.isAttrs value
then then
scrubDerivations pkgAttrName value scrubDerivations wholeName value
// optionalAttrs (isDerivation value) { // lib.optionalAttrs (lib.isDerivation value) {
outPath = "\${${pkgAttrName}}"; inherit (value) drvPath;
outPath = "\${${wholeName}}";
} }
else value; else value
in )
mapAttrs scrubDerivation attrs; pkgSet;
# Make sure the used package is scrubbed to avoid actually
# instantiating derivations.
scrubbedPkgsModule = {
imports = [
{
_module.args = {
pkgs = mkForce (scrubDerivations "pkgs" pkgs);
pkgs_i686 = mkForce {};
};
}
];
};
# Specify the path to the module entrypoint
nvimPath = toString ./..;
buildOptionsDocs = args @ {
modules,
includeModuleSystemOptions ? true,
warningsAreErrors ? true,
...
}: let
inherit ((evalModules {inherit modules;})) options;
# Declaration of the Github site URL.
# Takes a user, repo, and subpath, and returns a declaration site
# as a string.
githubDeclaration = user: repo: subpath: let
urlRef = "github.com";
branch = "main";
in { in {
url = "https://${urlRef}/${user}/${repo}/blob/${branch}/${subpath}"; _module = {
name = "<${repo}/${subpath}>"; check = false;
args.pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs);
}; };
in }
pkgs.buildPackages.nixosOptionsDoc ({ )
inherit warningsAreErrors; ];
})
options = )
if includeModuleSystemOptions options
then options ;
else builtins.removeAttrs options ["_module"];
transformOptions = opt: transformOptions = opt:
recursiveUpdate opt { opt
# Clean up declaration sites to not refer to the nvf // {
# source tree. declarations =
declarations = map (decl: map (
if hasPrefix nvimPath (toString decl) decl:
if lib.hasPrefix (toString ../.) (toString decl)
then then
githubDeclaration "notashelf" "nvf" lib.pipe decl [
(removePrefix "/" (removePrefix nvimPath (toString decl))) toString
(lib.removePrefix (toString ../.))
(lib.removePrefix "/")
(x: {
url = "https://github.com/NotAShelf/nvf/blob/main/${decl}";
name = "<nvf/${x}>";
})
]
else if decl == "lib/modules.nix" else if decl == "lib/modules.nix"
then then {
# TODO: handle this in a better way (may require upstream url = "https://github.com/NixOS/nixpkgs/blob/master/${decl}";
# changes to nixpkgs) name = "<nixpkgs/lib/modules.nix>";
githubDeclaration "NixOS" "nixpkgs" decl }
else decl) else decl
)
opt.declarations; opt.declarations;
}; };
}
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
nvimModuleDocs = buildOptionsDocs {
variablelistId = "nvf-options";
modules =
import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [scrubbedPkgsModule];
}; };
# Generate the `man home-configuration.nix` package
nvf-configuration-manual =
pkgs.runCommand "nvf-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} \
--header ${./man/header.5} \
--footer ${./man/footer.5} \
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/nvf.5
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
'';
# Generate the HTML manual pages # Generate the HTML manual pages
nvf-manual = pkgs.callPackage ./manual.nix { html = pkgs.callPackage ./manual.nix {
inherit revision manpageUrls; inherit release;
outputPath = "share/doc/nvf"; inherit (nvimModuleDocs) optionsJSON;
options = {
nvf = nvimModuleDocs.optionsJSON;
}; };
};
html = nvf-manual;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
in { in {
inherit (inputs) nmd; inherit (inputs) nmd;
options = {
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream # TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable. # `nixosOptionsDoc` is more customizable.
json = options.json =
pkgs.runCommand "options.json" { pkgs.runCommand "options.json" {
meta.description = "List of nvf options in JSON format"; meta.description = "List of nvf options in JSON format";
} '' } ''
@ -165,8 +112,31 @@ in {
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \ '${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
"$out/share/doc/nvf" "$out/share/doc/nvf"
''; '';
};
manPages = nvf-configuration-manual; # Generate the `man home-configuration.nix` package
manual = {inherit html htmlOpenTool;}; manPages =
pkgs.runCommand "nvf-reference-manpage" {
nativeBuildInputs = [
pkgs.buildPackages.installShellFiles
pkgs.nixos-render-docs
];
allowedReferences = ["out"];
} ''
# Generate manpages.
mkdir -p $out/share/man/{man5,man1}
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
--revision ${release} \
--header ${./man/header.5} \
--footer ${./man/footer.5} \
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/nvf.5
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
'';
manual = {
inherit html;
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {inherit html;};
};
} }

View file

@ -2,13 +2,9 @@
writeShellScriptBin, writeShellScriptBin,
makeDesktopItem, makeDesktopItem,
symlinkJoin, symlinkJoin,
}: {
html, html,
pathName ? "nvf",
projectName ? pathName,
name ? "${pathName}-help",
}: let }: let
helpScript = writeShellScriptBin name '' helpScript = writeShellScriptBin "nvf-help" ''
set -euo pipefail set -euo pipefail
if [[ ! -v BROWSER || -z $BROWSER ]]; then if [[ ! -v BROWSER || -z $BROWSER ]]; then
@ -24,20 +20,23 @@
echo "$0: unable to start a web browser; please set \$BROWSER" echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1 exit 1
else else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml" exec "$BROWSER" "${html}/share/doc/nvf/index.xhtml"
fi fi
''; '';
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
name = "${pathName}-manual"; name = "nvf-manual";
desktopName = "${projectName} Manual"; desktopName = "nvf Manual";
genericName = "View ${projectName} documentation in a web browser"; genericName = "View nvf documentation in a web browser";
icon = "nix-snowflake"; icon = "nix-snowflake";
exec = "${helpScript}/bin/${name}"; exec = "${helpScript}/bin/nvf-help";
categories = ["System"]; categories = ["System"];
}; };
in in
symlinkJoin { symlinkJoin {
inherit name; name = "nvf-help";
paths = [helpScript desktopItem]; paths = [
helpScript
desktopItem
];
} }

View file

@ -4,11 +4,10 @@
# build inputs # build inputs
nixos-render-docs, nixos-render-docs,
documentation-highlighter, documentation-highlighter,
path,
# nrd configuration # nrd configuration
manpageUrls, release,
revision, optionsJSON,
options,
outputPath ? "share/doc/nvf",
}: }:
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "nvf-manual"; name = "nvf-manual";
@ -20,9 +19,11 @@ stdenvNoCC.mkDerivation {
nativeBuildInputs = [nixos-render-docs]; nativeBuildInputs = [nixos-render-docs];
buildPhase = '' buildPhase = ''
mkdir -p out/{highlightjs,media} dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,media}
cp -vt out/highlightjs \ cp -vt $dest/highlightjs \
${documentation-highlighter}/highlight.pack.js \ ${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \ ${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \ ${documentation-highlighter}/mono-blue.css \
@ -31,36 +32,30 @@ stdenvNoCC.mkDerivation {
substituteInPlace ./options.md \ substituteInPlace ./options.md \
--subst-var-by \ --subst-var-by \
OPTIONS_JSON \ OPTIONS_JSON \
${options.nvf}/share/doc/nixos/options.json ${optionsJSON}/share/doc/nixos/options.json
substituteInPlace ./manual.md \ substituteInPlace ./manual.md \
--subst-var-by \ --subst-var-by \
NVF_VERSION \ NVF_VERSION \
${revision} ${release}
# copy stylesheet # copy stylesheet
cp ${./static/style.css} out/style.css cp ${./static/style.css} "$dest/style.css"
# copy release notes # copy release notes
cp -vr ${./release-notes} release-notes cp -vr ${./release-notes} release-notes
# generate manual from # generate manual from
nixos-render-docs manual html \ nixos-render-docs manual html \
--manpage-urls ${manpageUrls} \ --manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault revision} \ --revision ${lib.trivial.revisionWithDefault release} \
--stylesheet style.css \ --stylesheet style.css \
--script highlightjs/highlight.pack.js \ --script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \ --script highlightjs/loader.js \
--toc-depth 2 \ --toc-depth 2 \
--section-toc-depth 1 \ --section-toc-depth 1 \
manual.md \ manual.md \
out/index.xhtml "$dest/index.xhtml"
'';
installPhase = ''
dest="$out/${outputPath}"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
mkdir -p $out/nix-support/ mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products

View file

@ -1,7 +1,7 @@
# Custom Plugins {#ch-custom-plugins} # Custom Plugins {#ch-custom-plugins}
**nvf**, by default, exposes a wide variety of plugins as module options **nvf**, by default, exposes a wide variety of plugins as module options
for your convience and bundles necessary dependencies into **nvf**'s runtime. for your convenience and bundles necessary dependencies into **nvf**'s runtime.
In case a plugin is not available in **nvf**, you may consider making a pull In case a plugin is not available in **nvf**, you may consider making a pull
request to **nvf** to include it as a module or you may add it to your request to **nvf** to include it as a module or you may add it to your
configuration locally. configuration locally.

View file

@ -11,7 +11,7 @@ entries in nvf:
inserted before the rest of the DAG inserted before the rest of the DAG
2. `globalsScript` - used to set globals defined in `vim.globals` 2. `globalsScript` - used to set globals defined in `vim.globals`
3. `basic` - used to set basic configuration options 3. `basic` - used to set basic configuration options
4. `theme` - used to set up the theme, which has to be done before other plugins 4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option, 5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
plugins) DAG, used to set up internal plugins plugins) DAG, used to set up internal plugins

View file

@ -48,6 +48,18 @@ vim.maps."<leader>m" = {
}; };
``` ```
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
The nvim-code-action-menu plugin has been archived and broken for a long time,
so it's being replaced with a young, but better alternative called
fastaction.nvim. Simply remove everything set under
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
Note that we are looking to add more alternatives in the future like
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
everyone.
## Changelog {#sec-release-0.7-changelog} ## Changelog {#sec-release-0.7-changelog}
[ItsSorae](https://github.com/ItsSorae): [ItsSorae](https://github.com/ItsSorae):
@ -77,6 +89,7 @@ vim.maps."<leader>m" = {
longer filtered and thus should be used instead. longer filtered and thus should be used instead.
- Add dap-go for better dap configurations - Add dap-go for better dap configurations
- Make noice.nvim customizable - Make noice.nvim customizable
- Standardize border style options and add custom borders
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim [rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim [rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
@ -95,7 +108,8 @@ vim.maps."<leader>m" = {
- Fix "Emac" typo - Fix "Emac" typo
- Add [new-file-template.nvim] to automatically fill new file contents using templates. - Add [new-file-template.nvim] to automatically fill new file contents using
templates.
[diniamo](https://github.com/diniamo): [diniamo](https://github.com/diniamo):
@ -117,7 +131,6 @@ vim.maps."<leader>m" = {
plugin's options can now be found under `indentBlankline.setupOpts`, the plugin's options can now be found under `indentBlankline.setupOpts`, the
previous iteration of the module also included out of place/broken options, previous iteration of the module also included out of place/broken options,
which have been removed for the time being. These are: which have been removed for the time being. These are:
- `listChar` - this was already unused - `listChar` - this was already unused
- `fillChar` - this had nothing to do with the plugin, please configure it - `fillChar` - this had nothing to do with the plugin, please configure it
yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your
@ -126,6 +139,9 @@ vim.maps."<leader>m" = {
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
lua configuration lua configuration
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
breaking changes section above for more details
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd() [Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
- Make Neovim's configuration file entirely Lua based. This comes with a few - Make Neovim's configuration file entirely Lua based. This comes with a few
@ -172,7 +188,31 @@ vim.maps."<leader>m" = {
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim - Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
closure. Both of those scripts have been automatically added to your PATH upon closure. Both of those scripts have been automatically added to your PATH upon
using neovimConfig or `programs.nvf.enable`. using neovimConfig or `programs.nvf.enable`.
- `nvf-print-config` will display your `init.lua`, in full. - `nvf-print-config` will display your `init.lua`, in full.
- `nvf-print-config-path` will display the path to _a clone_ of your - `nvf-print-config-path` will display the path to _a clone_ of your
`init.lua`. This is not the path used by the Neovim wrapper, but an `init.lua`. This is not the path used by the Neovim wrapper, but an
identical clone. identical clone.
- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
being.
- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
controlling the default behaviour of the `nvim-navic` component on Lualine,
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
new format.
- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
server and make it default.
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
additional Python LSP server.
[ppenguin](https://github.com/ppenguin):
- Telescope:
- Fixed `project-nvim` command and keybinding
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)

View file

@ -1,21 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -52,28 +36,13 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mnw": { "mnw": {
"locked": { "locked": {
"lastModified": 1724456641, "lastModified": 1726188505,
"narHash": "sha256-SMgnviF6ofBPbyV3+rljPGcX0Hn9HBOhgXE10Cyjaic=", "narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=",
"owner": "Gerg-L", "owner": "Gerg-L",
"repo": "mnw", "repo": "mnw",
"rev": "c261925dbbf02f523af0e8add844df64fddf0359", "rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -129,11 +98,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722141560, "lastModified": 1726871744,
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -171,22 +140,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1702350026,
"narHash": "sha256-A+GNZFZdfl4JdDphYKBJ5Ef1HOiFsP18vQe9mqjmUis=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9463103069725474698139ab10f17a9d125da859",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": { "nmd": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -571,6 +524,22 @@
"type": "github" "type": "github"
} }
}, },
"plugin-fastaction-nvim": {
"flake": false,
"locked": {
"lastModified": 1721396662,
"narHash": "sha256-L7na78FsE+QHlEwxMpiwQcoOPhtmrknvdTZfzUoDANI=",
"owner": "Chaitanyabsprip",
"repo": "fastaction.nvim",
"rev": "2384dea7ba81d2709d0bee0e4bc7a8831ff13a9d",
"type": "github"
},
"original": {
"owner": "Chaitanyabsprip",
"repo": "fastaction.nvim",
"type": "github"
}
},
"plugin-fidget-nvim": { "plugin-fidget-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1052,22 +1021,6 @@
"type": "github" "type": "github"
} }
}, },
"plugin-nvim-code-action-menu": {
"flake": false,
"locked": {
"lastModified": 1702287297,
"narHash": "sha256-pY+aP9iBuJhvDZzVEsOHZmnfaq3vUP7TfKEEQrj+Mo8=",
"owner": "weilbith",
"repo": "nvim-code-action-menu",
"rev": "8c7672a4b04d3cc4edd2c484d05b660a9cb34a1b",
"type": "github"
},
"original": {
"owner": "weilbith",
"repo": "nvim-code-action-menu",
"type": "github"
}
},
"plugin-nvim-colorizer-lua": { "plugin-nvim-colorizer-lua": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1183,11 +1136,11 @@
"plugin-nvim-lspconfig": { "plugin-nvim-lspconfig": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1716498901, "lastModified": 1727085470,
"narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=", "narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=",
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996", "rev": "dd329912c8d446240584a2dbcd3802af3a19105a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1855,6 +1808,7 @@
"plugin-dracula": "plugin-dracula", "plugin-dracula": "plugin-dracula",
"plugin-dressing-nvim": "plugin-dressing-nvim", "plugin-dressing-nvim": "plugin-dressing-nvim",
"plugin-elixir-tools": "plugin-elixir-tools", "plugin-elixir-tools": "plugin-elixir-tools",
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
"plugin-fidget-nvim": "plugin-fidget-nvim", "plugin-fidget-nvim": "plugin-fidget-nvim",
"plugin-flutter-tools": "plugin-flutter-tools", "plugin-flutter-tools": "plugin-flutter-tools",
"plugin-gesture-nvim": "plugin-gesture-nvim", "plugin-gesture-nvim": "plugin-gesture-nvim",
@ -1885,7 +1839,6 @@
"plugin-nvim-autopairs": "plugin-nvim-autopairs", "plugin-nvim-autopairs": "plugin-nvim-autopairs",
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua", "plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
"plugin-nvim-cmp": "plugin-nvim-cmp", "plugin-nvim-cmp": "plugin-nvim-cmp",
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
"plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua", "plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua",
"plugin-nvim-cursorline": "plugin-nvim-cursorline", "plugin-nvim-cursorline": "plugin-nvim-cursorline",
"plugin-nvim-dap": "plugin-nvim-dap", "plugin-nvim-dap": "plugin-nvim-dap",
@ -1933,8 +1886,7 @@
"plugin-vim-vsnip": "plugin-vim-vsnip", "plugin-vim-vsnip": "plugin-vim-vsnip",
"plugin-which-key": "plugin-which-key", "plugin-which-key": "plugin-which-key",
"rnix-lsp": "rnix-lsp", "rnix-lsp": "rnix-lsp",
"systems": "systems_2", "systems": "systems_2"
"zig": "zig"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -2006,26 +1958,6 @@
"repo": "flake-utils", "repo": "flake-utils",
"type": "github" "type": "github"
} }
},
"zig": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1716725305,
"narHash": "sha256-LIz08gALt2wlutGXAEhNroEoIuPV5ePQB8LI4WzXcy8=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "93b02a697561ecd438cfa5779727b5a1c300cb4c",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -90,10 +90,7 @@
flake = false; flake = false;
}; };
# TODO: get zig from the zig overlay instead of nixpkgs # Language servers (use master instead of nixpkgs)
zig.url = "github:mitchellh/zig-overlay";
# Langauge server (use master instead of nixpkgs)
rnix-lsp.url = "github:nix-community/rnix-lsp"; rnix-lsp.url = "github:nix-community/rnix-lsp";
nil = { nil = {
url = "github:oxalica/nil"; url = "github:oxalica/nil";
@ -133,8 +130,8 @@
flake = false; flake = false;
}; };
plugin-nvim-code-action-menu = { plugin-fastaction-nvim = {
url = "github:weilbith/nvim-code-action-menu"; url = "github:Chaitanyabsprip/fastaction.nvim";
flake = false; flake = false;
}; };
@ -159,7 +156,7 @@
flake = false; flake = false;
}; };
# language support # Language support
plugin-sqls-nvim = { plugin-sqls-nvim = {
url = "github:nanotee/sqls.nvim"; url = "github:nanotee/sqls.nvim";
flake = false; flake = false;

View file

@ -67,7 +67,6 @@ in {
formatOnSave = true; formatOnSave = true;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
rust.enable = false; rust.enable = false;

View file

@ -67,7 +67,6 @@ in {
formatOnSave = true; formatOnSave = true;
lightbulb.enable = true; lightbulb.enable = true;
lspsaga.enable = false; lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true; trouble.enable = true;
lspSignature.enable = true; lspSignature.enable = true;
rust.enable = false; rust.enable = false;

View file

@ -8,6 +8,7 @@
docs = import ../docs {inherit pkgs inputs lib;}; docs = import ../docs {inherit pkgs inputs lib;};
in { in {
packages = { packages = {
inherit (docs.manual) htmlOpenTool;
# Documentation # Documentation
docs = docs.manual.html; docs = docs.manual.html;
docs-html = docs.manual.html; docs-html = docs.manual.html;

View file

@ -1,18 +0,0 @@
{
inputs,
lib,
}: let
modulesWithInputs = import ../modules inputs;
in
{
modules ? [],
pkgs,
check ? true,
extraSpecialArgs ? {},
extraModules ? [],
...
}:
modulesWithInputs {
inherit pkgs lib check extraSpecialArgs extraModules;
configuration.imports = modules;
}

View file

@ -11,5 +11,5 @@
languages = import ./languages.nix {inherit lib;}; languages = import ./languages.nix {inherit lib;};
lists = import ./lists.nix {inherit lib;}; lists = import ./lists.nix {inherit lib;};
lua = import ./lua.nix {inherit lib;}; lua = import ./lua.nix {inherit lib;};
neovimConfiguration = import ./configuration.nix {inherit inputs lib;}; neovimConfiguration = import ../modules {inherit inputs lib;};
} }

View file

@ -9,7 +9,7 @@
typesCustom = import ./custom.nix {inherit lib;}; typesCustom = import ./custom.nix {inherit lib;};
in { in {
inherit (typesDag) dagOf; inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
inherit (typesLanguage) diagnostics mkGrammarOption; inherit (typesLanguage) diagnostics mkGrammarOption;
inherit (typesCustom) anythingConcatLists char; inherit (typesCustom) anythingConcatLists char;
} }

View file

@ -51,9 +51,13 @@
}; };
}; };
}; };
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
in { in {
inherit extraPluginType fromInputs pluginType; inherit extraPluginType fromInputs pluginType;
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
pluginsOpt = { pluginsOpt = {
description, description,
example, example,

View file

@ -1,10 +1,13 @@
inputs: { {
configuration, inputs,
pkgs,
lib, lib,
check ? true, }: {
pkgs,
extraSpecialArgs ? {}, extraSpecialArgs ? {},
modules ? [],
# deprecated
extraModules ? [], extraModules ? [],
configuration ? {},
}: let }: let
inherit (pkgs) vimPlugins; inherit (pkgs) vimPlugins;
inherit (lib.strings) isString toString; inherit (lib.strings) isString toString;
@ -13,13 +16,25 @@ inputs: {
# import modules.nix with `check`, `pkgs` and `lib` as arguments # import modules.nix with `check`, `pkgs` and `lib` as arguments
# check can be disabled while calling this file is called # check can be disabled while calling this file is called
# to avoid checking in all modules # to avoid checking in all modules
nvimModules = import ./modules.nix {inherit pkgs check lib;}; nvimModules = import ./modules.nix {inherit pkgs lib;};
# evaluate the extended library with the modules # evaluate the extended library with the modules
# optionally with any additional modules passed by the user # optionally with any additional modules passed by the user
module = lib.evalModules { module = lib.evalModules {
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;}; specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
modules = concatLists [[configuration] nvimModules extraModules]; modules = concatLists [
nvimModules
modules
(lib.optional (configuration != {}) (lib.warn ''
nvf: passing 'configuration' to lib.neovimConfiguration is deprecated.
''
configuration))
(lib.optionals (extraModules != []) (lib.warn ''
nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead.
''
extraModules))
];
}; };
# alias to the internal configuration # alias to the internal configuration

View file

@ -7,5 +7,12 @@ in {
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
you depended on this functionality, please open an issue. you depended on this functionality, please open an issue.
'') '')
# 2024-07-20
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
'')
]; ];
} }

View file

@ -1,15 +1,14 @@
{ {
check ? true,
pkgs, pkgs,
lib, lib,
}: let }: let
inherit (lib.modules) mkDefault; inherit (lib.modules) mkDefault;
inherit (lib.lists) concatLists; inherit (lib.lists) concatLists;
allModules = let
# The core neovim modules. # The core neovim modules.
# Contains configuration for core neovim features # Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim). # such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: ./neovim + "/${p}") [ neovim = map (p: "${./neovim}/${p}") [
"init" "init"
"mappings" "mappings"
]; ];
@ -17,7 +16,7 @@
# Individual plugin modules, separated by the type of plugin. # Individual plugin modules, separated by the type of plugin.
# While adding a new type, you must make sure your type is # While adding a new type, you must make sure your type is
# included in the list below. # included in the list below.
plugins = map (p: ./plugins + "/${p}") [ plugins = map (p: "${./plugins}/${p}") [
"assistant" "assistant"
"autopairs" "autopairs"
"comments" "comments"
@ -47,7 +46,7 @@
# The neovim wrapper, used to build a wrapped neovim package # The neovim wrapper, used to build a wrapped neovim package
# using the configuration passed in `neovim` and `plugins` modules. # using the configuration passed in `neovim` and `plugins` modules.
wrapper = map (p: ./wrapper + "/${p}") [ wrapper = map (p: "${./wrapper}/${p}") [
"build" "build"
"rc" "rc"
"warnings" "warnings"
@ -55,23 +54,19 @@
# Extra modules, such as deprecation warnings # Extra modules, such as deprecation warnings
# or renames in one place. # or renames in one place.
extra = map (p: ./extra + "/${p}") [ extra = map (p: "${./extra}/${p}") [
"deprecations.nix" "deprecations.nix"
]; ];
in
allModules = concatLists [neovim plugins wrapper extra]; concatLists [neovim plugins wrapper extra];
in
pkgsModule = {config, ...}: { allModules
config = { ++ [
_module = { {
inherit check; _module.args = {
args = {
baseModules = allModules; baseModules = allModules;
pkgsPath = mkDefault pkgs.path; pkgsPath = mkDefault pkgs.path;
pkgs = mkDefault pkgs; pkgs = mkDefault pkgs;
}; };
}; }
}; ]
};
in
allModules ++ [pkgsModule]

View file

@ -3,11 +3,13 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) enum bool str int; inherit (lib.types) enum bool str int either;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.types) luaInline;
cfg = config.vim; cfg = config.vim;
in { in {
@ -158,9 +160,29 @@ in {
default = "sensitive"; default = "sensitive";
description = "Set the case sensitivity of search"; description = "Set the case sensitivity of search";
}; };
undoFile = {
enable = mkEnableOption "undofile for persistent undo behaviour";
path = mkOption {
type = either str luaInline;
default = mkLuaInline "vim.fn.stdpath('state') .. '/undo'";
defaultText = literalMD ''
```nix
mkLuaInline "vim.fn.stdpath('state') .. '/undo'"
```
'';
example = literalMD ''
```nix
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
```
'';
description = "Path to the directory in which undo history will be stored";
};
};
}; };
config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] '' config = {
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
-- Settings that are set for everything -- Settings that are set for everything
vim.o.encoding = "utf-8" vim.o.encoding = "utf-8"
vim.o.hidden = true vim.o.hidden = true
@ -178,6 +200,11 @@ in {
vim.g.mapleader = ${toLuaObject cfg.leaderKey} vim.g.mapleader = ${toLuaObject cfg.leaderKey}
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey} vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
${optionalString cfg.undoFile.enable ''
vim.o.undofile = true
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
''}
${optionalString cfg.splitBelow '' ${optionalString cfg.splitBelow ''
vim.o.splitbelow = true vim.o.splitbelow = true
''} ''}
@ -266,4 +293,5 @@ in {
vim.o.ignorecase = false vim.o.ignorecase = false
''} ''}
''; '';
};
} }

View file

@ -57,7 +57,7 @@
dapConfig = '' dapConfig = ''
dap.adapters.lldb = { dap.adapters.lldb = {
type = 'executable', type = 'executable',
command = '${cfg.dap.package}/bin/lldb-vscode', command = '${cfg.dap.package}/bin/lldb-dap',
name = 'lldb' name = 'lldb'
} }
dap.configurations.cpp = { dap.configurations.cpp = {

View file

@ -14,7 +14,7 @@
cfg = config.vim.languages.python; cfg = config.vim.languages.python;
defaultServer = "pyright"; defaultServer = "basedpyright";
servers = { servers = {
pyright = { pyright = {
package = pkgs.pyright; package = pkgs.pyright;
@ -30,6 +30,36 @@
} }
''; '';
}; };
basedpyright = {
package = pkgs.basedpyright;
lspConfig = ''
lspconfig.basedpyright.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/basedpyright-langserver", "--stdio"}''
}
}
'';
};
python-lsp-server = {
package = pkgs.python-lsp-server;
lspConfig = ''
lspconfig.pylsp.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/pylsp"}''
}
}
'';
};
}; };
defaultFormat = "black"; defaultFormat = "black";
@ -61,11 +91,12 @@
black-and-isort = { black-and-isort = {
package = pkgs.writeShellApplication { package = pkgs.writeShellApplication {
name = "black"; name = "black";
runtimeInputs = [pkgs.black pkgs.isort];
text = '' text = ''
black --quiet - "$@" | isort --profile black - black --quiet - "$@" | isort --profile black -
''; '';
runtimeInputs = [pkgs.black pkgs.isort];
}; };
nullConfig = '' nullConfig = ''
table.insert( table.insert(
ls_sources, ls_sources,

View file

@ -173,7 +173,7 @@ in {
dap = { dap = {
adapter = { adapter = {
type = "executable", type = "executable",
command = "${cfg.dap.package}/bin/lldb-vscode", command = "${cfg.dap.package}/bin/lldb-dap",
name = "rustacean_lldb", name = "rustacean_lldb",
}, },
}, },

View file

@ -17,12 +17,12 @@
cfg = config.vim.languages.ts; cfg = config.vim.languages.ts;
defaultServer = "tsserver"; defaultServer = "ts_ls";
servers = { servers = {
tsserver = { ts_ls = {
package = pkgs.typescript-language-server; package = pkgs.typescript-language-server;
lspConfig = '' lspConfig = ''
lspconfig.tsserver.setup { lspconfig.ts_ls.setup {
capabilities = capabilities; capabilities = capabilities;
on_attach = attach_keymaps, on_attach = attach_keymaps,
cmd = ${ cmd = ${
@ -49,6 +49,24 @@
} }
''; '';
}; };
# Here for backwards compatibility. Still consider tsserver a valid
# configuration in the enum, but assert if it's set to *properly*
# redirect the user to the correct server.
tsserver = {
package = pkgs.typescript-language-server;
lspConfig = ''
lspconfig.ts_ls.setup {
capabilities = capabilities;
on_attach = attach_keymaps,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
}
}
'';
};
}; };
# TODO: specify packages # TODO: specify packages
@ -65,6 +83,7 @@
) )
''; '';
}; };
prettierd = { prettierd = {
package = pkgs.prettierd; package = pkgs.prettierd;
nullConfig = '' nullConfig = ''
@ -94,6 +113,7 @@
}; };
}; };
in { in {
_file = ./ts.nix;
options.vim.languages.ts = { options.vim.languages.ts = {
enable = mkEnableOption "Typescript/Javascript language support"; enable = mkEnableOption "Typescript/Javascript language support";
@ -190,11 +210,32 @@ in {
}; };
}) })
# Extensions
(mkIf cfg.extensions."ts-error-translator".enable { (mkIf cfg.extensions."ts-error-translator".enable {
vim.startPlugins = ["ts-error-translator"]; vim.startPlugins = ["ts-error-translator"];
vim.pluginRC.ts-error-translator = entryAnywhere '' vim.pluginRC.ts-error-translator = entryAnywhere ''
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts}) require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
''; '';
}) })
# Warn the user if they have set the default server name to tsserver to match upstream (us)
# The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This
# is a purely cosmetic change, but emits a warning if not accounted for.
{
assertions = [
{
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
message = ''
As of a recent lspconfig update, he `tsserver` configuration has been renamed
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
to `"ts_ls"` instead of to `${cfg.lsp.server}`
Please see <https://github.com/neovim/nvim-lspconfig/pull/3232> for more details
about this change.
'';
}
];
}
]); ]);
} }

View file

@ -10,7 +10,6 @@
# lsp plugins # lsp plugins
./lspsaga ./lspsaga
./nvim-code-action-menu
./trouble ./trouble
./lsp-signature ./lsp-signature
./lightbulb ./lightbulb

View file

@ -7,6 +7,7 @@
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.attrsets) mapAttrs; inherit (lib.attrsets) mapAttrs;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp; cfg = config.vim.lsp;
in { in {
@ -22,7 +23,7 @@ in {
${ ${
optionalString config.vim.ui.borders.enable '' optionalString config.vim.ui.borders.enable ''
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
'' ''
} }
''; '';

View file

@ -36,7 +36,7 @@ in {
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
(mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
]; ];
}; };

View file

@ -1,37 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
cfg = config.vim.lsp;
self = import ./nvim-code-action-menu.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings;
mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
vim = {
startPlugins = ["nvim-code-action-menu"];
maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>";
binds.whichKey.register = pushDownDefault {
"<leader>c" = "+CodeAction";
};
pluginRC.code-action-menu = entryAnywhere ''
-- border configuration
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
-- show individual sections of the code action menu
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"}
${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"}
'';
};
};
}

View file

@ -1,20 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.lsp = {
nvimCodeActionMenu = {
enable = mkEnableOption "nvim code action menu";
show = {
details = mkEnableOption "Show details" // {default = true;};
diff = mkEnableOption "Show diff" // {default = true;};
actionKind = mkEnableOption "Show action kind" // {default = true;};
};
mappings = {
open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "<leader>ca";
};
};
};
}

View file

@ -11,7 +11,7 @@
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
cfg = config.vim.statusline.lualine; cfg = config.vim.statusline.lualine;
breadcrumbsCfg = config.vim.ui.breadcrumbs; bCfg = config.vim.ui.breadcrumbs;
in { in {
config = mkMerge [ config = mkMerge [
# TODO: move into nvim-tree file # TODO: move into nvim-tree file
@ -20,13 +20,14 @@ in {
extensions = ["nvim-tree"]; extensions = ["nvim-tree"];
}; };
}) })
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
vim.statusline.lualine.setupOpts = { vim.statusline.lualine.setupOpts = {
# TODO: rewrite in new syntax # TODO: rewrite in new syntax
winbar.lualine_c = mkDefault [ winbar.lualine_c = mkDefault [
[ [
"navic" "navic"
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}") (mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
] ]
]; ];
}; };
@ -34,7 +35,6 @@ in {
(mkIf cfg.enable { (mkIf cfg.enable {
vim = { vim = {
startPlugins = ["lualine"]; startPlugins = ["lualine"];
pluginRC.lualine = entryAnywhere '' pluginRC.lualine = entryAnywhere ''
local lualine = require('lualine') local lualine = require('lualine')
lualine.setup ${toLuaObject cfg.setupOpts} lualine.setup ${toLuaObject cfg.setupOpts}

View file

@ -7,7 +7,7 @@
inherit (lib.attrsets) attrNames; inherit (lib.attrsets) attrNames;
inherit (lib.types) bool lines enum; inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryBefore;
cfg = config.vim.theme; cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix { supportedThemes = import ./supported-themes.nix {
@ -45,7 +45,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = [cfg.name]; startPlugins = [cfg.name];
luaConfigRC.theme = entryAfter ["basic"] '' luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
${cfg.extraConfig} ${cfg.extraConfig}
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}} ${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
''; '';

View file

@ -4,31 +4,34 @@
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.lists) optionals; inherit (lib.nvim.types) borderType;
inherit (lib.types) enum;
cfg = config.vim.ui.borders; cfg = config.vim.ui.borders;
defaultStyles = ["none" "single" "double" "rounded"];
in { in {
options.vim.ui.borders = { options.vim.ui.borders = {
enable = mkEnableOption "visible borders for most windows"; enable = mkEnableOption "visible borders for most windows";
globalStyle = mkOption { globalStyle = mkOption {
type = enum defaultStyles; type = borderType;
default = "rounded"; default = "rounded";
description = '' description = ''
The global border style to use. The global border style to use.
If a list is given, it should have a length of eight or any divisor of
eight. The array will specify the eight chars building up the border in
a clockwise fashion starting with the top-left corner. You can specify
a different highlight group for each character by passing a
[char, "YourHighlightGroup"] instead
''; '';
example = ["" "" "" "" "" "" "" ""];
}; };
# TODO: make per-plugin borders configurable
plugins = let plugins = let
mkPluginStyleOption = name: { mkPluginStyleOption = name: {
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;}; enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
style = mkOption { style = mkOption {
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]); type = borderType;
default = cfg.globalStyle; default = cfg.globalStyle;
description = "The border style to use for the ${name} plugin"; description = "The border style to use for the ${name} plugin";
}; };
@ -40,7 +43,7 @@ in {
lspsaga = mkPluginStyleOption "lspsaga"; lspsaga = mkPluginStyleOption "lspsaga";
nvim-cmp = mkPluginStyleOption "nvim-cmp"; nvim-cmp = mkPluginStyleOption "nvim-cmp";
lsp-signature = mkPluginStyleOption "lsp-signature"; lsp-signature = mkPluginStyleOption "lsp-signature";
code-action-menu = mkPluginStyleOption "code-actions-menu"; fastaction = mkPluginStyleOption "fastaction";
}; };
}; };
} }

View file

@ -4,9 +4,9 @@
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) nullOr listOf enum bool str int; inherit (lib.types) nullOr listOf enum bool str int either;
inherit (lib.modules) mkRenamedOptionModule; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption; inherit (lib.nvim.types) mkPluginSetupOption borderType;
mkSimpleIconOption = default: mkSimpleIconOption = default:
mkOption { mkOption {
inherit default; inherit default;
@ -31,6 +31,8 @@ in {
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"]) (renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
# TODO: every option under icon is renamed to first letter capitalized # TODO: every option under icon is renamed to first letter capitalized
(renameSetupOpt ["icon"] ["icon"]) (renameSetupOpt ["icon"] ["icon"])
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "alwaysRender"] ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"])
]; ];
options.vim.ui.breadcrumbs = { options.vim.ui.breadcrumbs = {
@ -43,17 +45,43 @@ in {
''; '';
}; };
# maybe this should be an option to *disable* alwaysRender optionally but oh well # Options for configuring Lualine integration of nvim-navic
# too late lualine.winbar = {
enable = mkOption {
type = bool;
default = true; # for retaining previous behaviour
example = false;
description = ''
Whether to automatically configure a winbar component for
Lualine on the Winbar section.
::: {.note}
This is **set to `true` by default**, which means nvim-navic
will occupy `winbar.lualine_c` for the breadcrumbs feature
unless this option is set to `false`.
:::
'';
};
alwaysRender = mkOption { alwaysRender = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)"; example = false;
description = ''
Whether to always display the breadcrumbs component
on winbar.
::: {.note}
This will pass `draw_empty` to the `nvim_navic` winbar
component, which causes the component to be drawn even
if it's empty
:::
'';
};
}; };
navbuddy = { navbuddy = {
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic"; enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
mappings = { mappings = {
close = mkOption { close = mkOption {
type = str; type = str;
@ -212,8 +240,7 @@ in {
# position = {} # position = {}
border = mkOption { border = mkOption {
# TODO: let this type accept a custom string type = borderType;
type = enum ["single" "rounded" "double" "solid" "none"];
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "border style to use"; description = "border style to use";
}; };
@ -236,8 +263,7 @@ in {
*/ */
border = mkOption { border = mkOption {
# TODO: let this type accept a custom string type = borderType;
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "border style to use for the left section of Navbuddy UI"; description = "border style to use for the left section of Navbuddy UI";
}; };
@ -254,8 +280,7 @@ in {
*/ */
border = mkOption { border = mkOption {
# TODO: let this type accept a custom string type = borderType;
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "border style to use for the middle section of Navbuddy UI"; description = "border style to use for the middle section of Navbuddy UI";
}; };
@ -265,8 +290,7 @@ in {
# there is no size option for the right section, it fills the remaining space # there is no size option for the right section, it fills the remaining space
right = { right = {
border = mkOption { border = mkOption {
# TODO: let this type accept a custom string type = borderType;
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "border style to use for the right section of Navbuddy UI"; description = "border style to use for the right section of Navbuddy UI";
}; };

View file

@ -8,5 +8,6 @@
./illuminate ./illuminate
./breadcrumbs ./breadcrumbs
./borders ./borders
./fastaction
]; ];
} }

View file

@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.ui.fastaction;
borderCfg = config.vim.ui.borders.plugins.fastaction;
in {
config = mkIf cfg.enable {
vim = {
ui.fastaction.setupOpts = {
register_ui_select = mkDefault true;
popup.border = mkIf borderCfg.enable borderCfg.style;
};
startPlugins = ["fastaction-nvim"];
pluginRC.fastaction = entryAnywhere "require('fastaction').setup(${toLuaObject cfg.setupOpts})";
};
};
}

View file

@ -1,6 +1,6 @@
{ {
imports = [ imports = [
./nvim-code-action-menu.nix ./fastaction-nvim.nix
./config.nix ./config.nix
]; ];
} }

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.ui.fastaction = {
enable = mkEnableOption "overriding vim.ui.select with fastaction.nvim";
setupOpts = mkPluginSetupOption "fastaction" {};
};
}

View file

@ -25,7 +25,7 @@ in {
${optionalString config.vim.ui.borders.plugins.which-key.enable '' ${optionalString config.vim.ui.borders.plugins.which-key.enable ''
window = { window = {
border = "${config.vim.ui.borders.plugins.which-key.style}", border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
}, },
''} ''}
}) })

View file

@ -17,17 +17,19 @@
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [ vim = {
startPlugins = [
"telescope" "telescope"
"plenary-nvim" "plenary-nvim"
]; ];
vim.maps.normal = mkMerge [ maps.normal = mkMerge [
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>") (mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>") (mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>") (mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>") (mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
(mkSetBinding mappings.open "<cmd> Telescope<CR>") (mkSetBinding mappings.open "<cmd> Telescope<CR>")
(mkSetBinding mappings.resume "<cmd> Telescope resume<CR>")
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>") (mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>") (mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
@ -53,11 +55,11 @@ in {
( (
mkIf config.vim.projects.project-nvim.enable mkIf config.vim.projects.project-nvim.enable
(mkSetBinding mappings.findProjects "<cmd Telescope projects<CR>") (mkSetBinding mappings.findProjects "<cmd> Telescope projects<CR>")
) )
]; ];
vim.binds.whichKey.register = pushDownDefault { binds.whichKey.register = pushDownDefault {
"<leader>f" = "+Telescope"; "<leader>f" = "+Telescope";
"<leader>fl" = "Telescope LSP"; "<leader>fl" = "Telescope LSP";
"<leader>fm" = "Cellular Automaton"; "<leader>fm" = "Cellular Automaton";
@ -65,7 +67,7 @@ in {
"<leader>fvc" = "Commits"; "<leader>fvc" = "Commits";
}; };
vim.pluginRC.telescope = entryAnywhere '' pluginRC.telescope = entryAnywhere ''
local telescope = require('telescope') local telescope = require('telescope')
telescope.setup(${toLuaObject cfg.setupOpts}) telescope.setup(${toLuaObject cfg.setupOpts})
@ -88,4 +90,5 @@ in {
} }
''; '';
}; };
};
} }

View file

@ -150,13 +150,13 @@
in { in {
options.vim.telescope = { options.vim.telescope = {
mappings = { mappings = {
findProjects = mkMappingOption "Find files [Telescope]" "<leader>fp"; findProjects = mkMappingOption "Find projects [Telescope]" "<leader>fp";
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff"; findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg"; liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb"; buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh"; helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
open = mkMappingOption "Open [Telescope]" "<leader>ft"; open = mkMappingOption "Open [Telescope]" "<leader>ft";
resume = mkMappingOption "Resume (previous search) [Telescope]" "<leader>fr";
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw"; gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb"; gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";

View file

@ -45,8 +45,6 @@ in {
'noice', 'noice',
'NvimTree', 'NvimTree',
'alpha', 'alpha',
'code-action-menu-menu',
'code-action-menu-warning-message',
'notify', 'notify',
'Navbuddy' 'Navbuddy'
}, },

View file

@ -7,7 +7,7 @@
inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.strings) toUpper; inherit (lib.strings) toUpper;
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule; inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.nvim.types) mkPluginSetupOption luaInline borderType;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
in { in {
imports = [ imports = [
@ -453,7 +453,7 @@ in {
}; };
border = mkOption { border = mkOption {
description = "Border style of the notification window"; description = "Border style of the notification window";
type = enum ["none" "single" "double" "rounded" "solid" "shadow"]; type = borderType;
default = default =
if config.vim.ui.borders.enable if config.vim.ui.borders.enable
then config.vim.ui.borders.globalStyle then config.vim.ui.borders.globalStyle

View file

@ -78,8 +78,8 @@ in {
vim = { vim = {
luaConfigRC = { luaConfigRC = {
globalsScript = entryAnywhere (concatLines globalsScript); globalsScript = entryAnywhere (concatLines globalsScript);
# basic, theme # basic
pluginConfigs = entryAfter ["theme"] pluginConfigs; pluginConfigs = entryAfter ["basic"] pluginConfigs;
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs; extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
mappings = entryAfter ["extraPluginConfigs"] keymaps; mappings = entryAfter ["extraPluginConfigs"] keymaps;
}; };