mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 07:25:30 +00:00
Refactored pdfViewer and fixed infrec error
This commit is contained in:
parent
8384e388c2
commit
664b27cb2c
12 changed files with 194 additions and 430 deletions
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
# The attribute set of pdf viewers in this configuration.
|
||||
pdfViewers = config.vim.languages.tex.pdfViewer;
|
||||
|
||||
# The list of pdf viewers in this configuration.
|
||||
pdfViewersList = builtins.attrValues pdfViewers;
|
||||
|
||||
# The list of enabled pdf viewers.
|
||||
enabledPdfViewersList = builtins.filter (x: x.enable) pdfViewersList;
|
||||
|
||||
# The number of enabled pdf viewers.
|
||||
enabledPdfViewersCount = lib.lists.count (x: x.enable) pdfViewersList;
|
||||
in
|
||||
if (enabledPdfViewersCount == 0)
|
||||
# Use the fallback if no pdf viewer was enabled.
|
||||
then pdfViewers.fallback
|
||||
# Otherwise get the first enabled viewer.
|
||||
else builtins.head enabledPdfViewersList
|
||||
Loading…
Add table
Add a link
Reference in a new issue