diff options
Diffstat (limited to 'lua/telescope/builtin/files.lua')
| -rw-r--r-- | lua/telescope/builtin/files.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 24d02a0..23ceaa7 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -211,16 +211,16 @@ end files.file_browser = function(opts) opts = opts or {} + opts.depth = opts.depth or 1 opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd() - - local gen_new_finder = function(path) + opts.new_finder = opts.new_finder or function(path) opts.cwd = path local data = {} scan.scan_dir(path, { hidden = opts.hidden or false, add_dirs = true, - depth = 1, + depth = opts.depth, on_insert = function(entry, typ) table.insert(data, typ == 'directory' and (entry .. os_sep) or entry) end @@ -242,8 +242,8 @@ files.file_browser = function(opts) end pickers.new(opts, { - prompt_title = 'Find Files', - finder = gen_new_finder(opts.cwd), + prompt_title = 'File Browser', + finder = opts.new_finder(opts.cwd), previewer = conf.file_previewer(opts), sorter = conf.file_sorter(opts), attach_mappings = function(prompt_bufnr, map) @@ -253,7 +253,7 @@ files.file_browser = function(opts) local new_cwd = vim.fn.expand(action_state.get_selected_entry().path:sub(1, -2)) local current_picker = action_state.get_current_picker(prompt_bufnr) current_picker.cwd = new_cwd - current_picker:refresh(gen_new_finder(new_cwd), { reset_prompt = true }) + current_picker:refresh(opts.new_finder(new_cwd), { reset_prompt = true }) end) local create_new_file = function() @@ -276,7 +276,7 @@ files.file_browser = function(opts) Path:new(fpath:sub(1, -2)):mkdir({ parents = true }) local new_cwd = vim.fn.expand(fpath) current_picker.cwd = new_cwd - current_picker:refresh(gen_new_finder(new_cwd), { reset_prompt = true }) + current_picker:refresh(opts.new_finder(new_cwd), { reset_prompt = true }) end end |
