Basic Usage
Basic usage summary (with default keymaps)
Execute request
There are several ways to execute a request:
- Position the cursor on the line of the request or in the block of the request delimited by
###
and then press<CR>
or<leader>Rs
to run the request. - Select several requests in visual mode and press
<CR>
or<leader>Ra
to run the requests. - Press
<leader>Ra
to run all requests in the buffer. - Press
<C-c>
to cancel request execution. - To search for a request in the buffer, press
<leader>Rf
. - You can use
#
or//
to comment out a request or its data, and it wil not be processed.
Executing requests in non .http
files
- You can execute requests in any file type. However, since the
###
delimiters are only recognized in.http
files, you will need to position the cursor exactly on the line with the request or visually select the required requests and their accompanying data. - Common comment syntax is recognized, so you can run requests that are commented out in your code, for example:
vim.system("curl -X GET http://localhost:3000")
-- POST http://localhost:3000
-- Content-Type: application/json
-- {"name": "John Doe"}
Kulala UI
- Kulala UI is opened automatically when you run a request or you can open it manually with
<leader>Ro
at any time. - You can switch between different views with
(H) Headers
,B (Body)
,(A) All
,(V) Verbose
,(S) Stats
,(O) Script output
,(R) Report
- To scroll through the history of responses use
[
and]
. - To clear responses history press
X
. - To jump to the request in the request buffer press
<CR>
. - To open help window press
?
. - To open the Kulala scratch buffer use
<leader>Rb
. - To choose variables environment use
<leader>Re
and select the environment you want to use. - To manage Authentication configurations use
<leader>Ru
.
Kulala LSP
Kulala includes a built-in in-process LSP server that provides the following features:
- Autocompletion: HTTP syntax, metadata, commands, variables, requests and API.
- Symbols information: symbols search and symbols outline -
<leader>cs
,<leader>cS
. - Hover information for requests: equivalent to Kulala's inspect command -
K
. - Code actions: a list of all available Kulala commands -
gra/<leader>ca
.
info
Kulala LSP does not set any keymaps, but relies on your Neovim's default LSP keymaps. Some distributions set these keymaps only for LSPs that have been
setup through nvim-lspconfig
or the distributions's own LSP config. In this case, you may need to enable them yourself.
Please refer to keymaps for more information.
Some plugins, like lsp-saga
or nvim-lighbulb
show 💡 signs when there are code actions available.
Since Kulala provides code actions for every line, you may want to disable them in your config. For example:
require('lspsaga').setup({
lightbulb = { ignore = { ft = { 'http' } } }
})
require("nvim-lightbulb").setup({
ignore = { clients = { "kulala" } }
})
Syntax summary
#
and//
is used to comment out a request or its data.###
is used to delimit requests and their data.### Request name
is used to name a request, for UI,import
andrun
commands.
Metadata
# @meta-name meta-value
is used to add arbitrary metadata to a request or file.# @name request-name
is used to name a request, so it can be referred to in scripts.# @prompt variable-name prompt-string
is used to prompt the user for input and store it in a variable.
Directives
# @graphql
allows you to run a GraphQL query.# @accept chunked
allows you to accept Transfer-Encoding: chunked responses and streamed responses.# @curl-global-...
and# @curl-...
allows you to set global and per-request flags for curl requests.# @grpc-global-...
and# @grpc-...
allows you to set global and per-request flags for gRPC requests.
Variables
@variable-name=variable-value
is used to define variables that can be used in request URL, headers and body.{{variable}}
allows you to use variables defined inmetadata
,system environment
variables,http-client.env.json
file or.env
file.{{$dynamic-variable}}
allows you to use predefined dynamic, akamagic
variables.
Requests import
import /path/to/file
allows you to import requests from another file.run #request-name
allows you to run a named request.run /path/to/file
allows you to run all requests in another file.
File input/output
< /path/to/file
allows you to include the contents of a file in the request.>> /path/to/file
allows you to save the response to a file. Use>>!
to overwrite the file if it exists.
Scripts
> {% %}
and> {% -- lua }
allow you to run an inlinepre-request
js|lua
scripts.> /path/to/script.js|lua
allows you to run apre-request
js|lua
script in a file.< {% %}
and< {% --lua %}
allows you to run an inlinepost-request
js|lua
script.< /path/to/script.js|lua
allows you to run apost-request
js|lua
script in a file.
For details please consult the corresponding sections in the documentation.