Files
Hadi c5100cb2cd init
Signed-off-by: Hadi <[email protected]>
2026-05-26 20:32:48 +02:00

1.8 KiB

jwt-tui.nvim

A Neovim plugin for jwt-tui: open a floating JWT inspector from Neovim, optionally pre-filled with a token from your visual selection.

Requirements

  • Neovim 0.10+
  • jwt-tui installed and available in $PATH

Installation

lazy.nvim

{
  'anotherhadi/jwt-tui.nvim',
  config = function()
    require('jwt-tui').setup()
  end,
}

Setup

require('jwt-tui').setup()

All options and their defaults:

require('jwt-tui').setup({
  width  = 0.9,       -- fraction of editor width
  height = 0.9,       -- fraction of editor height
  border = "rounded", -- any value accepted by nvim_open_win
})

No keymaps are set by default. Add your own:

-- open empty
vim.keymap.set('n', '<leader>jj', '<cmd>JwtTui<cr>', { desc = 'jwt-tui: open' })

-- open with visual selection as token
vim.keymap.set('v', '<leader>jj', ':<C-u>JwtTuiOpen<CR>', { silent = true, desc = 'jwt-tui: open with selection' })

Commands

Command Description
:JwtTui Open the JWT inspector (empty)
:JwtTuiOpen Open with the current visual selection as the token

Lua API

You can call the functions directly in your keymaps or other plugins:

require('jwt-tui').open()                                        -- open empty
require('jwt-tui').open({ token = '...' })                       -- pre-fill token
require('jwt-tui').open({ token = '...', secret = 'mysecret' }) -- pre-fill token and secret
require('jwt-tui').open_selection()                              -- open with visual selection as token