From 6de8d790359cadcf355314ef4707253c86c63fa6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 7 Jul 2024 23:36:36 -0700 Subject: [PATCH 1/2] Fix #293 The where command seems to work differently on Windows. For a simple directory listing, we can just use cmd to run dir --- lua/auto-session/session-lens/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/auto-session/session-lens/init.lua b/lua/auto-session/session-lens/init.lua index f2aebc2..b42183d 100644 --- a/lua/auto-session/session-lens/init.lua +++ b/lua/auto-session/session-lens/init.lua @@ -111,8 +111,11 @@ SessionLens.search_session = function(custom_opts) return { "fdfind", "--type", "f", "--color", "never" } elseif 1 == vim.fn.executable "find" and vim.fn.has "win32" == 0 then return { "find", ".", "-type", "f" } - elseif 1 == vim.fn.executable "where" then + elseif 1 == vim.fn.executable "where" and vim.fn.has "win32" == 0 then + logger.info('where') return { "where", "/r", ".", "*" } + elseif 1 == vim.fn.executable "cmd" and vim.fn.has "win32" == 1 then + return { "cmd", "/C", "dir", "/b" } end end)() From 6b12b3f83d7b175f140564b075a906d89f0beca6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 8 Jul 2024 00:45:06 -0700 Subject: [PATCH 2/2] Better to remove where from session lens entirely I was wrong, it has to be a windows command given the param format but it returns full paths rather than filenames so removing it. --- lua/auto-session/session-lens/init.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/lua/auto-session/session-lens/init.lua b/lua/auto-session/session-lens/init.lua index b42183d..3ee75b2 100644 --- a/lua/auto-session/session-lens/init.lua +++ b/lua/auto-session/session-lens/init.lua @@ -111,9 +111,6 @@ SessionLens.search_session = function(custom_opts) return { "fdfind", "--type", "f", "--color", "never" } elseif 1 == vim.fn.executable "find" and vim.fn.has "win32" == 0 then return { "find", ".", "-type", "f" } - elseif 1 == vim.fn.executable "where" and vim.fn.has "win32" == 0 then - logger.info('where') - return { "where", "/r", ".", "*" } elseif 1 == vim.fn.executable "cmd" and vim.fn.has "win32" == 1 then return { "cmd", "/C", "dir", "/b" } end