Rest Client Plugin for Neovim. Inspired by Rest Client Plugin for VS Code
The plugin aims to be fully compatible with the .http files of the above mentioned VS Code Plugin and its features
Nvim-Rest-Client utilizes telescope as its "UI"
Since i failed getting the lua socket running i build the binaries for request handling with golang in ./go/api
- Neovim >= 0.7.0
- nvim-telescope
- luasocket
to install luasocket run
luarocks install luasocket
Should work with any plugin manager for Neovim. For example using packer.nvim:
return require('packer').startup(function(use)
use {
'funkymcb/nvim-rest-client',
requires = {
'nvim-telescope/telescope.nvim',
}
}
end)
Full Setup with default values. Change them in your neovim config as needed:
require('nvim-rest-client').setup({
fileparser = { -- fileparser searches for .http files and parses them into request objects
search_depth = 1, -- how deep are the .http files nested in the $PWD
}
})
The nvim-rest-client adds one command to vim:
:NvimRestClientFindRequests
This command initializes the search and parsing of .http files in the $PWD
If .http files are found it will open a telescope prompt with all requests.
By pressing Enter the request will be executed.
You could map this command to anything you like. I use it like the following:
nnoremap("<leader>fr", ":NvimRestClientFindRequests<CR>")
For now you can make Requests like the following:
echo NvimRestClientRequest("GET", "http://localhost:8000/get")
for local development you can clone my testing api which provides various basic endpoints for testing.
just run go run main.go
The api listens on port 8000. Your .http testing files should look like this:
GET http://localhost:8000/get
- implement file parser for .http files
- search for files depending on search_depth
- split file by
###
and store them into requests - write tests for http file parsing
- define request objects
- implement telescope integration for requests
- implement request logic
- implement language server or else for syntax highlighting and error output