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
Feature request: File actions #79
Comments
There are reasons we don't support destructive/risky operations like deletion.
what's the alternative you propose? There is no clipboard over SSH without X forwarding. And piping to scripts is risky which is why Also, the tagline says it all -
I think you are ignoring the complexity |
Precisely because clipboard is not really an option for SSH, I proposed that a different approach would need to be taken to support actions such as delete. I understand the rationale to be careful with desctructive/risky actions, which is why I mentioned that custom scripts would allow confirmations for such actions. However, I think you support rename with C-r, which I accidentally did do; I would consider this also as risky. Since flat out adding deleting could be dangerous and more limited anyway, I tried to describe an approach which is very close to what you are doing anyway with your scripts directory. Maybe my describtion was too vage and not very good. I did not say that I only created this issue as a feature request, not a pull request. If you do not like the idea at all, you can close this issue. I think the idea is good, because if you reread the discussions in Hacker News comparing I also would not want to create a PR that might get rejected anyway if the idea is not well received. And I while I did like |
Rename and delete are different. You do not lose data with rename. I do not want to support delete within Closing the defect. |
You can absolutely lose data with rename if you rename over an existing file.
… On Feb 12, 2018, at 12:52 PM, Arun Prakash Jana ***@***.***> wrote:
Rename and delete are different. You do not lose data with rename.
I do not want to support delete within nnn and I haven't come around a way to do anything about the SSH scenario without using scripts which is insecure.
Closing the defect.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#79 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADzesimfA6Sl_14J6qDOH-5fzETKhbzRks5tUHp2gaJpZM4SCP8G>.
|
You don't lose the file contents from renaming, but you loose the filename, which is also information. It can be very long and if you do not know the previous name it is lost. If you have scripts with include/exclude patterns, it can get deleted. And renames can have other disastrous results. It is a modification, just like deletion. Just to clarify, I did not specifically ask for "file deletion" and a solution just for SSH. I proposed that you could add a line to file to perform custom actions. For example:
This could mean that by pressing C-x on a selection, the selection would be send to a script. And in this script, I could provide my own action, for example I could ask for a yes/no confirmation. This solution is possible to use with SSH. And it is much easier to delete files with it, one could delete files just as in ncdu. And it should not be insecure. Since there is not default delete action in any way, |
Did you try this with |
I am adding this to the ToDo list. When I requested you to add a PR that was because I am short on bandwidth myself. |
I just tried the rename/overwrite thing, it's nice, I had another idea how one could add custom commmands: You now have a script directory for some parts that can be customized. You could use directories for keys and put scripts there. Then you would not need a config file. For example, you could do The only problem would be how to handle default keybindings and if you want to allow users to rebind them. That is something you have to think about. When I read the documentation about the keys, I just thought that I might change or even remove some (like ctrl+r for rename ;-) ). But I do not offer a solution for this. I also really like the tool as a way to change directories, it is faster than mc for this. If this tool makes its way into distros and can be installed via package managers, it might become quite popular. Ranger is also packaged now, but this tool seems to have a much different use case. |
As I mentioned earlier, I would like to see PRs. I am short on bandwidth.
I believe you haven't even read the README. |
I missed adding some other aspects for supporting deletion inherently within If there are thousands of files, the operation will block till completion. |
@kevin-stuart I took some time to work out a solution and here's what we have: https://github.com/jarun/nnn#copy-file-paths-when-x-is-missing This should be fine for all use cases where selected file names are required. |
And the latest release adds vidir integration so you can batch copy, move, delete easily even when there's no X. |
There might be one drawback to the current solution: If there is only a single file nnncp, this could cause problems with concurrent usage. For example, if you have two terminals open, use tmux, or if two users are using nnn. A solution could be to allow to supply an environment variable like you do for I would probably advise to use a default that maps the user as well, maybe the user's $XDG_CACHE_HOME? This would also be safer since only the user may be able to read this file (depending on the setup). |
Either that or we can have a tmp file generated per session and remember it. I would prefer tmp in any case. |
Custom script support in added at commit 2396b94. |
For actions such as file deletion, you say that you one should use the clipboard. However, this does not work well when you SSH to a machine. While you state that the tool is intended to be used in a DE, it could be very useful in pure shell environment if you consider adding an alternative workflow. It was also mentioned on Hacker News that the deletion workflow is very common.
Maybe you should consider adding a tiny bit of complexity to allow more customizations. You already have system in place with the scripts directory. Maybe you should consider adding a bit of complexity; for example, the default keybindins might not suit all users. If you add some kind of configuration file for keybindings, one could map actions of keys such as "x" to a file deletion script, maybe it even asks for confirmation with readline or something. This still seems to be reasonably simple to me and is just a suggestion to add some flexibility.
Nothing is suits everyone, but nnn would seem to be reasonable alternative to mc/ranger/fzf if one could adapt it a bit more to specific needs. This is just a suggestion, but I mainly wanted to express that the clipboard workflow is not very useable in all scenarios such as when using SSH. Then one would need to use different tools.
The text was updated successfully, but these errors were encountered: