https://github.com/mogelbrod/vim-jsonpath
Vim plugin that lets you navigate JSON documents using dot.notation.paths
https://github.com/mogelbrod/vim-jsonpath
json json-parser vim vim-plugin
Last synced: 9 months ago
JSON representation
Vim plugin that lets you navigate JSON documents using dot.notation.paths
- Host: GitHub
- URL: https://github.com/mogelbrod/vim-jsonpath
- Owner: mogelbrod
- License: mit
- Created: 2018-07-01T17:07:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-16T13:37:21.000Z (over 5 years ago)
- Last Synced: 2025-03-18T20:48:19.960Z (9 months ago)
- Topics: json, json-parser, vim, vim-plugin
- Language: Vim script
- Homepage:
- Size: 91.8 KB
- Stars: 91
- Watchers: 3
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-jsonpath
A Vim plugin which provides ways of navigating JSON document buffers.
* `:JsonPath`:
Echoes the path to the identifier under the cursor.
* `:JsonPath path.to.prop`:
Searches the active buffer for the given path, placing the cursor on it if found.
More information is available via `:help jsonpath`.
## Quick Start
```vim
" Install plugin (in this example using vim-plug)
Plug 'mogelbrod/vim-jsonpath'
" Optionally copy path to a named register (* in this case) when calling :JsonPath
let g:jsonpath_register = '*'
" Define mappings for json buffers
au FileType json noremap d :call jsonpath#echo()
au FileType json noremap g :call jsonpath#goto()
```
### Python support in vim
While not required it is recommended to use a Vim environment with the
`+python3` feature enabled, since the plugin provides a python implementation
that is much faster than the vimscript variant. You can check the availability
using:
```vim
:echo has("python3")
```
## Mappings
Mappings are not provided by default but can easily be added to your `.vimrc`.
* If you only want mappings when working with `.json` files:
```vim
au FileType json noremap d :call jsonpath#echo()
au FileType json noremap g :call jsonpath#goto()
```
* If you prefer global mappings:
```vim
noremap d :call jsonpath#echo()
noremap g :call jsonpath#goto()
```
## Configuration
See `:help jsonpath-configuration` for the available configuration options.
## Installation
Use [vim-plug](https://github.com/junegunn/vim-plug),
[Vundle](https://github.com/VundleVim/Vundle.vim),
[pathogen.vim](https://github.com/tpope/vim-pathogen)
or another Vim package manager.
```vim
Plug 'mogelbrod/vim-jsonpath' " example using vim-plug
```