fix: expand/normalize paths more selectively (#2628)

This commit is contained in:
James Trew
2024-03-19 18:55:27 -04:00
committed by GitHub
parent c816406bd5
commit 3b8399c273
10 changed files with 64 additions and 24 deletions

View File

@@ -115,12 +115,12 @@ files.live_grep = function(opts)
end
local search_dirs = opts.search_dirs
local grep_open_files = opts.grep_open_files
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd()
opts.cwd = opts.cwd and utils.path_expand(opts.cwd) or vim.loop.cwd()
local filelist = get_open_filelist(grep_open_files, opts.cwd)
if search_dirs then
for i, path in ipairs(search_dirs) do
search_dirs[i] = vim.fn.expand(path)
search_dirs[i] = utils.path_expand(path)
end
end
@@ -246,7 +246,7 @@ files.grep_string = function(opts)
end
elseif opts.search_dirs then
for _, path in ipairs(opts.search_dirs) do
table.insert(args, vim.fn.expand(path))
table.insert(args, utils.path_expand(path))
end
end
@@ -299,7 +299,7 @@ files.find_files = function(opts)
if search_dirs then
for k, v in pairs(search_dirs) do
search_dirs[k] = vim.fn.expand(v)
search_dirs[k] = utils.path_expand(v)
end
end
@@ -376,7 +376,7 @@ files.find_files = function(opts)
end
if opts.cwd then
opts.cwd = vim.fn.expand(opts.cwd)
opts.cwd = utils.path_expand(opts.cwd)
end
opts.entry_maker = opts.entry_maker or make_entry.gen_from_file(opts)
@@ -466,7 +466,7 @@ end
files.current_buffer_fuzzy_find = function(opts)
-- All actions are on the current buffer
local filename = vim.fn.expand(vim.api.nvim_buf_get_name(opts.bufnr))
local filename = vim.api.nvim_buf_get_name(opts.bufnr)
local filetype = vim.api.nvim_buf_get_option(opts.bufnr, "filetype")
local lines = vim.api.nvim_buf_get_lines(opts.bufnr, 0, -1, false)

View File

@@ -459,7 +459,7 @@ end
local set_opts_cwd = function(opts)
opts.use_git_root = vim.F.if_nil(opts.use_git_root, true)
if opts.cwd then
opts.cwd = vim.fn.expand(opts.cwd)
opts.cwd = utils.path_expand(opts.cwd)
elseif opts.use_file_path then
opts.cwd = current_path_toplevel()
if not opts.cwd then