0

I'm trying to make my life easier with vim fugitive and ex command line, by creating an abbreviation to a frequent task, which is switching to develop, pulling it and creating new branch.

That's my abbreviation:

cab gcdp G checkout develop <bar> :G pull <bar> :G checkout -b

I was hoping that it will stop execution after last command and allow me to input name of the branch. Apparently it is not default behaviour. Vim will execute every command without stopping and I will get error: switch -b requires a value

I went trough ex command line dosc but could not find anything that would help me.

6
  • Perhaps you wanted a normal-mode mapping rather than a command-line abbreviation? Or just a custom command?
    – D. Ben Knoble
    Feb 27 at 21:55
  • I'm a little bit confused by your question; if I use your abbreviation then it will fill the commandline with that you've written if I type gcdp, and I can type the branch name. What do you mean with "hoping that it will stop execution after last command"? Feb 28 at 0:16
  • @MartinTournoij in that case your behaviour differs to mine. In my case all three commands are executed. There is no chance to input branch name. Last command acts like if there was a <cr> at the end of it. Feb 28 at 13:22
  • Do you press enter or space after typing :gcdp?
    – D. Ben Knoble
    Feb 28 at 17:36
  • 1
    I always press space, but with this one I was pressing enter. Really do not know why :). Good catch @D.BenKnoble, thanks for the help, mate. Feb 28 at 19:14
1

It turns out that I was pressing enter, which was executing the last command without letting me input branch name.

space should have been pressed instead.

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.