mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-06 19:58:22 +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
|
end
|
||||||
|
|
||||||
---@param cwd string
|
---@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)
|
function M.update(cwd, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local ttl = opts.ttl or CACHE_TTL
|
local ttl = opts.ttl or CACHE_TTL
|
||||||
|
@ -62,10 +62,10 @@ function M.update(cwd, opts)
|
||||||
args = {
|
args = {
|
||||||
"--no-pager",
|
"--no-pager",
|
||||||
"status",
|
"status",
|
||||||
"-unormal",
|
|
||||||
"--porcelain=v1",
|
"--porcelain=v1",
|
||||||
"--ignored=matching",
|
"--ignored=matching",
|
||||||
"-z",
|
"-z",
|
||||||
|
opts.untracked and "-unormal" or "-uno",
|
||||||
},
|
},
|
||||||
}, function()
|
}, function()
|
||||||
stdout:close()
|
stdout:close()
|
||||||
|
|
|
@ -42,6 +42,7 @@ M.buffers = {
|
||||||
---@field tree? boolean show the file tree (default: true)
|
---@field tree? boolean show the file tree (default: true)
|
||||||
---@field git_status? boolean show git status (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_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? boolean show diagnostics
|
||||||
---@field diagnostics_open? boolean show recursive diagnostics for open directories
|
---@field diagnostics_open? boolean show recursive diagnostics for open directories
|
||||||
---@field watch? boolean watch for file changes
|
---@field watch? boolean watch for file changes
|
||||||
|
@ -55,6 +56,7 @@ M.explorer = {
|
||||||
diagnostics_open = false,
|
diagnostics_open = false,
|
||||||
git_status = true,
|
git_status = true,
|
||||||
git_status_open = false,
|
git_status_open = false,
|
||||||
|
git_untracked = true,
|
||||||
follow_file = true,
|
follow_file = true,
|
||||||
focus = "list",
|
focus = "list",
|
||||||
auto_close = false,
|
auto_close = false,
|
||||||
|
|
|
@ -211,6 +211,7 @@ function M.explorer(opts, ctx)
|
||||||
|
|
||||||
if opts.git_status then
|
if opts.git_status then
|
||||||
require("snacks.explorer.git").update(ctx.filter.cwd, {
|
require("snacks.explorer.git").update(ctx.filter.cwd, {
|
||||||
|
untracked = opts.git_untracked,
|
||||||
on_update = function()
|
on_update = function()
|
||||||
if ctx.picker.closed then
|
if ctx.picker.closed then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue