LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-02-2005, 05:57 AM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question vi questions... need to edit doc


The only thing I ever see myself needing to do in vi is edit config files... (I like pico but it's not on all my machines.)

What I need to know is how to edit a doc once I'm in it...

I'm guessing it starts the the i command to go to insert mode....

but what I need to know is simple.... how to move up, down, left and right and how to delete text and how to write text. As simple as possible.

Why is this to rediculous?
 
Old 04-02-2005, 06:06 AM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Use vim, not vi, and have a .vimrc file in your home dir as follows:

Code:
set nocompatible
set backspace=2
set ruler
syntax on
 
Old 04-02-2005, 06:06 AM   #3
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
google?
man vim?
vimtutor?
vim /usr/share/vim/vim63/tutor/tutor?
 
Old 04-02-2005, 06:46 AM   #4
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Re: vi questions... need to edit doc

Quote:
Originally posted by Thaidog
The only thing I ever see myself needing to do in vi is edit config files... (I like pico but it's not on all my machines.)

What I need to know is how to edit a doc once I'm in it...

I'm guessing it starts the the i command to go to insert mode....

but what I need to know is simple.... how to move up, down, left and right and how to delete text and how to write text. As simple as possible.

A) invoque 'vi' as VIM, on most of the distros VI is an alias to VIM, but some set's the 'vi' mode in vim.

B) Go to edit mode using:
Code:
CTRL  :a
Now you will be able to move around with the cursors and the rest of the keyboard as expected until you exit using the ESC key.
 
Old 04-02-2005, 11:10 AM   #5
calcon
Member
 
Registered: Mar 2005
Location: somewhere over the rainbow theres a place....
Distribution: Ubuntu Dapper and Arch
Posts: 121

Rep: Reputation: 15
Personally,
I use vi, NOT vim.
There is a great guide to using vi at http://www.eng.hawaii.edu/Tutor/vi.html

You don't have to read all of it, but if you look at parts, you will find good information.

calcon
 
Old 04-02-2005, 08:14 PM   #6
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Re: Re: vi questions... need to edit doc

Quote:
Originally posted by runlevel0
A) invoque 'vi' as VIM, on most of the distros VI is an alias to VIM, but some set's the 'vi' mode in vim.

B) Go to edit mode using:
Code:
CTRL  :a
Now you will be able to move around with the cursors and the rest of the keyboard as expected until you exit using the ESC key.
That seems to be working good! So what do I do to save changes? (after I hit esc)
 
Old 04-02-2005, 08:52 PM   #7
theMayor
LQ Newbie
 
Registered: Mar 2005
Location: Denver, CO
Posts: 19

Rep: Reputation: 0
From what I've learned thus far once your into the program and you hit your insert key you can then move around the text like you normally would. Once you finish and are ready to exit what I do(could be the long way but it works) is hit escape. Next I type in write and that saves it then I type in quit and that's it.

Hope it helps.
-theMayor
 
Old 04-02-2005, 08:54 PM   #8
theMayor
LQ Newbie
 
Registered: Mar 2005
Location: Denver, CO
Posts: 19

Rep: Reputation: 0
Sorry ... one other thing ... make sure after you hit escape and before you type in quit or write that you press ":"

:S
-theMayor
 
Old 04-03-2005, 05:28 AM   #9
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Re: Re: Re: vi questions... need to edit doc

Quote:
Originally posted by Thaidog
So what do I do to save changes? (after I hit esc)
To save an ordinary document:

ESC :w

To save a write protected doc:

ESC :w!

Save and Exit:

ESC :wq

The '!' sign at the end of an argument forces an action.

For more and better info, here's a quick command table: http://arioch.unomaha.edu/~jclark/vim.html
It's quite handy, it would be a good idea to save it as a PS/PDF file or even printing it.
 
Old 04-05-2005, 03:34 AM   #10
uzairkhan
Member
 
Registered: Apr 2005
Location: Islamabad, Pakistan
Distribution: Mandrake 10.0 & Window XP professional
Posts: 32

Rep: Reputation: 15
why use Vim or vi

hi,
soory for interrupting, but if u only have to edit config files, and no script editing etc, why go for vi,vim or emacs. i know most of the linux guys would scoff at not using one the above mentioned editors, but pico is far more simpler. as far as it not being on all machines, i think a RPM is available for pine for most distributiion and pico gets installed with it. Would'nt it be a simpler option.
also , if u are editing from with in x, then try nedit , its pretty simple and easy to work with.
regards
 
Old 04-05-2005, 04:45 AM   #11
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Re: why use Vim or vi

Quote:
Originally posted by uzairkhan
hi,
[...]why go for vi,vim or emacs. i know most of the linux guys would scoff at not using one the above mentioned editors, but pico is far more simpler [...] if u are editing from with in x, then try nedit , its pretty simple and easy to work with.
Or another widespread simple to use editor is the one shipped with good ol' Midnight Commander, you can invoque it with
Code:
mc -e FILE
  
  or

me FILE
Easy, nice and comes at no cost with the MC.

Or the traditional Gentoo editor: nano.

I myself prefer VIm on the command line, but most fellow Gentoo users likes nano better.

And ¿Why limit ourselves to the console? There is a superb killer-editor which is both powerfull and easy to use... ¡Kate!
An editor with all the bells and whistels but still easy to use and fast. Not to talk about Kate's reincarnation as a LaTeX editor called Kile, simply the best.


Last edited by runlevel0; 04-05-2005 at 04:49 AM.
 
  


Reply



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
trouble finding policy doc as pdf in doc mirrors stardotstar Debian 2 05-12-2005 10:56 PM
burning *.doc to cd tzonga1 Linux - Software 1 05-07-2005 11:54 PM
Script to check Doc-BBB against Doc-AAA for inconsistence satimis Programming 2 11-09-2004 01:43 AM
Where can I get some free doc? zhu_liheng Linux - Software 2 09-30-2003 04:56 AM
A doc to help starters mathi LQ Suggestions & Feedback 1 02-28-2001 08:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 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
Open Source Consulting | Domain Registration