I want to change the read only attribute from a file when I save it with :w!
in vim. How do I do it? (I don't mind if I have to call an external script).
I'm using Linux.
I know I can use an external script using this command: autocmd BufWrite /tmp/* !sh /tmp/script.sh
. So, I would like to call a chmod command when :w!
is invoked: the chmod command is going to be something like this:
autocmd BufWrite <:w! condition> !chmod u+w %
So, how do I do the ":w!" condition? Is it possible or do I need to use another structure?