feat: add configurable file and directory creation permissions

Problem: files were always created with mode 0644 and directories
with 0755, hardcoded in fs.touch and uv.fs_mkdir. Users who need
different defaults (e.g. 0600 for security) had no config option.

Solution: add new_file_mode (default 420 = 0644) and new_dir_mode
(default 493 = 0755) config options, passed through to fs.touch and
uv.fs_mkdir in the files and mac trash adapters. The fs.touch
signature accepts an optional mode parameter with backwards
compatibility (detects function argument to support old callers).
Local cache directories (SSH, S3) continue using standard system
permissions rather than the user-configured mode.

Based on: stevearc/oil.nvim#537
This commit is contained in:
Barrett Ruth 2026-02-20 16:58:15 -05:00
parent ded17258cd
commit c6b4a7a07b
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
5 changed files with 21 additions and 6 deletions

View file

@ -122,6 +122,10 @@ CONFIG *oil-confi
return nil
end,
},
-- Permission mode for new files (default 420 = 0644)
new_file_mode = 420,
-- Permission mode for new directories (default 493 = 0755)
new_dir_mode = 493,
-- Extra arguments to pass to SCP when moving/copying files over SSH
extra_scp_args = {},
-- Extra arguments to pass to aws s3 when creating/deleting/moving/copying files using aws s3