“!q” and “wq!” failed to quit vim [duplicate]












0















This question already has an answer here:




  • How to close vim from the command line?

    6 answers




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?










share|improve this question















marked as duplicate by muru, karel, Yaron, Eric Carvalho, Zanna Dec 12 at 11:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • because you cannot replace q! with !q
    – Alvin Liang
    Dec 12 at 9:45
















0















This question already has an answer here:




  • How to close vim from the command line?

    6 answers




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?










share|improve this question















marked as duplicate by muru, karel, Yaron, Eric Carvalho, Zanna Dec 12 at 11:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • because you cannot replace q! with !q
    – Alvin Liang
    Dec 12 at 9:45














0












0








0








This question already has an answer here:




  • How to close vim from the command line?

    6 answers




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?










share|improve this question
















This question already has an answer here:




  • How to close vim from the command line?

    6 answers




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?





This question already has an answer here:




  • How to close vim from the command line?

    6 answers








vim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 12 at 11:54









Zanna

50k13131238




50k13131238










asked Dec 12 at 8:01









recursivleyGreedy

224




224




marked as duplicate by muru, karel, Yaron, Eric Carvalho, Zanna Dec 12 at 11:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by muru, karel, Yaron, Eric Carvalho, Zanna Dec 12 at 11:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • because you cannot replace q! with !q
    – Alvin Liang
    Dec 12 at 9:45


















  • because you cannot replace q! with !q
    – Alvin Liang
    Dec 12 at 9:45
















because you cannot replace q! with !q
– Alvin Liang
Dec 12 at 9:45




because you cannot replace q! with !q
– Alvin Liang
Dec 12 at 9:45










1 Answer
1






active

oldest

votes


















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.






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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.






    share|improve this answer




























      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.






      share|improve this answer


























        2












        2








        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.






        share|improve this 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_filename


        then exit vim and replace old file with tmp_filename.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 12 at 9:40

























        answered Dec 12 at 8:03









        mature

        1,540422




        1,540422















            Popular posts from this blog

            Mouse cursor on multiple screens with different PPI

            Agildo Ribeiro

            Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”