*nvim-http.txt* nvim-http ============================================================================== CONTENTS *nvim-http-contents* 1. Introduction.............................................|nvim-http-intro| 2. Setup....................................................|nvim-http-setup| 3. Commands.................................................|nvim-http-commands| 4. HTTP Runner..............................................|nvim-http-http| ============================================================================== INTRODUCTION *nvim-http-intro* nvim-http supports: - Running HTTP commands from the current line under cursor - Parsing optional YAML header/body blocks under the request line - Showing command output in a Telescope tree window ============================================================================== SETUP *nvim-http-setup* Using lazy.nvim: >lua { "macocianradu/nvim-http", dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", }, build = "rockspec", config = function() require("nvim_http").setup({ http = { enabled = true, execute_keymap = "hr", clear_keymap = "hc", timeout_ms = 10000, highlight_group = "Comment", command_patterns = { "^curl%s+", "^http%s+", "^wget%s+", "^%u+%s+https?://", "^https?://", }, }, }) end, } < ============================================================================== COMMANDS *nvim-http-commands* :NvimHttpRun Run the HTTP command under cursor and open 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) :NvimHttpClear Close and clear the HTTP result Telescope window. ============================================================================== HTTP RUNNER *nvim-http-http* Default mapping: hr Default clear mapping: hc Result window usage: or to open/close/toggle the selected node q to close the result window Supported line styles: curl https://example.com http GET https://example.com wget https://example.com GET https://example.com https://example.com Lines in markdown lists/quotes/inline code are normalized first, so these also work: - curl https://example.com `GET https://example.com` > https://example.com YAML request blocks under request line: POST https://jsonplaceholder.typicode.com/users headers: Content-Type: application/json Authorization: Bearer token body: name: Jane username: jane1 Accepted block names: header / headers body / request Parsing behavior: - scans only directly-below lines with bounded lookahead (does not scan file) - ignores leading whitespace - uses only first header(s) block and first body/request block - stops when both are found - also stops when another top-level block is found 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 url header: X-Test: 1 body: a: 1 header2: ignored: true -> stops after body, ignores header2 url header: X-Test: 1 header2: nope: 1 body: ignored: true -> stops at header2, ignores body url body: a: 1 header: X-Test: 1 -> body-first order works ============================================================================== vim:tw=78:ts=8:ft=help:norl: