diff --git a/README.md b/README.md index bba6761..5f04ac1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ Fly through your JSON files with ease. Search ✨ blazingly fast ✨ for keys via [Telescope](https://github.com/nvim-telescope/telescope.nvim), and navigate through your JSON structure with ease. json(fly) is a Telescope extension that will show you all keys (including nested ones) in your JSON files and allow you to search and jump to them quickly. +It's completely customizable and even supports highlighting of the values. + + ## Installation @@ -13,6 +16,7 @@ Install with your favorite plugin manager, for example with [lazy.nvim](https:// { "nvim-telescope/telescope.nvim", dependencies = { + -- "Myzel394/easytables.nvim", -- "Myzel394/telescope-last-positions", -- Other dependencies -- .. @@ -21,6 +25,26 @@ Install with your favorite plugin manager, for example with [lazy.nvim](https:// }, ``` +Here's how I load it with lazy.nvim with lazy-loading :) + +```lua + { + "nvim-telescope/telescope.nvim", + dependencies = { + "Myzel394/jsonfly.nvim", + }, + keys = { + { + "j", + "Telescope jsonfly", + desc = "Open json(fly)", + ft = { "json" }, + mode = "n" + }, + } + }, +``` + Load the extension with: ```lua @@ -35,3 +59,52 @@ Go to a JSON file and run: :Telescope jsonfly ``` +## Configuration + +Please see [jsonfly.lua](https://github.com/Myzel394/jsonfly/blob/main/lua/telescope/_extensions/jsonfly.lua) for the default configuration. + +### Example: Vertical layout + + + +```lua +require"telescope".setup { + extensions = { + jsonfly = { + mirror = true, + layout_strategy = "vertical", + layout_config = { + mirror = true, + preview_height = 0.65, + prompt_position = "top", + }, + key_exact_length = true + } + } +} +``` + +### Example: Horizontal layout + + + +```lua +require"telescope".setup { + extensions = { + jsonfly = { + layout_strategy = "horizontal", + prompt_position = "top", + layout_config = { + mirror = false, + prompt_position = "top", + preview_width = 0.45 + } + } + } +} +``` + +## Acknowledgements + +- JSON parsing is done with [Jeffrey Friedl's JSON library](http://regex.info/blog/lua/json + diff --git a/docs/horizontal_layout.png b/docs/horizontal_layout.png new file mode 100644 index 0000000..4db0150 Binary files /dev/null and b/docs/horizontal_layout.png differ diff --git a/docs/vertical_layout.png b/docs/vertical_layout.png new file mode 100644 index 0000000..d1c35bb Binary files /dev/null and b/docs/vertical_layout.png differ