In vim, in my .vimrc, how can I redefine a command (i.e. :e) as something else?
I want to redefine :e *
as :tabe *
.
views:
114answers:
2
+1
A:
As I understand it, you can't. User defined commands must have an uppercase first letter.
:help :command
for more information
Jerub
2010-04-09 04:40:07
+1
A:
I figured out a way to do it. See http://stackoverflow.com/questions/1787127/how-to-disable-a-built-in-command-in-vim/1787963#1787963 . From that, we can see that we can use cabbrev to change what a command does. For my needs, cabbrev e tabe
is perfect.
But we can generalize this solution to make commands starting with lower case characters accessible to users for user-defined ones: use cabbrev to (re)define a built-in command as a user-defined one. As such, we are able to redefine built-in commands as well as user-defined ones.
Here's an example, which is equivalent to my aforementioned solution to my problem:
:command -nargs=+ E :tabe "<args>"
:cabbrev e E
That's all.
Yktula
2010-04-09 05:02:32