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,78 +21,80 @@ lib.nixvim.plugins.mkNeovimPlugin {
''; '';
settingsOptions = { settingsOptions = {
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] '' preview = {
Buftypes to disable markview-nvim. enable = defaultNullOpts.mkBool true ''
''; Enable preview functionality.
'';
modes = enable_hybrid_mode = defaultNullOpts.mkBool true ''
defaultNullOpts.mkListOf types.str Enable hybrid mode functionality.
[ '';
"n"
"no"
]
''
Modes where preview is enabled.
'';
hybrid_modes = defaultNullOpts.mkListOf types.str null '' buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
Modes where hybrid mode is enabled. Buftypes to disable markview-nvim.
''; '';
callback = { modes =
on_enable = defaultNullOpts.mkLuaFn' { defaultNullOpts.mkListOf types.str
pluginDefault = # Lua [
"n"
"no"
"c"
]
'' ''
function(buf, win) Modes where preview is enabled.
vim.wo[window].conceallevel = 2;
vim.wo[window].concealcursor = "nc";
end
''; '';
description = ''
Action to perform when markview is enabled.
'';
};
on_disable = defaultNullOpts.mkLuaFn' { hybrid_modes = defaultNullOpts.mkListOf types.str null ''
pluginDefault = # Lua Modes where hybrid mode is enabled.
'' '';
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' { icon_provider = defaultNullOpts.mkEnum [ "devicons" "internal" "mini" ] "internal" ''
pluginDefault = # Lua Provider for icons.
'' Available options:
function(buf, win, mode) - "devicons": Use nvim-web-devicons
if vim.list_contains(markview.configuration.modes, mode) then - "internal": Use internal icons (default)
vim.wo[window].conceallevel = 2; - "mini": Use mini.icons
else '';
vim.wo[window].conceallevel = 0;
end
end
'';
description = ''
Action to perform when mode is changed, while the plugin is enabled.
'';
};
}; };
}; };
settingsExample = { settingsExample = {
buf_ignore = [ ]; preview = {
modes = [ buf_ignore = [ ];
"n" modes = [
"x" "n"
]; "x"
hybrid_modes = [ ];
"i" hybrid_modes = [
"r" "i"
]; "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
'';
}; };
}; };
}; };