Skip to content

Allow editing a directory from the files view - #6057

Draft
EliasA5 wants to merge 2 commits into
jesseduffield:masterfrom
EliasA5:allow-edit-in-dir
Draft

EliasA5 wants to merge 2 commits into
jesseduffield:masterfrom
EliasA5:allow-edit-in-dir

Conversation

@EliasA5

@EliasA5 EliasA5 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Description

Hi, when im editing files in some editor, sometimes I want to open the directory of where some changed file exists, I usually open the file then go to directory view in my editor, this isn't the best user experience if the file is large as it takes time to load it or it is a binary file, when we try to edit the directory directly we get an error that we cannot edit a directory, but that is not the case for most editors

this commit removes the check that blocks hitting 'e' in files tab to edit a directory, and adds a call to edit the selected directories according to the config of editPreset.
It was tested on the following presets:

  • vi
  • vim
  • nvim
  • nvim-remote
  • lvim
  • emacs
  • micro - gives an error that the opened file is a directory
  • nano - gives an error that the opened file is a directory
  • kakoune
  • helix
  • helix (hx)
  • vscode - but causes vscode to open a new instance
  • sublime
  • bbedit
  • xcode
  • zed
  • acme

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Signed-off-by: Elias Assaf <elyas51000@gmail.com>
@EliasA5

EliasA5 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

I will continue checking if it works with the editors defined in editPreset.

please give feedback if something like this is desired to continue with the MR and adding tests etc

@stefanhaller

Copy link
Copy Markdown
Collaborator

please give feedback if something like this is desired to continue with the MR and adding tests etc

No, I don't take PRs here any more, see CONTRIBUTING.md.

I like the idea though, and can put it on my todo list. I suspect this needs a bit more work than the changes you made here. I'll look into this when time allows, but it will probably not be soon.

In the meantime, a good enough workaround could be a custom command; the only downside is that it would have a different keybinding. E is free in the Files panel.

@EliasA5

EliasA5 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

please give feedback if something like this is desired to continue with the MR and adding tests etc

No, I don't take PRs here any more, see CONTRIBUTING.md.

I like the idea though, and can put it on my todo list. I suspect this needs a bit more work than the changes you made here. I'll look into this when time allows, but it will probably not be soon.

In the meantime, a good enough workaround could be a custom command; the only downside is that it would have a different keybinding. E is free in the Files panel.

Np, just looked at CONTRIBUTING.md after publishing the MR, opened an issue that references the draft PR.

from testing more editors it seems that not all of them support this, like nano and micro, and other like vscode have "undesired" behavior of opening a new editor instance, so I agree it will take more thought to implement this correctly.

Will try the custom keybind approach, thanks for the suggestion

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants