Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: vi editor commands not working

  1. #1
    Join Date
    Oct 2011
    Location
    Bhilai, India
    Posts
    62

    Exclamation vi editor commands not working

    using SUSE v11.4

    i am using VIM v7.3.62 but none of its commands are executing.
    like pressing 'q' should exit the vi editor, 'wq' writes and quit but nothing is happening.

    i have also updated & installed all the bug fixes but still the same.

    is this really a bug or am doing something wrong?
    any solution to this?
    Shrikant Soni

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,582
    Blog Entries
    14

    Default Re: vi editor commands not working

    Not a bug. You missed something. To quit without saving is not "q", but "q!". To write to disk is not "w", but "w!". To save and exit you can also use (after Esc) "ZZ". The problem is the absence of the exclamation mark.

    Any reason why you're starting to use vim ? Most "not-old-school" people prefer editors like nano, with a less steep learning curve.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: vi editor commands not working

    Knurpht wrote:
    > Not a bug. You missed something. To quit without saving is not "q", but
    > "q!". To write to disk is not "w", but "w!". To save and exit you can
    > also use (after Esc) "ZZ". The problem is the absence of the exclamation
    > mark.


    Eh? The exclamation mark is only necessary to try to overcome data loss
    or file permission problems.

    The normal command to quit is plain "q". If you have modified the text
    in the buffer but not saved it, then you need to use "q!" as the error
    message advises.

    The normal command to write is plain "w". You need "w!" if you are
    trying to save to a file to which you do not have write permission, but
    which resides in a directory where you can alter the file permissions.

    Habitually using "!" removes the safety checks that some consider to be
    useful.

  4. #4

    Default Re: vi editor commands not working

    soni shrikant wrote:
    > using SUSE v11.4
    >
    > i am using VIM v7.3.62 but none of its commands are executing.
    > like pressing 'q' should exit the vi editor, 'wq' writes and quit but
    > nothing is happening.
    >
    > i have also updated & installed all the bug fixes but still the same.
    >
    > is this really a bug or am doing something wrong?


    It is almost certainly something you are doing wrong. But you are not
    clear enough about what you are doing to know what that is.

    What happens when you press q? What happens when you press wq? You need
    to give more detail.

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,721

    Default Re: vi editor commands not working

    Don't you forget to type a : first to get into command mode? Just typing a q or wq somewhere in the text does not do what you expect.
    Henk van Velden

  6. #6
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,582
    Blog Entries
    14

    Default Re: vi editor commands not working

    Quote Originally Posted by djh-novell View Post
    soni shrikant wrote:
    > using SUSE v11.4
    >
    > i am using VIM v7.3.62 but none of its commands are executing.
    > like pressing 'q' should exit the vi editor, 'wq' writes and quit but
    > nothing is happening.
    >
    > i have also updated & installed all the bug fixes but still the same.
    >
    > is this really a bug or am doing something wrong?


    It is almost certainly something you are doing wrong. But you are not
    clear enough about what you are doing to know what that is.

    What happens when you press q? What happens when you press wq? You need
    to give more detail.
    Aaargh, that's horrible what I did. Will contact a doctor straight away, something's wrong. I've been using vi for over 20 years now, and I'm still using vi an awful lot. It's most certainly Henk's remark, of not using ":" to go from escape mode to command mode, the sequence then, after editing would be-Esc : q, or Esc : wq
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,721

    Default Re: vi editor commands not working

    Well, the Esc is only needed when to get out of in INSERT mode and is a different beast.

    When you want to stop vi and you are in INSERT mode (that is all the characters you type are added to the text in the screen), you do first Esc.

    Then you are in "normal" (or has it another name) mode where you can travel through the tex with the arrows and al that.

    When you then want to (write and) quit, tipy type :q or :wq
    Henk van Velden

  8. #8
    Join Date
    Jun 2008
    Location
    Connecticut, USA
    Posts
    2,294
    Blog Entries
    1

    Default Re: vi editor commands not working

    Quote Originally Posted by hcvv View Post
    Don't you forget to type a : first to get into command mode? Just typing a q or wq somewhere in the text does not do what you expect.
    That was my first thought. I'm using vi on a FreeBSD server.. well, maybe "using" is too strong of a word... maybe "surviving" is better
    "Linux provides freedom, problem is most users don't know what it is or how to use it." ~me
    Friends don't let Friends wear red shirts on away parties!
    Linux User #477531 | Danbury Area Computer Society (www.dacs.org)

  9. #9
    Join Date
    Apr 2010
    Location
    i am location
    Posts
    1,421

    Default Re: vi editor commands not working

    On 08.02.2012 05:16, soni shrikant wrote:
    >
    > using SUSE v11.4
    >
    > i am using VIM v7.3.62 but none of its commands are executing.
    > like pressing 'q' should exit the vi editor, 'wq' writes and quit but
    > nothing is happening.
    >
    > i have also updated& installed all the bug fixes but still the same.
    >
    > is this really a bug or am doing something wrong?
    > any solution to this?
    >
    >

    Did you 'ESC :q' ?
    Just q will not do it.

    --

    Windows, supports nearly all software, hardware, and viruses.
    Linux Counter: 548299 https://linuxcounter.net/

  10. #10
    Join Date
    Jun 2008
    Location
    Connecticut, USA
    Posts
    2,294
    Blog Entries
    1

    Default Re: vi editor commands not working

    Hitting "Esc" will get you out of whatever command/mode you are currently in.

    Then ":q" to quit or ":q!" to force quit and ":wq" to write out the file then quit
    "Linux provides freedom, problem is most users don't know what it is or how to use it." ~me
    Friends don't let Friends wear red shirts on away parties!
    Linux User #477531 | Danbury Area Computer Society (www.dacs.org)

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •