Skip to content

Feature Request: Custom .filemanager-ignore support and hideassets toggle #4

Description

@DOZ-Michael

Hi,

I'm using your filemanager2 plugin and I love the improvements. However, I encountered a challenge when working in directories with problematic symlinks (e.g., disconnected network mounts or broken docker registries) or in environments where I don't have a Git repository.

Currently, the plugin relies on Git for ignoring files. In my setup, I implemented a surgical solution that adds a local ignore file support:

  1. New Option: filemanager2.hideassets (true/false) to toggle custom filtering.
  2. Custom Ignore File: A simple .filemanager-ignore file located in the plugin directory where users can list filenames or directories to hide.

Motivation

This prevents the plugin from scanning "poisonous" symlinks that can cause the editor to hang and provides a clean workspace even in non-Git environments. It makes the file tree much more stable and user-friendly for complex home directories.

Proposed Implementation Details

  1. Option Registration:

    config.RegisterCommonOption('filemanager2', 'hideassets', true)
  2. The Filter Logic:

    local function get_custom_ignore()
     local readout_results = {}
     local config_dir = config.ConfigDir
     local ignore_file_path = config_dir .. "/plug/filemanager2/.filemanager-ignore"
     local go_os = import("os")
     local _, err = go_os.Stat(ignore_file_path)
     if err == nil then
         local file = io.open(ignore_file_path, "r")
         if file then
             for line in file:lines() do
                 local pattern = line:match("^%s*(.-)%s*$")
                 if pattern ~= "" and string.sub(pattern, 1, 1) ~= "#" then
                     readout_results[#readout_results + 1] = pattern
                 end
             end
             file:close()
         end
     end
     return readout_results
    end
  3. Integration:
    Integrate get_custom_ignore() into the get_scanlist() function to filter results before they are processed.

I've already implemented this in my local version. Are you interested in a Pull Request for this feature?

Best regards,
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions