rtorr/vim-cheat-sheet

suggest a 'write read-only file' command

cuter44 opened this issue · 3 comments

Though not a basic command, but :w !sudo tee % is quite useful on Ubuntu.
Also some pseudo-commands are important but a hidden trick to newbie, such as 'enable line-no', 'enable syntax-highlight', 'change file type'... Maybe a new section is needed to include them.
Just depends on you. ╮(‾▽‾)╭

rtorr commented

I'm open to new suggestions, and welcome pull requests if you flush that idea out

Wouldn't :w! also write a read-only file?

@cascer1 :w! works only you are the owner of file, :w !sudo tee % always works if you are a sudoer(disregarding the ownership). As I just tested.
So these two may be used in different scenario, I think.
Anyway, thank you. You enlightened me. ("ㅍ‿ㅍ)