hillaryychan / ulauncher-fzf

Find files and directories in Ulauncher using fzf (and fd)
https://ext.ulauncher.io/-/github-hillaryychan-ulauncher-fzf
MIT License
53 stars 8 forks source link

Replace display path based on regex. #37

Closed slowsage closed 1 year ago

slowsage commented 1 year ago

When searching from a directory, the full path is shown which is often redundant (and takes up space). This PR lets you do a regex substitution on the displayed path.

hillaryychan commented 1 year ago

Thanks for raising a contribution.

Unfortunately, I don't think a regex substitution is the best solution to shortening the displayed path name to only contain relevant information. Personally I am not a big fan of using regex to configure things and would avoid using it anywhere unless I have to.

I'm also not sure what's the point of the match_replacement if we want to stop the displayed path name from containing less redundant information and taking up space if we're going to replace the match pattern with another prefix.

I believe the best way we can handle your problem would be to add a setting that lets us trim duplicate paths in a list of results. Python already has something for this - commonpath or commonprefix. If you're happy with this suggestion, I can raise a PR for that.