I've actually been thinking about how I'd like this for all my typing, but it's difficult to imagine how to do it.
One trick I've learned, if you want to make sure you get the benefit of this sort of approach, is to ensure that the new alias is not just possible, but mandatory. If you map "git commit" to something, you should make it no longer possible to type "git commit" instead of your new alias, and doing so should pop up the correction. This can also be used to move keys around; turn your Caps Lock into a Control key, you'll never use it, but if you unmap the left Control key at the same time, you'll find you've adjusted in about 5 uncomfortable minutes. It's fast enough to be worth experimenting with.
I've certainly found this the case when creating new key bindings for Emacs. Of course, this now means that other people have a little bit of trouble using my Emacs because some of the basic key bindings don't work any more and some of them do something new :).
I'm now using this strategy whenever I want to change something like a common command or key binding--essentially anything that is a habit I don't have to think about.
Another thing to note is that it really helps if you come up with the alias or new key combination yourself. I find it takes almost no effort to memorize a key binding I choose myself as opposed to remembering a new one that comes with the tool itself.
Yeah, that's the advice I'd give to people starting out in Emacs too. I didn't use it but somehow got the hang of navigating around with the keyboard anyhow. It's probably because I personally did not use the arrow keys before switching to Emacs--I usually used the mouse.
A bunch of people I know do use the arrow keys to move around, and it's quite a loss. You don't gain that much just by being on the home row, of course, but there is some gain. However, the real win comes when you start using higher-level movement commands and moving by word/line/paragraph/expression/whatever. People used to the arrow keys will not be able to take advantage of these nice commands nearly as easily.
I may misunderstand what you mean, but isn't unmapping standard commands bad for portable scripting? Not everyone will have the same aliases as you; for something like git commit this may not matter, but it seems like a bad habit to me. And again, I may misunderstand what you mean, I don't even know how to make it impossible to type a command.
Aliases typically only apply to interactive usage. From 'man bash':
Aliases are not expanded when the shell is not interactive,
unless the expand_aliases shell option is set using shopt (see
the description of shopt under SHELL BUILTIN COMMANDS below).
Comments
I've actually been thinking about how I'd like this for all my typing, but it's difficult to imagine how to do it.
One trick I've learned, if you want to make sure you get the benefit of this sort of approach, is to ensure that the new alias is not just possible, but mandatory. If you map "git commit" to something, you should make it no longer possible to type "git commit" instead of your new alias, and doing so should pop up the correction. This can also be used to move keys around; turn your Caps Lock into a Control key, you'll never use it, but if you unmap the left Control key at the same time, you'll find you've adjusted in about 5 uncomfortable minutes. It's fast enough to be worth experimenting with.
I've certainly found this the case when creating new key bindings for Emacs. Of course, this now means that other people have a little bit of trouble using my Emacs because some of the basic key bindings don't work any more and some of them do something new :).
I'm now using this strategy whenever I want to change something like a common command or key binding--essentially anything that is a habit I don't have to think about.
Another thing to note is that it really helps if you come up with the alias or new key combination yourself. I find it takes almost no effort to memorize a key binding I choose myself as opposed to remembering a new one that comes with the tool itself.
For vim I benefitted greatly from
Yeah, that's the advice I'd give to people starting out in Emacs too. I didn't use it but somehow got the hang of navigating around with the keyboard anyhow. It's probably because I personally did not use the arrow keys before switching to Emacs--I usually used the mouse.
A bunch of people I know do use the arrow keys to move around, and it's quite a loss. You don't gain that much just by being on the home row, of course, but there is some gain. However, the real win comes when you start using higher-level movement commands and moving by word/line/paragraph/expression/whatever. People used to the arrow keys will not be able to take advantage of these nice commands nearly as easily.
I may misunderstand what you mean, but isn't unmapping standard commands bad for portable scripting? Not everyone will have the same aliases as you; for something like git commit this may not matter, but it seems like a bad habit to me. And again, I may misunderstand what you mean, I don't even know how to make it impossible to type a command.
Aliases typically only apply to interactive usage. From 'man bash':
I completely agree. I would love to see something that beeped at me when I didn't use an aliases which is already in my system.
Maybe something like what emacs does when using a full command? It helpfully informs you of the shortcut for it, if one is available.