13 ms·
Heretical Confessions of an Emacs Addict – Joy of the Vim Text Editor « /usr
- thingie 15y agoSo I use emacs with viper and it's great. I have no idea how to really edit text in emacs without vi mode and I can't open a file in vim without :q and running it again with a different argument. Yet I can edit text vi style and use superior (to vim) and convenient emacs features like modes, tramp, buffer management, org-mode…
- markokocic 15y agoYou can try elvis. I havent tried it myself, but I heard it being a continuation of viper and vimpulse efforts.
- nyellin 15y agoYou mean evil: http://gitorious.org/evil http://gitorious.org/evil
- Marwy 15y agoI've been using it for only few days, but I think evil and Emacs makes a really nice enviroment. I finally managed to get capslock to be the key for evil-normal-state (default is ESC) and the world is a better place now. I recommend giving it a shot :-).
- vilya 15y ago> I can't open a file in vim without :q and running it again with a different argument. :e filename
- swah 15y agoI have the same feeling, that both worlds are appealing. Vim being "Just focus, don't go meta improving your tools your filthy procrastinator" and Emacs being an "comfortable playground". "How is that algorithm again? Let me try something in elisp on the scratch buffer." I'm trying to use Sublime Text these days (won't ever have Slime to develop Clojure, though).
- muxxa 15y agoI just can't get vim's modes - I'm constantly unintentionally entering keystrokes in the wrong mode, especially when I'm concentrating on what I'm doing. Of course emacs also has annoying modes, e.g. if you change your mind half way through a key combination, you are stuck in a mode. Ctrl+G gets you out of it with the result that I'm constantly pressing Ctrl+G in emacs before I do anything to avoid the sting of keystrokes being thrown away. I'm still waiting for Jef Raskin's modeless editor (there was a project called Archy which is now abandoned).
- groovy2shoes 15y agoPressing escape in Vim will put you back in command mode.
- muxxa 15y agoYes, I know how to use the editor and use it moderately. I'm saying there's something fundamentally unlearnable about modes for me as I keep making mode related errors after years of using both emacs and vim.
- chalst 15y agoI have the same trouble when I use unconfigured vim. It gets rather better when I give vim stronger visual clues as to which mode it is in, which I seem to remember for no more that 2 seconds otherwise. The following scripts give the general idea of how to do this: 1. http://vim.wikia.com/wiki/Change_statusline_color_to_show_insert_or_normal_mode http://vim.wikia.com/wiki/Change_statusline_color_to_show_in... 2. http://www.vim.org/scripts/script.php?script_id=3165 http://www.vim.org/scripts/script.php?script_id=3165 Also, I gather than the Gnome Vim's colorscheme support allows you to affect the appearance of the whole window, not just the status line or whatever. I don't use it, though.
- stevelosh 15y agoThe solution to this is that when using Vim properly you're always in normal mode except for short bursts of typing. Don't hang around in insert mode. Need to think for a second about what to type next? Get out of insert mode, think, and then enter insert mode again. The result of this is that "insert mode" stops being so much like a separate mode and starts feeling more like a command itself! It's the difference between: move over a word enter insert mode type "foo" exit insert mode move back a word and move over a word insert the word "foo" move back a word
- obiterdictum 15y agoI apologize in advance for this ode to Vim, but I feel I should get it off my chest. I admit, the main reason for me to develop in Vim these days is to simply minimize the number of keystrokes I have to press (and the number of times I have to reach for the mouse), because, due to RSI, I experience a mild, but constant, and noticeable discomfort in my wrists (...and triceps, and shoulder) whenever I type (I distinctly remember I developed it in Eclipse during my Symbian C++ development internship). I honestly tried Emacs a few times because of superior Lisp editing, but it just didn't stick, I just can't bring myself to press more keys than I use to in Vim. Force of habit? Maybe. I have never expected to be "hooked up" on Vim, but I was. In my first job out of the university I was writing Linux-based embedded software almost exclusively. I could never get used to Linux GUI editors after Visual Studio: the lack of any built-in IDE features and constant switching from the editor to the shell made me switch away to something closer to the shell. The initial discomfort of modal editing was less annoying than the lack of features and the accessibility of shell in Linux GUI editors (Eclipse CDT was a pain to set up and use back in these days). Then the discovery of split windows, regex replacement, folds, macros, ex-mode commands, and extensions made my experience what I then thought tolerable. The mechanical memory had set in, and, upon moving on to my next job, I discovered that I could no longer use Visual Studio with as much comfort as I used Vim! It was curious, since I've "grown up" as a programmer with Visual Studio in the 4 years at the university. It has snowballed further since then: remapping ';' to ':', ZQ and ZZ shortcuts, quickfix window, copy-paste registers, more motions with text objects ("delete between {}", "move to next ','", replace "()" with "[]", indent 4 line with "4>>"), sorting selected lines, coming up simple with ad-hoc refactoring functions and macros on the fly, marks, buffer greps, jumping between files with LustyExplorer an NERDTree, plugins (VimScript must die, but while it's there, it does the job), and falling back to the shell where Vim falls short. A few vimgolf (there is a site for this) challenges also added some tricks into my toolbox. Right now I use Vim whenever I can. It does show its age, especially in areas like REPL, IDE features and code completion (it'll get there, eventually, I hope), but I just don't feel at home using anything else at the moment. I'm always on the lookout on the future of Vim or its next successor. PS: Disclaimer: I don't necessarily advocate for everyone to learn Vim, it really requires a non-trivial investment of time to establish the necessary mechanical memory, but it was worth it for me personally (I do C, C++ and Python almost exclusively). Depending on your domain and the technology you use, you may be better off using Emacs (Lisp) or VS with Resharper (C#).
- chalst 15y agoI noticed recently that you can use the ex commands in Emacs without converting the whole editor over to Viper. This is really the part of vi that I find attractive. Notes: http://www.advogato.org/person/chalst/diary/277.html http://www.advogato.org/person/chalst/diary/277.html That said, vim's command set is a superset of ex, and includes some nice things that the above misses.
- mnemonicsloth 15y agoAren't Emacs and Vim basically the same editor at this point? There are some stylistic differences, which can be surprisingly subtle, like the differences between acoustic and electric guitar. But pretty much every other editor these days wants to be an MP3 player. Today's editor war is between (a.) technical people who expect to spend many hours a day manipulating text for the next few decades, and (b.) people who don't ever want to think about text editing because it seems low-level and boring.
- nyellin 15y agoNo. Not in the least bit. Emacs is an interactive Lisp interpreter. Once you realize that you can change function and variable bindings on the fly, you can do anything. Vim is "merely" an editor with an acceptable scripting language and incredible keyboard shortcuts. The shortcuts have survived for 40 years due to their ease of use and intuitive nature. The only similarities between Vim and Emacs are their ages and the fantastic communities surrounding each of them.
- mnemonicsloth 15y agoThe only similarities between Vim and Emacs are their ages and the fantastic communities - both require a large investment to achieve mastery. - both deliver excellent return on that investment. Proficient use "looks like magic." - both include (seriously underrated) tutorial software to get new users up and running. - both are still described as "hard to learn" by people who don't use them. - both have more popular competitors that are less capable but easier to pick up and use without thinking about it (various IDEs for Emacs, pico/nano for vim). I don't know what your problem is here, but you'd do better stating it outright. As it is, you're just embarrassing yourself. If age and community are the only similarities between Vim and and Emacs, the one of them is not a Unix text editor.
- Ixiaus 15y agoYou are being too emotional about this conversation between you Nyellin. Your original post was flawed - whether it was your understanding or the way you wrote it (I don't know which). - both require a large investment to achieve mastery. You don't have to achieve mastery in order to be productive in Emacs and Vim!!! Use Emacs for a solid month and you will be productive in it (like wise for Vim). - both deliver excellent return on that investment. Proficient use "looks like magic." This is true (of more things than just Emacs and Vim). - both include (seriously underrated) tutorial software to get new users up and running. This is also true (of more software than just Emacs and Vim). - both are still described as "hard to learn" by people who don't use them. Because most people have commitment issues and would prefer their IDE's (just like people who don't know how to use the terminal all of the Unix tools (sed/awk/grep/&c... complain it's "hard to learn"). - both have more popular competitors that are less capable but easier to pick up and use without thinking about it (various IDEs for Emacs, pico/nano for vim). There are no competitors to Emacs and Vim that I'm aware of (the only one to Emacs I can think of and it still isn't a competitor is Yii); IDE's aren't even in the same camp - IDE's are more project management than editor. [edit] I take this back, there's one piece of software I remember vaguely that is trying to be an IDE with Emacs/Vim style editing, I'm not sure if it provides the type of editing functionality Emacs and Vim do though. I don't know what your problem is here, but you'd do better stating it outright. As it is, you're just embarrassing yourself. If age and community are the only similarities between Vim and and Emacs, the one of them is not a Unix text editor. You're actually the one embarrassing yourself, not because of your lack of knowledge but because of your response! Nyellin gave a perfectly good comment to your flawed comment and you reacted emotionally instead of rationally. Your reasons above for why they are similar are very much moot points - most of those points can be said for many things other than text editors. See my comment for why they ARE DIFFERENT; Nyellin could have gone into more depth as to why they are different, but ultimately he's kind of right. They have both been around forever, they both have HUGE, vibrant, and passionate communities, and they both edit text. Please note, we are talking about "text editing" and not the gobldegook that is IDE "project management" (IDE's aren't proper text editors, they are stunted text editors).
- grayrest 15y agoAny discussion of Vim that lacks mention of text objects is under serving the editor. Text objects and repeat are by far the best features of the editor.
- yesimahuman 15y agoI'm curious if the speed difference between counting how many times to repeat a command versus using movement/visual block/etc. is big enough? I find the "repeat-n-times" modifiers require a lot of thought before I know what number to put before the command. I do consider myself very fast with Vim, but the repeat commands haven't done much for me.
- Symmetry 15y agoLikewise. I very, very seldom find myself using repetitions. I mostly use simple commands or text objects, and when those don't cover some weird case I fall back to visual mode. Occasionally I know I want to delete just 2 words and so use d2w or something, but that's so rare I really notice when it happens.
- robertskmiles 15y agoThere's a great deal of power in '.', which repeats the last command. So if you have to do something 12 times, your steps could look something like this; - Run the command once - Think "Hmm, looks like I have to do this about ten more times" - Type '10.', repeating the last command 10 times - See that there's only one left to do, since you guessed 10 and it was 11 - Press '.' one more time to do the last one You won't win any vim golf competitions like that, but it's very easy to do.
- Amnon 15y agoActually, 10. doesn't necessarily repeat the last command 10 times, it just runs it again with an argument of 10. For example ">>10." will indent the current line and then indent it and the following 9 lines. I still haven't found an easy way to indent a line N times without pressing ">" 2N times...
- ddfisher 15y agoActivate visual mode first. In visual mode, the argument is used for the number of indents (because the lines to indent are selected visually). So to indent the current line 4 times, type: "V4>". Happy vimming! :)
- drv 15y agoWhat's up with the angle quote /usr in the title?
- koenigdavidmj 15y ago/usr is the name of the blog, and the title of the HN item was pulled from the title of the page (likely by the submit-to-HN bookmarklet).
- agentultra 15y agoI went the other way around. I was a long-time Vim user (around 10 years or so) and switched to Emacs in order to use Lisp + Slime in order to win an argument about Lisp. What's important is that I lost that argument, like Lisp, and use Emacs as my primary editor now. However, the Vim keybindings are still etched upon my soul so I still find myself popping it open for quick-and-dirty edits. They're both good editors and I like the conclusion of this article.
- tikhonj 15y agoI'm also an Emacs user, but I've been curious about Vi. Have you tried using Viper? As somebody with experience in both, do you think it's something worth trying?
- agentultra 15y agoI'm not going to bother asking why Vim/Vi is interesting to you, but in answer to your question: No. I immediately went for the Viper-mode Vi emulation and it's not good. Go whole-hog. Just dive into the deep end and start swimming. The reason for that is that the emulation layer lives in a limbo that is half-emacs-half-vi. The modes don't work the same way. And I'd be wary of falling back on Emacs instead of learning the Vi way. If you really want to try to transition to a new editor, I would open up a fresh install of Vim and start with the in-editor tutorial.
- owenmarshall 15y agoThese "I've used vim/emacs and decided to try switching..." articles always leave me cold. I mean, both are insanely powerful editors. It's not as if there is something one can do that the other cannot, and if there is, it's doubtful that a user would want to -- for example, I don't think vim has a built in email client, but the vim users I've talked to laugh at the idea of an email client in their editor. As a result, all of these "I've switched" articles begin with a comparison of modal and non-modal editing, discuss some pros and cons of both, and end with the same conclusion: both are great editors! Where's the beef?
- rbxbx 15y agoWhile I generally agree with your sentiment, I will say that I use http://danielchoi.com/software/vmail.html http://danielchoi.com/software/vmail.html Vmail (vim-gmail) daily and quite like it. Some of us don't mind Vim throwing in the proverbial kitchen sink :)
- eridius 15y agoI used emacs for a while, but fairly recently I switched to vim for one simple reason: opening speed. Emacs always takes a while to launch, but no matter how many plugins and whatnot I install in Vim it always launches instantly. And that, to me, is worth learning a new editor.
- BCM43 15y agoAre you opening emacs with -nw? That will load it within the terminal, like vim. It loads within a second for me, and I have a sizable .emacs.
- eridius 15y agoMost of the time I'm just running /usr/bin/emacs which is non-GUI by default. A fast boot for me is about a second, a cold boot is a couple seconds. That's acceptable if I'm doing editing that will take a while, but it's interminable when I'm expecting to pop in and out of the editor frequently (e.g. writing very quick git commit messages). Vim's fast boot is near-instantaneous, and the cold boot is less than a second.
- gmartres 15y agoLaunch it in server mode at startup then use emacsclient: http://www.emacswiki.org/emacs/EmacsClient http://www.emacswiki.org/emacs/EmacsClient
- eridius 15y agoI don't like that because it forces all of my editing into one terminal window (or into GUI emacs if I use that as the server). I want to be able to pop open emacs in other terminal windows quickly.
- president 15y agoDoes anyone here use Dvorak + Vim? I've wanted to try out Vim really bad but not sure if the key bindings will make sense to my Dvorak fingers.
- erikcw 15y agoI used it without any problems for a number of years. Once the keystrokes make it into your muscle memory, you're off to the races.
- euccastro 15y agoSeconded. The direction keys (j, l, I think, and I forget which the other two were; I just kept the mapping from movement-of-fingers to movement-of-cursor) may not be as intuitive as they are in qwerty, but after a short while you just ingrain them in your muscle memory and it doesn't matter anymore.
- erikcw 15y agoI've been a vim user for about 10 years now. I've recently started using emacs for lisp/SLIME dev. The number one feature I miss when I'm in emacs land is vim's "i" and "a" commands. di" deletes everything between the double quotes. da" deletes everything between including the double quotes themselves It works with other matching pairs as well (ie di(, di[ di'). I use it constantly. I've searched and search, and have not been able to find an emacs equivalent.
- kroger 15y agoIn Emacs you have kill-sexp, that works for balanced expressions [1]. Despite the lispy name, it works for any mode. [1] http://www.gnu.org/s/libtool/manual/emacs/Expressions.html http://www.gnu.org/s/libtool/manual/emacs/Expressions.html