Browse and edit ArangoDB documents from Neovim.
This plugin extracts the ArangoDB browser workflow from my personal config into a reusable Neovim plugin with a small public API, user commands, and a healthcheck.
- Pick a database and manage collections from inside Neovim
- Search documents live with
snacks.nvim - Open documents in JSON buffers and save them back to ArangoDB
- Create draft documents with prefilled
_key,_id, and_rev, then insert them on first save - Jump to related documents from direct foreign keys, nested relation objects, and reverse links discovered in other collections
- Create, duplicate, rename, and truncate collections from the collections picker
- Duplicate draftable documents, delete documents, rename collections, and truncate collections
- Discover databases from environment variables or explicit connection config
- Neovim
>= 0.9 folke/snacks.nvimcurlforhttps://connections
The plugin now talks to ArangoDB through a built-in Lua HTTP client.
Plain http:// URLs use the built-in Lua transport.
https:// URLs are supported through curl.
{
"LeuciRemi/arangodb.nvim",
dependencies = {
"folke/snacks.nvim",
},
config = function()
require("arangodb").setup({
default_database = "_system",
connections = {
_system = "http://root:root@127.0.0.1:8529/_system",
},
keymaps = {
browse = "<leader>ea",
resume = "<leader>eA",
back = "<leader>eb",
},
picker_keymaps = {
execute = "<C-x>",
create = "<C-a>",
next_page = "<C-n>",
prev_page = "<C-p>",
back = "<C-b>",
change_field = "<C-f>",
reset = "<C-u>",
related = "<C-o>",
delete = "<C-d>",
duplicate = "<C-y>",
truncate = "<C-t>",
rename = "<C-r>",
},
layout = {
preset = "auto",
preview = true,
},
document_keymaps = {
save = "<leader>w",
delete = "<leader>d",
duplicate = "<leader>y",
related = "gr",
},
})
end,
}require("arangodb").setup({
connections = {
_system = "http://root:root@127.0.0.1:8529/_system",
kore = "https://root:root@db.example.com:8529/kore",
},
default_database = "kore",
keymaps = {
browse = "<leader>ea",
resume = "<leader>eA",
back = "<leader>eb",
},
picker_keymaps = {
execute = "<C-x>",
create = "<C-a>",
next_page = "<C-n>",
prev_page = "<C-p>",
back = "<C-b>",
change_field = "<C-f>",
reset = "<C-u>",
related = "<C-o>",
delete = "<C-d>",
duplicate = "<C-y>",
truncate = "<C-t>",
rename = "<C-r>",
},
layout = {
preset = "auto",
preview = true,
},
field_sample_size = 200,
page_size = 50,
json_indent = 2,
truncate_length = 120,
max_field_depth = 4,
aql_batch_size = 1000,
default_sort = "doc._key ASC",
show_system_collections = false,
http_timeout = 30000,
tls_verify = true,
tls_ca_file = nil,
})connections: table of named connection URLs, either{ name = url }or{ { name = "db", url = "..." } }; acceptshttp://andhttps://default_database: preferred database name or{ name, url }keymaps.browse: global normal-mode keymap forrequire("arangodb").browse()keymaps.resume: global normal-mode keymap forrequire("arangodb").resume()keymaps.back: global normal-mode keymap forrequire("arangodb").back()picker_keymaps: picker-local key bindings for actions such as create, pagination, related lookup, delete, duplicate, truncate, and renamelayout.preset: snacks picker layout preset;"auto"by default chooses a side-by-side layout on wide screens and a stacked layout on narrower screenslayout.preview: enable picker preview window (default:true)document_keymaps.save: buffer-local keymap for saving the current documentdocument_keymaps.delete: buffer-local keymap for deleting the current documentdocument_keymaps.duplicate: buffer-local keymap for duplicating the current document into a new draftdocument_keymaps.related: buffer-local keymap for opening related documentsfield_sample_size: number of documents sampled when listing candidate filter fieldspage_size: number of documents fetched per picker pagejson_indent: indentation width used for JSON previews and document formatting (default:2)truncate_length: max preview text length before truncation (default:120)max_field_depth: recursion depth when discovering nested field paths (default:4)aql_batch_size: cursor batch size used for AQL pagination (default:1000)default_sort: AQL sort clause used in document listings and related searches (default:"doc._key ASC")show_system_collections: include ArangoDB system collections in collection listings (default:false)http_timeout: timeout in milliseconds for ArangoDB HTTP requeststls_verify: verify HTTPS certificates when usinghttps://URLs (default:true)tls_ca_file: custom CA bundle path passed tocurl --cacertforhttps://URLs
You can use environment variables instead of explicit connections:
NVIM_ARANGO_HOSTNVIM_ARANGO_PORTNVIM_ARANGO_SCHEMENVIM_ARANGO_USERNVIM_ARANGO_PASSWORDNVIM_ARANGO_SYSTEM_URLNVIM_ARANGO_<DATABASE>_URL
Example:
export NVIM_ARANGO_USER=root
export NVIM_ARANGO_PASSWORD=root
export NVIM_ARANGO_SCHEME=https
export NVIM_ARANGO_HOST=db.example.com
export NVIM_ARANGO_PORT=8529
export NVIM_ARANGO_KORE_URL='https://root:root@db.example.com:8529/kore':ArangoBrowse- pick a database, then open the collections picker:ArangoBrowse {database}- open the collections picker for a specific database:ArangoResume- reopen the current browser picker:ArangoBack- return to the previous ArangoDB picker or document view:ArangoDocumentSave- buffer-local command that saves the current document buffer, or creates a draft document on first save:ArangoDocumentDuplicate- buffer-local command that duplicates the current document buffer into a new draft with a fresh id:ArangoDocumentDelete- buffer-local command that deletes the current document buffer, or discards a draft document:ArangoDocumentRelated- buffer-local command that opens a related document from direct keys, nested relations, or reverse links in the current buffer
- Collections picker defaults:
Enteropen collection,Ctrl-acreate a draft document,Ctrl-ncreate a collection,Ctrl-dduplicate a collection,Ctrl-rrename a collection,Ctrl-ttruncate a collection,Ctrl-xopen the actions menu,Ctrl-bgo back to the database picker when available - Documents picker defaults:
Ctrl-acreate a draft document in the current collection,Ctrl-yduplicate the selected document into a new draft with a fresh id,Ctrl-ddelete the selected document,Ctrl-ttruncate the current collection after confirmation,Ctrl-xopen the actions menu for the current document listing,Ctrl-fchange filter field,Ctrl-ureset search,Ctrl-oopen related,Ctrl-pprevious page,Ctrl-nnext page,Ctrl-bgo back
require("arangodb").setup(opts)
require("arangodb").browse({ database = "kore" })
require("arangodb").resume()
require("arangodb").back()Run:
:checkhealth arangodbIt checks the HTTP transport setup, optional HTTPS support through curl, snacks.nvim, and detected database candidates.
- This plugin currently relies on
folke/snacks.nvimfor the live picker UI. - Use
http://for plain connections orhttps://for TLS-enabled instances. - Install
curlto usehttps://connections. - Connection strings may contain credentials, so prefer environment variables if you do not want them stored in your config.
- Add a license before making the repository fully public for reuse.