1

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 continue

When 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 continue

I press Enter, it returns to the previous editor mode again.

How can I quit vim in this situation?

Zanna
  • 70,465
recursivleyGreedy
  • 117
  • 2
  • 2
  • 6

1 Answers1

2

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_filename

then exit vim and replace old file with tmp_filename.

slava
  • 3,887