neo-tree.nvim icon indicating copy to clipboard operation
neo-tree.nvim copied to clipboard

Is a PR for file permissions welcome

Open ludicast opened this issue 3 years ago • 6 comments

Liking this plugin a lot.

I live in the world of bash and many of the files I make have very specific permission requirements. I was wondering if it would be a reasonable PR if I build a permission modification popup (similar to the rename).

Admittedly this leave non-WSL windows folks out, but maybe that can be incorporated too.

ludicast avatar Jul 21 '22 10:07 ludicast

Sure. Would you just be prompting for a numerical code?

I don't think the command would be mapped by default, and there should be a helpful message if a windows user tries to use it.

cseickel avatar Jul 21 '22 11:07 cseickel

cool, yeah, that's sort of how I envisioned it.

the "mvp" would allow the numerical code for power users (can't see somebody using neo-tree in neovim on a *nix cli, and not knowing how file perms work :))

ludicast avatar Jul 22 '22 09:07 ludicast

@ludicast , I would highly recommend considering using vim.loop.fs_chmod. This (I believe) is cross platform compatible, thus not leaving windows users out, AND is provided by neovim in the standard library. However you present the chmod interface, as long as you use the above function, you should be able to safely target all platforms neovim is stable and tested against

miversen33 avatar Jul 22 '22 11:07 miversen33

As I usually use terminal buffer inside neovim, I would prefer doing this kind of job from the terminal buffer(or even doing it outside neovim). Why? That's because this kind of command can be dangerous(changing permission will mean those files can now be deleted by any mis-submitted command and/or logical error from any plugin implementor), so keeping the terminal command history is necessary for me. I can easily retrieve this information if this is done in terminal(-buffer). End of opinion.

So, it would be good if you could provide a way to revert what has been done in the last couple of permission-change actions. Or maybe storing a log file somewhere so the user can know how to revert when some mistyping happens.

nyngwang avatar Sep 28 '22 17:09 nyngwang

Logs are always great, but if you don't trust something to do the thing you told it to do, then don't use the thing?

miversen33 avatar Sep 28 '22 17:09 miversen33

[...] but if you don't trust something to do the thing you told it to do, then don't use the thing?

@miversen33 Yes, that is exactly what I want to express ;) But since we cannot avoid accidents, what I'm trying express is that if the backup/rollback mechnism can be designed so that things can be undo/recovered, I will try it even if I know I might make a typo in the future.

nyngwang avatar Sep 28 '22 17:09 nyngwang