PostVim is a simple yet powerful Neovim plugin that allows you to make HTTP requests directly from within your editor. Whether you need to send a GET request or POST some data, PostVim makes it easy to work with APIs without leaving your Neovim environment.
- Execute HTTP requests (GET, POST, etc.) directly from Neovim.
- Supports setting custom headers and request bodies.
- Responses are automatically formatted as pretty JSON with syntax highlighting.
- Responses for the same URL are shown in the same buffer; different URLs will open in new buffers.
- Integrated with
jqfor JSON formatting and colorization.
To install PostVim, use your preferred plugin manager.
Using vim-plug
Add the following to your init.vim or init.lua:
Plug 'chrisatdev/postvim'Then, run :PlugInstall in Neovim.
Add the following to your init.lua:
use 'chrisatdev/postvim'Then, run :PackerSync in Neovim.
- Create a JSON file with your HTTP requests. Example:
[{
"method": "GET",
"headers": [{
"Accept": "application/json",
"Authorization": "Bearer your_token_here"
}],
"url": "http://localhost:8080/api/users"
},
{
"method": "POST",
"headers": [{
"Content-Type": "application/json"
}],
"url": "http://localhost:8080/api/users",
"body": "{\"name\": \"John Doe\", \"email\": \"john@example.com\"}"
}]-
Execute the requests by pressing
<leader>(key)while in the JSON file. -
The response will be displayed in a split buffer with syntax highlighting.
You can customize this by mapping it to another key combination in your init.vim or init.lua:
nnoremap <leader>r :lua require('postvim').execute()<CR>
The plugin uses jq to format and colorize JSON responses. Ensure jq is installed on your system for this feature to work.
curl: Used to make the HTTP requests.
jq: Used to format and colorize the JSON output.
This project is licensed under the MIT License.
Contributions are welcome!
Feel free to submit a Pull Request or open an Issue if you find a bug or have a feature request.
- GitHub: chrisatdev