Try the below command
:w !sudo tee %
Explanation
- :w – write
- !sudo – call shell sudo command
- tee – the output of write (:w) command is redirected using tee
- % – current file name
More info
Try the below command
:w !sudo tee %
Explanation
More info