radumaco 70016196c1 MVP
2026-03-06 22:14:04 +01:00
MVP
2026-03-06 22:14:04 +01:00
MVP
2026-03-06 22:14:04 +01:00
MVP
2026-03-06 22:14:04 +01:00
MVP
2026-03-06 22:14:04 +01:00
2026-02-21 11:02:51 +01:00
MVP
2026-03-06 22:14:04 +01:00
MVP
2026-03-06 22:14:04 +01:00

nvim-http

A Neovim plugin for quick HTTP execution from your notes/code buffers.

Current status

Current features:

  • setup() configuration
  • Run HTTP commands under cursor
  • Optional YAML header(s) and body/request blocks under the request line
  • Telescope response tree with expandable headers and nested JSON result
  • :NvimHttpRun and :NvimHttpClear commands
  • :help nvim-http docs

Install

{
  "your-name/nvim-http",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-telescope/telescope.nvim",
  },
  build = "rockspec",
  config = function()
    require("nvim_http").setup()
  end,
}

Usage

Put cursor on a line like:

curl https://httpbin.org/get

Then run:

:NvimHttpRun

This opens a Telescope window with:

  • response_code
  • a collapsed request block (url, headers, body)
  • a collapsed headers block
  • a collapsed result block (nested JSON tree when response is JSON)

Use <CR> or <Tab> to expand/collapse the selected node and q to close.

Default keymap:

<leader>hr

Default clear keymap:

<leader>hc

This also supports lines like:

  • GET https://httpbin.org/get
  • https://httpbin.org/get (auto-translated to curl -sS <url>)

YAML blocks under request line

You can add request headers/body directly under the request line using YAML blocks:

POST https://jsonplaceholder.typicode.com/users
headers:
  Content-Type: application/json
  Authorization: Bearer token
body:
  name: Jane
  username: jane1

Also accepted block names:

  • header or headers
  • body or request

Parsing rules:

  • only lines directly under the request are scanned (bounded lookahead; not whole file)
  • leading whitespace is ignored
  • only the first header(s) and first body/request block are used
  • parsing stops once both blocks are found
  • parsing also stops if another top-level block appears after parsing started
  • request blocks are currently applied to curl-style requests
  • YAML block decoding requires the lyaml Lua rock

Examples:

url
header:
  X-Test: 1
body:
  a: 1

uses both header and body.

url
header:
  X-Test: 1
body:
  a: 1
header2:
  ignored: true

stops after body, so header2 is ignored.

url
header:
  X-Test: 1
header2:
  nope: 1
body:
  ignored: true

stops when header2 is reached, so body is ignored.

url
body:
  a: 1
header:
  X-Test: 1

works (body-first order is accepted).

Configuration

require("nvim_http").setup({
  http = {
    enabled = true,
    execute_keymap = "<leader>hr",
    clear_keymap = "<leader>hc",
    timeout_ms = 10000,
    highlight_group = "Comment",
    command_patterns = {
      "^curl%s+",
      "^http%s+",
      "^wget%s+",
      "^%u+%s+https?://",
      "^https?://",
    },
  },
})

Layout

  • plugin/nvim-http.lua: User command registration
  • lua/nvim_http/init.lua: Plugin API and HTTP runner
  • lua/nvim_http/config.lua: Defaults and config merging
  • doc/nvim-http.txt: Help documentation
Description
No description provided
Readme MIT 37 KiB
Languages
Lua 92.2%
Shell 7.8%