Reputation: 3069
I have the following curl
command in a file.
curl \
--request POST \
https://oauth2.googleapis.com/tokeninfo?id_token=eyJhbGci
How do I execute the command in bash/zsh shell within vim
?
I tried to do :!<C-r>"
(Ctrl + r then ") but it says
zsh:1: no match found: https://oauth2.googleapis.com/tokeninfo?id_token=eyJhbGci
shell returned 1
Upvotes: 0
Views: 274
Reputation: 196691
Alternatively, you can use :help :w_c
to pass arbitrary lines to an external command.
Select three lines and execute via sh
:
vjj
:'<,'>w !sh
Execute current line:
:.w !sh
Execute whole buffer:
:%w !sh
Execute given range:
:12,34w !sh
See :help :range
.
Upvotes: 3
Reputation: 204866
?
is a glob character, zsh is looking for a file named http://oauth2.googleapis.com/tokeninfo
+ a single character + id_token=eyJhbGci
and reporting that there are no matches.
Escape or quote it, any one of
https://oauth2.googleapis.com/tokeninfo\?id_token=eyJhbGci
'https://oauth2.googleapis.com/tokeninfo?id_token=eyJhbGci'
"https://oauth2.googleapis.com/tokeninfo?id_token=eyJhbGci"
or use setopt +o nomatch
to make zsh behave like the default in other shells (if no matches, continue with the argument untouched).
Preferably just quote it.
Upvotes: 4