Default permissions when creating new file #708
-
Hi I would like to know if there is any way to change the default permissions of newly created files in neo-tree. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Unfortunately the permissions are hard-coded here. But you can write a (This implementation does not handle permissions of parent directories created together (if any) tho. Feel free to customize it if you need.) *Tested only on Linux... event_handlers = {
{
event = "file_added",
handler = function (destination)
local uv = vim.loop
local file_info = uv.fs_stat(destination)
if not file_info then
return
elseif file_info.type == "file" then
uv.fs_chmod(destination, 436) -- (436 base 10) == (664 base 8)
elseif file_info.type == "directory" then
uv.fs_chmod(destination, 609) -- 644 does not work for directories I guess?
end
end,
}
} |
Beta Was this translation helpful? Give feedback.
Unfortunately the permissions are hard-coded here.
But you can write a
file_added
handler to overwrite the permission right after the files / directories are created. Something like this should work.(This implementation does not handle permissions of parent directories created together (if any) tho. Feel free to customize it if you need.)
*Tested only on Linux...