diff --git a/modules/plugins/languages/tex/build/builders/default.nix b/modules/plugins/languages/tex/build/builders/default.nix index 4586b768..fa51e70a 100644 --- a/modules/plugins/languages/tex/build/builders/default.nix +++ b/modules/plugins/languages/tex/build/builders/default.nix @@ -6,8 +6,7 @@ }: let inherit (lib.options) mkOption; inherit (lib.types) enum listOf package str; - inherit (lib.nvim.config) mkBool; - inherit (builtins) attrNames filter isAttrs hasAttr elemAt length; + inherit (builtins) attrNames; cfg = config.vim.languages.tex; in { diff --git a/modules/plugins/languages/tex/build/builders/latexmk.nix b/modules/plugins/languages/tex/build/builders/latexmk.nix index 9037fd6a..8872f3dd 100644 --- a/modules/plugins/languages/tex/build/builders/latexmk.nix +++ b/modules/plugins/languages/tex/build/builders/latexmk.nix @@ -29,7 +29,10 @@ in ( executable = mkOption { type = str; default = "latexmk"; - description = "The executable name from the build package that will be used to build/compile the tex."; + description = '' + The executable name from the build package that will be used to + build/compile the tex. + ''; }; # Flag options diff --git a/modules/plugins/languages/tex/build/builders/tectonic.nix b/modules/plugins/languages/tex/build/builders/tectonic.nix index b9b4e656..ed1e8edb 100644 --- a/modules/plugins/languages/tex/build/builders/tectonic.nix +++ b/modules/plugins/languages/tex/build/builders/tectonic.nix @@ -12,7 +12,7 @@ inherit (lib) optionals; inherit (lib.options) mkOption mkEnableOption mkPackageOption; - inherit (lib.types) enum ints listOf str; + inherit (lib.types) enum ints listOf str nullOr; inherit (lib.nvim.config) mkBool; inherit (builtins) concatLists elem map toString; @@ -29,23 +29,32 @@ in ( executable = mkOption { type = str; default = "tectonic"; - description = "The executable name from the build package that will be used to build/compile the tex."; + description = '' + The executable name from the build package that will be used to + build/compile the tex. + ''; }; # -- Flags -- keepIntermediates = mkBool false '' Whether to 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 '' Whether to 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 '' + Whether to use only resource files cached locally ''; - onlyCached = mkBool false "Whether to use only resource files cached locally"; synctex = mkBool true "Whether to generate SyncTeX data"; - untrustedInput = mkBool false "Whether to input is untrusted -- disable all known-insecure features"; + untrustedInput = mkBool false '' + Whether to diable all known-insecure features if the input is untrusted + ''; # -- Options -- reruns = mkOption { @@ -62,28 +71,37 @@ in ( }; bundle = mkOption { - type = str; - default = ""; - description = "Use this directory or Zip-format bundle file to find resource files instead of the default"; + type = nullOr str; + default = null; + 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"; + type = nullOr str; + default = null; + description = '' + Use this URL to find resource files instead of the default. + ''; }; outfmt = mkOption { - type = enum [ + type = nullOr (enum [ "pdf" "html" "xdv" "aux" "fmt" - "" - ]; - default = ""; - description = "The kind of output to generate"; + ]); + default = null; + description = '' + The kind of output to generate. + + Setting this to `null` (default) will let tectonic decide the most + appropriate output format, which usually be a pdf. + ''; }; hidePaths = mkOption { @@ -93,23 +111,27 @@ in ( "./secrets.tex" "./passwords.tex" ]; - description = "Tell the engine that no file at exists, if it tries to read it."; + description = '' + Tell the engine that no file at `` 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"; + type = nullOr str; + default = null; + description = '' + The name of the \"format\" file used to initialize the TeX engine. + ''; }; color = mkOption { - type = enum [ + type = nullOr (enum [ "always" "auto" "never" - "" - ]; - default = ""; + ]); + default = null; example = "always"; description = "Enable/disable colorful log output"; }; @@ -118,8 +140,10 @@ in ( 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. + 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. ''; }; }; @@ -139,12 +163,12 @@ in ( ++ (optionals builderCfg.untrustedInput ["--untrusted"]) # Options ++ (optionals (builderCfg.reruns > 0) ["--reruns" "${toString builderCfg.reruns}"]) - ++ (optionals (builderCfg.bundle != "") ["--bundle" "${toString builderCfg.bundle}"]) - ++ (optionals (builderCfg.webBundle != "") ["--web-bundle" "${toString builderCfg.webBundle}"]) - ++ (optionals (builderCfg.outfmt != "") ["--outfmt" "${toString builderCfg.outfmt}"]) + ++ (optionals (builderCfg.bundle != null) ["--bundle" "${toString builderCfg.bundle}"]) + ++ (optionals (builderCfg.webBundle != null) ["--web-bundle" "${toString builderCfg.webBundle}"]) + ++ (optionals (builderCfg.outfmt != null) ["--outfmt" "${toString builderCfg.outfmt}"]) ++ (concatLists (map (x: ["--hide" x]) builderCfg.hidePaths)) - ++ (optionals (builderCfg.format != "") ["--format" "${toString builderCfg.format}"]) - ++ (optionals (builderCfg.color != "") ["--color" "${toString builderCfg.color}"]) + ++ (optionals (builderCfg.format != null) ["--format" "${toString builderCfg.format}"]) + ++ (optionals (builderCfg.color != null) ["--color" "${toString builderCfg.color}"]) # Still options but these are not defined by builder specific options but # instead synchronize options between the global build options and builder # specific options diff --git a/modules/plugins/languages/tex/build/default.nix b/modules/plugins/languages/tex/build/default.nix index 3daa0ea7..9f9c5bc3 100644 --- a/modules/plugins/languages/tex/build/default.nix +++ b/modules/plugins/languages/tex/build/default.nix @@ -3,11 +3,11 @@ lib, ... }: let - inherit (lib.options) mkOption; - inherit (lib.modules) mkIf; - inherit (lib.types) str nullOr; inherit (builtins) filter isAttrs hasAttr attrNames length elemAt; + inherit (lib.modules) mkIf; inherit (lib.nvim.config) mkBool; + inherit (lib.options) mkOption; + inherit (lib.types) str nullOr; cfg = config.vim.languages.tex; @@ -48,20 +48,28 @@ in { ]; options.vim.languages.tex.build = { - enable = - mkBool (enabledBuildersCount == 1) '' - Whether to enable configuring the builder. + enable = mkBool (enabledBuildersCount == 1) '' + Whether to enable configuring the builder. - By enabling any of the builders, this option will be automatically set. - If you enable more than one builder then an error will be thrown. - ''; + By enabling any of the builders, this option will be automatically set. + 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."; + 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."; + This can also be thought of as enabling auto updating for your pdf viewer. + ''; + + 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. + 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. ''; @@ -70,10 +78,12 @@ in { type = str; default = "."; description = '' - When not using latexmk, provides a way to define the directory containing the .aux files. - Note that you need to set the aux directory in latex.build.args too. + When not using latexmk, provides a way to define the directory + containing the `.aux` files. + Note that you need to set the aux directory in `latex.build.args` too. - When using a latexmkrc file, texlab will automatically infer the correct setting. + When using a latexmkrc file, texlab will automatically infer the correct + setting. ''; }; @@ -81,10 +91,13 @@ in { type = str; default = "."; description = '' - When not using latexmk, provides a way to define the directory containing the build log files. - Note that you need to change the output directory in your build arguments too. + When not using latexmk, provides a way to define the directory + containing the build log files. + Note that you need to change the output directory in your build + arguments too. - When using a latexmkrc file, texlab will automatically infer the correct setting. + When using a latexmkrc file, texlab will automatically infer the correct + setting. ''; }; @@ -92,10 +105,13 @@ in { type = str; default = "."; description = '' - When not using latexmk, provides a way to define the directory containing the output files. - Note that you need to set the output directory in latex.build.args too. + When not using latexmk, provides a way to define the directory + containing the output files. + Note that you need to set the output directory in `latex.build.args` + too. - When using a latexmkrc file, texlab will automatically infer the correct setting. + When using a latexmkrc file, texlab will automatically infer the correct + setting. ''; }; @@ -104,17 +120,20 @@ in { default = null; 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. + This setting is used to find the correct PDF file to open during forward + search. ''; }; }; - config = mkIf (enabledBuildersCount > 0) { assertions = [ { - assertion = (enabledBuildersCount < 2); - message = "The nvf-tex-language implementation does not support having more than 1 builders enabled."; + assertion = enabledBuildersCount < 2; + message = '' + The nvf-tex-language implementation does not support having more than + 1 builders enabled. + ''; } ]; }; diff --git a/modules/plugins/languages/tex/default.nix b/modules/plugins/languages/tex/default.nix index be77a49e..e427f8a3 100644 --- a/modules/plugins/languages/tex/default.nix +++ b/modules/plugins/languages/tex/default.nix @@ -4,16 +4,17 @@ ... }: let inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.config) mkBool; inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) bool str; + inherit (lib.types) enum; cfg = config.vim.languages.tex; in { imports = [ - ./treesitter.nix - ./lsp ./build + ./lsp ./pdfViewer + ./treesitter.nix ]; options.vim.languages.tex = { @@ -21,38 +22,46 @@ in { extraOpts = { texFlavor = { - enable = mkOption { - type = bool; - default = false; - example = true; - description = '' - Whether to set the `vim.g.tex_flavor` (`g:tex_flavor`) option in your Lua config. + enable = mkBool false '' + Whether to set the `vim.g.tex_flavor` (`g:tex_flavor`) option in + your Lua config. - When opening a .tex file vim will try to automatically try to determine the file type from - the three options: plaintex (for plain TeX), context (for ConTeXt), or tex (for LaTeX). - This can either be done by a indicator line of the form `%&` on the first line or - if absent vim will search the file for keywords to try and determine the filetype. - If no filetype can be determined automatically then by default it will fallback to plaintex. + When opening a `.tex` file vim will try to automatically try to + determine the file type from the three options: `plaintex` (for + plain TeX), `context` (for ConTeXt), or `tex` (for LaTeX). + This can either be done by a indicator line of the form `%&` + on the first line or, if absent, vim will search the file for + keywords to try and determine the filetype. If no filetype can be + determined automatically then by default it will fallback to + plaintex. - This option will enable setting the tex flavor in your lua config and you can set its value - using the `vim.languages.tex.lsp.extraOpts.texFlavor.flavor = ` in your nvf config. + This option will enable setting the tex flavor in your lua config + and you can set its value using the + `vim.languages.tex.lsp.extraOpts.texFlavor.flavor = ` in + your nvf config. - Setting this option to `false` will omit the `vim.g.tex_flavor = ` line from your lua - config entirely (unless you manually set it elsewhere of course). - ''; - }; + Setting this option to `false` will omit the + `vim.g.tex_flavor = ` line from your lua config entirely + (unless you manually set it elsewhere of course). + ''; flavor = mkOption { - type = str; + type = enum [ + "plaintex" + "contex" + "tex" + ]; default = "plaintex"; example = "tex"; description = '' - The flavor to set as a fallback for when vim cannot automatically determine the tex flavor when - opening a .tex document. + The flavor to set as a fallback for when vim cannot automatically + determine the tex flavor when opening a `.tex` document. - The options are: plaintex (for plain TeX), context (for ConTeXt), or tex (for LaTeX). + The options are: `plaintex` (for plain TeX), `context` (for + ConTeXt), or `tex` (for LaTeX). - This can be particularly useful for when using `vim.utility.new-file-template` options for - creating templates when no context has yet been added to a new file. + This can be particularly useful for when using + `vim.utility.new-file-template` options for creating templates when + no context has yet been added to a new file. ''; }; }; diff --git a/modules/plugins/languages/tex/lsp/texlab.nix b/modules/plugins/languages/tex/lsp/texlab.nix index 5677d958..07c64aab 100644 --- a/modules/plugins/languages/tex/lsp/texlab.nix +++ b/modules/plugins/languages/tex/lsp/texlab.nix @@ -4,24 +4,34 @@ lib, ... }: let - inherit (lib.options) mkOption; - inherit (lib.modules) mkIf mkMerge; - inherit (lib.types) attrs either enum ints listOf nullOr package path str submodule; - inherit (lib.nvim.config) mkBool; inherit (builtins) isString map; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.config) mkBool; + inherit (lib.options) mkOption mkPackageOption; + inherit + (lib.types) + attrs + either + enum + ints + listOf + nullOr + package + path + str + submodule + ; cfg = config.vim.languages.tex; texlabCfg = cfg.lsp.texlab; builderCfg = cfg.build.builder; in { options.vim.languages.tex.lsp.texlab = { - enable = mkBool config.vim.languages.enableLSP "Whether to enable Tex LSP support (texlab)"; + enable = mkBool config.vim.languages.enableLSP '' + Whether to enable Tex LSP support (texlab). + ''; - package = mkOption { - type = package; - default = pkgs.texlab; - description = "texlab package"; - }; + package = mkPackageOption pkgs "texlab" {}; chktex = { enable = mkBool false "Whether to enable linting via chktex"; @@ -35,7 +45,9 @@ in { ''; }; - onOpenAndSave = mkBool false "Lint using chktex after opening and saving a file."; + onOpenAndSave = mkBool false '' + Lint using chktex after opening and saving a file. + ''; onEdit = mkBool false "Lint using chktex after editing a file."; @@ -43,7 +55,8 @@ in { type = listOf str; default = []; description = '' - Additional command line arguments that are passed to chktex after editing a file. + Additional command line arguments that are passed to chktex after + editing a file. Don't redefine the `-I` and `-f` flags as they are set by the server. ''; }; @@ -58,11 +71,15 @@ in { ]; 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) + 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). ''; }; @@ -77,13 +94,16 @@ in { 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. + 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. + 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. + Hint: If both allowedPatterns and ignoredPatterns are set, then + allowed patterns are applied first. Afterwards, the results are + filtered with the ignored patterns. ''; }; @@ -91,35 +111,48 @@ in { 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. + 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. + See also `texlab.diagnostics.allowedPatterns`. ''; }; }; experimental = { - followPackageLinks = mkBool false "If set to true, dependencies of custom packages are resolved and included in the dependency graph."; + 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`)."; + 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`)."; + 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. + 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. ''; }; @@ -127,9 +160,11 @@ in { type = listOf str; default = []; description = '' - Allows extending the list of commands which the server considers as citation commands (for example `\cite`). + 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`). + Hint: Additional commands need to be written without a leading `\` + (e.g. `foo` instead of `\foo`). ''; }; @@ -139,7 +174,8 @@ in { 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`). + Hint: Additional commands need to be written without a leading `\` + (e.g. `foo` instead of `\foo`). ''; }; @@ -149,7 +185,8 @@ in { 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`). + Hint: Additional commands need to be written without a leading `\` + (e.g. `foo` instead of `\foo`). ''; }; @@ -159,7 +196,8 @@ in { 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`). + Hint: Additional commands need to be written without a leading `\` + (e.g. `foo` instead of `\foo`). ''; }; @@ -167,13 +205,16 @@ in { type = listOf (listOf str); default = []; description = '' - Allows associating a label definition command with a custom prefix. Consider, + Allows associating a label definition command with a custom prefix. + Consider, ``` \newcommand{\theorem}[1]{\label{theorem:#1}} \theorem{foo} ``` - Then setting `texlab.experimental.labelDefinitionPrefixes` to `[["theorem", "theorem:"]]` and adding "theorem" - to `texlab.experimental.labelDefinitionCommands` will make the server recognize the `theorem:foo` label. + Then setting `texlab.experimental.labelDefinitionPrefixes` to + `[["theorem", "theorem:"]]` and adding `theorem` to + `texlab.experimental.labelDefinitionCommands` will make the server + recognize the `theorem:foo` label. ''; }; @@ -195,7 +236,8 @@ in { baz = 314; }; 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 will be placed in: @@ -218,10 +260,12 @@ in { enable = mkBool false '' 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 along with custom configs. + Note this is not all the options, but can act as a guide to help you + along with custom configs. ''; package = mkOption { @@ -239,7 +283,8 @@ in { type = str; default = cfg.pdfViewer.executable; description = '' - 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. By default it is set to the executable of the pdfViewer option. ''; @@ -249,28 +294,37 @@ in { type = listOf str; default = cfg.pdfViewer.args; description = '' - Defines additional arguments that are passed to the configured previewer to perform the forward search. - The placeholders %f, %p, %l will be replaced by the server. + Defines additional arguments that are passed to the configured + previewer to perform the forward search. + The placeholders `%f`, `%p`, `%l` will be replaced by the server. By default it is set to the args of the pdfViewer option. Placeholders: - - %f: The path of the current TeX file. - - %p: The path of the current PDF file. - - %l: The current line number. + - `%f`: The path of the current TeX file. + - `%p`: The path of the current PDF file. + - `%l`: The current line number. ''; }; }; formatter = { formatterLineLength = mkOption { - type = ints.positive; + type = ints.unsigned; default = 80; - description = "Defines the maximum amount of characters per line (0 = disable) when formatting BibTeX files."; + description = '' + Defines the maximum amount of characters per line when formatting + BibTeX files. + + Setting this value to 0 will disable this option. + ''; }; bibtexFormatter = mkOption { - type = enum ["texlab" "latexindent"]; + type = enum [ + "texlab" + "latexindent" + ]; default = "texlab"; description = '' Defines the formatter to use for BibTeX formatting. @@ -279,7 +333,10 @@ in { }; latexFormatter = mkOption { - type = enum ["texlab" "latexindent"]; + type = enum [ + "texlab" + "latexindent" + ]; default = "latexindent"; description = '' Defines the formatter to use for LaTeX formatting. @@ -290,14 +347,23 @@ in { }; inlayHints = { - labelDefinitions = mkBool true "When enabled, the server will return inlay hints for `\\label`-like commands."; + 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."; + 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."; + description = '' + When set, the server will truncate the text of the inlay hints to the + specified length. + ''; }; }; @@ -307,25 +373,33 @@ in { 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. + 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. + 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"]); + 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 + 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. ''; }; @@ -338,15 +412,18 @@ in { type = listOf str; default = []; description = '' - A list of regular expressions used to filter the list of reported document symbols. - If specified, only symbols that match at least one of the specified patterns are sent to the client. - Symbols are filtered recursively so nested symbols can still be sent to the client even though the - parent node is removed from the results. + A list of regular expressions used to filter the list of reported + document symbols. + If specified, only symbols that match at least one of the specified + patterns are sent to the client. + Symbols are filtered recursively so nested symbols can still be sent + to the client even though the parent node is removed from the results. See also `texlab.symbols.ignoredPatterns`. - Hint: If both allowedPatterns and ignoredPatterns are set, then allowed patterns are applied first. - Afterwards, the results are filtered with the ignored patterns. + Hint: If both `allowedPatterns` and `ignoredPatterns` are set, then + allowed patterns are applied first. Afterwards, the results are + filtered with the ignored patterns. ''; }; @@ -354,8 +431,10 @@ in { type = listOf str; default = []; description = '' - A list of regular expressions used to filter the list of reported document symbols. - If specified, only symbols that match none of the specified patterns are sent to the client. + A list of regular expressions used to filter the list of reported + document symbols. + If specified, only symbols that match none of the specified patterns + are sent to the client. See also `texlab.symbols.allowedPatterns`. ''; @@ -371,10 +450,14 @@ in { displayName = mkOption { type = nullOr str; default = null; - description = "The name shown in the document symbols. Defaults to the value of `name`."; + description = '' + The name shown in the document symbols. + Defaults to the value of `name`. + ''; }; label = mkBool false '' - If set, the server will try to match a label to environment and append its number. + If set to `true`, the server will try to match a label to + environment and append its number. ''; }; }); @@ -387,9 +470,10 @@ in { } ]; description = '' - A list of objects that allows extending the list of environments that are part of the document symbols. + A list of objects that allows extending the list of environments that + are part of the document symbols. - See also texlab.symbols.allowedPatterns. + See also `texlab.symbols.allowedPatterns`. Type: listOf submodule: - name: @@ -402,11 +486,12 @@ in { - default: - label: - type: boolean - - description: If set, the server will try to match a label to environment and append its number. + - description: If set, the server will try to match a label to + environment and append its number. - default: false - Note: This functionality may not be working, please follow https://github.com/latex-lsp/texlab/pull/1311 - for status updates. + Note: This functionality may not be working, please follow + https://github.com/latex-lsp/texlab/pull/1311 for status updates. ''; }; }; diff --git a/modules/plugins/languages/tex/pdfViewer/custom.nix b/modules/plugins/languages/tex/pdfViewer/custom.nix index 189663fe..7b8a9de4 100644 --- a/modules/plugins/languages/tex/pdfViewer/custom.nix +++ b/modules/plugins/languages/tex/pdfViewer/custom.nix @@ -9,8 +9,8 @@ # The viewer template template = import ./viewerTemplate.nix; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) package str listOf; + inherit (lib.options) mkOption mkEnableOption mkPackageOption; + inherit (lib.types) str listOf; in ( template { inherit name moduleInheritancePackage; @@ -18,10 +18,8 @@ in ( options = { enable = mkEnableOption "enable using a custom pdf viewer."; - package = mkOption { - type = package; - example = pkgs.okular; - description = "custom viewer package"; + package = mkPackageOption pkgs "okular" { + extraDescription = "custom viewer package"; }; executable = mkOption { @@ -32,7 +30,10 @@ in ( args = mkOption { type = listOf str; - example = ["--unique" "file:%p#src:%l%f"]; + example = [ + "--unique" + "file:%p#src:%l%f" + ]; description = "Arguments to pass to the viewer."; }; }; diff --git a/modules/plugins/languages/tex/pdfViewer/okular.nix b/modules/plugins/languages/tex/pdfViewer/okular.nix index e341fa4d..0c3d7f8d 100644 --- a/modules/plugins/languages/tex/pdfViewer/okular.nix +++ b/modules/plugins/languages/tex/pdfViewer/okular.nix @@ -9,8 +9,8 @@ # The viewer template template = import ./viewerTemplate.nix; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) package str listOf; + inherit (lib.options) mkOption mkEnableOption mkPackageOption; + inherit (lib.types) str listOf; in ( template { inherit name moduleInheritancePackage; @@ -18,11 +18,7 @@ in ( options = { enable = mkEnableOption "enable okular as the pdf file previewer."; - package = mkOption { - type = package; - default = pkgs.okular; - description = "okular package"; - }; + package = mkPackageOption pkgs "okular" {}; executable = mkOption { type = str; @@ -32,7 +28,10 @@ in ( args = mkOption { type = listOf str; - default = ["--unique" "file:%p#src:%l%f"]; + default = [ + "--unique" + "file:%p#src:%l%f" + ]; description = "Arguments to pass to the viewer."; }; }; diff --git a/modules/plugins/languages/tex/pdfViewer/qpdfview.nix b/modules/plugins/languages/tex/pdfViewer/qpdfview.nix index ef294bcf..1938fb94 100644 --- a/modules/plugins/languages/tex/pdfViewer/qpdfview.nix +++ b/modules/plugins/languages/tex/pdfViewer/qpdfview.nix @@ -9,8 +9,8 @@ # The viewer template template = import ./viewerTemplate.nix; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) package str listOf; + inherit (lib.options) mkOption mkEnableOption mkPackageOption; + inherit (lib.types) str listOf; in ( template { inherit name moduleInheritancePackage; @@ -18,11 +18,7 @@ in ( options = { enable = mkEnableOption "enable qpdfview as the pdf file previewer."; - package = mkOption { - type = package; - default = pkgs.qpdfview; - description = "qpdfview package"; - }; + package = mkPackageOption pkgs "qpdfview" {}; executable = mkOption { type = str; @@ -32,7 +28,10 @@ in ( args = mkOption { type = listOf str; - default = ["--unique" "%p#src:%f:%l:1"]; + default = [ + "--unique" + "%p#src:%f:%l:1" + ]; description = "Arguments to pass to the viewer."; }; }; diff --git a/modules/plugins/languages/tex/pdfViewer/sioyek.nix b/modules/plugins/languages/tex/pdfViewer/sioyek.nix index a4c647b1..ad0b4943 100644 --- a/modules/plugins/languages/tex/pdfViewer/sioyek.nix +++ b/modules/plugins/languages/tex/pdfViewer/sioyek.nix @@ -9,20 +9,16 @@ # The viewer template template = import ./viewerTemplate.nix; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) package str listOf; + inherit (lib.options) mkOption mkEnableOption mkPackageOption; + inherit (lib.types) str listOf; in ( template { inherit name moduleInheritancePackage; options = { - enable = mkEnableOption "enable sioyek as the pdf file previewer."; + enable = mkEnableOption "sioyek as the pdf file previewer."; - package = mkOption { - type = package; - default = pkgs.sioyek; - description = "sioyek package"; - }; + package = mkPackageOption pkgs "sioyek" {}; executable = mkOption { type = str; @@ -47,9 +43,9 @@ in ( description = '' Arguments to pass to the viewer. - By default, this is the only viewer that supports the inverse search feature by - command line arguments and doesn't explicitly require extra tinkering else where - in your config. + By default, this is the only viewer that supports the inverse search + feature by command line arguments and doesn't explicitly require extra + tinkering else where in your config. ''; }; }; diff --git a/modules/plugins/languages/tex/pdfViewer/viewerTemplate.nix b/modules/plugins/languages/tex/pdfViewer/viewerTemplate.nix index dd81b7a4..72c52877 100644 --- a/modules/plugins/languages/tex/pdfViewer/viewerTemplate.nix +++ b/modules/plugins/languages/tex/pdfViewer/viewerTemplate.nix @@ -56,7 +56,8 @@ in { opts) options; - # Check that the language and this pdf viewer have been enabled before making any config. + # Check that the language and this pdf viewer have been enabled before making + # any config. config = mkIf (cfg.enable && viewerCfg.enable) { vim.languages.tex.pdfViewer = { inherit name; diff --git a/modules/plugins/languages/tex/pdfViewer/zathura.nix b/modules/plugins/languages/tex/pdfViewer/zathura.nix index 99d95498..f1fd16d5 100644 --- a/modules/plugins/languages/tex/pdfViewer/zathura.nix +++ b/modules/plugins/languages/tex/pdfViewer/zathura.nix @@ -9,8 +9,8 @@ # The viewer template template = import ./viewerTemplate.nix; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) package str listOf; + inherit (lib.options) mkOption mkEnableOption mkPackageOption; + inherit (lib.types) str listOf; in ( template { inherit name moduleInheritancePackage; @@ -18,11 +18,7 @@ in ( options = { enable = mkEnableOption "enable zathura as the pdf file previewer."; - package = mkOption { - type = package; - default = pkgs.zathura; - description = "zathura package"; - }; + package = mkPackageOption pkgs "zathura" {}; executable = mkOption { type = str; @@ -32,7 +28,11 @@ in ( args = mkOption { type = listOf str; - default = ["--synctex-forward" "%l:1:%f" "%p"]; + default = [ + "--synctex-forward" + "%l:1:%f" + "%p" + ]; description = "Arguments to pass to the viewer."; }; }; diff --git a/modules/plugins/languages/tex/treesitter.nix b/modules/plugins/languages/tex/treesitter.nix index 98185ba8..fcebaa99 100644 --- a/modules/plugins/languages/tex/treesitter.nix +++ b/modules/plugins/languages/tex/treesitter.nix @@ -4,22 +4,17 @@ lib, ... }: let - # inherit (lib.options) mkEnableOption; inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.types) mkGrammarOption mkEnableTreesitterOption; cfg = config.vim.languages.tex; - - # mkEnableTreesitterOption = description: mkEnableOption description // {default = config.vim.languages.enableTreesitter;}; in { options.vim.languages.tex.treesitter = { latex = { - # enable = mkEnableTreesitterOption "Whether to enable Latex treesitter"; enable = mkEnableTreesitterOption config "latex"; package = mkGrammarOption pkgs "latex"; }; bibtex = { - # enable = mkEnableTreesitterOption "Whether to enable Bibtex treesitter"; enable = mkEnableTreesitterOption config "bibtex"; package = mkGrammarOption pkgs "bibtex"; };