LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I save in VI once I'm done editing? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-save-in-vi-once-im-done-editing-159214/)

thalerz 03-17-2004 09:47 PM

How do I save in VI once I'm done editing?
 
How do I save in VI once I'm done editing?

shanenin 03-17-2004 09:48 PM

I think it is <shift>zz

Kovacs 03-17-2004 09:53 PM

I use

:w to write

:wq to save and quit

:q! to quit without saving

thalerz 03-17-2004 10:26 PM

VI is only letting me delete text, and not adding text, for example "1024x768"

What gives? This is so fricking complicated, and has NO MANUAL!!!!

HELP I have been trying to edit and get my X up and running with the proper Resolution after screwing it up by accidentally setting my resolution too high. This is rediculious how much time and energy this takes to solve such a simple issue.

So how do I get VI to let me to FULL editing, and not just deleting and screwing it up MORE!

Thanks for the help.

-Justin

thalerz 03-17-2004 10:29 PM

Ok now I can edit, and change and delete and type.....but now the commands :w and :q and <SHIFT> ZZ are typing text, and not issuing commands... WHAT THE HECK!!!!

Kovacs 03-17-2004 10:29 PM

Google is your friend young jedi.

http://www.google.com/search?q=vi+tu...utf-8&oe=utf-8

Vi is super efficient once you know it, but far from intuitive. You might be better off using an easier editor like nano or pico to get you up and running.

For a super quick tutorial: you have to switch between command and writing mode by pressing escape to get into command mode - then you can type in commands and you will see them echoed at the very bottom of the screen. Press i (case sensitive) to get back into insert mode, then escape to get back into command mode etc etc.

thalerz 03-17-2004 10:31 PM

Ok I finally go X up and running. I had to hit the Esc key to get back to NOT EDITING and issuing commands. Is the a fricking manual for this stuff, or is it always guess work?

Thanks for the help guys!

Kovacs 03-17-2004 10:33 PM

Quote:

Originally posted by thalerz
Is the a fricking manual for this stuff, or is it always guess work?

http://www.google.com/search?q=vi+ma...utf-8&oe=utf-8

shanenin 03-17-2004 10:59 PM

for simple text-editing vi is a pain in the ass. Install something simple like pico or nano(like the previous poster said)

thalerz 03-17-2004 11:05 PM

I thank you greatly for the help guys. Unfortunately I tried using pico, and it was not a recognized command. I guess it's not installed, and I couldn't install it (or didn't know how to). So I was forced to using VI.

Thanks again!

-Justin (newbie, obviously!)

shanenin 03-17-2004 11:09 PM

I am guessing you are using redhat. It makes no sence why redhat only has vi for a text editor. It has every other package installed, why not throw in pico or nano.

slakmagik 03-18-2004 11:57 AM

Past the point, maybe, since you got it straightened out, but for future reference or others' reference...

If you're in vim and don't know what to do, hit 'escape' to make sure you're in command mode. Type ':' to get to the vi command line. Type 'help' to get help.

If you're in vim and want to get out, hit escape a zillion times because you're probably pretty annoyed and it'll make you feel better. :) Then hit ':' and 'q!', which means, basically, 'Command - quit and I mean it!'

Basically, if you use a gui editor, you can't edit while you're mousing over a menu, right? Or you use an accelerator like 'Alt-F' to open the file menu, right? It doesn't actually type an F. Same with vim - command mode is like a GUI menu mode. When you type 'i' in command mode, it doesn't insert an 'i'. It gets you into insert mode. Then you start typing as normal. Just like when you move off the menu with a mouse or hit 'escape' to close the menu, you start typing again as normal.

Vim just has 'modes' instead of menus. A command mode and insert mode instead of a menu bar and a text area. In a sense, it's a freaking pain and in a sense it's perfectly normal. And if you've seen gvim's menus and think how many things there are on them and how they represent a small fraction of what vim can do, you can see vim's pretty powerful.

But - if you don't have pico or nano or joe or whatever, you should really have mc. That has an internal editor that's very DOS-like. Very easy to use and comes complete with nifty highlighting. Either invoke it from within mc or issue 'mcedit' and, if you've got the symlink, it should bring up the editor component.

Genesee 03-18-2004 01:54 PM

keep in mind that vi dates back to 1976 - consider the advances in computers since then. that its still in wide use is pretty amazing, really.

watching someone who is really proficient in vi attacking a big file, source, etc. is awesome - its not pretty, but its very powerful and fast.

here's a good reference:
http://docs.freebsd.org/44doc/usd/12.vi/paper.html

mikshaw 03-18-2004 02:17 PM

Vim (Vi iMproved) includes a tutorial that's helpful for learning the basics. Type "vimtutor" in a terminal to launch it.

Vim is an excellent editor for advanced or simple editing, once you get accustomed to the commands and keys.

Crito 03-18-2004 02:28 PM

:wq = :x ;)


All times are GMT -5. The time now is 12:31 AM.