0

I have been trying to make a macro to allow me to check in/out files via the vim command line. Currently what I have which "sort of" works is this:

nmap :checkout :! cleartool checkout -nc %

As you can see there is a bit of redundancy using nmap. I was under the impression that cmap created a macro which only functioned in the command line, so I thought I could do something like this:

cmap checkout ! cleartool checkout -nc %

however this seems to be creating a recursive loop which crashes vim. Is there something I'm missing? would I want to use a different map or is my syntax wrong?

  • The crash is because you need cnoremap. But I agree with the answer and would use a command instead – D. Ben Knoble Jan 3 at 16:57
2

I guess that you want to create a new command. Like this:

:command Checkout :!cleartool checkout -nc %

This allows you to run cleartool checkout from Vim with the command :Checkout.

Note: User defined commands must start with a upper case letter.

  • interesting. I wasn't aware of the need for the "command" keyword. – mreff555 Jan 3 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.