• Post Reply Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Vim or Emacs?

 
Ranch Hand
Posts: 310
18
MS IE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this section is about politics, religion and other controversial topics, this is a good place for this discussion

Vim or Emacs?

Personally, I am worshiper of Vim. I totally love its features, philosophy, and ease of use. Long years ago I gave a try for Emacs for about a month and I didn't really like it. All I wanted was an effective text editor, not an operating system! However, it was fun to check email from Emacs in front of friends.

What's your opinion, what's your choice?

If you are Emacs worshiper, know you can throw a pie on me. There is a little pie icon next to my post


----------------
Note: adding a poll for this


 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My father was a EE professor his entire professional career. He was a devoted emacs user. I started using emacs when I was in 5th grade, and loved it.

Then I went away from computers for years, and basically started over with vi.

I wouldn't say I love it, but it's what I'm used to.

Of course, these days, you can use something like Notepad++, which does ftp behind the scenes to let you edit your files with a real editor - cut, paste, context highlighting...so the question actually become why would you use EITHER of vi or emacs?
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:so the question actually become why would you use EITHER of vi or emacs?



I think that is the point of this topic ... and why it is in the rattlesnake pit.

Arguably, both editors are from the past, and hence, outdated. However, both have a strong following, arguably to the point of religion...


Anyway, if you don't mind, I am going to add a poll (just to see the extent of the following)... and give you two cows for the trouble.
Henry
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:Anyway, if you don't mind, I am going to add a poll (just to see the extent of the following)...



Any chance of adding "I have tried both, and prefer to avoid using either whenever possible" to the options?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:...so the question actually become why would you use EITHER of vi or emacs?


Well I voted for vi/vim, and I'd say it's because of the power. With the 'ed' commands you can do incredibly complex global replaces of the kind I've only seen in IDE editors, although it's possible there are desktop ones that can do them as well; and with vim you can do cut+paste just like any other visual editor.

Admittedly 'vi' is rather arcane, but once you get it set up properly, you can do some remarkable things with it.

I guess it just comes down to familiarity. I've heard good things about emacs too, but I've just never used it.

Winston
 
Henry Wong
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:
Any chance of adding "I have tried both, and prefer to avoid using either whenever possible" to the options?



Done.

 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't imagine having to use either one to code. I use vi for editing text files on Linux. My intro to emacs came from an online course (Coursera I think). I was excited about the course until the first video. The instructor was using emacs for everything, including compiling. I spent all my time rewinding the video to try and determine what keystrokes he was using. I was spending more time trying to learn emacs than the language. I had to drop the course and I've hated emacs ever since.
 
fred rosenberger
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:
Well I voted for vi/vim, and I'd say it's because of the power. With the 'ed' commands you can do incredibly complex global replaces of the kind I've only seen in IDE editors, although it's possible there are desktop ones that can do them as well; and with vim you can do cut+paste just like any other visual editor.

Admittedly 'vi' is rather arcane, but once you get it set up properly, you can do some remarkable things with it.


I could take that exact quote and reverse the emacs/vi references, and it would still hold true.

Winston Gutkowski wrote:I guess it just comes down to familiarity. I've heard good things about emacs too, but I've just never used it.


My father once did an informal survey of CS folk he knew across the country. His results were pretty much 50/50. What was also interesting was that if you asked the additional question "Which were you exposed to first?", there was a extremely strong correlation to the favorite.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither.

For code, I use a full-featured code editor.

When I need to resort to a character cell editor, I use one of nano or pico.
 
Andrew Polansky
Ranch Hand
Posts: 310
18
MS IE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:Of course, these days, you can use something like Notepad++, which does ftp behind the scenes to let you edit your files with a real editor - cut, paste, context highlighting...so the question actually become why would you use EITHER of vi or emacs?


Vim has built-in plugin for handling editing over FTP, cute & paste, as well as context highlighting. Notepad++ is really nothing compared to Vim if you look at both features and available plugins/scripts.

Henry Wong wrote:

fred rosenberger wrote:so the question actually become why would you use EITHER of vi or emacs?



I think that is the point of this topic ... and why it is in the rattlesnake pit.


