superfile icon indicating copy to clipboard operation
superfile copied to clipboard

Configurable Default Code Editor for Text Files

Open sad7766 opened this issue 1 year ago • 1 comments

First, I'd like to express my appreciation for the excellent work on Superfile. It's been a valuable tool in my workflow.

However, I've encountered a persistent issue over the past few months of using Superfile. Currently, when opening text files (including code files and data files like CSV), Superfile defaults to opening them in the browser. I would greatly appreciate the ability to specify my preferred code editor in the configuration file.

This would enhance the user experience by allowing seamless integration with users' preferred development environments. I've tested this behavior on both Arch Linux with Hyprland and KDE, and the issue persists across these environments.

Implementing this feature would significantly improve the flexibility and usability of Superfile for many users who prefer working with external editors.

Thank you for considering this request.

Environment details:

  • Operating Systems tested: Arch Linux
  • Desktop Environments: Hyprland, KDE

sad7766 avatar Sep 02 '24 16:09 sad7766

It depends on the variable $EDITOR. I assume that your system has a browser installed in this variable.

Well, it would really be nice to have a mapping of extensions and programs to open. Example of configuration, as it is done in yazi.

MrPandir avatar Sep 02 '24 19:09 MrPandir

As I read other comments on #578 , it seems this is in how Superfile calls file opens. (xdg-open / open)

On MacOS, with Zed browser installed, instead of opening the CLI editor defined in my config, it opens the file using whatever has registered as the default file handler, completely ignoring what is defined in config.

Pressing 'e' when a file is highlighted does the right thing.

This small issue aside, I'd also like to share my appreciation for creating Superfile. Love this over some of the other options out there that have been the defacto for some time.

arrrgi avatar Apr 12 '25 05:04 arrrgi

I dont understand what is the problem here ? e -> Edit file using $EDITOR right arrow -> Open file with whatever is the default file editor in your system

lazysegtree avatar Apr 12 '25 06:04 lazysegtree

I think that the 'right arrow' open behavior was unexpected for me as I first started traversing directories. Having Zed open to view a TOML file didn't make any sense until I stumbled on #587 and understood what was happening.

Having some granularity to define what actions 'right arrow' can take would be a nice feature to have, so that, for example:

A config item for "right_arrow_action" might exist that could set behavior options such as:

  • default - descends into directories and opens files with the default app associated with the file extension
  • open_editor - descends into directories and opens files with whatever is configured in "editor" option, or $EDITOR
  • navigate - only descends into directories, performs no file action
  • smart_menu - descends into directories and opens a modal menu to:
    • "Open with default app"
    • "Open with editor"

arrrgi avatar Apr 12 '25 09:04 arrrgi

Okay. I get it. Its a nice idea. Have created an issue for it - https://github.com/yorukot/superfile/issues/769 Closing this issue. Will track this via that new issue.

lazysegtree avatar Apr 12 '25 12:04 lazysegtree