Compare commits

..

1 commit

Author SHA1 Message Date
diniamo
ae77f5eb96
Merge 55cdd6db48 into cb7ff874e2 2024-09-17 19:50:03 +10:00
30 changed files with 538 additions and 585 deletions

View file

@ -1,5 +1,4 @@
name: "Build and deploy documentation" name: "Build and deploy documentation"
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
@ -8,7 +7,6 @@ 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:
@ -22,34 +20,23 @@ 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:
- uses: actions/checkout@v4.1.7 - name: Checkout
- uses: DeterminateSystems/nix-installer-action@main uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
- run: |
nix build .#docs - name: Build
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,6 +17,7 @@ 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;
@ -59,7 +60,6 @@ isMaximal: {
python.enable = isMaximal; python.enable = isMaximal;
dart.enable = isMaximal; dart.enable = isMaximal;
bash.enable = isMaximal; bash.enable = isMaximal;
r.enable = isMaximal;
tailwind.enable = isMaximal; tailwind.enable = isMaximal;
typst.enable = isMaximal; typst.enable = isMaximal;
clang = { clang = {
@ -205,7 +205,6 @@ isMaximal: {
go = ["90" "130"]; go = ["90" "130"];
}; };
}; };
fastaction.enable = true;
}; };
assistant = { assistant = {

View file

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

View file

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

View file

@ -4,10 +4,11 @@
# build inputs # build inputs
nixos-render-docs, nixos-render-docs,
documentation-highlighter, documentation-highlighter,
path,
# nrd configuration # nrd configuration
release, manpageUrls,
optionsJSON, revision,
options,
outputPath ? "share/doc/nvf",
}: }:
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "nvf-manual"; name = "nvf-manual";
@ -19,11 +20,9 @@ stdenvNoCC.mkDerivation {
nativeBuildInputs = [nixos-render-docs]; nativeBuildInputs = [nixos-render-docs];
buildPhase = '' buildPhase = ''
dest="$out/share/doc/nvf" mkdir -p out/{highlightjs,media}
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,media}
cp -vt $dest/highlightjs \ cp -vt out/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 \
@ -32,32 +31,38 @@ stdenvNoCC.mkDerivation {
substituteInPlace ./options.md \ substituteInPlace ./options.md \
--subst-var-by \ --subst-var-by \
OPTIONS_JSON \ OPTIONS_JSON \
${optionsJSON}/share/doc/nixos/options.json ${options.nvf}/share/doc/nixos/options.json
substituteInPlace ./manual.md \ substituteInPlace ./manual.md \
--subst-var-by \ --subst-var-by \
NVF_VERSION \ NVF_VERSION \
${release} ${revision}
# copy stylesheet # copy stylesheet
cp ${./static/style.css} "$dest/style.css" cp ${./static/style.css} out/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 ${path + "/doc/manpage-urls.json"} \ --manpage-urls ${manpageUrls} \
--revision ${lib.trivial.revisionWithDefault release} \ --revision ${lib.trivial.revisionWithDefault revision} \
--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 \
"$dest/index.xhtml" out/index.xhtml
'';
mkdir -p $out/nix-support/ installPhase = ''
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products 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

@ -4,8 +4,6 @@ Release notes for release 0.7
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7} ## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7}
### `vim.configRC` removed {#sec-vim-configrc-removed}
In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the
top-level DAG, and thereby making the entire configuration Lua based. This top-level DAG, and thereby making the entire configuration Lua based. This
change introduces a few breaking changes: change introduces a few breaking changes:
@ -26,17 +24,6 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
brings unnecessary performance overhead while working with different brings unnecessary performance overhead while working with different
configuration formats. configuration formats.
### `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):
@ -108,7 +95,6 @@ everyone.
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
@ -117,9 +103,6 @@ everyone.
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
@ -192,7 +175,3 @@ everyone.
- Telescope: - Telescope:
- Fixed `project-nvim` command and keybinding - Fixed `project-nvim` command and keybinding
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`) - Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
[Soliprem](https://github.com/Soliprem)
- Add LSP and Treesitter support for R under `vim.languages.R`.

122
flake.lock generated
View file

@ -1,5 +1,21 @@
{ {
"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"
@ -36,6 +52,21 @@
"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": 1726188505, "lastModified": 1726188505,
@ -98,11 +129,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726871744, "lastModified": 1726142289,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -140,6 +171,22 @@
"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": {
@ -524,22 +571,6 @@
"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": {
@ -1021,6 +1052,22 @@
"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": {
@ -1136,11 +1183,11 @@
"plugin-nvim-lspconfig": { "plugin-nvim-lspconfig": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1727085470, "lastModified": 1716498901,
"narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=", "narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=",
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"rev": "dd329912c8d446240584a2dbcd3802af3a19105a", "rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1280,11 +1327,11 @@
"plugin-nvim-treesitter-context": { "plugin-nvim-treesitter-context": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1726947805, "lastModified": 1716388265,
"narHash": "sha256-5oN/vyhSqDqjLEzECj01A7A+Yq7U1H1HXLbzkC1Ljqw=", "narHash": "sha256-EY5Si6t7LXcxOP3ubGAAMd3lgbeaCOCIybSKi1Ucx98=",
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"repo": "nvim-treesitter-context", "repo": "nvim-treesitter-context",
"rev": "3d5390c49e3f8fe457b376df2a49aa39d75b7911", "rev": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1808,7 +1855,6 @@
"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",
@ -1839,6 +1885,7 @@
"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",
@ -1886,7 +1933,8 @@
"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": {
@ -1958,6 +2006,26 @@
"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,7 +90,10 @@
flake = false; flake = false;
}; };
# Language servers (use master instead of nixpkgs) # TODO: get zig from the zig overlay 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";
@ -130,8 +133,8 @@
flake = false; flake = false;
}; };
plugin-fastaction-nvim = { plugin-nvim-code-action-menu = {
url = "github:Chaitanyabsprip/fastaction.nvim"; url = "github:weilbith/nvim-code-action-menu";
flake = false; flake = false;
}; };
@ -156,7 +159,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,6 +67,7 @@ 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,6 +67,7 @@ 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,7 +8,6 @@
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;

18
lib/configuration.nix Normal file
View file

@ -0,0 +1,18 @@
{
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 ../modules {inherit inputs lib;}; neovimConfiguration = import ./configuration.nix {inherit inputs lib;};
} }

View file

@ -1,13 +1,10 @@
{ inputs: {
inputs, configuration,
lib,
}: {
pkgs, pkgs,
lib,
check ? true,
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;
@ -16,25 +13,13 @@
# 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 lib;}; nvimModules = import ./modules.nix {inherit pkgs check 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 [ modules = concatLists [[configuration] nvimModules extraModules];
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,12 +7,5 @@ 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,72 +1,77 @@
{ {
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.
# Contains configuration for core neovim features
# such as spellchecking, mappings, and the init script (init.vim).
neovim = map (p: "${./neovim}/${p}") [
"init"
"mappings"
];
# Individual plugin modules, separated by the type of plugin. # The core neovim modules.
# While adding a new type, you must make sure your type is # Contains configuration for core neovim features
# included in the list below. # such as spellchecking, mappings, and the init script (init.vim).
plugins = map (p: "${./plugins}/${p}") [ neovim = map (p: ./neovim + "/${p}") [
"assistant" "init"
"autopairs" "mappings"
"comments" ];
"completion"
"dashboard"
"debugger"
"filetree"
"git"
"languages"
"lsp"
"minimap"
"notes"
"projects"
"rich-presence"
"session"
"snippets"
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
"statusline"
"tabline"
"terminal"
"theme"
"treesitter"
"ui"
"utility"
"visuals"
];
# The neovim wrapper, used to build a wrapped neovim package # Individual plugin modules, separated by the type of plugin.
# using the configuration passed in `neovim` and `plugins` modules. # While adding a new type, you must make sure your type is
wrapper = map (p: "${./wrapper}/${p}") [ # included in the list below.
"build" plugins = map (p: ./plugins + "/${p}") [
"rc" "assistant"
"warnings" "autopairs"
]; "comments"
"completion"
"dashboard"
"debugger"
"filetree"
"git"
"languages"
"lsp"
"minimap"
"notes"
"projects"
"rich-presence"
"session"
"snippets"
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
"statusline"
"tabline"
"terminal"
"theme"
"treesitter"
"ui"
"utility"
"visuals"
];
# Extra modules, such as deprecation warnings # The neovim wrapper, used to build a wrapped neovim package
# or renames in one place. # using the configuration passed in `neovim` and `plugins` modules.
extra = map (p: "${./extra}/${p}") [ wrapper = map (p: ./wrapper + "/${p}") [
"deprecations.nix" "build"
]; "rc"
in "warnings"
concatLists [neovim plugins wrapper extra]; ];
in
allModules # Extra modules, such as deprecation warnings
++ [ # or renames in one place.
{ extra = map (p: ./extra + "/${p}") [
_module.args = { "deprecations.nix"
baseModules = allModules; ];
pkgsPath = mkDefault pkgs.path;
pkgs = mkDefault pkgs; allModules = concatLists [neovim plugins wrapper extra];
pkgsModule = {config, ...}: {
config = {
_module = {
inherit check;
args = {
baseModules = allModules;
pkgsPath = mkDefault pkgs.path;
pkgs = mkDefault pkgs;
};
}; };
} };
] };
in
allModules ++ [pkgsModule]

View file

@ -3,13 +3,11 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD; inherit (lib.options) mkOption literalExpression;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) enum bool str int either; inherit (lib.types) enum bool str int;
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 {
@ -160,138 +158,112 @@ 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 = { config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
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 vim.opt.shortmess:append("c")
vim.opt.shortmess:append("c") vim.o.expandtab = true
vim.o.expandtab = true vim.o.mouse = ${toLuaObject cfg.mouseSupport}
vim.o.mouse = ${toLuaObject cfg.mouseSupport} vim.o.tabstop = ${toLuaObject cfg.tabWidth}
vim.o.tabstop = ${toLuaObject cfg.tabWidth} vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth} vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
vim.o.softtabstop = ${toLuaObject cfg.tabWidth} vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight} vim.o.updatetime = ${toLuaObject cfg.updateTime}
vim.o.updatetime = ${toLuaObject cfg.updateTime} vim.o.tm = ${toLuaObject cfg.mapTimeout}
vim.o.tm = ${toLuaObject cfg.mapTimeout} vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt} vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset} 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 '' ${optionalString cfg.splitBelow ''
vim.o.undofile = true vim.o.splitbelow = true
vim.o.undodir = ${toLuaObject cfg.undoFile.path} ''}
''}
${optionalString cfg.splitBelow '' ${optionalString cfg.splitRight ''
vim.o.splitbelow = true vim.o.splitright = true
''} ''}
${optionalString cfg.splitRight '' ${optionalString cfg.showSignColumn ''
vim.o.splitright = true vim.o.signcolumn = "yes"
''} ''}
${optionalString cfg.showSignColumn '' ${optionalString cfg.autoIndent ''
vim.o.signcolumn = "yes" vim.o.autoindent = true
''} ''}
${optionalString cfg.autoIndent '' ${optionalString cfg.preventJunkFiles ''
vim.o.autoindent = true vim.o.swapfile = false
''} vim.o.backup = false
vim.o.writebackup = false
''}
${optionalString cfg.preventJunkFiles '' ${optionalString (cfg.bell == "none") ''
vim.o.swapfile = false vim.o.errorbells = false
vim.o.backup = false vim.o.visualbell = false
vim.o.writebackup = false ''}
''}
${optionalString (cfg.bell == "none") '' ${optionalString (cfg.bell == "on") ''
vim.o.errorbells = false vim.o.visualbell = false
vim.o.visualbell = false ''}
''}
${optionalString (cfg.bell == "on") '' ${optionalString (cfg.bell == "visual") ''
vim.o.visualbell = false vim.o.errorbells = false
''} ''}
${optionalString (cfg.bell == "visual") '' ${optionalString (cfg.lineNumberMode == "relative") ''
vim.o.errorbells = false vim.o.relativenumber = true
''} ''}
${optionalString (cfg.lineNumberMode == "relative") '' ${optionalString (cfg.lineNumberMode == "number") ''
vim.o.relativenumber = true vim.o.number = true
''} ''}
${optionalString (cfg.lineNumberMode == "number") '' ${optionalString (cfg.lineNumberMode == "relNumber") ''
vim.o.number = true vim.o.number = true
''} vim.o.relativenumber = true
''}
${optionalString (cfg.lineNumberMode == "relNumber") '' ${optionalString cfg.useSystemClipboard ''
vim.o.number = true vim.opt.clipboard:append("unnamedplus")
vim.o.relativenumber = true ''}
''}
${optionalString cfg.useSystemClipboard '' ${optionalString cfg.syntaxHighlighting ''
vim.opt.clipboard:append("unnamedplus") vim.cmd("syntax on")
''} ''}
${optionalString cfg.syntaxHighlighting '' ${optionalString (!cfg.wordWrap) ''
vim.cmd("syntax on") vim.o.wrap = false
''} ''}
${optionalString (!cfg.wordWrap) '' ${optionalString cfg.hideSearchHighlight ''
vim.o.wrap = false vim.o.hlsearch = false
''} vim.o.incsearch = true
''}
${optionalString cfg.hideSearchHighlight '' ${optionalString cfg.colourTerm ''
vim.o.hlsearch = false vim.o.termguicolors = true
vim.o.incsearch = true ''}
''}
${optionalString cfg.colourTerm '' ${optionalString (!cfg.enableEditorconfig) ''
vim.o.termguicolors = true vim.g.editorconfig = false
''} ''}
${optionalString (!cfg.enableEditorconfig) '' ${optionalString (cfg.searchCase == "ignore") ''
vim.g.editorconfig = false vim.o.smartcase = false
''} vim.o.ignorecase = true
''}
${optionalString (cfg.searchCase == "ignore") '' ${optionalString (cfg.searchCase == "smart") ''
vim.o.smartcase = false vim.o.smartcase = true
vim.o.ignorecase = true vim.o.ignorecase = true
''} ''}
${optionalString (cfg.searchCase == "smart") '' ${optionalString (cfg.searchCase == "sensitive") ''
vim.o.smartcase = true vim.o.smartcase = false
vim.o.ignorecase = true vim.o.ignorecase = false
''} ''}
'';
${optionalString (cfg.searchCase == "sensitive") ''
vim.o.smartcase = false
vim.o.ignorecase = false
''}
'';
};
} }

View file

@ -17,7 +17,6 @@ in {
./ocaml.nix ./ocaml.nix
./php.nix ./php.nix
./python.nix ./python.nix
./r.nix
./rust.nix ./rust.nix
./sql.nix ./sql.nix
./svelte.nix ./svelte.nix

View file

@ -1,78 +0,0 @@
{
config,
pkgs,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.r;
r-with-languageserver = pkgs.rWrapper.override {
packages = with pkgs.rPackages; [languageserver];
};
defaultServer = "r_language_server";
servers = {
r_language_server = {
package = pkgs.writeShellScriptBin "r_lsp" ''
${r-with-languageserver}/bin/R --slave -e "languageserver::run()"
'';
lspConfig = ''
lspconfig.r_language_server.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${lib.getExe cfg.lsp.package}"}''
}
}
'';
};
};
in {
options.vim.languages.r = {
enable = mkEnableOption "R language support";
treesitter = {
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "r";
};
lsp = {
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "R LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "R LSP server package, or the command to run as a list of strings";
example = literalExpression "[ (lib.getExe pkgs.jdt-language-server) \"-data\" \"~/.cache/jdtls/workspace\" ]";
type = 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.r-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -17,12 +17,12 @@
cfg = config.vim.languages.ts; cfg = config.vim.languages.ts;
defaultServer = "ts_ls"; defaultServer = "tsserver";
servers = { servers = {
ts_ls = { tsserver = {
package = pkgs.typescript-language-server; package = pkgs.typescript-language-server;
lspConfig = '' lspConfig = ''
lspconfig.ts_ls.setup { lspconfig.tsserver.setup {
capabilities = capabilities; capabilities = capabilities;
on_attach = attach_keymaps, on_attach = attach_keymaps,
cmd = ${ cmd = ${
@ -49,24 +49,6 @@
} }
''; '';
}; };
# 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
@ -83,7 +65,6 @@
) )
''; '';
}; };
prettierd = { prettierd = {
package = pkgs.prettierd; package = pkgs.prettierd;
nullConfig = '' nullConfig = ''
@ -113,7 +94,6 @@
}; };
}; };
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";
@ -210,32 +190,11 @@ 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,6 +10,7 @@
# lsp plugins # lsp plugins
./lspsaga ./lspsaga
./nvim-code-action-menu
./trouble ./trouble
./lsp-signature ./lsp-signature
./lightbulb ./lightbulb

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')")
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action") (mkIf (!cfg.nvimCodeActionMenu.enable) (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

@ -0,0 +1,38 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
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 = ${toLuaObject 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,6 +1,6 @@
{ {
imports = [ imports = [
./fastaction-nvim.nix ./nvim-code-action-menu.nix
./config.nix ./config.nix
]; ];
} }

View file

@ -0,0 +1,20 @@
{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

@ -43,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";
fastaction = mkPluginStyleOption "fastaction"; code-action-menu = mkPluginStyleOption "code-actions-menu";
}; };
}; };
} }

View file

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

View file

@ -1,24 +0,0 @@
{
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,9 +0,0 @@
{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

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