Exactly And the poll is a great idea. So far vim is leading!
Thanks for the cows

For people unfamiliar with the Editor War: https://en.wikipedia.org/wiki/Editor_war

I am a big fan of vim, but I am not using it 100% of the time. For bigger projects I use NetBeans, a good IDE is certainly a better solution here. However, for smaller projects that don't exceed a few files, I definitely prefer vim. No matter if I am using my desktop or connected to a remote server. I can type the code much faster thanks to macros, motions, bunch of other features. The best in it is that I can do work without having to move my hands away from the keyboard. No mouse needed at all. No need to even leave the editor, as I can execute shell commands from vim as well.
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I prefer to use a graphical editor or IDE if possible. But recently I've been working with Linux virtual machines on cloud platforms, so I've had to start using text editors again. Can't get the hang of Nano, but I still have some residual muscle-memory of vi from my early Unix days 20 years ago. So it's vim for me if I have to choose. Always start by hitting the escape key a few times...

Like JKR above, I tried emacs on the Coursera "Programmjng Languages" course by Dan Grossman, but I swiftly realised I could either learn emacs or learn lots of cool stuff about programming, but not both. So I ditched emacs and used Sublime Text instead. Glad I did so, as the course was brilliant.

#lifestooshortforemacs
 
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both are anachronistic in terms of writing code, however I do still use vi on *nix production machines for support / script editing etc as it is ubiquitous.
From that point of view its a useful skill to have, so I view it as part of the *nix toolset (awk, grep, sed, ...) rather than as a contemporary dev tool like eclipse or netbeans.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a user, who has never used either, I am curious if there are any advantages left in using them as compared to 'modern' day IDEs.
For e.g. Eclipse has plugins which you can install as required. Does anything similar exist for Vim/Emacs?
 
Andrew Polansky
Ranch Hand
Posts: 310
18
MS IE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Important thing to recognize is that Vim/Emacs shouldn't be compared to IDEs. Those two are text editors, whose goal is to provide fast and effective text and code editing. IDEs are, as the name says, integrated development environments. Their goal is to provide environment for effective software development in general.

You can see how work in Vim looks like on those YouTube videos:
https://www.youtube.com/watch?v=FcpQ7koECgk
https://www.youtube.com/watch?v=f8EW2uPz868

As you can see, the speed and minimal effort to write code in editors like Vim is incomparable to the ones in IDEs. On the other hand, IDEs are winning when it comes to tasks like profiling or debugging of bigger projects. I use both Vim and Netbeans, depending on what I work on. Small projects, I go with Vim. Bigger projects, I go with Netbeans.

Vim has a lot of plugins, scripts and configuration files available. The community wrote a bunch of great stuff over those all years. The same is with Emacs. In Emacs case, there is an old joke that "Emacs is a good operating system, it only lacks a good text editor". The joke came from plugins like built in web browsers or email clients that the community wrote. The "it only lacks a good text editor" came from Vim users during Editor War

I don't know about popularity of Emacs those days, but Vim is certainly not something that can be called "archaic". There are groups all around the world that discuss Vim both online and in meetings. There is even one meeting group here in Munich, where people are meeting from time to time to exchange configuration files and new findings/techniques/plugins in Vim. The community is still alive and well doing.
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vi because I learned it first .

I do my coding in an IDE. I use vi when I need to edit a file on a server though. It's on every server and I appreciate it's power. It's also the default editor for cron on the systems I use.
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
:Q!
-
^X^C
- harrumph
^G^G^G^X^C
- arg!
^zKILLl %%
- wha?
^alt-del
- ??? oh so stupid
cpslck
:q!
-grrr...
^g^g^g^g^g^g^g^g^g^g^g^g^x^c
 
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:
My father once did an informal survey of CS folk he knew across the country. His results were pretty much 50/50. What was also interesting was that if you asked the additional question "Which were you exposed to first?", there was a extremely strong correlation to the favorite.



Definitely - we tend to like things which we used first!

I used emacs at university, and haven't used it since 2002 or so. I used vi/vim for 8 years in my last job, and so am much more familiar with it. I however would probably say emacs purely out of nostalgia!
 
Andrew Polansky
Ranch Hand
Posts: 310
18
MS IE Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


