Hacker News new | ask | show | jobs
by kamaal 5404 days ago
I started out vim, with bare minimum commands but later on went to emacs. With emacs I have an option M-x tab auto complete In case I don't get to remember something. I would like to know what are vim equivalents of this?

Some how I feel deep down inside that vim was not designed bottom for this kind of complexity. I mean to say when you want to design something to scale you have to clearly decide what goes into the core and what can be added using a extension system. Although I understand the spirit behind the use cases for vi when it was first invented to light weight. Now when you decide to stick to minimalism you must be consistent to that philosophy. When you violate that, you go on bolting stuff on top of it which doesn't belong there. The net result is a huge bloat of things which make usability too complex. Besides I only can commit so many things to memory.

One look at this cheat sheet made my head spin. Every time I fire up a editor to write code, I need brain space to think about the problem at hand. I can't afford to context switch between looking a up a sheet of command to do editor work. Which in case even Notepad will turn up to be more useful than this.

If someone has a better way to doing this I would be more than happy to learn. I keep hearing a lot of vim these days, and want to learn it too. But everytime I face the uphill task of memorizing something, I just drop it and go on to do something else.

7 comments

Vi is like touch typing or driving a stick shift, it needs to be muscle memory to get full benefit from it, but it takes a while to learn and a long time to really sink in. Learning touch typing was worth the effort for me; I'm not sure at this point if all the time I spend 'learning' (i.e, mucking about with) Vi will be worth it purely in time saved. However I do love the ease and speed with which I can edit now, so for the comfort of editing, and for me, it was worth it, I think.
Touch typing is a great analogy. I was a pretty good hunt-and-peck typer in 6th grade; I would even do 2-3 finger "rolls" across keys to type faster.

Learning to touch-type was frustrating at first: I knew I could go faster with my usual methods. But with perseverance, I became much faster with touch typing than I ever was before.

Vim is the same way. At first, it feels terrible to have to use these awkward keystrokes instead of the GUI editor commands you're used to. But eventually, with muscle memory and intentional practice, editing in Vim becomes very fast and efficient.

I recently written this introduction:

http://goo.gl/oRn1K

It received quite a lot of positive returns.

But the idea behind vim is you don't learn vim like you learn a lesson. You learn vim like you learn piano. You have to use it against your intuition for some days until you're accustomed to it. Once done, you'll start to progress by adding a new habit regularly.

The most difficult part is to start and continue until you reach a standard usability zone. After each new trick will make you better, stronger, faster.

vim will auto complete words if you press control-p while in insert mode.

http://i.imgur.com/tdcEc.png

For what it's worth I feel how you feel about vim, about emacs. I suspect it's just a matter of familiarity.

edit: As DrJ points out, control-n works too. Seems the 'p' is for previous keyword and the 'n' for next keyword.

The "M-x <tab>" that kamaal is talking about is for editor commands. Similar to ": <tab>" in Vim. The difference being that all of Emacs' editor commands (even "move one char to the left") are elisp functions that are available from the M-x prompt.
I agree that this is way too much information to be useful. I like focused cheatsheets that help you on a particular aspect that you're trying to improve. I created a cheatsheet for the most important vim movement commands that helped me focus to memorize all of them rather than get overwhelmed (http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wal...).
Personally I found vim easier to memorize than emacs commands and that's one of the reasons I went with it. If you work in vim day in and day out for a year (with a little curiosity and exploration) you should have most of this cheat sheet committed to muscle memory and move on to formulating more complex macros and using more advanced vim plugins to their potential.

I agree that emacs is more elegant in its implementation, but then again I think the very foundation of building an editor in lisp creates a level of elegance that is almost impossible to reach by any other path. In other words, vim is less elegant, but I don't think it's bad.

Fundamentally I see vim/emacs as unequaled peers. Vim is optimized for raw text editing potential, and emacs is optimized for customizability. Vim is still richly extensible, and emacs is still powerful for raw editing out of the box, but they lose out to each other on their respective strengths. I think the vim expert will be more effective editing disparate files on vanilla systems, and the emacs user will be more effective customizing his environment for his particular workflows.

There is the auto/omni-complete functionality using C-n
"wollw" and "DrJ" I am talking about command auto completion, not word auto completion inside the editor.

In emacs, for word auto completion M-/ is just too awesome.

Pressing Tab completes commands in command-line mode, and its very smart. (Be sure to :set wildmenu to see a list of all matching commands as well.)
Even without wildmenu option, repeatedly pressing TAB key will cycle through the list of matches.
What's more, you can press <ctrl-D> to view the whole list of possible completions at one time. For example, enter ':colo ' then press <ctrl-D> and you'll see a list of all the colorscheme names. (The space in ':colo ' is important, since if you press ctl-D with just ':colo' Vim will just show you the 'colorscheme' completion. . . )
You can press the tab key in Vim to get command auto completion.

For example, :colo<tab> completes to :colorscheme.

Command-line mode has tab completion. I'm not aware of there being auto completion in the other modes.