LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-26-2013, 07:51 PM   #1
faisalnawazmir
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Rep: Reputation: Disabled
Vim does not quit in terminal by escape and q or x or qw keys


I am using debian wheezy, I installed vim, it works quite well; excpet it does not quit in terminal by pressing the keys escape and pressing q, x or wq. I have to close the window adn then it closed.

What misktak most probably I have made....
 
Old 07-26-2013, 08:04 PM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
You're missing the : prefix for the wq!

:wq! = write, quit/exit
:q! = exit, no save
or...
ESC twice - ZZ is what I usually use.

https://www.linuxquestions.org/quest...or-4175469764/

Last edited by Habitual; 07-26-2013 at 08:07 PM.
 
Old 07-26-2013, 11:12 PM   #3
faisalnawazmir
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Vim does not quit

Thanks habitual for such informative response. but still with these keys it did not quit properly
 
Old 07-26-2013, 11:22 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
I suggest you search on Google or similar for how to use vi/vim. The key combinations you're asking about are extremely well established and explained, verbatim, thousands of times over.

It is literally a matter of:
Code:
vi file
i #switches to insert mode
type some stuff
Esc #switches back to command mode
:q!
 
Old 07-27-2013, 12:30 AM   #5
doctor.sniff
LQ Newbie
 
Registered: Aug 2007
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by suicidaleggroll View Post
I suggest you search on Google or similar for how to use vi/vim. The key combinations you're asking about are extremely well established and explained, verbatim, thousands of times over.

It is literally a matter of:
Code:
vi file
i #switches to insert mode
type some stuff
Esc #switches back to command mode
:q!
This technique, doesn't save your edit.
you can save with this command->
ESC
:
wq or wq!
 
Old 07-27-2013, 02:27 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,114

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
When I've been editing for a while, and maybe got distracted, I habitually hit ESC a couple of times before trying something in command mode. Even if I may have already been in command mode. Habit. Doesn't hurt anything. And then you're sure you're in command mode before you start typing commands. Same thing when I want to go into insert mode after having been distracted. I hit ESC a couple of times before hitting "i" (or whatever insert command key I want). Nothing worse than thinking you are in insert mode typing text when you are actually in commnd mode typing commands. You will mess up your file really horribly and really fast in that situation!
 
Old 07-29-2013, 02:45 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
As above, ensure you are in Cmd mode by hitting ESC once or twice (repeat doesn't hurt).
Now you can use cmds
Code:
:q      # quit, no save (will ask to save changes if any have been made)

:x      # exit with save

:q!     # quit and definitely don't ask to save changes

:w      # write current buffer to disk ie save any changes made up till now
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vim to render terminal colouring using escape characters? khaan Linux - Software 1 11-02-2010 11:06 AM
vim map Caps Lock to Escape sadarax Linux - General 3 01-30-2010 02:16 PM
Terminal escape sequenses Four Programming 6 10-20-2006 04:53 AM
How to stop terminal escape sequences ? Mike Davies Linux - Newbie 1 08-08-2004 12:37 PM
Vim and escape key jrdioko Linux - Newbie 3 07-11-2004 12:57 PM


All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration