Skip to content

Commit

Permalink
plugins/markview: v25 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman authored and GaetanLepage committed Mar 4, 2025
1 parent 0747f55 commit 3858936
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 93 deletions.
101 changes: 39 additions & 62 deletions plugins/by-name/markview/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,78 +21,55 @@ lib.nixvim.plugins.mkNeovimPlugin {
'';

settingsOptions = {
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
Buftypes to disable markview-nvim.
'';
preview = {
enable = defaultNullOpts.mkBool true ''
Enable preview functionality.
'';

modes =
defaultNullOpts.mkListOf types.str
[
"n"
"no"
]
''
Modes where preview is enabled.
'';
enable_hybrid_mode = defaultNullOpts.mkBool true ''
Enable hybrid mode functionality.
'';

hybrid_modes = defaultNullOpts.mkListOf types.str null ''
Modes where hybrid mode is enabled.
'';
buf_ignore = defaultNullOpts.mkListOf types.str [ "nofile" ] ''
Buftypes to disable markview-nvim.
'';

callback = {
on_enable = defaultNullOpts.mkLuaFn' {
pluginDefault = # Lua
modes =
defaultNullOpts.mkListOf types.str
[
"n"
"no"
"c"
]
''
function(buf, win)
vim.wo[window].conceallevel = 2;
vim.wo[window].concealcursor = "nc";
end
Modes where preview is enabled.
'';
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.
'';
};
hybrid_modes = defaultNullOpts.mkListOf types.str null ''
Modes where hybrid mode is enabled.
'';

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.
'';
};
icon_provider = defaultNullOpts.mkEnum [ "devicons" "internal" "mini" ] "internal" ''
Provider for icons.
Available options:
- "devicons": Use nvim-web-devicons
- "internal": Use internal icons (default)
- "mini": Use mini.icons
'';
};
};

settingsExample = {
buf_ignore = [ ];
modes = [
"n"
"x"
];
hybrid_modes = [
"i"
"r"
];
preview = {
buf_ignore = [ ];
modes = [
"n"
"x"
];
hybrid_modes = [
"i"
"r"
];
};
};
}
45 changes: 14 additions & 31 deletions tests/test-sources/plugins/by-name/markview/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,20 @@
enable = true;

settings = {
buf_ignore = [ "nofile" ];
modes = [
"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
'';
preview = {
enable = true;
buf_ignore = [ ];
icon_provider = "internal";
filetypes = [ ];
hybrid_modes = [ ];
ignore_previews = [ ];
max_buf_lines = 1000;
modes = [ ];
render_distance = [
200
200
];
splitview_winopts = { };
};
};
};
Expand Down

0 comments on commit 3858936

Please sign in to comment.