From 32e76da1b119de5d7c8111e6563a0587ec017b65 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 8 Oct 2025 19:00:08 +0300 Subject: [PATCH] docs: add snacks.nvim mention to readme --- doc/http-codes.txt | 45 +++++++++++++++++------------------ readme.md | 58 +++++++++++++++++++++------------------------- 2 files changed, 48 insertions(+), 55 deletions(-) diff --git a/doc/http-codes.txt b/doc/http-codes.txt index 4b2d132..6b2294e 100644 --- a/doc/http-codes.txt +++ b/doc/http-codes.txt @@ -1,38 +1,35 @@ -http-codes *http-codes.txt* +http-codes *http-codes.txt* Author: Barrett Ruth -Homepage: +Homepage: =============================================================================== INTRODUCTION *http-codes.nvim* -https-codes.nvim lets you quickly investigate HTTP status codes with mozilla, -supporting fzf-lua and telescope.nvim. - -Author: Barrett Ruth +http-codes.nvim lets you quickly investigate HTTP status codes with Mozilla, +supporting fzf-lua, snacks.nvim, and telescope.nvim. =============================================================================== -SETUP *http-codes.setup()* ->lua - require('http-codes').setup(config) -< -Parameters: ~ +CONFIGURATION *http-codes.config* - {config} `(table)`: table containing configuration for http-codes. - Defaults shown below. - -Usage: ~ +Configure via `vim.g.http_codes` before the plugin loads: >lua - require('http-codes').setup({ - -- defaults to available picker: 'fzf-lua' or 'telescope' - use = 'fzf-lua' - -- How the mozilla url is opened. - -- Configured by default based on OS: - open_url = 'xdg-open %s' -- UNIX - -- = 'open %s' -- OSX - -- = 'start %s' -- Windows - }) + vim.g.http_codes = { + use = 'fzf-lua', + open_url = 'xdg-open %s', + } < +Options: ~ + + {use} `(string|nil)`: Picker to use: 'fzf-lua', 'snacks', or + 'telescope'. Auto-detected if not specified. + + {open_url} `(string|nil)`: Command to open URLs. Uses `%s` as placeholder. + Defaults based on OS: + - Linux: 'xdg-open %s' + - macOS: 'open %s' + - Windows: 'start %s' + =============================================================================== COMMANDS *http-codes.commands* diff --git a/readme.md b/readme.md index f4a1a80..1be0b04 100644 --- a/readme.md +++ b/readme.md @@ -1,51 +1,47 @@ # http-codes.nvim -Quickly investigate HTTP status codes with the help of [mozilla](https://developer.mozilla.org/en-US/docs/Web/HTTP), including [telescope](https://github.com/barrett-ruth/telescope-http.nvim/) and [fzf-lua](https://github.com/ibhagwan/fzf-lua) integrations. +Quickly investigate HTTP status codes with the help of [Mozilla](https://developer.mozilla.org/en-US/docs/Web/HTTP), with telescope, fzf-lua, and snacks.nvim integrations. ## Installation -Install via your favorite package manager, like [lazy](https://github.com/folke/lazy.nvim): +Install using your package manager of choice or via [luarocks](https://luarocks.org/modules/barrettruth/http-codes.nvim): -```lua -require('lazy').setup({ - { - 'barrett-ruth/http-codes.nvim', - config = true, - -- or 'nvim-telescope/telescope.nvim' - dependencies = 'ibhagwan/fzf-lua' - keys = { { 'H', 'HTTPCodes' }} - } -}) +``` +luarocks install http-codes.nvim ``` -## [Configuration](./doc/http-codes.txt) +## Dependencies -`http-codes.nvim` uses telescope or fzf-lua (whichever you've installed), which can be manually overidden. +One of: +- [fzf-lua](https://github.com/ibhagwan/fzf-lua) +- [snacks.nvim](https://github.com/folke/snacks.nvim) +- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) -`http-codes.nvim` opens the Mozilla documentation URLs based on your operating system. This can be overidden. +## Configuration -| OS | open_url | -| ------- | ------------- | -| Windows | `start %s` | -| OSX | `open %s` | -| UNIX | `xdg-open %s` | +Configure via `vim.g.http_codes` before the plugin loads: -See [the docs](./doc/http-codes.txt) for more information. +```lua +vim.g.http_codes = { + use = 'fzf-lua', -- or 'snacks' or 'telescope', auto-detected by default + open_url = 'xdg-open %s', -- OS-specific by default +} +``` + +| OS | Default open_url | +| ------- | ---------------- | +| Windows | `start %s` | +| macOS | `open %s` | +| Linux | `xdg-open %s` | ## Usage -Use the exposed command in vimscript: - -```lua +```vim :HTTPCodes ``` -or in lua: +## Documentation -```lua -require('http-codes').http_codes() +```vim +:help http-codes.nvim ``` - -## Migration - -If migrating from [telescope-http.nvim](https://github.com/barrett-ruth/telescope-http.nvim), follow the above instructions—no telescope-specific config is necessary.