mirror of
https://github.com/Myzel394/jsonfly.nvim.git
synced 2025-06-18 04:05:26 +02:00
feat(docs): Add examples
This commit is contained in:
parent
a5a4e25379
commit
c96e5350e7
73
README.md
73
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.
|
||||
|
||||
<img src="docs/horizontal_layout.png" width="600">
|
||||
|
||||
## 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 = {
|
||||
{
|
||||
"<leader>j",
|
||||
"<cmd>Telescope jsonfly<cr>",
|
||||
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
|
||||
|
||||
<img src="docs/vertical_layout.png" width="200">
|
||||
|
||||
```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
|
||||
|
||||
<img src="docs/horizontal_layout.png" width="200">
|
||||
|
||||
```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
|
||||
|
||||
|
BIN
docs/horizontal_layout.png
Normal file
BIN
docs/horizontal_layout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
BIN
docs/vertical_layout.png
Normal file
BIN
docs/vertical_layout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
Loading…
x
Reference in New Issue
Block a user