mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/markview: init
This commit is contained in:
parent
f13bdef0bc
commit
d9055abe20
3 changed files with 150 additions and 0 deletions
|
@ -72,6 +72,7 @@
|
|||
./languages/ltex-extra.nix
|
||||
./languages/markdown/glow.nix
|
||||
./languages/markdown/markdown-preview.nix
|
||||
./languages/markdown/markview.nix
|
||||
./languages/markdown/preview.nix
|
||||
./languages/nix.nix
|
||||
./languages/nvim-jdtls.nix
|
||||
|
|
103
plugins/languages/markdown/markview.nix
Normal file
103
plugins/languages/markdown/markview.nix
Normal file
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
inherit (lib) types;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "markview";
|
||||
originalName = "markview.nvim";
|
||||
defaultPackage = pkgs.vimPlugins.markview-nvim;
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
description = ''
|
||||
An experimental markdown previewer for Neovim.
|
||||
|
||||
Supports a vast amount of rendering customization.
|
||||
Please refer to the plugin's [documentation](https://github.com/OXY2DEV/markview.nvim/wiki/Configuration-options) for more details.
|
||||
'';
|
||||
|
||||
# TODO: remove when https://github.com/NixOS/nixpkgs/pull/333587 is available
|
||||
extraPlugins = with pkgs.vimPlugins; [ nvim-web-devicons ];
|
||||
|
||||
settingsOptions = {
|
||||
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
|
||||
Buftypes to disable markview-nvim.
|
||||
'';
|
||||
|
||||
mode =
|
||||
defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"n"
|
||||
"no"
|
||||
]
|
||||
''
|
||||
Modes where preview is enabled.
|
||||
'';
|
||||
|
||||
hybrid_modes = defaultNullOpts.mkListOf types.str null ''
|
||||
Modes where hybrid mode is enabled.
|
||||
'';
|
||||
|
||||
callback = {
|
||||
on_enable = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 2;
|
||||
vim.wo[window].concealcursor = "nc";
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when markview is enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
on_disable = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 0;
|
||||
vim.wo[window].concealcursor = "";
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when markview is disabled.
|
||||
'';
|
||||
};
|
||||
|
||||
on_mode_change = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = # Lua
|
||||
''
|
||||
function(buf, win, mode)
|
||||
if vim.list_contains(markview.configuration.modes, mode) then
|
||||
vim.wo[window].conceallevel = 2;
|
||||
else
|
||||
vim.wo[window].conceallevel = 0;
|
||||
end
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Action to perform when mode is changed, while the plugin is enabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
buf_ignore = [ ];
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
hybrid_modes = [
|
||||
"i"
|
||||
"r"
|
||||
];
|
||||
};
|
||||
}
|
46
tests/test-sources/plugins/languages/markdown/markview.nix
Normal file
46
tests/test-sources/plugins/languages/markdown/markview.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
_: {
|
||||
empty = {
|
||||
plugins.markview.enable = true;
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins.markview = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
buf_ignore = [ "nofile" ];
|
||||
mode = [
|
||||
"n"
|
||||
"no"
|
||||
];
|
||||
hybrid_modes = [ ];
|
||||
callback = {
|
||||
on_enable = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 2;
|
||||
vim.wo[window].concealcursor = "nc";
|
||||
end
|
||||
'';
|
||||
on_disable = # Lua
|
||||
''
|
||||
function(buf, win)
|
||||
vim.wo[window].conceallevel = 0;
|
||||
vim.wo[window].concealcursor = "";
|
||||
end
|
||||
'';
|
||||
on_mode_change = # Lua
|
||||
''
|
||||
function(buf, win, mode)
|
||||
if vim.list_contains(markview.configuration.modes, mode) then
|
||||
vim.wo[window].conceallevel = 2;
|
||||
else
|
||||
vim.wo[window].conceallevel = 0;
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue