I tried to quit vim
"/etc/sysconfig/network-scripts"
"/etc/sysconfig/network-scripts" E212: Can't open file for writing
Press ENTER or type command to continueWhen I press Enter, it returns to edit mode. I tried
!q
Press ENTER or type command to continue
[No write since last change]
/bin/bash: q: command not found
shell returned 127
Press ENTER or type command to continueI press Enter, it returns to the previous editor mode again.
How can I quit vim in this situation?
11 Answer
If you want save changes :wq!, but if something wrong and you want quit anyway (ignore changes) - :q!
Often you can start edit file with no permissions to save it. You can make many changes and then understood, you can't save it. In this case i recommend save as it:
:w tmp_filenamethen exit vim and replace old file with tmp_filename.