Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(I love both editors)

That's something disgusting about Vim - mapping to other keys instead of commands. In Emacs its much nicer IMO:

    (global-set-key (kbd "C-a") 'beginning-of-line)


Disgusting but practical. I already know the keys on the right because I use them every day. If it were a function I'd have to look it up first.


Is there a Vim equivalent of Emacs's C-h k followed by the key combo, which basically says, "Tell me what the official command name is for this keystroke?"


I don't know of anything quite like that but the help can be searched by key, though only for the default key combinations, e.g. ":h i^a" would show the docs for the ctrl-a command in insert mode.

Note though that vim really doesn't have commands the same way as emacs does. That's why you generally see assigning one key combination to another instead of some "command name."


You can bind a key to a command too. However, mapping to keys allows you to create your own. To give you a crude example, you could map a key to go down 5 times (5j). A real example would be more complicated for some specific task -- jump to other window, maxmimize it, go down to 5th line or some bookmark, etc.


Mapping to keys lets one map to the first part of a key sequence as opposed to the whole sequence/command name.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: