LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to exit vi? (https://www.linuxquestions.org/questions/linux-general-1/how-to-exit-vi-19794/)

lommer0 04-29-2002 08:14 PM

How to exit vi?
 
Ok, I've been using linux on console only PC for a couple days now and one big thing is really bothering me...

How do I exit vi/emacs/joe?! also, how do I save + open files? I know how to stop the process (ctrl + Z) but I doubt thats the best way to exit :-)

This is really bugging me b/c its sooo simple and I've been trying key combos for hours, but I've finally decided to just put my pride aside and ask. So please, anyone, how do I exit?

lethe 04-29-2002 08:29 PM

vi - press escape to get into command mode if you re not already in command mode (if you are, it s OK to press it anyway). :q to quit :w to save, :wq to do both.

emacs - ^X^S to save, ^X^C to quit

growler 04-29-2002 11:46 PM

also, adding an exclamation mark at the end of the command means "do it!" - as in

:q!

(yes, I know I made changes, but quit anyway, and don't bother me about it...)

:)

lommer0 04-30-2002 12:28 AM

Thank You!

Btw, this kind of super-newbie information should maybe be put in man pages? maybe a section of the man dedicated to newbs? Just so that people might have some idea where to start...

this also applies to exiting man pages I figured out too... :-)

rockin chair 05-01-2002 04:02 PM

For more information on the subject of vi, you might want to review the following thread, where I asked information regarding vi

http://www.linuxquestions.org/questi...threadid=19701



That might give you more information. :jawa:

marlaina1 05-01-2002 10:39 PM

There is a really good vi command reference at: http://mmdc.net/h/vi.html

For Joe, ^kz will stop the job, not a good thing. Use ^kx to save the file and ^c to cancel the file or any changes. At any time in joe, use ^kh and you'll get a split screen with the commands in the top half. ^[. takes you to the next help page if needed. Use ^kh again to get rid of it. It is very fast.

Emacs is not a good one to start with. I'd get vi or joe down well first.

BTW, to get out of man pages, hit q

gene_gEnie 05-02-2002 06:16 AM

Jed or even better, XJed is a V good editor IMHO.

Comes with syntax highlighting, can be set up to emulate a number of other editors, the default being emacs so its an easy transition.

Doesnt have the HUGE overhead of LISP and all the emacs baggage but does have its own S Lang thingy should the need arise to go beyond the norm.

small, lean and mean

XJed forevaaa

Martin

Lazarus 05-02-2002 08:08 AM

I use a small simple editor joe. Bit like wordstar remember that.
rpm for it on Redhat distro and probably many more.
Sorry I hate vi!

Mara 05-02-2002 08:17 AM


 
I use joe, too. It's not simple, quite many options... I can remember all commands I need, and there is good help.

5amYan 05-03-2002 02:26 AM

I use vi cause every *N*X has it. The BSD versions are tricky sometimes.

Linux
i or insert to insert text
ii ir insert insert to replace (overwrite)
arrow keys to navigate
esc :q! to exit with out changes
esc :wq to save and exit
my fave
esc shift^ZZ to save and exit.

*BSD
same as above but no arrow keys and sometimes no insert i(only)
esc takes you to command mode and you can navigate
.with keys

x =delete
h,j,k,l = arrows
etc...
just the very basics:)
Almost forgot that *BSD has an editor ee I like alot when you're done editing
esc and you get a little menu

molotov 02-05-2009 11:34 PM

vi in ssh
 
Help please.
I'm connected to debian through SSH and have vi running with resolv.conf open and close to mashing it up which I don't want to do. Esc :q isn't working. How can I exit without saving mistakes?

chrism01 02-06-2009 01:09 AM

Quote:

Esc :q isn't working.
what exactly do you mean???

If you use the Esc key, that brings up the cmd line beginning with ':'

If you HAVEN'T made any changes

:q

will quit+no save

:q!

will quit+no save if you HAVE made changes

:x

will exit+save changes

ErV 02-06-2009 05:41 AM

Quote:

Originally Posted by molotov (Post 3433773)
Help please.
I'm connected to debian through SSH and have vi running with resolv.conf open and close to mashing it up which I don't want to do. Esc :q isn't working. How can I exit without saving mistakes?

:q!

dameunmate 03-17-2010 05:51 AM

in Vi I press ESC key but I don't get the : prompt....in fact theres no way I can get any text to appear, or close Vi.

using Arch Linux and Openbox

Sayan Acharjee 03-17-2010 05:54 AM

When you will press escape the insert mode will be disabled, then you need to type : After that you can provide q! the hit enter.


All times are GMT -5. The time now is 06:23 PM.