Page 1 of 1

Emacs or VIM should I try it?

Posted: Mon May 26, 2008 6:14 pm
by Pinkfloyd
Right now I'm using Kate for all of my coding but I always hear how nice Vi and Emacs are if you learn them.Is there a huge advantage like people who use these editors say?

Posted: Mon May 26, 2008 9:03 pm
by iammisc
I'm an emacs addict and my answer to your question is : YES. When I first used emacs I didn't think it was that great. But then I got more into it and I fell in love with being able to do everything in emacs. For example, I had a terminal on the top, a main file on the bottom left and a side pane which allows me to view to files. This allows me to see the header files with all my structs and everything so I don't have to continuously cycle through files to make sure that the names of all my identifiers are correct. Also emacs allows me to do all my editing without taking my hand off the keyboard(using the mouse takes too much time).

VIM probably also has most of these advantages but I'm not very experienced in vim.

Posted: Mon May 26, 2008 9:29 pm
by Alboin
For some people, vi\emacs can be a huge productivity booster.

Personally, I use vim. As iammisc said, at first you'll say to yourself: "What is this? How can this be so productive?" However, after using it for awhile, and learning its workings, you'll get quicker and more accustomed to it.

Recently, seeing my success with vim, I've switched from GNOME to xmonad. So far, I like it a lot. Lesson of the story: shift around to various tools and try them all.

Posted: Mon May 26, 2008 11:35 pm
by Osbios
I didn't know xmonad. I tried ion 2-3 years ago for notebooks. But the standard keys are horrible. But right now I have no notebook. :/
And on the desktop I stay on xfce... pushing my mouse.

I know that the advantage is the speed by using only the keyboard. But how long do you need to learn/get used to it and how much faster do you work?

Vi is the best

Posted: Tue May 27, 2008 1:49 am
by DeletedAccount
:P Vi is cool and slick , The most important feature for the productivity of vi is that for most of the time your finger remain in the centre of the keyboard unlike many (non vi ish and so called true programs ) editors . Vi is the best editor om the whole wide world .<evil laugh> Mu ha ha ha h ha </evil laugh>

Posted: Tue May 27, 2008 2:48 am
by JamesM
Your choice on whether to use emacs or vi depends on whether you are more comfortable with a modal or modeless editor.

Vi is a modal editor - it has a command mode and an insert mode (among others) where the same keys do different things - e.g. in command mode 'j' moves up a line, in insert mode it inserts the letter 'j'.

Emacs is modeless - 'j' will always insert a character 'j'. All its functionality is accessed using key modifiers - generally with combinations of keys and the CTRL and ALT keys (referred to a C- and M- (for META)).

For example, to save a file and then quit in Vi(m), you press ESC a few times to make sure you're in command mode then type

Code: Select all

:wq
the 'w' being write, and the 'q' being quit.

In emacs, you would do this:

Code: Select all

C-x C-s C-x C-c
control-x is a modifier used to access emacs standard functions (because emacs has so many functions that it needs multiple modifiers to map them all). C-x C-s saves the file, and C-x C-c quits. It sounds more complex than the vi(m) version but really because of the locality of the keys it's very simple and automatic.

I personally use Emacs, but this has come about after using both and deciding that I preferred a modeless editor. I would, however, prefer an Emacs without any of the bells and whistles it currently has (emacs is almost an OS, it's got so much stuff, in fact one common insult is that "Emacs is a great operating system, all it lacks is a decent text editor")

Cheers,

James

Posted: Tue May 27, 2008 4:02 pm
by iammisc
I know that the advantage is the speed by using only the keyboard. But how long do you need to learn/get used to it and how much faster do you work?
Use it solely for a week and you'll get used to it. In regards to speed, I work a lot faster. Consider this: in text editors like gedit and kate, each file is kept in a separate tab. To switch you have to take your hands of the keyboard(about 2 seconds if you're on a desktop. a little easier on a laptop) and then you have to position the mouse on the tab and click( and be careful not to hit the close button). In emacs, I just hit C-x C-b and type in part of the name and click TAB for emacs to fill in the rest. Most of the time, I don't even have to type anything other than C-x C-b ENTER because emacs will automatically select the most recent buffer. Also, opening a file is much quicker, emacs has tab completion so I just type in the first few letters and voila, the file comes up. Lastly the great thing about emacs and vim is that you won't have to switch between a text editor and a console. Emacs and Vim(AFAIK) can both run a console so it will save you on compilation time.

