LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-17-2004, 10:47 PM   #1
thalerz
LQ Newbie
 
Registered: Nov 2003
Posts: 21

Rep: Reputation: 15
How do I save in VI once I'm done editing?


How do I save in VI once I'm done editing?
 
Old 03-17-2004, 10:48 PM   #2
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
I think it is <shift>zz
 
Old 03-17-2004, 10:53 PM   #3
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 31
I use

:w to write

:wq to save and quit

:q! to quit without saving
 
Old 03-17-2004, 11:26 PM   #4
thalerz
LQ Newbie
 
Registered: Nov 2003
Posts: 21

Original Poster
Rep: Reputation: 15
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
 
Old 03-17-2004, 11:29 PM   #5
thalerz
LQ Newbie
 
Registered: Nov 2003
Posts: 21

Original Poster
Rep: Reputation: 15
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!!!!
 
Old 03-17-2004, 11:29 PM   #6
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 31
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.

Last edited by Kovacs; 03-17-2004 at 11:31 PM.
 
Old 03-17-2004, 11:31 PM   #7
thalerz
LQ Newbie
 
Registered: Nov 2003
Posts: 21

Original Poster
Rep: Reputation: 15
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!
 
Old 03-17-2004, 11:33 PM   #8
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 31
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
 
Old 03-17-2004, 11:59 PM   #9
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
for simple text-editing vi is a pain in the ass. Install something simple like pico or nano(like the previous poster said)
 
Old 03-18-2004, 12:05 AM   #10
thalerz
LQ Newbie
 
Registered: Nov 2003
Posts: 21

Original Poster
Rep: Reputation: 15
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!)
 
Old 03-18-2004, 12:09 AM   #11
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
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.
 
Old 03-18-2004, 12:57 PM   #12
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
 
Old 03-18-2004, 02:54 PM   #13
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
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
 
Old 03-18-2004, 03:17 PM   #14
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
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.
 
Old 03-18-2004, 03:28 PM   #15
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
:wq = :x
 
  


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
NEED AWNSER QUICK how do I save editing a text file in Konsole? DDRfreak2 Mandriva 1 08-18-2005 07:09 PM
save my h/d alaios Linux - Hardware 3 12-13-2003 12:04 PM
where to save in VI DTre08 Linux - Software 3 07-15-2003 02:17 AM
SOX - Save Our X benjaminrtz Linux - General 6 09-01-2002 11:45 PM
Save her..... A-dummy General 5 08-15-2002 01:00 PM


All times are GMT -5. The time now is 09:04 PM.

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