I'm running vim for windows in a Powershell 7 terminal. I'd like to make my own command, called SB
that would do the following:
- Save the current file
- Run the script
build.ps1
So I added the following to my _vimrc
file:
command! SB w|!powershell.exe -file .\build.ps1
This works OK, but when I run :SB
the screen clears out and I get the following message:
Press ENTER or type command to continue
I have to press "Enter" to get back to Vim, which is inconvenient since I aim to use SB
quite a lot.
I found a potential solution, namely inserting a carriage return after the shell command as follows:
command! SB w|!powershell.exe -file .\build.ps1|<CR>
But this doesn't work and I get an error:
) was unexpected at this time.
shell returned 1
Press ENTER or type command to continue
I feel like the carriage return could be a good solution to this problem. What am I doing wrong above?