You would be surprised at how many people, programmers or not, experienced or not, don't know those and other basic shortcuts. No wonder Vim's motions sound like necromancy to so many people.
No need to have two plugins that do the same thing, CtrlP does buffer switching too.
While we are at it…
I never really used TagList or equivalent widgets in other IDEs/editors as an outline of my code but rather as a navigation tool. :CtrlPBufferTag is great for moving around in a large file. Same thing with :CtrlPTag for navigating a project. I love CtrlP.
If the "you" is me you don't need to convince me at all: I'm a diehard Vimmer.
In emacs, you'd be better off using anything+eproject for fuzzy file searching. I.e., type C-f foo and it will show you all the files in the current repository that contain foo.
Came here to hopefully post or see ctrlp fuzzy search for vim. When I didn't see it recommended I was shocked. It completely changed the way I interact with my files while I develop.
I think its much more important to become good at using whatever text editor is infront of you - i.e. learning the standard Windows/Mac shortcuts, instead of becoming reliant on what I consider the 'old' style of text editor.
Yet to meet anyone using vim or emacs who is actually more productive than me... the more productive people use Visual Studio, Xcode, Eclipse or whatever else is infront of them.
Maybe I am wrong, but I think typing is probably 30% or less of the time I spend coding... and thinking to make sure I write less code is probably more valuable than typing faster, not just in saving me time, but in improving stability and ease of reading code...
My idea is: Use whatever makes you happy. A happy person is sure to be more productive than an unhappy one. If you like IDEs, use those. If you like old fashioned text editors, use those. If you like new fangled text editors, use those.
Just always keep an eye out how you can improve yourself and your tools. There are many hidden joys to be found in all those programs, methodologies and workflows. Don't fall into the trap that just because you committed to one thing, you can't try another. There is nothing worse than being limited by your tools and not even noticing it.
Even if you don't stick with the new stuff in the long run, you will probably still learn something valuable. Learning a new tool or language or methodology is like visiting a foreign country. It is not so much about seeing new stuff, but more about gaining new insight in your own ways and getting a new appreciation and context for what you take for granted.
You are confusing non-expressive languages like C# and Java which needs lots of "refactoring" and lots of boilerplate code (hence the need for code generators which understand "patterns" and refactoring tools etc.) with "productive languages", for a start.
Then your point is moot anyway: since quite some time there are vim programmers using an Eclipse bridge and getting the Eclipse features right from inside vim (it's called "eclim") and there's, of course, a port to Emacs ("emacs-eclim") which, despite only being used by a few people, works quite well (I'm using it and getting the best of both world and for when I do really need to something inside that piece of underperforming bloat that Eclipse is, I can just switch to it in a heartbeat).
But anyway, even without these Eclipse bridges, if you do really think that someone using, say, Visual Studio to develop C# code is more productive than a programmer using Emacs to develop Clojure code I'd like to have some of the stuff you're smoking because it looks good ; )
To me the biggest issue with Eclipse / Visual Studio / IntelliJ is that their "text editor" part is really terrible.
In addition to that, programmers do craft tools to make their life easier : to me it's only logical that a programmer would want to be able to program his editor.
I suggest to take a look at the "Emacs rocks!" series on YouTube to get a feel of what's possible using Emacs.
To me a good example of a productive programmer using Emacs would be Rich Hickey. He created the Lisp dialect Clojure and then he went on to create an amazing DB (Datomic) using Clojure. He knows about productivity...
Now of course if you're stuck in the C#/NHibernate/SQL hell working on apps full of mutability and where it's close to impossible to reproduce state, I do understand why you feel Visual Studio would be better. But I do really your ability to "move fast" compared to people using more advanced technologies and who are not stuck in the "design pattern" / ORM mindset...
C# is a quite expressive language in my opinion. And i'm quite versed in Clojure, which seems to be your language of predilection. It does have limited type inference and lambdas, which makes it a lot less painful than Java.
It really depends on the problem you have at hand anyway. But even if you have a problem where you need a more functional approach, with immutable data structures, you can use F#, which is an amazing language.
> But anyway, even without these Eclipse bridges, if you do really think that someone using, say, Visual Studio to develop C# code is more productive than a programmer using Emacs to develop Clojure code I'd like to have some of the stuff you're smoking because it looks good ; )
I use Visual Studio to develop C# code. I use Eclipse if i have to code Scala. I use emacs if i have to clojure, i actually used it to develop Clojurescript's Lua backend. Most of them have good vim bindings anyway, but in emacs i prefer to use emacs.
C# with Visual Studio can be the most productive of languages, provided the good use case. And you sound like you know nothing about what you're talking about.
look at a Stream/Recording of Minecraft creator Notch writing game code in Eclipse and i bet you will think twice before sniffing at IDEs like Eclipse in that way again.
Downvoted because I'm not entirely sure what point this is addressing, and really, people have preferences for editors.
So fucking what if someone has the audacity to eschew vim/emacs/ed/acme/pen and paper in favour of a nice IDE they're familiar and productive with? You don't get any geek-cred for using any editor over the alternatives.
The "keys instead of notations" idea is neat, but it makes it a little more difficult to visually parse, and more importantly, it ignores other keyboard layouts. For such a small article it's not a big deal, but if this were a larger list, I would definitely go with a more abstract representation.
As long as my programmer idols Carmack and Persson use Visual Studio and Eclipse respectively to produce amazing stuff, i dont really care about changing to vim/emacs...besides i work mostly in statically typed languages anyway, so i would miss alot of the IDE features for refactoring.
Just spent half of the day doing AS3 in Eclipse. That was nice… thanks to the Vrapper plugin. Once you go Vim, using any other editor is a nightmare.
Maybe that's just me but I would be incapable of choosing an editor/IDE/smartphone/perfume/car/whatever because someone I admire uses it. That sounds incredibly childish to me.
> Maybe that's just me but I would be incapable of choosing an editor/IDE/smartphone/perfume/car/whatever because someone I admire uses it. That sounds incredibly childish to me.
That is not what i was trying to say. I mean that when reading HN with all its Vim/Emacs hype one could get the impressions that you cant be an awesome software developer without using vim/emacs. But some examples like mine might help to check with reality.
Lots of what you read on HN is hype, be it vim/emacs, textmate, NoSQL, or some form of super cool javascript framework that is currently fashionable. Its good to know that there are still lots of devs in the real world, using proven tools and being as productive/awesome as the people using the latest buzz.
Thanks, this explanation makes more sense than your original comment.
I agree with you on everything. These days, the number of new Vim users who switched because of some misinformed and/or shiny blog post is staggering. People now seem to just jump from one ORM or VCS or editor or framework or DB or design pattern or language to another twice a week. I wonder what would happen if nobody was there to tell them what to do?
Being a good dev is totally independent on the tools: everything that matters is in the head.
I like Vim because it shortens the path from brain to code quite dramatically. But it's definetely not a pre-requisite for being a good dev (which I don't pretend to be, BTW).
I'm not sure that there is a large group of developers that "jump from one ORM or VCS or editor or framework or DB or design pattern or language to another twice a week" actually. I think there are enough developers around these days that when they occasionally try out new tools or technologies and blog about it, it creates the impression that everyone is switching all the time.
It's hard to measure this, of course. But I have a hard time believing that there's this population of developers out there that are constantly switching tools/frameworks/platforms/etc. and getting any work done at the same time.
Not every textbox has Vim, so learn the basics of how to type in a standard Windows textbox.
Ctrl+<L/R arrow> moves one word to the left/right
Ctrl+Backspace deletes the previous word
Home takes you to the beginning of the line
End takes you to the end of the line
Adding Shift to any of the selection operators will select the word/line in question.
Now you don't have to press arrow,arrow,arrow,backspace,backspace,backspace anymore.
On my Mac every textbox has emacs thanks to OSX's NeXT heritage. On my Windows box every textbox has emacs thanks to XKeymacs[1]. That's one area where I think emacs users have a leg up on Vim users, our editing style can be configured to work almost everywhere you input text.
> Once you go Vim, using any other editor is a nightmare.
Not really. I'm over a month into using Vim full time because it's the standard at my workplace. It sucks. I can't believe that the people around me insist on using this piece of junk. It has so many problems that I never had to deal with in Textmate. Huge step backward.
Not enough credit is given to Visual Studio's Autocomplete feature. It seriously is unmatched, and to me is one of the reasons why C# is very pleasant to work with.
I did try it. It is certainly better than before. That is, it's usable now. Nowhere near Eclipse/Java, XCode/Ocj-C or VS/C#, though.
Usually, I tend to ignore it more often than I actually find it useful. Even some simplistic look-for-common-words-in-open-buffers in regular text editors works better in my experience.
That said, add Visual Assist X and it's a different ball game.
For me the post boils down to "learn how to do these six things when editing code". Which is good advice to IDE users as well.
Okay, indentation and auto-completion are rather trivial things to do in an IDE, but most IDEs come with powerful search tools and for most IDEs I don't know how to use them.
Indentation by itself can be tricky, too. Is your code correctly indented when you copy and paste it somewhere? Can it correctly re-indent code that got mangled for some reason? How well does indentation cope with non-standard language extensions (think Qt or C++ macros)? So I would not call that trivial.
Yeah: think time is typically >> than type time. The one thing that good hand-editor coordination is good for is not breaking flow: the faster one can do a brain dump (without having to micro-manage the typing/translation of mental pseudo-code image into real runnable source code) the better.
If you are deleting a word in order to correct a mistake (ie/ by typing it back in) it's usually best to `cw` or `cb`, which will leave you in insert mode after the delete.
For some more modern auto-complete functionality in vim, clang_complete is worth a look: https://github.com/Rip-Rip/clang_complete. It uses clang for intelligently auto-completing C and C++, and I am constantly surprised that more people haven't heard of it.
Yeah, I think that both 'change word' and either the 'change inner word' or 'change a word' ('ciw' and 'caw', respectively) should have been included. I find myself using the last two modifiers much more often than 'change word' by itself. I hope that's not a symptom of inefficient vim usage.
I use it fairly often in combination with cw. 'dwcw' is easier for me than '2cw'. One character longer but on QWERTY it is slightly easier, and it has a sort of repetition anyway.
The other day I was thinking about how Sublime Text's Ctrl+P's great usability could be extended to more use cases, and I began wondering,
1. Why doesn't it already index on the function names (the ones you get to by pressing @), so that I could find a file not by it's name or path, but by it's function definition (and with less priority, by it's function use)?
2. Why doesn't find in files work with the same usability, even if the match would not be as instant? Having an overhead box and the file auto open in the buffer as it matched would be a great improvement over what seems like a set in stone standard of opening a new dialog/file to display the find in files results.
If anyone knows of settings, plugins or even other editors I can get for these features, I'd be in heaven.
Good article, I feel rather foolish for not knowing the delete whole words stuff; I have the feeling it's going to be a big step up in productivity for me.
There's project-wide fuzzy opening in Xcode too: bind "Open Quickly" to whatever you like (I use cmd+O). It has the same fuzzy searching as Sublime Text (for example, gvcm will take you straight to your GridViewController) but builds on it can take you straight to symbols if you want.
I have tried watching a couple of peepcode videos, but at some point, sooner or later, I invariably fall to sleep no matter how interesting the topic they present is. Somehow the videos feel lifeless and monotonous. Maybe its just me, but thats been my experience.
Regarding the point about autocompletion: If autocompletion is needed don't use vim or emacs, -use Netbeans or eclipse, both excellent, free (both ways) and open source.
vim is great and I use it all the time but not for Java and PHP where the IDE support is so good that it really makes a difference.
> If autocompletion is needed don't use vim or emacs, -use Netbeans or eclipse, both excellent, free (both ways) and open source.
Vim also contains excellent autocompletion (several kinds, actually, most powerful of which is the omni complete) but it's not restricted to one language. It may, however require you to install your language specific plugins. Vim ships with C and C++ mode, which requires you to build a ctags database of your source code. In addition you might want to add cscope for source code navigation.
Eclipse has autocomplete perhaps for a handful of languages but Vim has support for autocompletion in tons of languages.
In addition to omni-complete, vim can have an user defined completion (C-x C-u), which is handy to set to do syntax completion (set completefunc=syntaxcomplete#Complete). Vim ships with tons of syntax files, which are used for completion and syntax highlighting. This is not super useful for programming, but is excellent for different kinds of configuration files, so you don't have to memorize (or look in the manual) for the configuration options you use.
And I'd rather use Vim without autocomplete than have to deal with Eclipse. Thankfully I don't have to.
I like to use eclipse with the vrapper plugin. That way I get the completion and refactoring of eclipse as well a decent set vim key bindings. Vrapper may not perfectly emulate vi/vim but it does the basics well. And when I need to use advanced vim features (eg macro magic) I just open the file in vim.
To me the IDE features make up for the minor annoyances of using vi/vim emulation.
For most languages (however, notably not Java), Emacs can have great auto-completion. I personally really like auto-complete mode. It might take a little bit of effort to configure auto-complete mode to work very well with your favorite language, but I've found it well worth doing: it's far, far easier than learning some new editor and lets me keep using the rest of Emacs's great features in any language I happen to be using.
EDIT: Reading some other comments, there is Emacs-eclim that gives you Java IDE features inside Emacs. So forget what I said about Java: Emacs can now handle even Java well!
For dynamically typed languages, Emacs can essentially be as good as possible fairly easily. I've been using it for JavaScript and Racket lately, and it's been really great for both. For statically typed languages, there are often type-aware tools that make it as good as any IDE--for example, I've used TypeRex[1] for OCaml; there is also ENSIME[2] for Scala and similar tools for a bunch of other languages.
Just because Emacs is a great text editor does not mean it isn't a good IDE. It has some very good support for a whole bunch of languages. I'm under the impression that Java is an exception to this rule, but I really don't know--I haven't used Java in a couple of years and really hope I will never have to use it again.
So, all told, I think this oft-repeated advice to use an IDE instead of a text editor like Emacs is misguided: Emacs is much more an IDE than just a text editor. Perhaps it's accurate for Vim, which I've never used (and I wouldn't be surprised if Vim support IDE features well too), but it isn't anywhere near true for Emacs.
Dumb autocompletion easily covers 50% of my cases and with Emacs hippie-expand (or one of its modern siblings) up to 75%: http://emacswiki.org/emacs/HippieExpand
That said, Emacs and Vim also have intelligent autocompletion depending on the language and support for it has only been getting better.
I concur - Java dev off Eclipse can be a complete nightmare. I used to be a hard core vimmer/command liner - until I realised 2 things:
1. The vast majority of things that I did were repetitive and were already solved in other environments
2. Knowing the minutiae of the stuff that I know now does not improve my skills at all - production matters for shipping, minutiae matters for interviews. Best way to get a job is to produce so much - you don't have to interview :D
Now I just use whatever is the most widely deployed, best supported environment for each language (e.g. Visual Studio for C++ and Eclipse for Java).
The one thing I have kept is my vim foo by using IDE specific plugins :D. Pick your tools carefully - and don't fall into the "true final solution trap" that people try to sell you.
This is so wrong. vim has eclim, which is a bridge to Eclipse (you can either run Eclipse visually or use Eclipse in server mode) and provides all the Eclipse auto-completion. It just works.
It actually works so well that the "emacs eclim", based on eclim, "Just Works! [TM]" and gives you, right inside Emacs, the Eclipse auto-completion.
Even when stuck in the Java/ORM/Hibernate/SQL/XML hell (at which point I want to kill myself and really question the company's "productivity"), I'd still rather use Emacs + emacs-eclim then Eclipse (or IntelliJ IDEA -- which gives both NetBeans and Eclipse a run for its money btw).
Thing is: adding Eclipse / IntelliJ support to vim / emacs is not that hard. But turning the "text editor" part of Eclipse into Emacs just looks like mission impossible.
IIRC using eclim you can replace the (very lame) text editor of Eclipse with vim. So you get vim running right in the middle of your Eclipse.
For vim users, Gary Bernhardt's vimrc has a nice little snippet to map the tab key to perform completion if the cursor isn't at the beginning on a line.
Also, 'Fuzzy file' searching in vim: https://github.com/kien/ctrlp.vim