mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-16 23:35:13 +00:00
Compare commits
No commits in common. "95d5463e634b7be388bb09369ff0a344b685d5a9" and "a8cd1af2a1e381b37b6600d2b6a19662161b7a3e" have entirely different histories.
95d5463e63
...
a8cd1af2a1
13 changed files with 504 additions and 517 deletions
|
|
@ -1,16 +1,13 @@
|
||||||
.TH "nvf" "5" "January 1, 1980" "nvf"
|
.TH "nvf" "5" "01/01/1980" "nvf"
|
||||||
.\" disable hyphenation
|
.\" disable hyphenation
|
||||||
.nh
|
.nh
|
||||||
.\" disable justification (adjust text to left margin only)
|
.\" disable justification (adjust text to left margin only)
|
||||||
.ad l
|
.ad l
|
||||||
.\" enable line breaks after slashes
|
.\" enable line breaks after slashes
|
||||||
.cflags 4 /
|
.cflags 4 /
|
||||||
|
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
nvf \- Configuration specification for the nvf.
|
nvf configuration specification
|
||||||
|
.SH "OPTIONS"
|
||||||
.SH "DESCRIPTION"
|
.PP
|
||||||
The nvf configuration specification provides a declarative structure for configuring Neovim using Nix with few
|
You can use the following options to configure nvf:
|
||||||
lines of Nix. This document outlines the available options and their usage to create modular, reusable, and
|
.PP
|
||||||
reproducible configurations using nvf's module system options. For tips, tricks and possible quirks with available
|
|
||||||
plugins please visit https://notashelf.github.io/nvf/
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
.Dd January 1, 1980
|
.Dd January 1, 1980
|
||||||
.Dt NVF 1
|
.Dt nvf 1
|
||||||
.Os nvf
|
.Os nvf
|
||||||
.\" disable hyphenation
|
.\" disable hyphenation
|
||||||
.nh
|
.nh
|
||||||
|
|
@ -7,46 +7,27 @@
|
||||||
.ad l
|
.ad l
|
||||||
.\" enable line breaks after slashes
|
.\" enable line breaks after slashes
|
||||||
.cflags 4 /
|
.cflags 4 /
|
||||||
|
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm nvf
|
.Nm nvf
|
||||||
.Nd A modular, extensible, and distro-agnostic Neovim configuration framework for Nix/NixOS.
|
.Nd A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
|
||||||
|
.
|
||||||
.Sh DESCRIPTION
|
|
||||||
.Nm nvf
|
|
||||||
is a highly modular, configurable, extensible, and easy-to-use Neovim configuration in Nix.
|
|
||||||
Designed for flexibility and ease of use, nvf allows you to easily configure your fully featured
|
|
||||||
Neovim instance with a few lines of Nix.
|
|
||||||
|
|
||||||
.Sh COMMANDS
|
|
||||||
The following commands are bundled with nvf to allow easier debugging of your configuration.
|
|
||||||
|
|
||||||
.Bl -tag -width Ds
|
|
||||||
.It Nm nvf-print-config
|
|
||||||
Outputs the full configuration of the current `nvf` setup. This command is useful for debugging
|
|
||||||
or inspecting the applied configuration.
|
|
||||||
.Pp
|
|
||||||
.It Nm nvf-print-config-path
|
|
||||||
Prints the file path to the configuration file currently in use. This command is helpful for locating
|
|
||||||
the source configuration file for troubleshooting or easily sharing it via online paste utilities.
|
|
||||||
.El
|
|
||||||
|
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
.Pp
|
.Pp
|
||||||
Please report any bugs on the project issue tracker:
|
Please report any bugs that you might encounter on the
|
||||||
.Lk https://github.com/notashelf/nvf/issues
|
\m[blue]\fBproject issue tracker\fR\m[]\&.
|
||||||
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Pp
|
.Pp
|
||||||
.Fn nvf 5
|
\fBnvf\fR(5)
|
||||||
|
|
||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
.Pp
|
.Pp
|
||||||
.Fn nvf contributors
|
\fBnvf contributors\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Primary contributors and maintainers of the project.
|
Author.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.Sh COPYRIGHT
|
.Sh COPYRIGHT
|
||||||
.Pp
|
.br
|
||||||
Copyright (c) 2023–2025 nvf contributors.
|
Copyright \(co 2023\(en2024 nvf contributors
|
||||||
|
.br
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,6 @@
|
||||||
your Editorconfig configuration, or use an autocommand to set indentation
|
your Editorconfig configuration, or use an autocommand to set indentation
|
||||||
values for buffers with the Nix filetype.
|
values for buffers with the Nix filetype.
|
||||||
|
|
||||||
- Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the
|
|
||||||
previously managed lightbulb autocommand.
|
|
||||||
- A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and
|
|
||||||
`vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time.
|
|
||||||
Pick only one.
|
|
||||||
|
|
||||||
[amadaluzia](https://github.com/amadaluzia):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
|
@ -65,8 +59,7 @@
|
||||||
- Add `vim.snippets.luasnip.setupOpts`, which was previously missing.
|
- Add `vim.snippets.luasnip.setupOpts`, which was previously missing.
|
||||||
- Add `"prettierd"` as a formatter option in
|
- Add `"prettierd"` as a formatter option in
|
||||||
`vim.languages.markdown.format.type`.
|
`vim.languages.markdown.format.type`.
|
||||||
- Add the following plugins from
|
- Add the following plugins from [mini.nvim](https://github.com/echasnovski/mini.nvim)
|
||||||
[mini.nvim](https://github.com/echasnovski/mini.nvim)
|
|
||||||
- `mini.ai`
|
- `mini.ai`
|
||||||
- `mini.align`
|
- `mini.align`
|
||||||
- `mini.animate`
|
- `mini.animate`
|
||||||
|
|
@ -109,8 +102,7 @@
|
||||||
- `mini.trailspace`
|
- `mini.trailspace`
|
||||||
- `mini.visits`
|
- `mini.visits`
|
||||||
- Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua`
|
- Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua`
|
||||||
- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim)
|
- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim) in `vim.visuals.rainbow-delimiters`
|
||||||
in `vim.visuals.rainbow-delimiters`
|
|
||||||
- Add options to define highlights under [](#opt-vim.highlight)
|
- Add options to define highlights under [](#opt-vim.highlight)
|
||||||
|
|
||||||
[kaktu5](https://github.com/kaktu5):
|
[kaktu5](https://github.com/kaktu5):
|
||||||
|
|
@ -130,8 +122,3 @@
|
||||||
[ruff]: (https://github.com/astral-sh/ruff)
|
[ruff]: (https://github.com/astral-sh/ruff)
|
||||||
|
|
||||||
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
||||||
|
|
||||||
[ARCIII](https://github.com/ArmandoCIII):
|
|
||||||
|
|
||||||
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
|
|
||||||
Inspiration from `vim.languages.clang.dap` implementation.
|
|
||||||
|
|
|
||||||
66
modules/plugins/languages/tex/build/builders/custom.nix.bak
Normal file
66
modules/plugins/languages/tex/build/builders/custom.nix.bak
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.types) bool listOf package str;
|
||||||
|
inherit (lib) mkDefault;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.tex;
|
||||||
|
|
||||||
|
# --- Enable Options ---
|
||||||
|
mkEnableDefaultOption = default: description: (mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = default;
|
||||||
|
example = !default;
|
||||||
|
description = description;
|
||||||
|
});
|
||||||
|
|
||||||
|
collateArgs = buildConfig: buildConfig.builders.custom.args;
|
||||||
|
in {
|
||||||
|
options.vim.languages.tex.build.builders.custom = {
|
||||||
|
enable = mkEnableDefaultOption false "Whether to enable using a custom build package";
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.tectonic;
|
||||||
|
description = "build/compiler package";
|
||||||
|
};
|
||||||
|
executable = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "tectonic";
|
||||||
|
description = "The executable name from the build package that will be used to build/compile the tex.";
|
||||||
|
};
|
||||||
|
args = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [
|
||||||
|
"-X"
|
||||||
|
"compile"
|
||||||
|
"%f"
|
||||||
|
"--synctex"
|
||||||
|
"--keep-logs"
|
||||||
|
"--keep-intermediates"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
Defines additional arguments that are passed to the configured LaTeX build tool.
|
||||||
|
Note that flags and their arguments need to be separate elements in this array.
|
||||||
|
To pass the arguments -foo bar to a build tool, args needs to be ["-foo" "bar"].
|
||||||
|
The placeholder `%f` will be replaced by the server.
|
||||||
|
|
||||||
|
Placeholders:
|
||||||
|
- `%f`: The path of the TeX file to compile.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf (cfg.enable && cfg.build.builders.custom.enable) {
|
||||||
|
vim.languages.tex.build.builder = {
|
||||||
|
name = mkDefault "custom";
|
||||||
|
args = mkDefault (collateArgs cfg.build);
|
||||||
|
package = mkDefault (cfg.build.builders.custom.package);
|
||||||
|
executable = mkDefault (cfg.build.builders.custom.executable);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -3,14 +3,15 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) enum listOf package str;
|
inherit (lib.types) enum listOf package str;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (builtins) attrNames;
|
||||||
inherit (builtins) attrNames filter isAttrs hasAttr elemAt length;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./latexmk.nix
|
./latexmk.nix
|
||||||
./tectonic.nix
|
./tectonic.nix
|
||||||
|
|
@ -26,8 +27,6 @@ in {
|
||||||
This is just the default custom option. By setting any of the
|
This is just the default custom option. By setting any of the
|
||||||
builders to true, this will be overwritten by that builder's
|
builders to true, this will be overwritten by that builder's
|
||||||
parameters.
|
parameters.
|
||||||
Setting this parameter to the name of a declared builder will
|
|
||||||
not automatically enable that builder.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
|
|
@ -46,7 +45,7 @@ in {
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
|
default = (pkgs.texlive.withPackages (ps: [ ps.latexmk ]));
|
||||||
description = ''
|
description = ''
|
||||||
The tex builder package to use.
|
The tex builder package to use.
|
||||||
|
|
||||||
|
|
@ -68,3 +67,4 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# TODO: I need testing.
|
# TODO: I need testing.
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
|
|
@ -12,6 +13,16 @@
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) bool package str;
|
inherit (lib.types) bool package str;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.tex;
|
||||||
|
|
||||||
|
# --- Enable Options ---
|
||||||
|
mkEnableDefaultOption = default: description: (mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = default;
|
||||||
|
example = !default;
|
||||||
|
description = description;
|
||||||
|
});
|
||||||
in (
|
in (
|
||||||
template {
|
template {
|
||||||
inherit name moduleInheritencePackage;
|
inherit name moduleInheritencePackage;
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,18 @@
|
||||||
template = import ./builderTemplate.nix;
|
template = import ./builderTemplate.nix;
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) enum ints listOf package str;
|
inherit (lib.types) bool enum ints listOf package str;
|
||||||
inherit (lib.nvim.config) mkBool;
|
|
||||||
inherit (builtins) concatLists elem map toString;
|
inherit (builtins) concatLists elem map toString;
|
||||||
|
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
|
|
||||||
|
# --- Enable Options ---
|
||||||
|
mkEnableDefaultOption = default: description: (mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = default;
|
||||||
|
example = !default;
|
||||||
|
description = description;
|
||||||
|
});
|
||||||
in (
|
in (
|
||||||
template {
|
template {
|
||||||
inherit name moduleInheritencePackage;
|
inherit name moduleInheritencePackage;
|
||||||
|
|
@ -36,30 +43,26 @@ in (
|
||||||
};
|
};
|
||||||
|
|
||||||
# -- Flags --
|
# -- Flags --
|
||||||
keepIntermediates = mkBool false ''
|
keepIntermediates = mkEnableDefaultOption false ''
|
||||||
Keep the intermediate files generated during processing.
|
Keep the intermediate files generated during processing.
|
||||||
|
|
||||||
If texlab is reporting build errors when there shouldn't be, disable this option.
|
If texlab is reporting build errors when there shouldn't be, disable this option.
|
||||||
'';
|
'';
|
||||||
keepLogs = mkBool true ''
|
keepLogs = mkEnableDefaultOption true ''
|
||||||
Keep the log files generated during processing.
|
Keep the log files generated during processing.
|
||||||
|
|
||||||
Without the keepLogs flag, texlab won't be able to report compilation warnings.
|
Without the keepLogs flag, texlab won't be able to report compilation warnings.
|
||||||
'';
|
'';
|
||||||
onlyCached = mkBool false "Use only resource files cached locally";
|
onlyCached = mkEnableDefaultOption false "Use only resource files cached locally";
|
||||||
synctex = mkBool true "Generate SyncTeX data";
|
synctex = mkEnableDefaultOption true "Generate SyncTeX data";
|
||||||
untrustedInput = mkBool false "Input is untrusted -- disable all known-insecure features";
|
untrustedInput = mkEnableDefaultOption false "Input is untrusted -- disable all known-insecure features";
|
||||||
|
|
||||||
# -- Options --
|
# -- Options --
|
||||||
reruns = mkOption {
|
reruns = mkOption {
|
||||||
type = ints.unsigned;
|
type = ints.unsigned;
|
||||||
default = 0;
|
default = 0;
|
||||||
example = 2;
|
example = 2;
|
||||||
description = ''
|
description = "Rerun the TeX engine exactly this many times after the first";
|
||||||
Rerun the TeX engine exactly this many times after the first.
|
|
||||||
|
|
||||||
Setting this value to 0 will diable setting this option.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bundle = mkOption {
|
bundle = mkOption {
|
||||||
|
|
|
||||||
217
modules/plugins/languages/tex/build/builders/tectonic.nix.bak
Normal file
217
modules/plugins/languages/tex/build/builders/tectonic.nix.bak
Normal file
|
|
@ -0,0 +1,217 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit
|
||||||
|
(lib.types)
|
||||||
|
bool
|
||||||
|
enum
|
||||||
|
ints
|
||||||
|
listOf
|
||||||
|
package
|
||||||
|
str
|
||||||
|
;
|
||||||
|
inherit (builtins) concatLists elem map toString;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.tex;
|
||||||
|
|
||||||
|
# --- Enable Options ---
|
||||||
|
mkEnableDefaultOption = default: description: (mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = default;
|
||||||
|
example = !default;
|
||||||
|
description = description;
|
||||||
|
});
|
||||||
|
|
||||||
|
# --- Arg Collation Functions --
|
||||||
|
collateArgs = buildConfig: let
|
||||||
|
selfConfig = buildConfig.builders.tectonic;
|
||||||
|
in (
|
||||||
|
# Base args
|
||||||
|
[
|
||||||
|
"-X"
|
||||||
|
"compile"
|
||||||
|
"%f"
|
||||||
|
]
|
||||||
|
# Flags
|
||||||
|
++ (
|
||||||
|
if selfConfig.keepIntermediates
|
||||||
|
then ["--keep-intermediates"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.keepLogs
|
||||||
|
then ["--keep-logs"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.onlyCached
|
||||||
|
then ["--only-cached"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.synctex
|
||||||
|
then ["--synctex"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.untrustedInput
|
||||||
|
then ["--untrusted"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
# Options
|
||||||
|
++ (
|
||||||
|
if selfConfig.reruns > 0
|
||||||
|
then ["--reruns" "${toString selfConfig.reruns}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.bundle != ""
|
||||||
|
then ["--bundle" "${toString selfConfig.bundle}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.webBundle != ""
|
||||||
|
then ["--web-bundle" "${toString selfConfig.webBundle}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.outfmt != ""
|
||||||
|
then ["--outfmt" "${toString selfConfig.outfmt}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (concatLists (map (x: ["--hide" x]) selfConfig.hidePaths))
|
||||||
|
++ (
|
||||||
|
if selfConfig.format != ""
|
||||||
|
then ["--format" "${toString selfConfig.format}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
++ (
|
||||||
|
if selfConfig.color != ""
|
||||||
|
then ["--color" "${toString selfConfig.color}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
# Still options but these are not defined by builder specific options but
|
||||||
|
# instead synchronize options between the global build options and builder
|
||||||
|
# specific options
|
||||||
|
++ (
|
||||||
|
if !(elem buildConfig.pdfDirectory ["." ""])
|
||||||
|
then ["--outdir" "${buildConfig.pdfDirectory}"]
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
options.vim.languages.tex.build.builders.tectonic = {
|
||||||
|
enable = mkEnableOption "Whether to enable Tex Compilation Via Tectonic";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.tectonic;
|
||||||
|
description = "tectonic package";
|
||||||
|
};
|
||||||
|
|
||||||
|
executable = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "tectonic";
|
||||||
|
description = "The executable name from the build package that will be used to build/compile the tex.";
|
||||||
|
};
|
||||||
|
|
||||||
|
# -- Flags --
|
||||||
|
keepIntermediates = mkEnableDefaultOption false ''
|
||||||
|
Keep the intermediate files generated during processing.
|
||||||
|
|
||||||
|
If texlab is reporting build errors when there shouldn't be, disable this option.
|
||||||
|
'';
|
||||||
|
keepLogs = mkEnableDefaultOption true ''
|
||||||
|
Keep the log files generated during processing.
|
||||||
|
|
||||||
|
Without the keepLogs flag, texlab won't be able to report compilation warnings.
|
||||||
|
'';
|
||||||
|
onlyCached = mkEnableDefaultOption false "Use only resource files cached locally";
|
||||||
|
synctex = mkEnableDefaultOption true "Generate SyncTeX data";
|
||||||
|
untrustedInput = mkEnableDefaultOption false "Input is untrusted -- disable all known-insecure features";
|
||||||
|
|
||||||
|
# -- Options --
|
||||||
|
reruns = mkOption {
|
||||||
|
type = ints.unsigned;
|
||||||
|
default = 0;
|
||||||
|
example = 2;
|
||||||
|
description = "Rerun the TeX engine exactly this many times after the first";
|
||||||
|
};
|
||||||
|
|
||||||
|
bundle = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
description = "Use this directory or Zip-format bundle file to find resource files instead of the default";
|
||||||
|
};
|
||||||
|
|
||||||
|
webBundle = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
description = "Use this URL to find resource files instead of the default";
|
||||||
|
};
|
||||||
|
|
||||||
|
outfmt = mkOption {
|
||||||
|
type = enum [
|
||||||
|
"pdf"
|
||||||
|
"html"
|
||||||
|
"xdv"
|
||||||
|
"aux"
|
||||||
|
"fmt"
|
||||||
|
""
|
||||||
|
];
|
||||||
|
default = "";
|
||||||
|
description = "The kind of output to generate";
|
||||||
|
};
|
||||||
|
|
||||||
|
hidePaths = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = [
|
||||||
|
"./secrets.tex"
|
||||||
|
"./passwords.tex"
|
||||||
|
];
|
||||||
|
description = "Tell the engine that no file at <hide_path> exists, if it tries to read it.";
|
||||||
|
};
|
||||||
|
|
||||||
|
format = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "";
|
||||||
|
description = "The name of the \"format\" file used to initialize the TeX engine";
|
||||||
|
};
|
||||||
|
|
||||||
|
color = mkOption {
|
||||||
|
type = enum [
|
||||||
|
"always"
|
||||||
|
"auto"
|
||||||
|
"never"
|
||||||
|
""
|
||||||
|
];
|
||||||
|
default = "";
|
||||||
|
example = "always";
|
||||||
|
description = "Enable/disable colorful log output";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraOptions = {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
Add extra command line options to include in the tectonic build command.
|
||||||
|
Extra options added here will not overwrite the options set in as nvf options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf (cfg.enable && cfg.build.builders.tectonic.enable) {
|
||||||
|
vim.languages.tex.build.builder = {
|
||||||
|
name = "tectonic";
|
||||||
|
args = collateArgs cfg.build;
|
||||||
|
package = cfg.build.builders.tectonic.package;
|
||||||
|
executable = cfg.build.builders.tectonic.executable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -4,71 +4,34 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) str nullOr;
|
inherit (lib.types) bool str;
|
||||||
inherit (builtins) filter isAttrs hasAttr attrNames length elemAt;
|
|
||||||
inherit (lib.nvim.config) mkBool;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
|
|
||||||
enabledBuildersCount = let
|
|
||||||
# This function will sort through the builder options and count how many
|
|
||||||
# builders have been enabled.
|
|
||||||
getEnabledBuildersCount = {
|
|
||||||
enabledBuildersCount ? 0,
|
|
||||||
index ? 0,
|
|
||||||
builderNamesList ? (
|
|
||||||
filter (
|
|
||||||
x: let
|
|
||||||
y = cfg.build.builders.${x};
|
|
||||||
in (isAttrs y && hasAttr "enable" y)
|
|
||||||
) (attrNames cfg.build.builders)
|
|
||||||
),
|
|
||||||
}: let
|
|
||||||
currentBuilderName = elemAt builderNamesList index;
|
|
||||||
currentBuilder = cfg.build.builders.${currentBuilderName};
|
|
||||||
nextIndex = index + 1;
|
|
||||||
newEnabledBuildersCount =
|
|
||||||
if currentBuilder.enable
|
|
||||||
then enabledBuildersCount + 1
|
|
||||||
else enabledBuildersCount;
|
|
||||||
in
|
|
||||||
if length builderNamesList > nextIndex
|
|
||||||
then
|
|
||||||
getEnabledBuildersCount {
|
|
||||||
inherit builderNamesList;
|
|
||||||
enabledBuildersCount = newEnabledBuildersCount;
|
|
||||||
index = nextIndex;
|
|
||||||
}
|
|
||||||
else newEnabledBuildersCount;
|
|
||||||
in (getEnabledBuildersCount {});
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./builders
|
./builders
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages.tex.build = {
|
options.vim.languages.tex.build = {
|
||||||
enable =
|
forwardSearchAfter = mkOption {
|
||||||
mkBool (
|
type = bool;
|
||||||
if enabledBuildersCount > 1
|
default = false;
|
||||||
then throw "nvf-tex-language does not support having more than 1 builders enabled!"
|
description = "Set this property to true if you want to execute a forward search after a build.";
|
||||||
else (enabledBuildersCount == 1)
|
};
|
||||||
) ''
|
onSave = mkOption {
|
||||||
Whether to enable configuring the builder.
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Set this property to true if you want to compile the project after saving a file.";
|
||||||
|
};
|
||||||
|
useFileList = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
When set to true, the server will use the .fls files produced by the TeX engine as an additional input for the project detection.
|
||||||
|
|
||||||
By enabling any of the builders, this option will be automatically set.
|
Note that enabling this property might have an impact on performance.
|
||||||
If you enable more than one builder then an error will be thrown.
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
forwardSearchAfter = mkBool false "Set this property to true if you want to execute a forward search after a build.";
|
|
||||||
|
|
||||||
onSave = mkBool false "Set this property to true if you want to compile the project after saving a file.";
|
|
||||||
|
|
||||||
useFileList = mkBool false ''
|
|
||||||
When set to true, the server will use the .fls files produced by the TeX engine as an additional input for the project detection.
|
|
||||||
|
|
||||||
Note that enabling this property might have an impact on performance.
|
|
||||||
'';
|
|
||||||
|
|
||||||
auxDirectory = mkOption {
|
auxDirectory = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = ".";
|
default = ".";
|
||||||
|
|
@ -79,7 +42,6 @@ in {
|
||||||
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
logDirectory = mkOption {
|
logDirectory = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = ".";
|
default = ".";
|
||||||
|
|
@ -90,7 +52,6 @@ in {
|
||||||
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pdfDirectory = mkOption {
|
pdfDirectory = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = ".";
|
default = ".";
|
||||||
|
|
@ -101,10 +62,9 @@ in {
|
||||||
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
When using a latexmkrc file, texlab will automatically infer the correct setting.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
filename = mkOption {
|
filename = mkOption {
|
||||||
type = nullOr str;
|
type = str;
|
||||||
default = null;
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Allows overriding the default file name of the build artifact. This setting is used to find the correct PDF file to open during forward search.
|
Allows overriding the default file name of the build artifact. This setting is used to find the correct PDF file to open during forward search.
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,16 @@
|
||||||
# TODO:
|
# TODO:
|
||||||
# - Add Texlab LSP settings:
|
# - Add Texlab LSP settings:
|
||||||
# - chktex
|
# - chktex
|
||||||
|
# - diagnosticsDelay
|
||||||
|
# - diagnostics
|
||||||
# - symbols
|
# - symbols
|
||||||
|
# - formatterLineLength
|
||||||
|
# - bibtexFormatter
|
||||||
|
# - latexFormatter
|
||||||
|
# - latexindent
|
||||||
|
# - completion
|
||||||
|
# - inlayHints
|
||||||
|
# - experimental
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
|
@ -10,15 +19,40 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.types) listOf package str attrs ints enum either path nullOr;
|
inherit
|
||||||
inherit (lib.nvim.config) mkBool;
|
(lib.types)
|
||||||
|
bool
|
||||||
|
listOf
|
||||||
|
package
|
||||||
|
str
|
||||||
|
;
|
||||||
|
inherit
|
||||||
|
(builtins)
|
||||||
|
attrNames
|
||||||
|
concatStringsSep
|
||||||
|
elemAt
|
||||||
|
filter
|
||||||
|
hasAttr
|
||||||
|
isAttrs
|
||||||
|
length
|
||||||
|
map
|
||||||
|
throw
|
||||||
|
toString
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
texlabCfg = cfg.lsp.texlab;
|
|
||||||
builderCfg = cfg.build.builder;
|
# --- Enable Options ---
|
||||||
|
mkEnableDefaultOption = default: description: (mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = default;
|
||||||
|
example = !default;
|
||||||
|
description = description;
|
||||||
|
});
|
||||||
|
mkEnableLspOption = mkEnableDefaultOption config.vim.languages.enableLSP;
|
||||||
in {
|
in {
|
||||||
options.vim.languages.tex.lsp.texlab = {
|
options.vim.languages.tex.lsp.texlab = {
|
||||||
enable = mkBool config.vim.languages.enableLSP "Whether to enable Tex LSP support (texlab)";
|
enable = mkEnableLspOption "Whether to enable Tex LSP support (texlab)";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
|
|
@ -27,15 +61,19 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
forwardSearch = {
|
forwardSearch = {
|
||||||
enable = mkBool false ''
|
enable = mkOption {
|
||||||
Whether to enable forward search.
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = ''
|
||||||
|
Whether to enable forward search.
|
||||||
|
|
||||||
Enable this option if you want to have the compiled document appear in your chosen PDF viewer.
|
Enable this option if you want to have the compiled document appear in your chosen PDF viewer.
|
||||||
|
|
||||||
For some options see [here](https://github.com/latex-lsp/texlab/wiki/Previewing).
|
|
||||||
Note this is not all the options, but can act as a guide to help you allong with custom configs.
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
For some options see [here](https://github.com/latex-lsp/texlab/wiki/Previewing).
|
||||||
|
Note this is not all the options, but can act as a guide to help you allong with custom configs.
|
||||||
|
'';
|
||||||
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = pkgs.okular;
|
default = pkgs.okular;
|
||||||
|
|
@ -44,7 +82,6 @@ in {
|
||||||
This viewer needs to support Synctex.
|
This viewer needs to support Synctex.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
executable = mkOption {
|
executable = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "okular";
|
default = "okular";
|
||||||
|
|
@ -52,7 +89,6 @@ in {
|
||||||
Defines the executable of the PDF previewer. The previewer needs to support SyncTeX.
|
Defines the executable of the PDF previewer. The previewer needs to support SyncTeX.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [
|
default = [
|
||||||
|
|
@ -71,212 +107,12 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
diagnostics = {
|
|
||||||
delay = mkOption {
|
|
||||||
type = ints.positive;
|
|
||||||
default = 300;
|
|
||||||
description = "Delay in milliseconds before reporting diagnostics.";
|
|
||||||
};
|
|
||||||
|
|
||||||
allowedPatterns = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
A list of regular expressions used to filter the list of reported diagnostics.
|
|
||||||
If specified, only diagnostics that match at least one of the specified patterns are sent to the client.
|
|
||||||
|
|
||||||
See also texlab.diagnostics.ignoredPatterns.
|
|
||||||
|
|
||||||
Hint: If both allowedPatterns and ignoredPatterns are set, then allowed patterns are applied first.
|
|
||||||
Afterwards, the results are filtered with the ignored patterns.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ignoredPatterns = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
A list of regular expressions used to filter the list of reported diagnostics.
|
|
||||||
If specified, only diagnostics that match none of the specified patterns are sent to the client.
|
|
||||||
|
|
||||||
See also texlab.diagnostics.allowedPatterns.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
latexindent = {
|
|
||||||
local = mkOption {
|
|
||||||
type = nullOr (either str path);
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Defines the path of a file containing the latexindent configuration.
|
|
||||||
This corresponds to the --local=file.yaml flag of latexindent.
|
|
||||||
By default the configuration inside the project root directory is used.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
modifyLineBreaks = mkBool false ''
|
|
||||||
Modifies linebreaks before, during, and at the end of code blocks when formatting with latexindent.
|
|
||||||
This corresponds to the --modifylinebreaks flag of latexindent.
|
|
||||||
'';
|
|
||||||
|
|
||||||
replacement = mkOption {
|
|
||||||
type = nullOr (enum ["-r" "-rv" "-rr"]);
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Defines an additional replacement flag that is added when calling latexindent. This can be one of the following:
|
|
||||||
- "-r"
|
|
||||||
- "-rv"
|
|
||||||
- "-rr"
|
|
||||||
- null
|
|
||||||
By default no replacement flag is passed.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
completion.matcher = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "fuzzy-ignore-case";
|
|
||||||
description = ''
|
|
||||||
Modifies the algorithm used to filter the completion items returned to the client. Possibles values are:
|
|
||||||
- fuzzy: Fuzzy string matching (case sensitive)
|
|
||||||
- fuzzy-ignore-case: Fuzzy string matching (case insensitive)
|
|
||||||
- prefix: Filter out items that do not start with the search text (case sensitive)
|
|
||||||
- prefix-ignore-case: Filter out items that do not start with the search text (case insensitive)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
inlayHints = {
|
|
||||||
labelDefinitions = mkBool true "When enabled, the server will return inlay hints for `\\label-like` commands.";
|
|
||||||
|
|
||||||
labelReferences = mkBool true "When enabled, the server will return inlay hints for `\\ref``-like commands.";
|
|
||||||
|
|
||||||
maxLength = mkOption {
|
|
||||||
type = nullOr ints.positive;
|
|
||||||
default = null;
|
|
||||||
description = "When set, the server will truncate the text of the inlay hints to the specified length.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
experimental = {
|
|
||||||
followPackageLinks = mkBool false "If set to true, dependencies of custom packages are resolved and included in the dependency graph.";
|
|
||||||
|
|
||||||
mathEnvironments = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = "Allows extending the list of environments which the server considers as math environments (for example `align*` or `equation`).";
|
|
||||||
};
|
|
||||||
|
|
||||||
enumEnvironments = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = "Allows extending the list of environments which the server considers as enumeration environments (for example `enumerate` or `itemize`).";
|
|
||||||
};
|
|
||||||
|
|
||||||
verbatimEnvironments = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows extending the list of environments which the server considers as verbatim environments (for example `minted` or `lstlisting`).
|
|
||||||
This can be used to suppress diagnostics from environments that do not contain LaTeX code.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
citationCommands = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows extending the list of commands which the server considers as citation commands (for example `\cite`).
|
|
||||||
|
|
||||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
labelDefinitionCommands = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows extending the list of `\label`-like commands.
|
|
||||||
|
|
||||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
labelReferenceCommands = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows extending the list of `\ref`-like commands.
|
|
||||||
|
|
||||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
labelReferenceRangeCommands = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows extending the list of `\crefrange`-like commands.
|
|
||||||
|
|
||||||
Hint: Additional commands need to be written without a leading `\` (e. g. `foo` instead of `\foo`).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
labelDefinitionPrefixes = mkOption {
|
|
||||||
type = listOf (listOf str);
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows associating a label definition command with a custom prefix. Consider,
|
|
||||||
```
|
|
||||||
\newcommand{\thm}[1]{\label{thm:#1}}
|
|
||||||
\thm{foo}
|
|
||||||
```
|
|
||||||
Then setting `texlab.experimental.labelDefinitionPrefixes` to `[["thm", "thm:"]]` and adding "thm"
|
|
||||||
to `texlab.experimental.labelDefinitionCommands` will make the server recognize the `thm:foo` label.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
labelReferencePrefixes = mkOption {
|
|
||||||
type = listOf (listOf str);
|
|
||||||
default = [];
|
|
||||||
description = ''
|
|
||||||
Allows associating a label reference command with a custom prefix.
|
|
||||||
See `texlab.experimental.labelDefinitionPrefixes` for more details.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
formatterLineLength = mkOption {
|
|
||||||
type = ints.positive;
|
|
||||||
default = 80;
|
|
||||||
description = "Defines the maximum amount of characters per line (0 = disable) when formatting BibTeX files.";
|
|
||||||
};
|
|
||||||
|
|
||||||
bibtexFormatter = mkOption {
|
|
||||||
type = enum ["texlab" "latexindent"];
|
|
||||||
default = "texlab";
|
|
||||||
description = ''
|
|
||||||
Defines the formatter to use for BibTeX formatting.
|
|
||||||
Possible values are either texlab or latexindent.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
latexFormatter = mkOption {
|
|
||||||
type = enum ["texlab" "latexindent"];
|
|
||||||
default = "latexindent";
|
|
||||||
description = ''
|
|
||||||
Defines the formatter to use for LaTeX formatting.
|
|
||||||
Possible values are either texlab or latexindent.
|
|
||||||
Note that texlab is not implemented yet.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraLuaSettings = mkOption {
|
extraLuaSettings = mkOption {
|
||||||
type = attrs;
|
type = str;
|
||||||
default = {};
|
default = "";
|
||||||
example = {
|
example = ''
|
||||||
foo = "bar";
|
formatterLineLength = 80,
|
||||||
baz = 314;
|
'';
|
||||||
};
|
|
||||||
description = ''
|
description = ''
|
||||||
For any options that do not have options provided through nvf this can be used to add them.
|
For any options that do not have options provided through nvf this can be used to add them.
|
||||||
Options already declared in nvf config will NOT be overridden.
|
Options already declared in nvf config will NOT be overridden.
|
||||||
|
|
@ -300,76 +136,97 @@ in {
|
||||||
|
|
||||||
config = mkIf (cfg.enable && (cfg.lsp.texlab.enable)) (
|
config = mkIf (cfg.enable && (cfg.lsp.texlab.enable)) (
|
||||||
let
|
let
|
||||||
# ----- Setup Config -----
|
tl = cfg.lsp.texlab;
|
||||||
# Command to start the LSP
|
builder = cfg.build.builder;
|
||||||
setupConfig.cmd = ["${texlabCfg.package}/bin/texlab"];
|
|
||||||
|
|
||||||
# Create texlab settings section
|
listToLua = list: nullOnEmpty:
|
||||||
setupConfig.settings.texlab = (
|
if length list == 0
|
||||||
{
|
then
|
||||||
# -- General Settings --
|
if nullOnEmpty
|
||||||
formatterLineLength = texlabCfg.formatterLineLength;
|
then "null"
|
||||||
|
else "{ }"
|
||||||
|
else "{ ${concatStringsSep ", " (map (x: ''"${toString x}"'') list)} }";
|
||||||
|
|
||||||
# -- Formatters --
|
stringToLua = string: nullOnEmpty:
|
||||||
bibtexFormatter = texlabCfg.bibtexFormatter;
|
if string == ""
|
||||||
latexFormatter = texlabCfg.latexFormatter;
|
then
|
||||||
|
if nullOnEmpty
|
||||||
|
then "null"
|
||||||
|
else ""
|
||||||
|
else ''"${string}"'';
|
||||||
|
|
||||||
# -- Diagnostics --
|
boolToLua = boolean:
|
||||||
diagnosticsDelay = texlabCfg.diagnostics.delay;
|
if boolean
|
||||||
diagnostics = {
|
then "true"
|
||||||
allowedPatterns = texlabCfg.diagnostics.allowedPatterns;
|
else "false";
|
||||||
ignoredPatterns = texlabCfg.diagnostics.ignoredPatterns;
|
|
||||||
};
|
|
||||||
|
|
||||||
# -- Latex Indent --
|
# -- Build --
|
||||||
latexindent = texlabCfg.latexindent;
|
buildConfig = let
|
||||||
|
# This function will sort through the builder options and count how many
|
||||||
|
# builders have been enabled.
|
||||||
|
getEnabledBuildersCount = {
|
||||||
|
enabledBuildersCount ? 0,
|
||||||
|
index ? 0,
|
||||||
|
builderNamesList ? (
|
||||||
|
filter (
|
||||||
|
x: let
|
||||||
|
y = cfg.build.builders.${x};
|
||||||
|
in (isAttrs y && hasAttr "enable" y)
|
||||||
|
) (attrNames cfg.build.builders)
|
||||||
|
),
|
||||||
|
}: let
|
||||||
|
currentBuilderName = elemAt builderNamesList index;
|
||||||
|
currentBuilder = cfg.build.builders.${currentBuilderName};
|
||||||
|
nextIndex = index + 1;
|
||||||
|
newEnabledBuildersCount =
|
||||||
|
if currentBuilder.enable
|
||||||
|
then enabledBuildersCount + 1
|
||||||
|
else enabledBuildersCount;
|
||||||
|
in
|
||||||
|
if length builderNamesList > nextIndex
|
||||||
|
then
|
||||||
|
getEnabledBuildersCount {
|
||||||
|
inherit builderNamesList;
|
||||||
|
enabledBuildersCount = newEnabledBuildersCount;
|
||||||
|
index = nextIndex;
|
||||||
|
}
|
||||||
|
else newEnabledBuildersCount;
|
||||||
|
|
||||||
# -- Completion --
|
enabledBuildersCount = getEnabledBuildersCount {};
|
||||||
completion.matcher = texlabCfg.completion.matcher;
|
in
|
||||||
|
if enabledBuildersCount == 0
|
||||||
# -- Inlay Hints --
|
then ""
|
||||||
inlayHints = texlabCfg.inlayHints;
|
else if enabledBuildersCount > 1
|
||||||
|
then throw "Texlab does not support having more than 1 builders enabled!"
|
||||||
# -- Experimental --
|
else ''
|
||||||
experimental = texlabCfg.experimental;
|
build = {
|
||||||
}
|
executable = "${builder.package}/bin/${builder.executable}",
|
||||||
#
|
args = ${listToLua builder.args false},
|
||||||
# -- Forward Search --
|
forwardSearchAfter = ${boolToLua cfg.build.forwardSearchAfter},
|
||||||
// (
|
onSave = ${boolToLua cfg.build.onSave},
|
||||||
if texlabCfg.forwardSearch.enable
|
useFileList = ${boolToLua cfg.build.useFileList},
|
||||||
then {
|
auxDirectory = ${stringToLua cfg.build.auxDirectory true},
|
||||||
forwardSearch = {
|
logDirectory = ${stringToLua cfg.build.logDirectory true},
|
||||||
executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}";
|
pdfDirectory = ${stringToLua cfg.build.pdfDirectory true},
|
||||||
args = texlabCfg.forwardSearch.args;
|
filename = ${stringToLua cfg.build.filename true},
|
||||||
};
|
},
|
||||||
}
|
'';
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
|
||||||
# -- Build --
|
|
||||||
// (
|
|
||||||
if cfg.build.enable
|
|
||||||
then {
|
|
||||||
build = {
|
|
||||||
executable = "${builderCfg.package}/bin/${builderCfg.executable}";
|
|
||||||
args = builderCfg.args;
|
|
||||||
forwardSearchAfter = cfg.build.forwardSearchAfter;
|
|
||||||
onSave = cfg.build.onSave;
|
|
||||||
useFileList = cfg.build.useFileList;
|
|
||||||
auxDirectory = cfg.build.auxDirectory;
|
|
||||||
logDirectory = cfg.build.logDirectory;
|
|
||||||
pdfDirectory = cfg.build.pdfDirectory;
|
|
||||||
filename = cfg.build.filename;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
|
||||||
# -- Extra Settings --
|
|
||||||
// texlabCfg.extraLuaSettings
|
|
||||||
);
|
|
||||||
in {
|
in {
|
||||||
vim.lsp.lspconfig.sources.texlab = "lspconfig.texlab.setup(${lib.nvim.lua.toLuaObject setupConfig})";
|
vim.lsp.lspconfig.sources.texlab = ''
|
||||||
|
lspconfig.texlab.setup {
|
||||||
|
cmd = { "${tl.package}/bin/texlab" },
|
||||||
|
settings = {
|
||||||
|
texlab = {
|
||||||
|
${buildConfig}
|
||||||
|
forwardSearch = {
|
||||||
|
executable = "${tl.forwardSearch.package}/bin/${tl.forwardSearch.executable}",
|
||||||
|
args = ${listToLua tl.forwardSearch.args true}
|
||||||
|
},
|
||||||
|
${tl.extraLuaSettings}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,10 @@
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge mkDefault;
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) bool either listOf package str enum;
|
inherit (lib.types) either listOf package str enum;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
||||||
cfg = config.vim.languages.zig;
|
|
||||||
|
|
||||||
defaultServer = "zls";
|
defaultServer = "zls";
|
||||||
servers = {
|
servers = {
|
||||||
zls = {
|
zls = {
|
||||||
|
|
@ -33,35 +31,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: dap.adapter.lldb is duplicated when enabling the
|
cfg = config.vim.languages.zig;
|
||||||
# vim.languages.clang.dap module. This does not cause
|
|
||||||
# breakage... but could be cleaner.
|
|
||||||
defaultDebugger = "lldb-vscode";
|
|
||||||
debuggers = {
|
|
||||||
lldb-vscode = {
|
|
||||||
package = pkgs.lldb;
|
|
||||||
dapConfig = ''
|
|
||||||
dap.adapters.lldb = {
|
|
||||||
type = 'executable',
|
|
||||||
command = '${cfg.dap.package}/bin/lldb-dap',
|
|
||||||
name = 'lldb'
|
|
||||||
}
|
|
||||||
dap.configurations.zig = {
|
|
||||||
{
|
|
||||||
name = 'Launch',
|
|
||||||
type = 'lldb',
|
|
||||||
request = 'launch',
|
|
||||||
program = function()
|
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
|
||||||
end,
|
|
||||||
cwd = "''${workspaceFolder}",
|
|
||||||
stopOnEntry = false,
|
|
||||||
args = {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
options.vim.languages.zig = {
|
options.vim.languages.zig = {
|
||||||
enable = mkEnableOption "Zig language support";
|
enable = mkEnableOption "Zig language support";
|
||||||
|
|
@ -86,26 +56,6 @@ in {
|
||||||
default = pkgs.zls;
|
default = pkgs.zls;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dap = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = config.vim.languages.enableDAP;
|
|
||||||
description = "Enable Zig Debug Adapter";
|
|
||||||
};
|
|
||||||
|
|
||||||
debugger = mkOption {
|
|
||||||
type = enum (attrNames debuggers);
|
|
||||||
default = defaultDebugger;
|
|
||||||
description = "Zig debugger to use";
|
|
||||||
};
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = package;
|
|
||||||
default = debuggers.${cfg.dap.debugger}.package;
|
|
||||||
description = "Zig debugger package.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -127,12 +77,5 @@ in {
|
||||||
globals.zig_fmt_autosave = mkDefault 0;
|
globals.zig_fmt_autosave = mkDefault 0;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
|
||||||
vim = {
|
|
||||||
debugger.nvim-dap.enable = true;
|
|
||||||
debugger.nvim-dap.sources.zig-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
|
@ -13,29 +12,13 @@ in {
|
||||||
config = mkIf (cfg.enable && cfg.lightbulb.enable) {
|
config = mkIf (cfg.enable && cfg.lightbulb.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-lightbulb"];
|
startPlugins = ["nvim-lightbulb"];
|
||||||
|
|
||||||
pluginRC.lightbulb = entryAnywhere ''
|
pluginRC.lightbulb = entryAnywhere ''
|
||||||
local nvim_lightbulb = require("nvim-lightbulb")
|
vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()')
|
||||||
nvim_lightbulb.setup(${toLuaObject cfg.lightbulb.setupOpts})
|
|
||||||
${optionalString cfg.lightbulb.autocmd.enable ''
|
-- Enable trouble diagnostics viewer
|
||||||
vim.api.nvim_create_autocmd(${toLuaObject cfg.lightbulb.autocmd.events}, {
|
require'nvim-lightbulb'.setup(${toLuaObject cfg.lightbulb.setupOpts})
|
||||||
pattern = ${toLuaObject cfg.lightbulb.autocmd.pattern},
|
|
||||||
callback = function()
|
|
||||||
nvim_lightbulb.update_lightbulb()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
warnings = [
|
|
||||||
# This could have been an assertion, but the chances of collision is very low and asserting here
|
|
||||||
# might be too dramatic. Let's only warn the user, *in case* this occurs and is not intended. No
|
|
||||||
# error will be thrown if 'lightbulb.setupOpts.autocmd.enable' has not been set by the user.
|
|
||||||
(mkIf (cfg.lightbulb.autocmd.enable -> (cfg.lightbulb.setupOpts.autocmd.enabled or false)) ''
|
|
||||||
Both 'vim.lsp.lightbulb.autocmd.enable' and 'vim.lsp.lightbulb.setupOpts.autocmd.enable' are set
|
|
||||||
simultaneously. This might have performance implications due to frequent updates. Please set only
|
|
||||||
one option to handle nvim-lightbulb autocmd.
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,11 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.types) listOf str either;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
lightbulb = {
|
lightbulb = {
|
||||||
enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font";
|
enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font";
|
||||||
setupOpts = mkPluginSetupOption "nvim-lightbulb" {};
|
setupOpts = mkPluginSetupOption "nvim-lightbulb" {};
|
||||||
autocmd = {
|
|
||||||
enable = mkEnableOption "updating lightbulb glyph automatically" // {default = true;};
|
|
||||||
events = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = ["CursorHold" "CursorHoldI"];
|
|
||||||
description = "Events on which to update nvim-lightbulb glyphs";
|
|
||||||
};
|
|
||||||
|
|
||||||
pattern = mkOption {
|
|
||||||
type = either str luaInline;
|
|
||||||
default = "*";
|
|
||||||
description = ''
|
|
||||||
File patterns or buffer names to match, determining which files or buffers trigger
|
|
||||||
glyph updates.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue