LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-14-2008, 12:05 PM   #1
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Rep: Reputation: 15
Why use vim?


Ubuntu 8.04 is my distro. I use the terminal to do various routines. I have used gedit to make some simple scripts. I am not a programmer.

Am reading Sobell's book on Ubuntu and reading about vim. Looks complicated.

Why should I use vim? Why not just gedit?

Thanks
 
Old 05-14-2008, 12:07 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,291
Blog Entries: 3

Rep: Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447
Hi,

You should use what you are comfortable with. 'vi' is a great editor once you learn the syntax and semantics.
 
Old 05-14-2008, 12:09 PM   #3
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS
Posts: 375

Rep: Reputation: 38
Vim does not create a line return unless you hit the enter/return key. Very useful when writing scripts or editing config files where line returns can make or break your file.
Some editors create line returns where the window word wraps the lines of text.
 
Old 05-14-2008, 12:45 PM   #4
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
I would recommend you not to waste too much time with vim. Just make sure you can use it for quick edits. I see no point at all using vim nowadays. It doesn't integrate well with any Desktop (unless you are using gvim or something like that, which is kinda pointless anyway) and it does not have any good features such as templates and simultaneous edit mode. If it does have those features, probably it has a huge learning curve.

Many say that the good thing about vim is that it is available on every *nix machine out there, which is not even entirely true (not as true as "vi", anyway). Switching from edit mode to command mode is so 70's it is not even funny. It is like using ICQ as your main messenger today (since I brought it up, MSN Messenger should be retired soon too).

Not to say that gedit is that great of an editor either, but it is definitely better than vim for some "serious" editing. When you have to read pages on the Internet about how to copy, paste, search, find and replace texts in a small tool like a text editor, you can call it either broken or dated. That is what Vim is.

Sorry if this sounds like I am trying to start a flamewar, but I just wanted to say that, in my opinion, people give far too much credit for a dated editor which hasn't received any new (or worthy mentioning) features since 2006.

UltraEdit, for Windows, is quite possibly the best editor on the planet and I hope it will make to Linux someday, natively. And not to mention the support is amazing. I got a reply today from them in exactly 15 minutes. Worthy every single penny it costs...

Last edited by Mega Man X; 05-14-2008 at 02:09 PM.
 
Old 05-14-2008, 01:01 PM   #5
vadkutya
Member
 
Registered: Apr 2008
Distribution: slackware 10.2
Posts: 117

Rep: Reputation: 16
i don't want to feed a flame war but imo there's a second reason--beside that vi(m) is the standard editor on *nix systems--why you should at least familiarize yourself with it. many vi(m) commands are similar to those of other command line tools. if you page a file with less you might want to search it as well. so how you do it. as you'd do it with vi(m). in command mode you type /<searchphrase>. or think of text replacement s/.../.../g and so on.

i used emacs a lot but emcas is also it's own os and i'm still busy learning linux . you do not need to use vi(m) for your everyday work. but get aquainted with it. it might serve you good some day

vadkutya

p.s.: it's quite cumbersome at the beginning but i have seen guys doing magic with it.
 
Old 05-14-2008, 01:12 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,291
Blog Entries: 3

Rep: Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447
Hi,

A lot of the 'vi' users are actually using 'elvis' and don't realize that.

I don't want a flame war either. The 'vi' editor is a valuable tool and can be used by everyone with a little effort. Most of my editing for the systems does involve the use of 'vi'. I do use kwrite while in 'X' and other times kword. But most of system work is with 'vi'.
 
Old 05-14-2008, 01:19 PM   #7
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Rep: Reputation: 51
I never did completely learn the use of vim, but I have found it useful at times. I like to play around with my xorg.conf file and I occassionaly try something and kill my desktop. Using vim is the only way I can restore a backup file without a desktop, as you certainly cannot use gedit without a desktop. Vim has its uses even yet.

Bob
 
