aurelienC
aurelienC

Reputation: 1183

Is there a way to rename vim commands?

I easily found how to remap keys in my vimrc, but not how to change commands like :badd , :new ... to be for example :bd, :n ...

Can someone show me how to do this, or give me a link to a page that shows it?

Upvotes: 1

Views: 366

Answers (1)

lwassink
lwassink

Reputation: 1691

Use :command!. For example, if you want to be able to type :W<cr> in addition to :w<cr> to save your file you would add the following line to your vimrc

command! W w

The exclamation point makes the command mapping non-recursive, similar to noremap vs. map. Further, commands you define must start with a capital letter. This stops them from overlapping with built-in commands.

Upvotes: 2

Related Questions