I am trying to pipe curl result to jq then to Vim, but nothing happens.

If I follow the below method I get the desired result:

curl --location --request GET "$url/myproj/v1alpha1/consumption" --header "Authorization: Bearer $token" | vi -

then in Vim type the command to format.

:%!jq .

But if I do as below, piping the two commands to Vim, it doesn't work:

curl --location --request GET "$url/myproj/v1alpha1/consumption" --header "Authorization: Bearer $token" | jq | vi -

How to do it?

  • What is the result of the combined command when you pipe it to a file? May 10 at 4:00
  • most likely this is related to neovim bug 1496 May 10 at 8:44
  • It seems to work fine for me with both vim 9.0 and nvim 0.9 :-| May 10 at 13:34

2 Answers 2


I would try:

curl --location --request GET "$url/myproj/v1alpha1/consumption" --header "Authorization: Bearer $token" | jq . | vi -
  • the dot after jq was missing . Thanks May 11 at 15:19
  • Thanks for the feedback! If the solution solves your problem maybe could you validate the solution using the v button next to the arrow voting button. It allow the question to rest :-) May 11 at 15:38


:read !curl … | jq .

From within Vim you can read the output of a command. You could also :read !curl … and then :%!jq . as before

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.