dorkhub

vim-jsonpath

Vim plugin that lets you navigate JSON documents using dot.notation.paths

mogelbrod
Vim script965 forksMITupdated 6 years ago
git clone https://github.com/mogelbrod/vim-jsonpath.gitmogelbrod/vim-jsonpath

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

" 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 <buffer> <silent> <leader>d :call jsonpath#echo()<CR>
au FileType json noremap <buffer> <silent> <leader>g :call jsonpath#goto()<CR>

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:

: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:

    au FileType json noremap <buffer> <silent> <leader>d :call jsonpath#echo()<CR>
    au FileType json noremap <buffer> <silent> <leader>g :call jsonpath#goto()<CR>
  • If you prefer global mappings:

    noremap <buffer> <silent> <leader>d :call jsonpath#echo()<CR>
    noremap <buffer> <silent> <leader>g :call jsonpath#goto()<CR>

Configuration

See :help jsonpath-configuration for the available configuration options.

Installation

Use vim-plug, Vundle, pathogen.vim or another Vim package manager.

Plug 'mogelbrod/vim-jsonpath' " example using vim-plug

more like this

vim-dap

Vim/Neovim debugger plugin providing a terminal interface to the Debug Adapter Protocol

Vim Script50

vim-halo

:innocent: Visual highlight for your cursor.

Vim script50

search

search projects, people, and tags