mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 03:08:13 +00:00
feat(explorer): allow disabling untracked git status. Closes #983
This commit is contained in:
parent
f037027cad
commit
a3b083b844
3 changed files with 5 additions and 2 deletions
|
@ -30,7 +30,7 @@ function M.is_dirty(cwd)
|
|||
end
|
||||
|
||||
---@param cwd string
|
||||
---@param opts? {on_update?: fun(), ttl?: number, force?: boolean, ignored?: boolean}
|
||||
---@param opts? {on_update?: fun(), ttl?: number, force?: boolean, untracked?: boolean}
|
||||
function M.update(cwd, opts)
|
||||
opts = opts or {}
|
||||
local ttl = opts.ttl or CACHE_TTL
|
||||
|
@ -62,10 +62,10 @@ function M.update(cwd, opts)
|
|||
args = {
|
||||
"--no-pager",
|
||||
"status",
|
||||
"-unormal",
|
||||
"--porcelain=v1",
|
||||
"--ignored=matching",
|
||||
"-z",
|
||||
opts.untracked and "-unormal" or "-uno",
|
||||
},
|
||||
}, function()
|
||||
stdout:close()
|
||||
|
|
|
@ -42,6 +42,7 @@ M.buffers = {
|
|||
---@field tree? boolean show the file tree (default: true)
|
||||
---@field git_status? boolean show git status (default: true)
|
||||
---@field git_status_open? boolean show recursive git status for open directories
|
||||
---@field git_untracked? boolean needed to show untracked git status
|
||||
---@field diagnostics? boolean show diagnostics
|
||||
---@field diagnostics_open? boolean show recursive diagnostics for open directories
|
||||
---@field watch? boolean watch for file changes
|
||||
|
@ -55,6 +56,7 @@ M.explorer = {
|
|||
diagnostics_open = false,
|
||||
git_status = true,
|
||||
git_status_open = false,
|
||||
git_untracked = true,
|
||||
follow_file = true,
|
||||
focus = "list",
|
||||
auto_close = false,
|
||||
|
|
|
@ -211,6 +211,7 @@ function M.explorer(opts, ctx)
|
|||
|
||||
if opts.git_status then
|
||||
require("snacks.explorer.git").update(ctx.filter.cwd, {
|
||||
untracked = opts.git_untracked,
|
||||
on_update = function()
|
||||
if ctx.picker.closed then
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue