vim-jsonpath


Ⅰ. 插件描述

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

Ⅱ. 基本信息

创建日期:  2018-07-01
使用用户:  10
Github星:  28
插件作者:  Victor Hallberg

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'mogelbrod/vim-jsonpath'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'mogelbrod/vim-jsonpath'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'mogelbrod/vim-jsonpath'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/mogelbrod/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> <expr> <leader>p jsonpath#echo()
au FileType json noremap <buffer> <silent> <expr> <leader>g jsonpath#goto()

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> <expr> <leader>p jsonpath#echo()
    au FileType json noremap <buffer> <silent> <expr> <leader>g jsonpath#goto()
  • If you want global mappings:

    noremap <silent> <expr> <leader>p jsonpath#echo()
    noremap <silent> <expr> <leader>g jsonpath#goto()

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

添加新评论