From 999fad2ce514d869b736aa5d948d355fad89be8d Mon Sep 17 00:00:00 2001 From: Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> Date: Tue, 13 Jul 2021 19:16:50 +0100 Subject: [PATCH] feat: add Windows `where` file finder command (#979) --- lua/telescope/builtin/files.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 29c8df5..5c36963 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -7,6 +7,7 @@ local pickers = require('telescope.pickers') local previewers = require('telescope.previewers') local utils = require('telescope.utils') local conf = require('telescope.config').values +local log = require('telescope.log') local scan = require('plenary.scandir') local Path = require('plenary.path') @@ -173,7 +174,7 @@ files.find_files = function(opts) table.insert(find_command, v) end end - elseif 1 == vim.fn.executable("find") then + elseif 1 == vim.fn.executable("find") and not vim.fn.has('win32') then find_command = { 'find', '.', '-type', 'f' } if not hidden then table.insert(find_command, { '-not', '-path', "*/.*" }) @@ -186,6 +187,17 @@ files.find_files = function(opts) table.insert(find_command, 2, v) end end + elseif 1 == vim.fn.executable("where") then + find_command = { 'where', '/r', '.', '*'} + if hidden ~= nil then + log.warn('The `hidden` key is not available for the Windows `where` command in `find_files`.') + end + if follow ~= nil then + log.warn('The `follow` key is not available for the Windows `where` command in `find_files`.') + end + if search_dirs ~= nil then + log.warn('The `search_dirs` key is not available for the Windows `where` command in `find_files`.') + end end end