marta-file-manager / marta-issues

An issue tracker for Marta File Manager.
https://marta.yanex.org/
329 stars 0 forks source link

[Feature Request] Select all files with same extension #997

Closed cpresse closed 1 year ago

cpresse commented 1 year ago

The command "Select all files with same extension" is the only thing I'm actually missing from TC.

Thanks in advance and keep up the good work.

marvelph commented 1 year ago

I wrote a plugin.

action {
    id = "select.extension",
    name = "Select Extension",
    apply = function(context)
        local model = context.activePane.model
        local currentFile = model.currentFile
        if currentFile ~= nul then
            martax.alert(currentFile.pathExtension)
            for i = 1, model.lastIndex do
                local item = model:getItem(i)
                if item.info.pathExtension == currentFile.pathExtension then
                    model:select(i)
                end
            end
        end
    end
}
cpresse commented 1 year ago

Thanks a lot. Works like a charm and I learned how to make a plugin. And right after finishing it I found clicked on your repository, @marvelph and found the finished plugins 😉 Thanks for sharing and inspiring.