Vim: Show current json path
api, json, vim
Solution
I recently wrote a plugin for this called vim-jsonpath. It currently provides the following commands (that of course can be mapped):
- `: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.
Problem
I'm editing a very large, nested JSON doc (rightscale api incase you're interested) in vim and would love to know the current json-path (like xpath for json) Something like: Given the JSON: ``` { "leve1": { "level2": { "level3": { "name": "goes here" } } } } ``` With my cursor between "name": and "goes here" i'd like a command (or status line) that shows me: ``` level1/level2/level3/name ``` or similar. Does anything like this exist?