0

I'm trying to combine

:w
:Gcommit -a -m "update"
:Gpush

to a new Command like :W – I've tried

:command! W w | Gcommit -a -m "update" | Gpush

But it doesn't work because he treats Gpush as a shell-command instead of a vim-command.

Nudin
  • 351
  • 2
  • 11
  • Do not use "update" as all your commit messages. [Commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) should [mean something](http://mislav.net/2014/02/hidden-documentation/) – Peter Rincker Feb 14 '17 at 22:24
  • Well I just use this for one of my gitrepos where I don't need any commit-message because I only use git for syncing my todo-list across platforms (and keep a history). – Nudin Feb 14 '17 at 22:59

1 Answers1

1
:command! W w | execute "Gcommit -a -m 'update'" | Gpush

Gcommit has not been given -bar argument that would allow it to terminate at the bar (and prohibit it from taking the bar as an argument). Thus, use execute to isolate the command, as described in :help :|. See also :help :command-bar.

Amadan
  • 191,408
  • 23
  • 240
  • 301