mirror of
https://github.com/anotherhadi/jwt-tui.nvim.git
synced 2026-10-05 11:18:25 +02:00
@@ -0,0 +1,65 @@
|
||||
# jwt-tui.nvim
|
||||
|
||||
A Neovim plugin for [jwt-tui](https://github.com/anotherhadi/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](https://github.com/anotherhadi/jwt-tui) installed and available in `$PATH`
|
||||
|
||||
## Installation
|
||||
|
||||
**lazy.nvim**
|
||||
|
||||
```lua
|
||||
{
|
||||
'anotherhadi/jwt-tui.nvim',
|
||||
config = function()
|
||||
require('jwt-tui').setup()
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
```lua
|
||||
require('jwt-tui').setup()
|
||||
```
|
||||
|
||||
All options and their defaults:
|
||||
|
||||
```lua
|
||||
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:
|
||||
|
||||
```lua
|
||||
-- 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:
|
||||
|
||||
```lua
|
||||
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
|
||||
```
|
||||
Reference in New Issue
Block a user