I want to change a read-only attribute from a file when I save it with :w! in vim. How can I do it? (I do not mind if I need to call an external script).
I am using Linux.
I know that with this command I can use an external script: autocmd BufWrite /tmp/* !sh /tmp/script.sh . So, I would like to call the chmod command when calling :w! : the chmod command would be something like this:
autocmd BufWrite <:w! condition> !chmod u+w %
So how do I do this: w! state? Is it possible for me to use a different structure?
source share