Skip to content

feat: add option to skip gitignored files on git navigation #2583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lua/nvim-tree/actions/moves/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ local M = {}

---@param where string
---@param what string
---@param opts table|nil
---@return fun()
function M.fn(where, what)
function M.fn(where, what, opts)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, if we all agree, I'd do a little refactor here, having just an opts table with the where and what fields, so that we can easily add new ones if necessary.

Copy link
Member

@alex-courtis alex-courtis Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. The API could be altered to pass opts.

We would need to retain backwards compatibility as per ApiTreeToggleOpts so as not to break existing users.

If you are sufficiently motivated we could add enums for where and what :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we release 0.x.x and introduce whatever breaking changes we want for 1.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we release 0.x.x and introduce whatever breaking changes we want for 1.0.

Interesting... the highlight overhaul could also go before 1.0.0. Perhaps we might do an audit and do any "final breaks" before the big release.

return function()
local node_cur = lib.get_node_at_cursor()
local first_node_line = core.get_nodes_starting_line()
Expand All @@ -27,7 +28,8 @@ function M.fn(where, what)
local valid = false

if what == "git" then
valid = explorer_node.get_git_status(node) ~= nil
local git_status = explorer_node.get_git_status(node)
valid = git_status ~= nil and (not opts.skip_gitignored or git_status[1] ~= "!!")
elseif what == "diag" then
valid = node.diag_status ~= nil
elseif what == "opened" then
Expand Down