Posted: Tue May 27, 2008 5:55 pm
by B.E
iammisc wrote:In emacs, I just hit C-x C-b and type in part of the name and click TAB for emacs to fill in the rest. Most of the time, I don't even have to type anything other than C-x C-b ENTER because emacs will automatically select the most recent buffer. Also, opening a file is much quicker, emacs has tab completion so I just type in the first few letters and voila, the file comes up. Lastly the great thing about emacs and vim is that you won't have to switch between a text editor and a console. Emacs and Vim(AFAIK) can both run a console so it will save you on compilation time.
Just for information sake, Vim has Tabs. To move to another tab it's 'gt' (move to the next tab left). to create a new tab its ':tabnew' (or can be maped to a simple key combo (imap ,t <Esc>:tabnew<CR> would map it to ',t' keys). To move to a specific tab it's ':tab <tab number>'.

Posted: Tue May 27, 2008 6:25 pm
by Pyrofan1
Image

Posted: Tue May 27, 2008 7:06 pm
by Alboin
B.E wrote:
iammisc wrote:In emacs, I just hit C-x C-b and type in part of the name and click TAB for emacs to fill in the rest. Most of the time, I don't even have to type anything other than C-x C-b ENTER because emacs will automatically select the most recent buffer. Also, opening a file is much quicker, emacs has tab completion so I just type in the first few letters and voila, the file comes up. Lastly the great thing about emacs and vim is that you won't have to switch between a text editor and a console. Emacs and Vim(AFAIK) can both run a console so it will save you on compilation time.
Just for information sake, Vim has Tabs. To move to another tab it's 'gt' (move to the next tab left). to create a new tab its ':tabnew' (or can be maped to a simple key combo (imap ,t <Esc>:tabnew<CR> would map it to ',t' keys). To move to a specific tab it's ':tab <tab number>'.
Does anyone actually use vim tabs? I was under the impression everyone just :sp\:vsp their windows or opened a new terminal..

Posted: Tue May 27, 2008 10:57 pm
by Osbios
If I work on more then one file I just open several instances of the editor and then tab/alt-tab between them.

Posted: Wed May 28, 2008 4:19 am
by JamesM
By the way, if you do choose to use Emacs make sure you get the snapshot, latest version as it has antialiased font support, which is teh awesome.

Posted: Wed May 28, 2008 4:23 pm
by B.E
Alboin wrote:Does anyone actually use vim tabs? I was under the impression everyone just :sp\:vsp their windows or opened a new terminal..
Your right, tabs were only just added in v7.0 (May 7, 2006).

Posted: Wed May 28, 2008 5:06 pm
by iammisc
By the way, if you do choose to use Emacs make sure you get the snapshot, latest version as it has antialiased font support, which is teh awesome.
I second that. The only bad thing about regular emacs is the horrible fonts. But the new anti aliased fonts are just plain beautiful.

Re: Emacs or VIM should I try it?

Posted: Sat May 31, 2008 6:42 am
by fingerprint211b
Pinkfloyd wrote:Right now I'm using Kate for all of my coding but I always hear how nice Vi and Emacs are if you learn them.Is there a huge advantage like people who use these editors say?
I'm using Kate myself, and always have an open terminal on my other monitor.
Before that, when I was using GNOME, I used gedit, which I find to be excellent. Both editors can do syntax highlighting, and gedit has an embedded terminal (plugin), and auto-complete plugins...

I heard stories and examples of how vim and emacs are good and why, but I can't get myself to learn them :)
But from what I saw they seem worth it.