superfile
superfile copied to clipboard
enhancement: Custom file previews
The part you want to Enhancement There is currently limited file preview support. One way to help everyone get what they need without forcing something on them is to make it configurable. What if you could simply specify a pattern to match and a command to run in your Superfile config to show a preview. It is a universal solution.
[previews]
"*.plist" = "ppl <filepath>" # Patterns that come first override the ones that come after.
"*" = "bat <filepath>" # <filepath> gets replaced with the full path of the file
Several other replacements could be possible, including:
<extension>File extension, if it exists<filename>Short name of the file, for/tmp/123.txt, it would be123.txt<filepath>Full path to the file
Why it is necessary to enhancement Because not being able to preview specific files then requires exiting Superfile, using another tool to preview any necessary files, then continuing on.
I agree, this is a great feature to have - since even plain text based formats such as csvs are unsupported.
@plutonium-239
csv is supported. As a metter of fact. Any random file extension is now supported. It just shouldn't have non ascii characters. This has been recently updated in main branch, and its not in the latest release 1.1.7.1 yet. It will be in the newer release.
"command to run in your Superfile config"
Running custom commands that user puts in config file, for a critical function like file preview is risky.
After the new fix, I dont think this is needed. A lot of code changes and rule to be defined around the commands what user can give. Its hard to get this feature right, without overcomplicating it, and also keeping it intuitive.
cc : @yorukot
It is not risky, programs like lazygit and fzf (which are already very well established) provide this functionality.
You can set a custom diff viewer for lazygit and set a custom file preview with fzf.
Running custom commands that user puts in config file, for a critical function like file preview is risky.
Risky how? I might misunderstand, but if you are suggesting that it causes security issues, I think you are wrong. Especially since the configurations are local.
I would love to contribute additional preview formats and views, but at a certain point reinventing the wheel becomes pointless. Especially since file previews are very opinionated in some way. Take for example a SQLite database. I would probably want a list of tables and potentially schemas of each, but someone else might want a list of recent changes. Especially when navigating around a new project, custom preview functionality would make Superfile my go to choice, rather than manually navigating directories and choosing the right tool or command to preview.
@lazysegtree
Running custom commands that user puts in config file, for a critical function like file preview is risky.
I don't think this is a security issue, I think this feature is a nice update.
I'm agree too most of text files are unsupported to preview
Another similar request
- https://github.com/yorukot/superfile/discussions/1124