An open API service indexing awesome lists of open source software.

https://github.com/abidibo/nvim-httpyac

A simple plugin which integrates HttpYac in Neovim
https://github.com/abidibo/nvim-httpyac

Last synced: 3 months ago
JSON representation

A simple plugin which integrates HttpYac in Neovim

Awesome Lists containing this project

README

          

# Neovim HttpYac

![Screenshot](screenshots/screen.png)

A very simple plugin which integrates [HttpYac](https://httpyac.github.io/) in Neovim.

I currently use it to to run REST requests, I don't need much, but I'll add functionalities once I need them.

It basically runs httpyac cli against the current file, executing all request or the one under the cursor, so you can use vars, envs, etc...
It provides syntax highlighting for the responses.

> [!IMPORTANT]
> You need to have [HttpYac](https://httpyac.github.io/) installed and in path!
i.e. `npm install -g httpyac`

## Installation

With [LazyVim](https://github.com/LazyVim/LazyVim):

```lua
return {
"abidibo/nvim-httpyac",
config = function ()
require('nvim-httpyac').setup({
output_view = "vertical" -- "vertical" | "horizontal"
})
-- if you want to set up the keymaps
vim.keymap.set('n', 'rr', ':NvimHttpYac', { desc='Run request'})
vim.keymap.set('n', 'ra', ':NvimHttpYacAll', { desc='Run all requests'})
vim.keymap.set('n', 'rp', ':NvimHttpYacPicker', { desc='Run named request'})
end
}
```

## Configuration

You can configure the plugin by passing a table to the `setup` function.

- `output_view`: Defines how the output window is opened. Can be `"vertical"` (default) or `"horizontal"`.

## Commands

> [!TIP]
> It's not mandatory to save the file before running the requests,the current buffer content will be used

- **NvimHttpYac**: executes the request under the cursor
- **NvimHttpYacAll**: executes all the requests
- **NvimHttpYacPicker**: shows a picker with all the named requests

Both commands take optional parameters that are passed to `httpyac`.
E.g. to use a specific dev environment call `:NvimHttpYac --env dev`

## Credits

This plugin was inspired by the following projects:

- [HttpYac](https://httpyac.github.io/): for the great cli tool
- [rest.nvim](https://github.com/rest-nvim/rest.nvim): for the syntax highlighting
- [vimyac](https://github.com/oxcafedead/vimyac): for the idea