-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close buffer and delete underlying file #4592
Comments
I'm not sure I like the idea of being able to really easily rm a file from Helix (and closing the buffer means that there's no way to recover it using Helix), especially since it would be a command that could potentially be accidentally autocompleted; if we were to add this, I'd want it to utilize the system's "trash" mechanism, rather than rm-ing the file. |
I strongly agree that this implementation should be aware of system specific trash mechanism. Any ideas around that, does linux have a general trash mechanism or is it distro specific? I know for Windows and MacOs there are unified trash directories. I will try to research this for linux. |
Looks like the answer was quiet simple to find there exists a The FreeDesktop.org Trash specification which stated by https://github.com/Byron/trash-rs/blob/fcf6bb5eded49de4fedb40513c949f11c6da0b12/src/freedesktop.rs#L1-L7 is implemented by all common distros and DE. I'm not aware about the dependency guidelines for this repo. Would it be okay to add the dependency on something like Byron/trash-rs (https://crates.io/crates/trash) or should this be implemented within the project itself? |
That would be a feasible solution for me, too. I can unterstand the desire to keep file-management out from the editor. Command substitutions would be really nice. Maybe it's worth contributing to #3134.Feel free to close this issue as not relevant within the core. I think #4393 should be getting the same information about command substitutions being a better option instead ab baking in file-management as it's quiet similar to this issue. |
The two PRs mentioned by QiBaobin have been closed. As far as I can tell, their replacements are: I strongly believe that this should be part of helix core. While I agree that file management might be out of the scope of an editor, it is required to manage a code bases efficiently just like creating new files, moving them and locating them. I would like to implement it similar to the I would prevent accidental deletion, but I have come up with a good solution for that yet. This config kind of works [keys.normal.space]
del = [":move ~/trash", ":buffer-close"] # move! on #11093 However, I can't advise anyone else use this because it tells the LSP to change all imports (rust-analyzer ignores that though if the destination is outside the src directory). |
Surely, while working on a project, you create, rename, and delete files. How am I expected to do this right now? (Serious question.) |
I use I feel there's a lot of parallels here to the discussions about an integrated terminal, and figuring out at what point we should be building these things into the editor, or leaving that for a dedicated tool (or for someone to go implement it in the plugin system themselves). Personally, I like how simple Helix is, it makes it easy to use and contribute to (and likely easier to maintain). |
I usually do so from either another terminal tab or from |
Thanks for your answers. I also use yazi and coreutils for file management quite often. However, in Helix, this feels cumbersome because I have to manually navigate to the file again in yazi to delete it (and then also manually close the buffer afterwards, but this is less important). Similarly, with |
you can already do |
Thank you, this is much better already. Is this documented somewhere? Also, is it possible to use this inside of a key mapping? |
I redact my previous statements. If you use register insertion, deleting files is fairly reasonable. There is no way you could do it by accident, and it doesn't take much longer than typing out a dedicated command. To answer kabouzeid on whether it is documented:
So it can be inferred; however, it might be nice to have it explicitly mentioned somewhere... |
I would like to have an option to delete files from within helix itself. AFAIK there is only the option to use the shell command to rm a file.
Lets assume I've a file called
hello.world
and I want to delete it. I imagine something like the following to delete the current open file and close the buffer.:delete
Would this something be considered worth adding into helix?
The text was updated successfully, but these errors were encountered: