8
2
In Vim, when I write a copy of the current buffer to a new file using :w [filename]
, it appears that Vim uses the default (i.e. set by umask or whatever) file permissions for the new file. If the current buffer was loaded from an existing file, though, shouldn't the "right" behavior be to duplicate the permissions from that file? For example, if I'm editing an executable file, and I write a new copy of the file, why doesn't Vim write a new executable? Is there any way to force Vim to behave the way I'm describing, other than just doing something like ! chmod --reference % [newfilename]
after writing the new file?
Possibly related: http://unix.stackexchange.com/q/58880/22703
– allquixotic – 2013-10-11T20:31:03.367I think the answer is already in the question -- you should make a macro or keybinding that does that
chmod
for you. AFAIK, vim does not have this built in. – Kevin Panko – 2013-10-11T21:29:47.757