Reputation: 65
I have searched through couple of places but wasn't able to find any answer. The title states it all, is there a command to close the current file and re-open it right away in read-only mode?
Upvotes: 4
Views: 199
Reputation: 3603
say your file is hello.sh
which you opened in vim with
vim hello.sh
now to close and open it in read-only, press ESC
and type
:view!
Upvotes: 6