leny / atom-tree-ignore

Use a .atomignore file to hide files & folder in tree view
MIT License
41 stars 13 forks source link

Add option to bind treeview toggle to Atom's hide vcs ignored files. #27

Closed nikolowry closed 5 years ago

nikolowry commented 8 years ago

Would love to see an option to bind .atomignore files toggling with Atom's hide vcs ignored files toggle.

The following is my personal Atom init script, if you are open to implementing this feature I can convert it from CoffeeScript and make a pull request.

# Your init script

do ->
    toggleAtomIgnore = (val) ->
        setTimeout ((e) ->
            cmdEvt = if val.newValue == true then 'enable' else 'disable'
            atom.views
                .getView(atom.workspace)
                .dispatchEvent(new CustomEvent(
                    'tree-ignore:' + cmdEvt,
                    bubbles: true,
                    cancelable: true
                ))
        ), 1
        return

    #Listen for Changes
    atom.config
        .onDidChange 'tree-view.hideVcsIgnoredFiles', toggleAtomIgnore

    #On Start
    toggleAtomIgnore({
        oldValue: null,
        newValue: atom.config.get 'tree-view.hideVcsIgnoredFiles'
    })
    return