Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Customizable filter composition logic #3119

Open
Labels
PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedQOLQuality Of Life Improvementfeature request
@gracepetryk

Description

@gracepetryk

When using the git_clean and no_buffer filters together, I think it would be more useful to show files that are either dirty or open in a buffer. The current behavior is to only show files that are both dirty and open in a buffer.

Can this functionality be implemented utilising API?
Not currently, the filter logic is not exposed in the public API.

Describe the solution you'd like
Exposing the various filter functions to the public api in a way that they could be composed in the custom filter would be my preferred solution. Something like this would be nice:

require('nvim-tree').setup({filters= {no_buffer=false,git_clean=false,custom=function (path)localfilter_api=require('nvim-tree.api.filter')-- return true only when *both* git_clean and no_buffer would filter the path. These-- functions should not check the enabled/disabled state of the function so that the-- custom filter can have precedence while still using their result.returnfilter_api.git_clean(path)andfilter_api.no_buffer(path)end  }})

Describe alternatives you've considered
I've implemented the behavior I want in my config with a couple janky runtime patches tonvim-tree's internal filter API:

localfilters=require('nvim-tree.explorer.filters')localenum=require('nvim-tree.enum')localshould_filter=filters.should_filterlocalshould_filter_as_reason=filters.should_filter_as_reasonfilters.should_filter=function (self,path,fs_stat,status)ifself.state.no_bufferandnotself:buf(path,status.bufinfo)thenreturnfalseendifself.state.git_cleanandnotself:git(path,status.project)thenreturnfalseendreturnshould_filter(self,path,fs_stat,status)endfilters.should_filter_as_reason=function (self,path,fs_stat,status)ifnotshould_filter(self,path,fs_stat,status)thenreturnenum.FILTER_REASON.noneendreturnshould_filter_as_reason(self,path,fs_stat,status)end

Additional context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedQOLQuality Of Life Improvementfeature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp