plugins/markview: v25 migration

Co-Authored-By: Matt Sturgeon <matt@sturgeon.me.uk>
This commit is contained in:
Austin Horstman 2025-02-21 08:37:51 -06:00 committed by Gaétan Lepage
parent ade9e131cd
commit 3feb4b4b4b
2 changed files with 78 additions and 93 deletions

View file

@ -21,6 +21,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
''; '';
settingsOptions = { settingsOptions = {
preview = {
enable = defaultNullOpts.mkBool true ''
Enable preview functionality.
'';
enable_hybrid_mode = defaultNullOpts.mkBool true ''
Enable hybrid mode functionality.
'';
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] '' buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
Buftypes to disable markview-nvim. Buftypes to disable markview-nvim.
''; '';
@ -30,6 +39,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
[ [
"n" "n"
"no" "no"
"c"
] ]
'' ''
Modes where preview is enabled. Modes where preview is enabled.
@ -39,52 +49,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
Modes where hybrid mode is enabled. Modes where hybrid mode is enabled.
''; '';
callback = { icon_provider = defaultNullOpts.mkEnum [ "devicons" "internal" "mini" ] "internal" ''
on_enable = defaultNullOpts.mkLuaFn' { Provider for icons.
pluginDefault = # Lua Available options:
'' - "devicons": Use nvim-web-devicons
function(buf, win) - "internal": Use internal icons (default)
vim.wo[window].conceallevel = 2; - "mini": Use mini.icons
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 = { settingsExample = {
preview = {
buf_ignore = [ ]; buf_ignore = [ ];
modes = [ modes = [
"n" "n"
@ -95,4 +71,30 @@ lib.nixvim.plugins.mkNeovimPlugin {
"r" "r"
]; ];
}; };
};
extraConfig = cfg: {
# v25 migration warning added 2025-03-04
warnings = lib.nixvim.mkWarnings "plugins.markview" (
lib.map
(name: {
when = cfg.settings ? ${name};
message = ''
v25 had a complete spec redesign. `${name}` had been moved to `preview.${
if name == "callback" then "callbacks" else name
}`.
See https://github.com/OXY2DEV/markview.nvim/blob/v25.0.0/doc/migration.txt#L155
'';
})
[
"buf_ignore"
"callback"
"callbacks"
"debounce"
"filetypes"
"hybrid_modes"
"modes"
]
);
};
} }

View file

@ -8,37 +8,20 @@
enable = true; enable = true;
settings = { settings = {
buf_ignore = [ "nofile" ]; preview = {
modes = [ enable = true;
"n" buf_ignore = [ ];
"no" icon_provider = "internal";
]; filetypes = [ ];
hybrid_modes = [ ]; hybrid_modes = [ ];
callback = { ignore_previews = [ ];
on_enable = # Lua max_buf_lines = 1000;
'' modes = [ ];
function(buf, win) render_distance = [
vim.wo[window].conceallevel = 2; 200
vim.wo[window].concealcursor = "nc"; 200
end ];
''; splitview_winopts = { };
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
'';
}; };
}; };
}; };