FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


the vi editor of unix





pollux1er
i need some help with the editor. I'm a new user and i need some help. When i type "vi", the editor runs. But after it is open what am i supposed to type first? for example if i want to tye a text and then save it? Please help me. thanks
Davedough
Type anything you want for the actual text of it, then when you want to save, type :wq which stands for Write Quit.... saves it...... if you wanna start off with a document name, just do vi new and it'll save the file as new when you :wq

Also, take a look at this page, it'll help. http://www.chem.brown.edu/instructions/vi.html
pollux1er
thanks for the help. it runs.
the_mariska
don't use it. This is a Satan's tool created especially to frighten junior IT students. I try to use actually any editor but this one, it seems really senseless to me that vi is the default editor in the most of unix systems... ;]
Traveller
The vi editor is an extremely powerful tool but can be VERY cryptic, especially if you have been spoon-fed Microsoft's Kool-Aid for every day of your computing life. Thus, slaves of Windows hate it, but those who have been able to break away (or, like me, who were using vi long before Windows - or even MS-DOS - existed) can learn to make vi do miraculous things that are just not possible with a GUI editor, nor with conventional text editors.

In one job I had years ago, the programs the company was using from their earlier programmers were 5000 lines of compiled BASIC code that they wanted migrated to a newer system (though, initially, still using compiled BASIC). One of the things they had done was to use separate variables and separate subroutines for each month's calculations. Thus, for example, they had variables named TOTAL1QTY%, TOTAL2QTY%, TOTAL3QTY%, ... TOTAL12QTY%, and TOTAL1AMT#, ...TOTAL12AMT#. I both laughed out loud and groaned in pain when I saw it. With a single (though admittedly long and complex) instruction to vi, I converted ALL of those variables to the form TOTALQTY%(MON), and TOTALAMT#(MON) for use as arrays keyed by month number. Just think of all the things that had to be done at once, but vi did it with a single command.

EMACS has its adherents, as well, but I always found vi to be more useful for me. Either way, try doing that with some luser program such as MS-Word!

To be fair: of course, vi is useless when it comes to the WYSIWYG editing of pretty text files, but that was never its purpose.

If you DO wish to learn the vi editor, the O'Reilly guides do a respectable job, and I would also recommend using chapter two of The AWK Programming Language as a great reference for how to use "regular expressions." By mastering regular expressions (the patterns used to search for text within a file), you unlock the incredible power that lies waiting in vi.
ganesh
After 4-5 years of using Linux / Unix, you will grow to love 'vi'

The trick is to keep on using it as much as possible even if you are not up to grip with it.

Start by using it for minor editiing jobs. and you will soon be using it for all your editing needs.

There are so many tricks that you can do which are not possible in the fancy editors yousee on Windows.

The reason is that once you start using Linux or Unix more than Windows, you get used to doing stuff with keystrokes rather than mouse clicks. For example, if you wanted to replace some set of characters with another set, and if you are using windows, you need to use your mouse for some of the operations, and you waste time in focussing your hand's attention from the keyboard to the mouse. When you use vi, you just use your keyboard alone and some pre-defined key strokes (ESC:/s/<CharToReplace>/<ReplacingChar>)..Saves so much time indeed!!
bluefossil
google is your friend
pollux1er
bluefossil wrote:
google is your friend


googl e is our friend! Wink
Liu
the_mariska wrote:
don't use it. This is a Satan's tool created especially to frighten junior IT students. I try to use actually any editor but this one, it seems really senseless to me that vi is the default editor in the most of unix systems... ;]

You are limiting yourself. Sad

vi is a beast.
turbowolf
I give some vi quick reference here:
c
Add changes to file. This is a commonly used command for editing a file with vi. When this option is invoked, you rewrite over the text you want to change by backing up over it using the del key. Simply re-type over the text you have backed up over. When you use the left arrow key to back up over text you can not rewrite over the text you backed up over, but just insert new text at the point where you stopped backing up. Make sense? If not, no worries, you'll catch on.

a
Append text after the cursor.

A
Append text at the end of the line.

d
delete text

i
Insert text before the cursor.

I
Insert text at the beginning of the line.

R
Allows you to overwrite over text.



pollux1er wrote:
i need some help with the editor. I'm a new user and i need some help. When i type "vi", the editor runs. But after it is open what am i supposed to type first? for example if i want to tye a text and then save it? Please help me. thanks
ganesh
Do you know that Gvim can be installed on Windows also!

ftp://ftp.vim.org/pub/vim/pc/gvim70.exe

It is really great, and I have almost ceased to use Notepad etc. on my Windows machines!

I use Linux at work and do a lot of text editing. I just got too used to Gvim, and I found a Windows port too Smile Am really on top of the world!
desertwind
the_mariska wrote:
don't use it. This is a Satan's tool created especially to frighten junior IT students. I try to use actually any editor but this one, it seems really senseless to me that vi is the default editor in the most of unix systems... ;]


WOW, WoW, wOw!!!

Admit that vi has a very steep learning curve, but never heard as it a satan's tool.

vi is a very powerful programming tool, if not a simple editor. I rate it next only to emacs.
pollux1er
desertwind wrote:
the_mariska wrote:
don't use it. This is a Satan's tool created especially to frighten junior IT students. I try to use actually any editor but this one, it seems really senseless to me that vi is the default editor in the most of unix systems... ;]


WOW, WoW, wOw!!!

Admit that vi has a very steep learning curve, but never heard as it a satan's tool.

vi is a very powerful programming tool, if not a simple editor. I rate it next only to emacs.


I entirely agree with you desertwind. I think that those who think like you have the same view of things with me.
Arnie
The problem is that their should be a simple alternative text editor for the 90% of users that doesn't need those brilliant functions.
infinisa
You should definitely know how to use vi if you are a unix user. It is the editor which is always available, if all else fails.

Go to http://www.vim.org/, and you can download vim (the version of vi included in linux) for practically any OS (including Windows, so you can practice in what may be a more familiar environment). The other nice feature is that it comes with a tutorial (vimtutor) and help (:help), although there's plenty of documentation available on the vim site.

To get you started:
i = enter insert mode
r = enter replace mode
Esc = exit insert/replace mode
x = delete char
dd = delete line
$ = go to end of line
:q = quit
:wq = save & quit

Hope this helps.
Related topics
Great php editor
A "small" list of free apps
PHP Editor
MS frontpage or Dreamweaver or NVU?
i need suggestions
What Web Design Software is everyone using?
C++ help
Web Developer
the vi editor of unix
Moving files between Debian and Windows. Locale issues?
KDE - Su returned with an error(linux root error)
Java utilties for VI
Great free photo editor
Advice on switching OS [Windows --> UNIX? Linux?]
Reply to topic    Frihost Forum Index -> Lifestyle and News -> Jobs and Learning

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.