feat: add Windows where file finder command (#979)

This commit is contained in:
Luke Kershaw
2021-07-13 19:16:50 +01:00
committed by GitHub
parent 5692edd004
commit 999fad2ce5

View File

@@ -7,6 +7,7 @@ local pickers = require('telescope.pickers')
local previewers = require('telescope.previewers') local previewers = require('telescope.previewers')
local utils = require('telescope.utils') local utils = require('telescope.utils')
local conf = require('telescope.config').values local conf = require('telescope.config').values
local log = require('telescope.log')
local scan = require('plenary.scandir') local scan = require('plenary.scandir')
local Path = require('plenary.path') local Path = require('plenary.path')
@@ -173,7 +174,7 @@ files.find_files = function(opts)
table.insert(find_command, v) table.insert(find_command, v)
end end
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' } find_command = { 'find', '.', '-type', 'f' }
if not hidden then if not hidden then
table.insert(find_command, { '-not', '-path', "*/.*" }) table.insert(find_command, { '-not', '-path', "*/.*" })
@@ -186,6 +187,17 @@ files.find_files = function(opts)
table.insert(find_command, 2, v) table.insert(find_command, 2, v)
end end
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
end end