jemag / jsonpath.nvim

A Neovim plugin to help you access JSON values, powered by treesitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a Neovim-only plugin containing a function to return a path to access the value under the cursor by using treesitter. It may help you understand how to access even deeply nested values in JSON files.

A "JSON path" is a jq-like expression, such as . for root, .[0] for the first array item, .name for the property "name" of an object.

jsonpath-nvim-demo.webm

Colorscheme is vim-moonfly-colors

Dependencies

Usage

" in ~/after/ftplugin/json.vim

" show json path in the winbar
if exists('+winbar')
  setlocal winbar=%{luaeval('require\"jsonpath\".get()')}
endif

" send json path to clipboard
nnoremap <buffer> y<C-p> :let @+=luaeval('require"jsonpath".get()')<CR>

About

A Neovim plugin to help you access JSON values, powered by treesitter

License:MIT License


Languages

Language:Lua 100.0%