https://xkcd.com/378/
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Emacs is the One True Editor. The Vimmers will burn in their own self-created Hell.

Actually, for me it mostly boils down to this:

If I need to do something quick and dirty, almost all systems have vim/vi installed, so it's there and I can use it. Emacs is bulkier and often not available. Then again, I've been known to use nano.

The bad thing about vi is that if you sneeze while seated at the keyboard, you've probably managed to press random keys, and just about any random key sequence is a (probably dangerous) vi command. Which, to compound the injury, will probably get executed, since command mode is the default vi editor mode. In Emacs, the normal mode is data-entry mode, so at worst you generally can just delete the inserted text and grab a Kleenex.

Emacs also has the additional virtual in that it's easier to run in an independent window, so when I want to do an edit-and-test cycle on a script, I can spawn an Emacs session from the same command window that I'm running the test script in. Vi's natural state is to own that window, so it's a series of start-vi, edit, save/quit, test, repeat. Of course REAL Emacs diehards simply run the script inside a command-line pane within Emacs, but I don't usually have the patience for that.

The Emacs macro language is Lisp, so you can feel like an old-school hacker when customizing it.

On the mixed-blessing side, Emacs leaves behind a "before" image of the file being edited. This was more important back before git, when sometimes the best way to get out of a hole was to pretend you never dug it. But all those backup files tend to clutter directories until you get around to deleting them.
 
Andrew Polansky
Ranch Hand
Posts: 310
18
MS IE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh no no no no no!


Tim Holloway wrote:The bad thing about vi is that if you sneeze while seated at the keyboard, you've probably managed to press random keys, and just about any random key sequence is a (probably dangerous) vi command. Which, to compound the injury, will probably get executed, since command mode is the default vi editor mode.


I agree that hitting random keys in command mode may lead to weird things, but it's nothing that couldn't be undone by hitting "u" (undo) or ESC button to cancel the current command.

Tim Holloway wrote:Emacs also has the additional virtual in that it's easier to run in an independent window, so when I want to do an edit-and-test cycle on a script, I can spawn an Emacs session from the same command window that I'm running the test script in. Vi's natural state is to own that window, so it's a series of start-vi, edit, save/quit, test, repeat. Of course REAL Emacs diehards simply run the script inside a command-line pane within Emacs, but I don't usually have the patience for that.


Here I disagree completely. In vim you can easily spawn new windows, tab, split windows and so on. There are also powerful buffers that allow you to edit the same file in several windows. You can spawn bash or anything else inside vim as well. And you don't have to save/quit vim at all. You can simply send the process to background (CTRL-Z), do your stuff in the terminal, and bring the process back to foreground (fg command). You can use terminal multiplexers like tmux to switch between terminals in a single terminal. The two last mentioned things are vim unspecific and would work with any software.

Tim Holloway wrote:The Emacs macro language is Lisp, so you can feel like an old-school hacker when customizing it.


You can script vim with lua, perl, python, scheme (lisp dialect), ruby and tcl.

Tim Holloway wrote:On the mixed-blessing side, Emacs leaves behind a "before" image of the file being edited. This was more important back before git, when sometimes the best way to get out of a hole was to pretend you never dug it. But all those backup files tend to clutter directories until you get around to deleting them.


There are plugins and script available for such functionality.


 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Adam Scheller wrote:Oh no no no no no! ...


Actually, you're all wrong. Real men who don't eat quiche use sed. No poxy screens or arcane keystroke combos to think about; just plain honest-to-god command lists that can refactor entire Java projects on the fly with a few judicious regexes and globs.

Now that's power, my friends.

Winston
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ESC : q !

Whenever I need to edit a few lines in a config file on Linux, I use nano. It's easier to use than either vi or Emacs if you don't have the key sequences for those editors in your head.

Otherwise I use Gedit or Geany on Linux, or Notepad++ on Windows.

I'm sure vi and Emacs work well for the people who are used to those editors and who know all the commands, but I don't believe those editors have something magical that makes you much more productive than with any other text editor.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Last vote in cow poll was on March 1, 2017
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    Bookmark Topic Watch Topic
  • New Topic