Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

  1. More ways to get the info! - we shoot all of our new original content out as well as random messages on Twitter and our newsletter!. Twitter | Newsletter
    Dismiss Notice

How to quit vi/vim

Discussion in 'Shell / Command Line' started by Rob, May 4, 2019.

  1. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    444
    Likes Received:
    942
    This has been a long term joke, but as an avid vim user, it's simple.

    Once you open your file and edit it, to quit vi/vim, you simply:

    Quit without saving:
    ESC, then :q

    If you ctrl-c, you'll create a swap file..


    (Log in to hide this advertisement)


    Quit with saving:
    ESC, then :ZZ

    Vim is really the ultimate editor.. learn to use it and you'll get a promotion at work ;)
     
  2. atanere

    atanere Moderator
    Gold Supporter

    Joined:
    Apr 6, 2017
    Messages:
    1,835
    Likes Received:
    1,938
    I don't want a promotion! I want to ESCAPE! :D:D

    Less than 8 weeks to go... but who's counting?

    Cheers
     
    wizardfromoz likes this.
  3. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    444
    Likes Received:
    942
    Congrats @atanere! Hopefully, that'll earn you some time here! :)
     
    wizardfromoz and atanere like this.
  4. Pawan Bahuguna

    Pawan Bahuguna New Member

    Joined:
    Jul 23, 2018
    Messages:
    6
    Likes Received:
    0

    I am in the habit of using ESC :wq!
     
  5. Andy20190506

    Andy20190506 New Member

    Joined:
    May 6, 2019
    Messages:
    2
    Likes Received:
    0
    My understanding of Save and Quit is: ESC; :wq
    I have not see :ZZ usage.
    Kindly, could you please tell me if this is a newly added feature?
    How is :ZZ different from :wq?
     
  6. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    444
    Likes Received:
    942
    :ZZ has been around for a while.. I'm thinking at least 20yrs that I've been using it - My understanding is that its identical to :wq.

    It's quicker for me to type and I'm just used to it :)
     
  7. TechnoJunky

    TechnoJunky Active Member

    Joined:
    Dec 3, 2018
    Messages:
    159
    Likes Received:
    147
  8. blackneos940

    blackneos940 Active Member

    Joined:
    May 16, 2017
    Messages:
    155
    Likes Received:
    85
    Lol, maybe then you and I can finally talk..... :D
     
    atanere likes this.
  9. blackneos940

    blackneos940 Active Member

    Joined:
    May 16, 2017
    Messages:
    155
    Likes Received:
    85
    OpenBSD kinda forced me to learn Vim, since the default install doesn't include Nano..... :) So, another way, if someone didn't post it, is this: when at the last character on a line, press the Right Arrow on your Keyboard..... :3 Now, you're in interactive mode..... :) I don't know much beyond this: type ; Scratch that..... Vim on Linux is different..... :( :( :(
     
  10. rahul chauhan

    rahul chauhan New Member

    Joined:
    May 14, 2019
    Messages:
    2
    Likes Received:
    0
    VI commands for day to day working:
    Note: **Press ESC key to come out of VI

    :q -> to quit
    :w -> to write
    :qw -> to write and quite
    :qw! -> to write and quite forcefully

    h -> to move cursor left
    j -> to move cursor down
    k -> to move cursor up
    L -> to move cursor down

    x -> to delete a character
    dw -> to delete a word
    dd -> delete a line
     
  11. heavydistortion

    heavydistortion New Member

    Joined:
    Today
    Messages:
    1
    Likes Received:
    0
    Yeah, I've been using it for a long time and when the joke starting popping up everywhere, I was confused. I thought there was a new bug in vim, or may be it's not about something else altogether!
     

Share This Page