Old 05-14-2008, 01:25 PM   #8
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
And just to add fuel to the none-existent flame war , remember that many of the unix systems you might come across don't have X running or installed. It's by no means guaranteed, but vim ( and to a greater extent vi) ARE just about universal across unix machines. So if you have to log into a server via ssh, change your OpenWRT router settings, or any number of other things, you can be fairly confident you'll be able to edit things if you know vi.

It can be confusing at first trying to remember all the commands, but you get used to things fairly quickly. In my case, if I'm writing a script in a gui editor, I'll find myself doing an '<esc>:w' without thinking. Of course it doesn't work, but it's second nature. Same goes for cutting and pasting.

Furthermore, (and slightly off topic), the regex facilities are very powerful. Maybe not for new users, but if you're writing config files, looking through logs or lots of other things, it's often worth spending a few minutes coming up with a regex to do the job for you. Changing things in large numbers of files becomes a breeze.

Still, each to their own.
 
Old 05-14-2008, 01:39 PM   #9
hal8000b
Member
 
Registered: Mar 2001
Location: UK
Distribution: Mint, Arch, Debian7
Posts: 170

Rep: Reputation: 21
I think sometimes you tend to stay with the first editor you use. I tried vi first and liked it, tried emacs later but never got round to learning emacs syntax.
One other reason for learning vi (or any other text based editor) is that you may one day find that your X windows system does not work. You will probably need to edit some system files, so knowing how to use a console editor will give you a better chance of fixing things.
 
Old 05-14-2008, 03:38 PM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,291
Blog Entries: 3

Rep: Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447
Hi,

All the suggestions for 'vi' are justified and a newbie should learn something outside of 'X'. The GUI environment is here too stay but users still need to know a good text editor. Why do you think M$ keeps notepad across their releases? Plain an simple editing of base OS configuration files that's why.

You will find 'vi' or a link pointing 'elvis' or 'vim' on most unix systems which is stated as a programmers text editor for a reason. I like 'elvis' and I still have too go to my crib sheet for things that I don't use frequently.
 
Old 05-14-2008, 06:47 PM   #11
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Speaking of universality, if you ever have to use a rescue floppy or boot into single (cmd-line) mode, the one editor you can guarantee still available is vi (or vim if you're lucky) across just about any variation of Linux/Unix/BSD/OSX.
Definitely worth learning the basics.
Personally, I do all my work on backend programming, eg sysadmin, sys integration/automation, heavy duty DB via Perl etc, so it's all cmd line anyway.
 
Old 05-14-2008, 07:09 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,355

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
nano.
If a system is *really* down the toilet, I'm more likely to use sed than vi for a quick fix.
vi really is a tool of last resort.
 
Old 05-14-2008, 07:10 PM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,291
Blog Entries: 3

Rep: Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447Reputation: 1447
Hi,
I don't know why you refer the use of 'vi' as a last resort?
 
Old 05-14-2008, 07:58 PM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,355

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
Because it's such a PITA compared to the other two options I mentioned.
 
Old 05-14-2008, 08:06 PM   #15
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Learn vi (or vim)

The benefits are that you'll learn "ex" (a less feature-rich editor) since most of the [esc]: commands in vi are ex. Plus, you'll learn the basic syntax of "ed" (about as basic as you can get - like typing in the dark).

Admittedly, when everything's clicking and you have no problems, vi may seem to be a hassle, but after using it for 10 years I can't tell you how many times Notepad makes me nuts when I want to hop to a word match and I end up type [esc]/th... damn...

The best reason to learn ed, ex and vi is that, if you're a sysadmin, you're eventually going to get stuck in a situation where there won't be any other option than to use the most primal editors around if you want to bring your system back online.

Otherwise, I'm all for using whatever you like best

, Mike
 
  


Reply

Tags
gedit, vim


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
VIM Users: Do you use VIM via console or gui? JMJ_coder Linux - General 48 04-16-2008 03:12 AM
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 09:00 AM
LXer: Vim tips: Using Vim mappings and abbreviations LXer Syndicated Linux News 0 06-18-2006 01:54 PM
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-17-2006 11:54 PM
^M and vim jrdioko Linux - Software 5 08-04-2004 11:36 PM


All times are GMT -5. The time now is 08:02 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration