From fa4d663c8c75dd082a1cd320090bb2f73846ae24 Mon Sep 17 00:00:00 2001 From: James Trew <66286082+jamestrew@users.noreply.github.com> Date: Mon, 25 Dec 2023 11:45:01 -0500 Subject: [PATCH] docs(git_status): add missing opt `expand_dir` (#2824) * docs(git_status): add missing opt `expand_dir` * [docgen] Update doc/telescope.txt skip-checks: true --------- Co-authored-by: Github Actions --- doc/telescope.txt | 54 ++++++++++++++++++--------------- lua/telescope/builtin/__git.lua | 9 +++--- lua/telescope/builtin/init.lua | 1 + 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/doc/telescope.txt b/doc/telescope.txt index dd35ada..adcbb8a 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -1148,6 +1148,8 @@ builtin.git_status({opts}) *telescope.builtin.git_status()* {git_icons} (table) string -> string. Matches name with icon (see source code, make_entry.lua git_icon_defaults) + {expand_dir} (boolean) pass flag `-uall` to show files in + untracked directories (default: true) builtin.git_stash({opts}) *telescope.builtin.git_stash()* @@ -1394,27 +1396,32 @@ builtin.buffers({opts}) *telescope.builtin.buffers()* {opts} (table) options to pass to the picker Options: ~ - {cwd} (string) specify a working directory to - filter buffers list by - {show_all_buffers} (boolean) if true, show all buffers, - including unloaded buffers - (default: true) - {ignore_current_buffer} (boolean) if true, don't show the current - buffer in the list (default: false) - {only_cwd} (boolean) if true, only show buffers in the - current working directory (default: - false) - {cwd_only} (boolean) alias for only_cwd - {sort_lastused} (boolean) Sorts current and last buffer to - the top and selects the lastused - (default: false) - {sort_mru} (boolean) Sorts all buffers after most recent - used. Not just the current and last - one (default: false) - {bufnr_width} (number) Defines the width of the buffer - numbers in front of the filenames - (default: dynamic) - {file_encoding} (string) file encoding for the previewer + {cwd} (string) specify a working directory to + filter buffers list by + {show_all_buffers} (boolean) if true, show all buffers, + including unloaded buffers + (default: true) + {ignore_current_buffer} (boolean) if true, don't show the current + buffer in the list (default: + false) + {only_cwd} (boolean) if true, only show buffers in the + current working directory + (default: false) + {cwd_only} (boolean) alias for only_cwd + {sort_lastused} (boolean) Sorts current and last buffer to + the top and selects the lastused + (default: false) + {sort_mru} (boolean) Sorts all buffers after most + recent used. Not just the current + and last one (default: false) + {bufnr_width} (number) Defines the width of the buffer + numbers in front of the filenames + (default: dynamic) + {file_encoding} (string) file encoding for the previewer + {sort_buffers} (function) sort fn(bufnr_a, bufnr_b). true if + bufnr_a should go first. Runs + after sorting by most recent (if + specified) builtin.colorscheme({opts}) *telescope.builtin.colorscheme()* @@ -3311,9 +3318,8 @@ actions.to_fuzzy_refine({prompt_bufnr}) *telescope.actions.to_fuzzy_refine()* {prompt_bufnr} (number) The prompt bufnr -actions.delete_mark({prompt_bufnr}) *telescope.actions.delete_mark()* - Delete the selected mark or all the marks selected using multi - selection. +actions.delete_mark({prompt_bufnr}) *telescope.actions.delete_mark()* + Delete the selected mark or all the marks selected using multi selection. Parameters: ~ diff --git a/lua/telescope/builtin/__git.lua b/lua/telescope/builtin/__git.lua index 6418c16..8c38383 100644 --- a/lua/telescope/builtin/__git.lua +++ b/lua/telescope/builtin/__git.lua @@ -365,12 +365,13 @@ git.status = function(opts) return end + local args = { "status", "--porcelain=v1", "--", "." } + local gen_new_finder = function() - local expand_dir = vim.F.if_nil(opts.expand_dir, true) - local git_cmd = git_command({ "status", "--porcelain=v1", "--", "." }, opts) - if expand_dir then - table.insert(git_cmd, #git_cmd - 1, "-u") + if vim.F.if_nil(opts.expand_dir, true) then + table.insert(args, #args - 1, "-uall") end + local git_cmd = git_command(args, opts) opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_status(opts)) return finders.new_oneshot_job(git_cmd, opts) end diff --git a/lua/telescope/builtin/init.lua b/lua/telescope/builtin/init.lua index 4af5201..24087c1 100644 --- a/lua/telescope/builtin/init.lua +++ b/lua/telescope/builtin/init.lua @@ -216,6 +216,7 @@ builtin.git_branches = require_on_exported_call("telescope.builtin.__git").branc ---@field use_file_path boolean: if we should use the current buffer git root (default: false) ---@field use_git_root boolean: if we should use git root as cwd or the cwd (important for submodule) (default: true) ---@field git_icons table: string -> string. Matches name with icon (see source code, make_entry.lua git_icon_defaults) +---@field expand_dir boolean: pass flag `-uall` to show files in untracked directories (default: true) builtin.git_status = require_on_exported_call("telescope.builtin.__git").status --- Lists stash items in current repository