https://github.com/letieu/graphql.nvim
Interactive Graphql client for neovim
https://github.com/letieu/graphql.nvim
graphql neovim neovim-plugin nvim-lua nvim-plugin
Last synced: 4 months ago
JSON representation
Interactive Graphql client for neovim
- Host: GitHub
- URL: https://github.com/letieu/graphql.nvim
- Owner: letieu
- Created: 2025-01-13T15:09:33.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-05-02T13:29:16.000Z (8 months ago)
- Last Synced: 2025-05-12T21:45:59.976Z (8 months ago)
- Topics: graphql, neovim, neovim-plugin, nvim-lua, nvim-plugin
- Language: Lua
- Homepage:
- Size: 24.4 KB
- Stars: 27
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Graphql.nvim
Interactive Graphql client for neovim

> [!CAUTION]
> Currently, this plugin is under development. It may not work as expected.
## Installation
* With **lazy.nvim**
```lua
{
"letieu/graphql.nvim",
keys = {
{
"gg",
function()
require("graphql").open()
end,
desc = "graphql - Open",
},
{
"gq",
function()
require("graphql").close()
end,
},
{
"gr",
function()
require("graphql").run()
end,
}
},
}
```
* Lsp for autocomplete
```lua
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#graphql
require'lspconfig'.graphql.setup{}
```
* Install treesitter for syntax highlight: `:TSInstall graphql`
* Install [conform.nvim](https://github.com/stevearc/conform.nvim) for format query, var, result
## Usage
1. create new collection
2. update `.graphqlrc.json` file [docs](https://the-guild.dev/graphql/config/docs) and save
3. run the query
```lua
require('graphql').open()
require('graphql').close()
require('graphql').run()
```
* example `.graphqlrc.json` file
```json
{
"schema": "https://rickandmortyapi.com/graphql",
"url": "https://rickandmortyapi.com/graphql",
"headers": {
"Authorization": "Bearer abc"
}
}
```
## Config
**Default config**
```lua
-- TODO:
require('graphql').setup({
prefix_path = vim.fn.stdpath('data') .. '/graphql.nvim',
})
```
## TODO:
- [x] Handle var
- [x] Handle header
- [ ] Handle environment