Avoid using ways like sudo vim

use :w !sudo tee % to write the file that no permission to edit

(it could use user's custom vim profile

(refer: ArchLinuxCN IRC