From dd94cd6d016005a836549bef55dc512d9b4f8f52 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 21 Feb 2025 08:37:51 -0600 Subject: [PATCH] plugins/markview: v25 migration --- plugins/by-name/markview/default.nix | 101 +++++++----------- .../plugins/by-name/markview/default.nix | 45 +++----- 2 files changed, 53 insertions(+), 93 deletions(-) diff --git a/plugins/by-name/markview/default.nix b/plugins/by-name/markview/default.nix index 1272b0a721..bafd4551e0 100644 --- a/plugins/by-name/markview/default.nix +++ b/plugins/by-name/markview/default.nix @@ -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" + ]; + }; }; } diff --git a/tests/test-sources/plugins/by-name/markview/default.nix b/tests/test-sources/plugins/by-name/markview/default.nix index 6209dd4fc3..91a31d66a7 100644 --- a/tests/test-sources/plugins/by-name/markview/default.nix +++ b/tests/test-sources/plugins/by-name/markview/default.nix @@ -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 = { }; }; }; };