I am frequently opening files that are readonly, I would like to know if there is a way to make them writable from inside Vim. I do not mean :w!, I need the file to be writeable after I close Vim.
I am frequently opening files that are readonly, I would like to know if
Share
The issue comes from the fact that after changing the file attributes Vim will detect it and will try to reload the file and you will loose what you typed.
The best seems to create a function that redefines the
autocmd FileChangedShellto do nothing when the attribute change is detected.See this example of setting file attributes without reloading a buffer where an example is given for making all files executables.
This should do the trick for you