Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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 03:09 PM..
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.
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'.
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.
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.
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.
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.