1

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 there 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?

Ry-
226k56 gold badges496 silver badges504 bronze badges
asked Jun 5, 2011 at 10:59

1 Answer 1

1

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.

answered Jun 5, 2011 at 11:11

2 Comments

Only first letter must be uppercase.
after defining command as in the answer you can use cmap to use lower case: cmap bash BASH<CR>

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.