13 ms·
From Vim to Emacs
- Animats 12y agoHaving used EMACS all the way back to the original Stanford SAIL machines (with a physical META key on their custom keyboards) I still don't want to use it.
- unclebunkers 12y agoI firmly went the other way a few years back, and haven't regretted it. Looking at this how-to, I have no real urge to back, though it is a good writeup.
- hello_asdf 12y agoAs someone who has always used vim, what are the benefits of this system over a standard vim installation?
- michaelsbradley 12y agoYou get a computing environment which "breathes" Lisp[1] and is itself mostly built up from a fully hackable Lisp codebase. I can highly recommend Bozhidar Batsov's Emacs Prelude[2] as a nice foundation for building a personalized configuration. Just fork it and put your personal .el files under the "personal" subdirectory; then "git fetch ... && git merge" to keep up to date with improvements committed to the author's repository. [1] http://en.wikipedia.org/wiki/Emacs_Lisp http://en.wikipedia.org/wiki/Emacs_Lisp [2] https://github.com/bbatsov/prelude https://github.com/bbatsov/prelude
- mahmoudimus 12y agoI disagree re: forking it, I think there's a lot of stuff that continues to be a bit of a pain to manage, but it's a good first start. I think my approach re: prelude is a bit cleaner. See this: https://github.com/mahmoudimus/.emacs.d https://github.com/mahmoudimus/.emacs.d This allows an easy to back up to github while still maintaining easy update access to prelude.
- Derbasti 12y agoYou get access to things like org mode and magit and deep REPL integration and an integrated package manager. You get the ability to configure absolutely everything in elisp. Many experienced Emacsers routinely write small snippets of elisp to automate some task. This goes well beyond adding a key bindings here and there, or the odd macro, and is really amazingly powerful.
- omellet 12y agoCan't you do the same thing with vimscript (or python, if you're using +python builds)?
- Derbasti 12y agoNo. This has been discussed ad nauseam already. Vimscript offers a limited API to some functionality of Vim. Emacs is written in Elisp, and thus, everything is accessible and changeable in Elisp. What is more, Emacs and Elisp were designed from the ground up with malleability in mind.
- SmileyKeith 12y agoI love seeing this on the front page. I've been a Vim user for a few years and feel like there isn't a ton of help out there for switching to emacs + evil.
- euid 12y agoHere's my migration guide from early September, if you're looking for more resources: http://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-config.html http://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-c... Bling, who I've linked to in that post, has repeatedly made quality posts about making the transition: http://bling.github.io/ http://bling.github.io/
- laichzeit0 12y agoI should probably write a blog or something about this since I've spent quite of time getting Emacs to behaving like Vim with Evil. I went the Prelude route, because it included a lot of cool things out of the box and I felt like I could just customize it a bit. My main goal was to get an Emacs environment that behaved like Vim for working through the SICP using the Geiser plugin. There's surprisingly little that has to be customized to get a well-behaved Emacs. Here is my prelude customizations: https://github.com/humana/dotfiles/blob/master/emacs/personal/custom.el https://github.com/humana/dotfiles/blob/master/emacs/persona...
- cnp 12y agoI began using Vim about a month ago and it has been totally revelatory to me, and believe quite honestly that it was the best career decision I've ever made. The one thing, however, is its speed. MacVim gets very slow sometimes, particularly with buffers. So my question: How does Emacs and Vim compare speed-wise? I come from a Sublime Text background and really miss the ability to quickly navigate between tabs (buffers in vim), and sometimes it takes a full second.
- bdamm 12y agoEarly in my career I did a self-study of the entire vim user manual. My time has been repaid over and over, every single day, ever since. Normally vim is very snappy for me. Perhaps you have a ton of plugins that are clogging up your installation? Or perhaps just one very badly behaved plugin?
- mrpollo 12y agoI've been using MacVim for close to 3 years now w/o any slowness, CtrlP (plugin) sometimes gets buggy with large projects but aside from that buffer navigation is always good, but then again I'm running on SSD and maxed out ram on my mbp. I also use Janus https://github.com/carlhuda/janus https://github.com/carlhuda/janus so i might be a victim of improvements made by them. Speed is the #1 reason I switched to Vim
- brandonmenc 12y ago> it was the best career decision I've ever made I hear this a lot, and I'm not debating whether it's true or not since ymmv. I'm curious if anyone here has gone the other way. I used vi in my teens then switched to emacs, which I used for over a decade. A couple years ago I switched to JetBrains IDEs and have never been happier. I hadn't used an IDE since Borland Turbo C, and forgot what I was missing. Are there any other former vi/emacs users (like, hardcore - I used to browse the web in emacs) who ditched it for an IDE? I found that the mouse really wasn't a productivity killer for the few times you need to use it in a modern IDE.
- crazypyro 12y ago
- geoffc 12y agoAn age old debate and both are great! I used Emacs for a decade plus and on a whim spent a vacation re-programming my fingers for Vim and stuck with it as it felt slightly faster, not sure it really makes a difference :-)
- sriram_sun 12y agoI used Emacs for 4 years in school and was pretty comfortable with it. Couldn't use it when I was logged on to some server at my first job. Picked up vim .. use vimperator on firefox. Been using it for over a decade now.
- TallboyOne 12y agoImpossible.
- callesgg 12y agoIf you want to use emacs as if it was vim why change? Personaly: I try to use my console editors as vanila as posible so that I can feel right at home directly. Kind of the exact opposite of this :)
- rtpg 12y agoThe only thing I really like in vim is the modal editing. Evil replicates all that stuff really well in my opinion. Plugins in vim are usually pretty poor compared to emacs, and vimscript is frustrating. Emacs Lisp is at least a consistent language, and one that I can figure out how to use much better.
- vsbuffalo 12y agoI thought this was the case too, but YouCompleteMe is really terrific for Vim! I wish emacs had something similar.
- michaelsbradley 12y agoHave you tried company-mode? http://company-mode.github.io http://company-mode.github.io
- vsbuffalo 12y agoThis looks great! I can use Emacs again!! Thanks!
- sjm 12y agoHaven't actually tried it, but I've come across https://github.com/abingham/emacs-ycmd https://github.com/abingham/emacs-ycmd before and it looks decent? I also use autocomplete-mode which has a bunch of hooks for pretty much every language under the sun. I have it set up with jedi for python and clang for C/C++/Obj-C.
- nocman 12y ago"If you want to use emacs as if it was vim why change?" -- to get all that juicy goodness that is the emacs environment, that's why. Emacs is far from perfect, but there are a lot of things to like about it -- especially if you want to interface with Lisp or Lisp-like environments (Common Lisp, Scheme, Clojure, etc). Emacs does a better job of interacting asynchronously with other processes -- which is one of the reasons it is better for use with Lisp-like environments. I've used vim for over 15 years, and I still use it daily, but I prefer the emacs/evil environment for anything where I want to interact with a repl from inside my text editor.
- m45t3r 12y agoI made a similar switch to SublimeText, at least for programming tasks (non-programming tasks I still use vim since it works with just a terminal). Vintageous has a much better vim emulation than Vintage (the default vim plugin to ST), and ST has lots of interesting plugins. And I can use both modal and non-modal shortcuts (I use, for example, Ctrl+S to save rather than Ex-mode's :w since I find it less disruptive for my workflow).
- ojbyrne 12y ago"I'm totally addicted to modal text editing to the point that I feel crippled when I've to edit text in a non-modal editor...but if you can imagine somebody programming on an on screen keyboard on a tablet, you know how modal editor users feel about non modal edition." And vice-versa.
- deleted 12y ago[deleted]
- dlau1 12y agoBravo man, I tried to make the switch from vim to emacs evil and failed horribly. I would eventually throw emacs into a state where it wasn't in any of the evil modes, then bash my keyboard with C-X C-C. Is it possible to use emacs+evil without knowing emacs inside and out? Emacs with evil, without a doubt, runs so much smoother while editing large projects. The biggest point is that asynchronous operations are a lot easier to perform in emacs. You can get close to it with plugins like vim-dispatch or vimproc, but they always felt like a second class solution to me. You get cool stuff like search/replace preview and super smooth async operations in the background (like on the fly linting with flycheck). In the end, I'm still using vim. Unite with vimproc is "good enough" for me. For me, the only real place where async operation is a huge problem is with file search operations. Every few months I try to use emacs for a day, maybe next time it will stick :)
- hsitz 12y ago>> I would eventually throw emacs into a state where >> it wasn't in any of the evil modes, then >> bash my keyboard with C-X C-C. I think the snippet of code in linked article in section 'Escape . . . escapes things' fixes most of the situations where you'd get stuck in a non-Evil mode in Emacs. It's a must have for me, otherwise I too got frustrated with getting stuck in Emacs minibuffer/command line and <esc> not getting me back to Evil-mode in main buffer. I also turned off the bell in Emacs, which helped psychologically.
- dlau1 12y agoI think the main problem is that in vim everything works like a buffer. When I browse files or any sort of search results, I can use the standard vim key bindings to navigate through or even dismiss the window. With emacs, it seems like I have to learn the system to even use some plugins like projectile effectively.
- aerique 12y agoIt is possible to use Emacs + evil without knowing Emacs inside-out, but you do need some basic Emacs knowledge. If you had to do C-x C-c when entering a non-evil mode, you did not have that basic knowledge :-) The least you should do is the tutorial that's presented on the startup screen or "M-x help-with-tutorial".
- bch 12y agoI used to be all vi all the time. One day I figured I ought to learn emacs. I don't remember what the exact impetus was, but I gave myself an 8 week challenge to use nothing but emacs. For the next ~7 years, I pretty much used nothing but emacs, and it was enlightening to work with text in the emacs concept, and to witness emacs' implementation of its concepts, and all the excellent modes that authors developed within its framework. Fast-forward to about 4 months ago, and I thought: "My vi-fu isn't at the level of my emacs-fu", so I gave myself an 8 week challenge... If anybody were to ask me "should I learn emacs or vi?", an appropriate answer would be "yes." They're both awesome, and you can learn both. Go for it.
- naner 12y agoBy default, most themes look like shit on terminal Emacs (emacs -nw if you don't want the window to open). Since he appears to be on Linux, another way to solve this issue is to use a terminal that supports 256 colors. urxvt and Xterm both have 256 color variants.
- mattvvhat 12y agoyo why is anyone reading this kind of shit
- mattvvhat 12y ago-_- seriously how much can we talk about vim and emacs
- Tenhundfeld 12y agoI think you're just trolling, but I'll respond as if you're sincere. Software developers spend hours every day writing code, dozens of hours each week, hundreds of hours each year. It's only natural to care about the tools you spend hundreds and thousands of hours using. We talk about vim and emacs so much because they are the most powerful popular editors, in terms of being flexible and customizable. There's a limit to how many "editor workflows" one can use with Sublime (though Sublime is great) or Visual Studio or XCode or whatever. Not so with vim and emacs. They both also have decades of plugins and hardening. It's only natural that developers who prefer OSS and jump around amongst different languages and platforms would gravitate towards vim and emacs. Those of us who love one of those two editors (vim, in my case) are often very curious to see how the other side lives, what workflows they use, etc. That curiosity is a great thing. Trying to improve your skills is a great thing. Stop complaining about it. If you don't care or maybe used to care but are now soooooo over it, then just don't freaking open the comments, right? This topic is totally germane to HN and interesting to many of us.
- mattvvhat 12y agoYou know, I agree that I shouldn't care. That was a momentary sentiment. Either way, I use vim, and, as a result, I have to listen to pro-and-con debates unwillingly... all the time. At the time, this was an example. In actuality there is no right answer to what browser is best. Personally, I think vim is fast and easier-on-the-hands than emacs. In particular, I never have to lift my hands from the main row, where in emacs I too-frequently have to press combinations of keys and shift my positioning. This all comes from someone who originally used emacs, then converted to vim.
- DAddYE 12y agoI'm a vim (loser[1]) and terminal (power) user for 7+ years. Two things comes to my mind when we talk about emacs and other editors. The Terminal! In particular iterm.app Basically with iterm and vim, I'm on osx close to a i3 on linux. Vim works perfectly inside a terminal (no need to remap meta). We have terminals on android, ipad etc... I love working in a terminal because... well, is where I spend most of the time. Running ruby, compiling go, js, logging on a server, running a script, tailing logs... [1] loser because my vim is "modern" so with mouse, arrows and so on...
- aerique 12y agoIt's not quite the same but since Emacs is primarily an OS it has window managements build in, so by running it fullscreen and making a bunch of horizontal and vertical splits you get pretty close to i3[1] as well. The only problem is terminals. You can run them inside of Emacs, but there's always issues. You can run eshell[2] which is wonderful. Myself, I prefer to use terminals outside of Emacs. [1] my development OS is Linux and I run i3 [2] http://www.masteringemacs.org/articles/2010/12/13/complete-guide-mastering-eshell/ http://www.masteringemacs.org/articles/2010/12/13/complete-g...
- b3n 12y agoBut Vim has window management built in too, with splits, tabs, buffers, etc.
- endlessvoid94 12y agoI was a vim user for years. I accepted a challenge from the programmer who sat next to me (an emacs user): we'd swap editors for a week. Every time either of us swore or complained about the editor, we'd pay the other a dollar. That was 2011. I've been an emacs user ever since.
- paufernandez 12y agoWhat about the other guy?
- endlessvoid94 12y agoGood question! He switched to vim due to RSI I believe. Conclusion: neither is better. I think.
- notfoss 12y agoAnd you switched to emacs due to RMS ;) Jokes aside, during the 1 or 2 weeks that I forced myself to use emacs (a few years back), I felt that I would get RSI because of the painful default keybindings. Of course, I didn't know of evil back then, so I returned back to using vim.
- GeneralMayhem 12y agoMap caps lock to control and it gets a lot better.
- Attic 12y agoOr use god mode!
- huehue 12y agoThe "problem" with vi is that you'll outgrow it very fast. People tend to work around this by installing a dozen of plugins but I think you should use Emacs for that. I'm quite proficient in both editors and while I resort to Emacs for 95% of my coding (and mail, and notes, and agenda, and...) sometimes nothing beats the simplicity of firing up vi for a quick edit in a remote server. Using vanilla vi with a minimal to non existent .vimrc can be liberating.
- chongli 12y agoHuh? vi does not have any plugins; only vim. vi is even more bare-bones than vim, lacking a lot of features (macro recording and text objects being the ones I miss). It is extremely common to find vi pre-installed on countless servers, however, making it extremely convenient if you're an expert with it. What's amusing to me is how many people don't know vi very well and use plugins in vim that vi can handle as well or better through macros, ex scripts or external commands.
- clarry 12y agoThis bothers me. People should just call it vim when they mean vim. I suspect most people here haven't actually touched Joy's vi or its closest derivative, nvi. I don't know where this practice comes from but it feels exactly the same as when people say Unix when they are very obviously talking about GNU/Linux.
- falcolas 12y agoIt probably comes from the fact that most people alias vi to vim. And from the fact that when you type vi, you're probably not getting vi, but vim in full compatibility mode. These actions make the two interchangeable in people's minds.
- deleted 12y ago[deleted]
- unhammer 12y ago"With Vim I had defined a keybinding that selected the last pasted text. It was useful when you wanted to reformat or indent text that you've pasted from somewhere. At the moment I've been unable to reproduce this in Emacs." - in non-evil-mode at least, C-x C-x will reselect what you last pasted if you haven't moved. What really happens is that when you paste, the "mark" is set there (equivalent to doing C-SPC), and C-x C-x will switch point (your cursor) and the mark. However, if you want a function that works even after you've moved around a bit you could do e.g. (defadvice yank (around advice-yank-set-vars activate) (setq yank-last-start (point)) ad-do-it (setq yank-last-end (point))) (global-set-key (kbd "C-c C-y") (defun select-last-yank () (interactive) (push-mark yank-last-start) (goto-char yank-last-end) (activate-mark))) although this'll fail if you've inserted text before the yanked text (I suppose you could do it more correctly by setting text-properties, but that's getting rather advanced)
- klibertp 12y agoNo need for text properties, just make "yank-last-start" and "yank-last-end" markers instead of simple ints (https://www.gnu.org/software/emacs/manual/html_node/elisp/Markers.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Ma...) - they will be moved automatically with every edit.
- unhammer 12y agoOh, nice, I suspected there was a better way :-)
- BostX 12y agoI've been using evil for ~2 year but I learned something. Thanx!
- bnolsen 12y agovim is already too slow (i typically code edit with elvis which is good but not for huge text data files). evil's lagginness is utterly maddenning. and emacs isn't typically installed everywhere. i'm a multi terminal user who typically works remotely via ssh, remote usually being over a gigabit connection. I can probably burst 120+ wpm and yeah watching other people code is typically very painful. And I don't use plugins, thats what a posix shell is for.
- colbyh 12y agoIf we're being pedantic, Vim isn't installed everywhere either. Vi is, of course, but if you're evangelizing the benefits of the posix shell over vim-specific plugins I can only assume you didn't mean to :%s/vim/vi/ before hitting reply ;-).
- msoftware 12y agoIf anybody would ask me "should I learn emacs or vi?" My answer is "lern vi!"
- erikb 12y agoI always have a hard time figuring out why people would switch from one tool to another just to start configuring the other to behave like the original tool. Can someone name some reasons to switch from vim to a vim-like configured Emacs? The reason I've seen mentioned by the author is to learn the other tool, in this case Emacs. But for that I think the smarter way would be to learn to use Emacs like Emacs users do it. There's a reason why things are implemented differently, right?
- Sirenos 12y agoEmacs isn't superior to Vim in every possible way. I personally find Vim's modal editing hard to let go of. On the other hand, vimscript is an atrocity compared to Elisp. Vimmers have certainly managed to make some amazing extensions to the editor despite that fact, but no tool is perfect; the whole point of an extension layer is to make the tool work the way you want. The defaults aren't necessarily what everyone likes (or ought to like).
- mercurial 12y agoThis may change with Neovim, though, since add-ons will, as far as I understand, exist separately and do IPC through JSON.
- Quasimoto3000 12y agoBut you can get Vim's modal editing with Emacs'evil-mode.
- mercurial 12y ago> Can someone name some reasons to switch from vim to a vim-like configured Emacs? You're attached to modal editing but you want some of the Emacs plugins and a less terrible scripting language.
- deleted 12y ago[deleted]
- splawn 12y ago
- mariocesar 12y agoI'm vim guy and I started to watch http://emacsrocks.com/ http://emacsrocks.com/ There are another similar sites?
- noelwelsh 12y agoI don't know of any. However the Reddit community http://reddit.com/r/emacs http://reddit.com/r/emacs is pretty good for linking to any videos / tutorials / interesting new packages that come up.
- odc 12y agoYou guys need to start doing some real work instead of playing with your editor all the time...
- sornaensis 12y agoThat's kind of a poor attitude to have on a forum about -hacking-. :P
- lcedp 12y ago> I don't miss any text command, operator, motion or work flow from Vim. Marks, paragraph reformatting, visual mode, visual block, macros, registers, text objects, splits (vertical, horizontal, :normal, folding, etc)... it has almost everything. Tried for 10 minutes and found out it has not g-/g+. (still awesome)