From 255a86c6ec414e6f92efe4404dba0ee11cb28bd1 Mon Sep 17 00:00:00 2001 From: unc0 Date: Wed, 12 Jan 2022 17:57:46 +0800 Subject: [PATCH] Make plugins detection acting correctly on Windows `vim.api.nvim_*` return path with `\\` on Windows, so those patterns should be changed. --- lua/cheatsheet/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/cheatsheet/init.lua b/lua/cheatsheet/init.lua index b4a3232..54e58bd 100644 --- a/lua/cheatsheet/init.lua +++ b/lua/cheatsheet/init.lua @@ -20,16 +20,16 @@ M.get_cheatsheet_files = function(opts) if opts.include_only_installed_plugins then local rtp_dirs = {} for _, dir in pairs(vim.api.nvim_list_runtime_paths()) do - table.insert(rtp_dirs, dir:match(".+/(.+)")) + table.insert(rtp_dirs, dir:match(".+[\\/](.+)$")) end plugin_include = { enabled = rtp_dirs } else plugin_include = true end - local cheatsheet_name_pat = '.+/cheatsheets/cheatsheet%-(.+)%.txt' + local cheatsheet_name_pat = '.+[\\/]cheatsheets[\\/]cheatsheet%-(.+)%.txt' local cheatsheet_plugin_name_pat = - '.+/cheatsheets/plugins/cheatsheet%-(.+)%.txt' + '.+[\\/]cheatsheets[\\/]plugins[\\/]cheatsheet%-(.+)%.txt' local bundled_plugins = {} filter_insert(