PBJ
PBJ

Reputation: 65

Vim reopen current file into read-only?

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

Answers (1)

sa77
sa77

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

Related Questions