Use jq in Neovim.
Install jq or ensure it is on your PATH
.
Using lazy.nvim
{ 'TravisYeah/jq.nvim' }
Open a .json
file in Neovim and try the command
:Jq or <leader>jq
Edit the first line to alter the jq
input. The output will update automatically as you type.
You can also pass a command that will be piped into jq
as input
:Jq "xclip -o"
or add it to a keymap
vim.api.nvim_set_keymap('n', '<leader>jc', '<cmd>Jq "xclip -o"<cr>', { noremap = true })
Go to a line or visual select some text and press:
<leader>jf
to search your original json (files only) for that text.
Close the window by running the command :Jq
again or simply exit the window.