简体   繁体   中英

Vimrc: combine commands with fugitive

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.

: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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM