开发者

Defining own command in command mode with :

开发者 https://www.devze.com 2023-03-11 15:42 出处:网络
I want to define a command that is executed by :command<CR>. I tried something like this: cmap hello exec \"normal aHello World\"<Esc>

I want to define a command that is executed by :command<CR>.

I tried something like this:

cmap hello exec "normal aHello World"<Esc>

I have two problems with the result:

  1. If I type slowly, then there sits :hello in the bottom line, and after pressing Return, I get

    Not an editor command: hello

  2. If I type fast then :hello doesn’t sit th开发者_如何学Cere and it doesn't wait for me to hit the Return key – but at least it works.

Can somebody please points out to me how I have to define the hello command in a way that typing slowly will work?


The way I've always written colon-mode commands in vim is like this:

command! BASH !start bash

note the command must be in uppercase.

0

精彩评论

暂无评论...
验证码 换一张
取 消