To do this without leaving vi, you type:
Using vi, you want to save changes to the file my file with :w!, but vi complains it cannot write to the file. Therefore, you want to check the write permissions on the file. To do this without leaving vi, you type: