7 ms·
Why I can’t stop using Vim
- icantthinkofone 12y agoIt's unfortunate that, to me, the title implies there's something wrong with a person who still uses vim and nothing could be further from the truth.
- edanm 12y agoOh c'mon. Us vim users are seen as "those crazy people" by the majority of other programmers, and they have at least some point :)
- broodbucket 12y agoI am the only person in my office that uses Emacs. Everyone knows vim. Everyone loves vim. You think you're the crazy one?
- edanm 12y agoJokes aside, outside of certain areas which are fairly unusual, most programmers have never used vim OR emacs and I would guess that most don't even really know about them. It can be hard to imagine in the echo-chamber that is the online tech scene, but really most developers just use IDE's and get on with life.
- alwillis 12y agoWhat I’ve noticed in the Boston/Cambridge area is a resurgence of interest in Vim. I’ve been to companies where they are intentionally using Vim and not an IDE, even though they could. They have repos on GitHub (like https://github.com/thoughtbot/dotfiles https://github.com/thoughtbot/dotfiles) where everyone pulls down the standard Vim and other dotfiles and goes from there.
- icantthinkofone 12y agoThat's interesting. We all have our own circles we run in but every programmer I know uses vim or emacs except Windows users but, well, you know.
- farresito 12y agoI suffer from the same thing. I've gone even futher: I've customized my tiling wm to work with the vim keybindings; my file manager also works with those keybindings; I use vimperator, a firefox plugin, that has those keybindings... There's a lot of stuff that I wish were better in vim, but, at the end of the day, it gets my work done better than anything else out there, so I don't have any reason to move away from it. It works amazingly well with tmux (otherwise, I would be using emacs + evil -which I actually use for Clojure-). And I'm pretty excited about neovim :). They are doing an outstanding job.
- hyperion2010 12y agoYep. Pretty much every piece of software that I write for myself or use I write or customize so that it has vim style modes and keybindings. Keyboard input is still the highest bandwidth human computer interface (voice can't quite make it because error rates mean that the bandwidth actually ends up being lower), and modality is an excellent way to reduce complexity and provide simple cues that make it easy to compartmentalize and remember lots and lots of useful commands.
- disputin 12y ago"/ for searching (really, no other editor has made it this simple)" Well, it's really esc-/ which is no easier than ctrl-f. Or am I missing something? Edit: Same with "1G to go to the top of the file, G to go to the bottom" - esc-1-shift-g vs ctrl-home. Same with ctrl-end.
- deleted 12y ago[deleted]
- viraptor 12y agoI don't really agree about "esc". "Normal mode" is the normal mode as the name indicates. That's where you normally start from. It's the actual writing that's two characters more (start insert mode, write, exit). Unless you're just writing new file from scratch in one go, you're likely to be in normal mode a lot of the time. Also, shift is not needed for the beginning of the file. It's also "gg" for the first line / "G" for the last. Regarding the ctrl+home/end, I much prefer not using them. Simply because I switch between 4 different keyboards during the week and I don't know where home/end are without looking. (3 of them being laptops with wildly different layouts) gg/G are on the home row. That's much easier.
- nakkiel 12y agoWhat's ^Home / ^End? If it's moving to the beginning / end of a line there are vi shortcuts for that: ^ and $.
- disputin 12y ago"It's the actual writing that's two characters more (start insert mode, write, exit)." Makes sense. Asking for permission to type in a text editor feels counter-intuitive, but I'll give that a try.
- mcpherrinm 12y agoVim really is an editor: It's designed around changing existing text. Inserting new text is just one of the actions you can perform, and you can combine that action with other modifiers, like "5ifoo<esc>" results in foofoofoofoofoo -- 5 repetitions of "insert foo"
- gnuvince 12y agoI don't really understand the comment about etags; if you use ctags in Vim, you'll get the same kind of functionality. If you want something more advanced, Emacs has support for cscope and GNU Global which give you more features. Considering that he's interested in having something better than VimScript and wants org-mode, it seems that Emacs + Evil would really be the best fit for him.
- farresito 12y agoI've never had any problems with etags, either. I've always gotten the same functionality as vim. Maybe we are missing something.
- falcolas 12y agoI had this same problem: they function differently in evil mode than Emacs mode; for some reason evil does its own word boundary definitions for etags lookups, and it breaks up words on underscores. I dug into it, and it was some problem with evil's word semantics (that only existed for etags lookups). I ran out of energy to debug it further, and just went back to Vim. Regular etags called with the emacs bindings worked just fine, but switching contexts from evil mode was a pain.
- kornerstoane 12y agoThanks for quantifying it for me. I never dug in deep enough to figure it out. It always just felt "wonky" when I used. (That's an opinion, of course.)
- aidenn0 12y agoCould you mention this on the mailing list? I don't know if I'll have time to fix it any time soon, but someone else might, and that needs to be fixed.
- alwillis 12y agoIt’s great that people are so inspired by Vim that they continue to create new plugins, tutorials and websites like Vim Awesome: http://vimawesome.com http://vimawesome.com
- kornerstoane 12y agoThanks for the link. I checked it out today and was finally able to convert from pathogen to Vundle. The site gives you the exact strings to configure the plugins in all the major plugin managers. IIRC, it scans github looking for .vimrc files and indexes them to gather usage data. Very cool.
- VLM 12y agoOne feature he missed is its not as configurable, and in some situations that is awesome. So you're doing something weird, manually, but I repeat myself because if it was BAU you'd automate the whole process in puppet or similar. The local vim will work more or less like every other vim out there. Can't really say that with emacs. If you're traveling somewhere weird, vim is a great travel companion. Not because it can be compiled anywhere (lots of editors can be compiled anywhere) but because it works the same anywhere.
- kornerstoane 12y agoI think Vim is potentially as configurable as Emacs, but it is harder to do after you get past some basic key mappings and a few plugins. In all my exploring of Emacs, I never saw a .emacs that wasn't completely tricked out with custom stuff that only works for that user. Because of this, I believe you are correct - it's easier to work in a plain vi environment since we don't typically trick out Vim like our fellow Emacs users do with their environment.
- noelwelsh 12y agoFunnily enough, I'm going to other way: long time Emacs users, getting closer to switching to evil-mode (Vi emulation in Emacs). Doubt I'll ever leave Emacs though. As an aside, how does one keep up with Emacs package development? There is lots of stuff that's new to me (e.g. I just found out about company-mode). I'd like to have some way to have this information pushed to me, rather than having to go searching.
- broodbucket 12y agoWell, there's a myriad of blog posts about great packages for Emacs, so that covers everything pre-existing. Add MELPA to your package sources, then just M-x list-packages here and there and check out anything new that looks cool.
- S4M 12y agoYou may want to check r/emacs on reddit. People discuss about new packages there. If someone knows other resources, please let me know as well.
- farresito 12y agoevil-mode is actually pretty good. I've been using it for clojure (paredit is quite nice). Keep in mind, though, that not all packages are gonna work as expected (I had problems with multiple-cursors, for example). Something I would really recommend you: there are a lot of people in vim (like me) that have remaped the ESC key to a combination of keys (in my case jk); that is, by pressing j followed by k you go to normal mode (it's actually way faster than having to reach ESC). In vim, such thing is very easy; in emacs, you need to install the key-chord package, and something like the following would work: (require 'key-chord) (key-chord-mode 1) (key-chord-define evil-insert-state-map "jk" 'evil-normal-state) (setq key-chord-two-keys-delay 1.0) Relative numbers are very nice, as well. By the way, regarding company-mode, I think autocomplete is newer and it's what most people are using nowadays. I found out about a bunch of plugins through emacs live and prelude (and then switched to my own config). Take a look to other people's config on github :)
- spacemanmatt 12y agoEven now that I'm practically married to SublimeText, I can't stop using classic mode and I still sometimes end up in vim by force of habit.
- cm127 12y agoFirst you'll learn how to orientate around text quickly using normal mode, then you'll start playing with tabs, splits and buffers to search between multiple files, and then you'll start using registers to save phrases and regular expressions to search directories. At that point you'll never want to leave Vim again. :wq
- beaumartinez 12y ago:x (It's the same as :wq, but one character shorter.)
- philsnow 12y agoEven shorter: ZZ "Shift z z" is one key shorter than "shift colon x enter"
- virtualwhys 12y agoColon? That sounds painful, map it to some single keystroke. I use back slash on my tiny cherry keyboard. noremap \ :
- philsnow 12y agoIsn't backslash the default <leader> keystroke?
- virtualwhys 12y agoyep, have leader mapped to space ;-)
- Xcore 12y agoNo it is not the same. x only writes if not already written.
- virtualwhys 12y ago> then you'll start playing with tabs, splits and buffers I want to like vim's window management but it's pretty quirky, at times it seems to be following the principle of most surprise. Ideally one could use tabs (that aren't renamed to the buffer name when populating a named tab), splits, and buffers together in such a way that one's layout never, for example, collapses, leaving a single displayed buffer and N hidden ones, or a buffer getting cloned across 2 splits (the latter is pretty disorienting, unless I'm diff'ing versions of a file I don't ever want to see 2 versions of the code consuming visible screen area). Granted am only 3 days into the vim WM experiment here, lot's to learn...
- arooaroo 12y agoI know this is a minor point but using 'gg' to move to the first line is easier than '1G'.
- adolph 12y agoThe author started in vi, which has no gig as far as I can tell.
- a3n 12y agoAnd I use :0, which is consistent with :N to get to the Nth line, which I also use. (I know, :1 same, just my habit.) And I could use :% to get to the last line, for more consistency, but G is my habit there. Many ways to edit a cat.
- danford 12y agoI went back to Sublime after using Vim for a while but then realized I was going to have a terminal open 24/7 anyway so what's the point? Then I learned how to use a terminal multiplexer and now Sublime and other GUI editors just hinder my workflow. IMHO if you're a programmer you should know how to use a terminal to the point that you prefer it over most GUIs (of course, you should always use whatever has the feature you need). Oh, and on a side note: Vim and terminal usage is not a "time sink" and it pains me whenever I hear people who consider them selves "programmers" claim it to be. If you haven't learned how to use the terminal yet (or haven't found a use for it) then you aren't a respectable programmer IMHO. I would not read a book on programming by someone who doesn't know how to use a terminal and I would not take a class on programming taught by a professor who doesn't know how to use a terminal.
- oldmanjay 12y agoIn my opinion, other people's opinions about how I program are worth just about nothing. I'll never understand the sort of arrogance that leads to posting things like that. do you really believe you're so smart that you figured out the only way anyone should do anything?
- read 12y agoWhat I never heard explained in one sentence about vi is: why have multiple modes? Why not zero modes instead?
- dasil003 12y agoBecause as a programmer your time is dominated by editing rather than creating text, therefore it is more efficient for every key to default to direct access to an editing function.
- read 12y agoThat's too broad of a stroke on what a programmer does with text. It's not just about editing. It's also about (a) moving to the point where you want to edit, (b) moving to an other point right after you just finished editing. Switching between the two becomes harder when you always have to Escape, compared to having direct access to an arrow key. And (c) about editing. Why type an extra character (i for insert) to let you insert? Why not just type to insert?
- dllthomas 12y agoIn modern vim you do have direct access to the arrow keys. Rarely is this meaningful, for someone skilled in vim. It can potentially be faster if you need to move just a couple characters over, but if you need to move 25? It winds up being something like: Esc 22hhhh People navigate by jumping across words, across features, searching...
- read 12y agoI wonder if there's navigation modern vim doesn't offer. Can you tell if or how you can do the following in vim? In Emacs, Ctrl-<up arrow> moves the cursor ahead of a block of code. If you had a for loop for example, with a blank line where the for begins and a blank line where it ends, and the cursor was at the blank line where it ends, pressing the two keys Ctrl and <up arrow> would put you in the beginning. How would you do this in vim? Would you have to first gauge how many lines of text up you should move?
- dominotw 12y ago>q to record a macro; @ to execute it again Is using macros' really common? I haven't yet figured out in when and where to use macros during my workflow.
- moe 12y agoVim user of 18yrs here. I never use macros. Everyone uses a slightly different subset of vim, in slightly different ways. Don't worry about dogmas. Try everything out once, and keep what works for you!
- kornerstoane 12y agoI do a lot of work on multiple rows/sections/blocks of similar data. My workflow usually goes like this... 1. Do the same thing 3 times, realize that I'll be done faster if I automate it. 2. qz to record a macro into buffer z. 3. Do the work, taking care to leave myself in a state where the next invocation of the macro will pick up right where I want it to. 4. q to finish recording. 5. :map <M-f12> @z to execute buffer z 6. Hit Alt-f12 over and over until I'm done. Seems like a lot of steps, but it has saved me tons of time. Of course, as the other commenter said, some folks don't use the feature. That's ok. There's room for all kinds :)
- MichaelGG 12y agoMacros are fabulous! Any time you're going to edit multiple lines in the same way, bam! For instance, you've got a create table script, and want to turn the column defs into some code or type definitions. For me, macros are quicker than getting a regex right. Or perhaps you're cleaning up a file, and there's a few common changes. Pop each into a macro and go to town. The low friction aspect makes them more common than the name might sound.
- bnegreve 12y agoI use a text editor because using a text editor that you've mastered is pleasant. (I'm an Emacs user fwiw.) I think we should stop trying to rationalize this choice. Or rather, we should realize that we like text editors because we went through a long training and acquired complex skills which are fun to put in practice. Being a power user of Emacs or Vim is is satisfying, the same way mastering a video game is satisfying.
- kornerstoane 12y agoExactly. It's why I wrote the article. For me, using Vim brings with it a whole general feeling of comfort, which probably includes those early days hacking away on the Xenix box with family close by and Mario dinging in up the hallway. Weird, I know. But whenever I come back to Vim after straying for any amount of time, I just feel happy. Probably because I can do everything I want to do in the text without having to think about it.
- doorhammer 12y agoI get the same feeling. It's usually accompanied by the similar feeling I get when I drop back into a linux terminal after having spent eight or nine hours at work on .net. I just sort of automatically relax and feel good, heh. It's like the nostalgia I get when the seasons change, and for a few days I can feel my childhood.
- tomphoolery 12y agoIf that is so, why do people change text editors? (I agree with you, I just wonder this myself)
- doorhammer 12y agoI'm only speaking for myself with the below. ymmv of course I get the "grass is greener" feeling sometimes, so I go looking to see if anything better has come along. Then there's just the practical switch. My main job is in .net right now, while my home computers are all linux distros. It's made me search through a lot of editors to find something that runs well and feels good with windows. I also just like to explore software, you know? A for instance would be Sublime Text. I've said it in a few other threads, but I do dig some of the features in ST2. They really did multiple cursors right. It's a really simple, but intuitive and powerful way to edit things. Using that on ST2 me want it everywhere else, and also made me fall in love with how they set up the command palette. Using emacs for a bit made me really dig how elisp worked. Light Table showed me another take on the integration of a language into the editor itself. So it's a lot of curiosity with that, and to know what's out there. As an aside, if Neovim delivers it's promises, it'll probably solidify vim even further as my only editor of choice, but I'll still go looking around to see what other people are coming up with.
- manish_gill 12y agoI spent this entire weekend setting up Evil mode for Emacs, in the Emacs Starter Kit package. It's been decent so far. Evil mode is surprisingly good, and I really don't think it could come any closer to vim emulation for Emacs. Took a lot of googling around to set up some basic plugins that I need - projectile for CtrlP etc. I think the only thing that I need atm is Magit integration with Evil and I'll be good to go. What has been amazing so far is that even after using vim for almost 3 years, I'd been sort of afraid of diving deep into the config system (I made do with copy-pasting some popular vimrc files) and it was good enough, but in the short span of 2 days, I've actually gotten to know more about emacs configuration style than I ever did about vim. And I suspect it will only get better as I start to learn Emacs Lisp.
- bphogan 12y agoDo you happen to have some resources you can share? I've been playing with Tidal, a live-coding library and it wants me to use Emacs, and I just... can't. So any info on setting up evil-mode would be great, especially since it's fresh in your mind. I've found some resources but really don't know where to start.
- manish_gill 12y agoI haven't dived into the details of Evil mode too much. The basic Vim motions and commands work out of the box, so for a casual vim user, it ought to be enough. I also went ahead and installed Evil-leader, so I could have the same <leader> keymaps that I have in my vim config. A few places where I looked for small things here and there: 1. http://www.emacswiki.org/emacs/Evil http://www.emacswiki.org/emacs/Evil 2. https://github.com/cofi/evil-leader https://github.com/cofi/evil-leader 3. https://stackoverflow.com/questions/8483182/evil-mode-best-practice https://stackoverflow.com/questions/8483182/evil-mode-best-p... 4. https://github.com/mixandgo/emacs.d/blob/master/my-evil.el https://github.com/mixandgo/emacs.d/blob/master/my-evil.el 5. https://bling.github.io/blog/2013/10/27/emacs-as-my-leader-vim-survival-guide/ https://bling.github.io/blog/2013/10/27/emacs-as-my-leader-v... And I also got ido-vertical-mode so the emacs command buffer looks better. Here's my setup: https://github.com/mgill25/emacs https://github.com/mgill25/emacs See user.el Cheers! PS: Some of the configuration needs to be set up before you activate certain modes - which is often implicit in plugins, so watch out for that. Eg: To emulate C-u behavior, the functions had to be put ahead of the (require 'evil) call in evil-leader.el
- bokchoi 12y agoYay, I'm glad J got a shout-out even if it is one of the rejected editors. I've loved using J in the past and have even made a few releases of J on sourceforge [0]. I've attempted to move to github as well [1]. Sadly, I haven't found much time to work on it -- paid work and family take precedence. Oh, and I too love using vim as well. [0] http://armedbear-j.sourceforge.net/ [1] https://github.com/kevinkrouse/j/tree/master/j
- RichardFord 12y agoI can't stop using vi key bindings, whether that's Evil for Emacs, VsVim for Visual Studio, the Intellij one, Sublime, etc.. But my days of using straight Vim are over. For a straight text editor, I finally got over the hump with Emacs recently, and I'm not going back.
- geoka9 12y ago> and ‘Esc’ to move around again. For me personally this is the reason I stopped using Vi(m) except for occasional config file editing on unfamiliar servers, and started looking elsewhere (Emacs) for my goto text editor. I'm not looking to switch, but it genuinely interests me how Vi users put up with the constant need to strain their pinky to switch to command mode.
- ejstronge 12y agoYou've got a couple of options here - I personally have remapped my Caps Lock key to escape (not many downsides, besides limiting my ability to post humorous trolling messages). You can also use Ctrl-[ which I believe essentially sends an escape character to whatever program you happen to be running. Both options should save your pinky!
- dllthomas 12y agoCtrl-[ is the ASCII for Esc. Ctrl effectively subtracts 0x40. So: Ctrl-A = 0x41 - 0x40 = 0x01 = SOH Ctrl-I = 0x49 - 0x40 = 0x09 = Tab Ctrl-M = 0x4D - 0x40 = 0x0D = CR Ctrl-[ = 0x5B - 0x40 = 0x1B = Esc Ctrl-@ = 0x40 - 0x40 = 0x00 = NUL
- JoelHobson 12y agoI've heard of people rebinding it to caps lock. It makes sense as long as you don't mind holding down shift for the occasional all-caps text.
- dominotw 12y agoI remapped it to 'jk'. I don't think I've seen any vim users using 'esc' key to go to normal mode.
- nobleach 12y agowell, I DO use ESC when leaving Visual mode... but otherwise, 'jk' all the way.
- 12y ago
- scelerat 12y agoI've learned to love the modal nature of vim, or rather, the notion that text entry ('insert' mode) is merely one aspect of manipulating text. The combination of movement of commands is very powerful and these days I feel naked when I use editors without this ability. My first dedicated text editor was BBedit (when it was still freeware), and for many years had extended experiments with other editors, always eventually returning to BBEdit. Something about it always clicked with me, and I felt like Siegel and co. fundamentally understood both the Mac and the needs of programmers. These days I keep BBedit around for its excellent diff tool, syntax-highlighted multi-file grep search and replace, and its decent project browsing. But it's mostly a supplement to vim (MacVim), which I use all the time when I'm actually in there editing text.