Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/plugins/utility/preview/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
imports = [
./markdown-preview
./live-preview
./glow
];
}
18 changes: 18 additions & 0 deletions modules/plugins/utility/preview/live-preview/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;

cfg = config.vim.utility.preview.livePreview;
in {
config.vim.lazy.plugins."live-preview-nvim" = mkIf cfg.enable {
package = "live-preview-nvim";
cmd = ["LivePreview"];
after = ''
require("livepreview.config").set(${toLuaObject cfg.setupOpts})
'';
};
}
6 changes: 6 additions & 0 deletions modules/plugins/utility/preview/live-preview/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
imports = [
./live-preview.nix
./config.nix
];
}
61 changes: 61 additions & 0 deletions modules/plugins/utility/preview/live-preview/live-preview.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit
(lib.types)
bool
enum
int
str
;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.preview.livePreview = {
enable = mkEnableOption "live preview in a web browser with live-preview.nvim";

setupOpts = mkPluginSetupOption "live-preview.nvim" {
port = mkOption {
type = int;
default = 5500;
description = "Port to run the live preview server on.";
};

browser = mkOption {
type = str;
default = "default";
example = "firefox";
description = "Terminal command to open the browser for live-previewing (eg. `firefox`, `flatpak run com.vivaldi.Vivaldi`). By default, it will use the system's default browser.";
};

dynamic_root = mkOption {
type = bool;
default = false;
description = "If `true`, the root directory of the server will be the parent directory of the current file. Otherwise, it will be the current directory.";
};

sync_scroll = mkOption {
type = bool;
default = true;
description = "If `true`, the plugin will sync the scrolling in the browser as you scroll in the Markdown files in Neovim.";
};

picker = mkOption {
type = enum [
""
"telescope"
"fzf-lua"
"mini.pick"
"snacks.picker"
"vim.ui.select"
];
default = "";
description = "Picker to use for opening files. 5 choices are available: `telescope`, `fzf-lua`, `mini.pick`, `snacks.picker` or `vim.ui.select`. If `\"\"`, the plugin looks for the first available picker when you call the `pick` command.";
};

address = mkOption {
type = str;
default = "127.0.0.1";
description = "Hostname/IP-address to bind the server to. Default: `127.0.0.1`.";
};
};
};
}
13 changes: 13 additions & 0 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,19 @@
"url": "https://github.com/kawre/leetcode.nvim/archive/4e8b3683940a8377379ce9398e7f329e3560b42c.tar.gz",
"hash": "sha256-82ppJQURAJcffgWwPHjrU9hROIKgk1hVITxNTzGtY5o="
},
"live-preview-nvim": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "brianhuster",
"repo": "live-preview.nvim"
},
"branch": "main",
"submodules": false,
"revision": "a6307fa340ed7c0d96f5c567afc8c991aad94ce0",
"url": "https://github.com/brianhuster/live-preview.nvim/archive/a6307fa340ed7c0d96f5c567afc8c991aad94ce0.tar.gz",
"hash": "sha256-xyeoz4lEqrinkqY5U4Fu1S2HlmCyXiNQ2l2+AJFozIc="
},
"lsp-signature-nvim": {
"type": "Git",
"repository": {
Expand Down
Loading