{"id":44826032,"url":"https://github.com/zerochae/dbab.nvim","last_synced_at":"2026-04-06T04:11:35.708Z","repository":{"id":336814747,"uuid":"1150396750","full_name":"zerochae/dbab.nvim","owner":"zerochae","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-19T00:38:10.000Z","size":13043,"stargazers_count":23,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T06:38:45.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerochae.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-05T08:24:09.000Z","updated_at":"2026-02-19T00:38:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zerochae/dbab.nvim","commit_stats":null,"previous_names":["zerochae/dbab.nvim"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zerochae/dbab.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerochae%2Fdbab.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerochae%2Fdbab.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerochae%2Fdbab.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerochae%2Fdbab.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerochae","download_url":"https://codeload.github.com/zerochae/dbab.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerochae%2Fdbab.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29856813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-16T22:00:42.461Z","updated_at":"2026-02-26T11:03:01.977Z","avatar_url":"https://github.com/zerochae.png","language":"Lua","readme":"# dbab.nvim\n\nA lightweight database client for Neovim. Query databases directly from your editor.\n\n![dbab.nvim](./screenshots/main.png)\n\n## Features\n\n- **Multi-database support**: PostgreSQL, MySQL, MariaDB, SQLite\n- **Flexible layout**: Choose from presets or define your own pane arrangement\n- **Schema browser**: Navigate schemas, tables, and columns in sidebar\n- **Query editor**: Write and execute SQL with syntax highlighting\n- **Query history**: Track executed queries with timing, re-execute or load to editor\n- **Multiple query tabs**: Work with multiple queries simultaneously\n- **Save queries**: Store frequently used queries per connection\n- **Result viewer**: Multiple display styles (table, json, vertical, markdown, raw) with type-aware highlighting\n\n## Layout\n\n### Classic (default)\n\n![Classic Layout](./screenshots/layout-classic.png)\n\n```\n┌─────────────────────┬─────────────────────────────────────┐\n│ Sidebar (20%)       │ Query Editor (80%)                  │\n├─────────────────────┼─────────────────────────────────────┤\n│ History (20%)       │ Result Viewer (80%)                 │\n└─────────────────────┴─────────────────────────────────────┘\n```\n\n### Wide\n\n![Wide Layout](./screenshots/layout-wide.png)\n\n```\n┌─────────────────────┬─────────────────────┬───────────────┐\n│ Sidebar (33%)       │ Query Editor (34%)  │ History (33%) │\n├───────────────────────────────────────────────────────────┤\n│                    Result Viewer (100%)                   │\n└───────────────────────────────────────────────────────────┘\n```\n\n## Requirements\n\n- Neovim \u003e= 0.9.0\n- Database CLI tools:\n  - `psql` for PostgreSQL\n  - `mysql` for MySQL/MariaDB\n  - `sqlite3` for SQLite\n- [nui.nvim](https://github.com/MunifTanjim/nui.nvim)\n- [vim-dadbod](https://github.com/tpope/vim-dadbod) (optional: for `executor = \"dadbod\"`)\n- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) (optional: for async execution)\n\n## Installation\n\n### lazy.nvim\n\n```lua\n{\n  \"zerochae/dbab.nvim\",\n  dependencies = {\n    \"MunifTanjim/nui.nvim\",\n    \"nvim-lua/plenary.nvim\",       -- Optional: for async execution\n    \"tpope/vim-dadbod\",            -- Optional: for executor = \"dadbod\"\n    \"hrsh7th/nvim-cmp\",            -- Optional: for nvim-cmp autocompletion\n  },\n  -- For blink.cmp, the source is included in this plugin (blink_dbab)\n  config = function()\n    require(\"dbab\").setup({\n      connections = {\n        { name = \"local\", url = \"postgres://user:pass@localhost:5432/mydb\" },\n        { name = \"prod\", url = \"$DATABASE_URL\" }, -- supports env vars\n      },\n    })\n  end,\n}\n```\n\n## Autocompletion (Optional)\n\n### nvim-cmp\n\nIf you use `nvim-cmp`, add `dbab` to your sources to enable SQL autocompletion (tables, columns, keywords):\n\n```lua\nrequire(\"cmp\").setup({\n  sources = {\n    { name = \"dbab\" },\n    -- other sources...\n  },\n})\n```\n\n### blink.cmp\n\nIf you use `blink.cmp`, add `dbab` to your sources:\n\n```lua\nrequire(\"blink.cmp\").setup({\n  sources = {\n    default = { \"lsp\", \"path\", \"snippets\", \"buffer\", \"dbab\" },\n    providers = {\n      dbab = {\n        name = \"dbab\",\n        module = \"blink_dbab\",\n      },\n    },\n  },\n})\n```\n\n## Usage\n\n### Commands\n\n| Command | Description |\n|---------|-------------|\n| `:Dbab` | Open dbab sidebar |\n| `:DbabClose` | Close dbab |\n\n### Sidebar Keymaps\n\n| Key | Action |\n|-----|--------|\n| `\u003cCR\u003e` / `o` | Toggle node / Open query |\n| `\u003cTab\u003e` | Move to editor |\n| `S` | Select table (SELECT *) |\n| `i` | Insert table (INSERT template) |\n| `d` | Delete saved query |\n| `q` | Close |\n\n### Editor Keymaps\n\n| Key | Action |\n|-----|--------|\n| `\u003cCR\u003e` | Execute query |\n| `\u003cC-s\u003e` | Save query |\n| `gt` / `gT` | Next / Previous tab |\n| `\u003cLeader\u003ew` | Close tab |\n| `\u003cTab\u003e` | Move to result |\n| `q` | Close |\n\n### History Keymaps\n\n| Key | Action |\n|-----|--------|\n| `\u003cCR\u003e` | Load or execute query (based on config) |\n| `R` | Re-execute query immediately |\n| `y` | Copy query to clipboard |\n| `d` | Delete entry |\n| `C` | Clear all history |\n| `\u003cTab\u003e` | Move to sidebar |\n| `\u003cS-Tab\u003e` | Move to result |\n| `q` | Close |\n\n### Result Keymaps\n\n| Key | Action |\n|-----|--------|\n| `y` | Yank current row as JSON |\n| `Y` | Yank all rows as JSON |\n| `\u003cTab\u003e` | Move to sidebar |\n| `\u003cS-Tab\u003e` | Move to editor |\n| `q` | Close |\n\n## Screenshots\n\n### Schema Browser\n![Schema Browser](./screenshots/sidebar.png)\n\n### Query Result with Type Highlighting\n![Result Viewer](./screenshots/result.png)\n\n### Query History\n![Query History](./screenshots/history.png)\n\n## Configuration\n\n```lua\nrequire(\"dbab\").setup({\n  connections = {\n    { name = \"local\", url = \"postgres://localhost/mydb\" },\n  },\n  executor = \"cli\",    -- \"cli\" (self-contained) | \"dadbod\" (requires vim-dadbod)\n  layout = \"classic\",  -- \"classic\" | \"wide\" | custom layout table\n  sidebar = {\n    width = 0.2,\n    use_brand_icon = false,   -- true: per-DB icons, false: generic db icon\n    use_brand_color = false,  -- true: per-DB brand colors, false: single color (Number)\n    show_brand_name = false,  -- true: show [postgres] label, false: icon + name only\n    show_system_schemas = true,\n  },\n  editor = {\n    show_tabbar = true,       -- show tab bar above editor\n  },\n  result = {\n    max_width = 120,\n    max_height = 20,\n    show_line_number = true,\n    header_align = \"fit\",     -- \"fit\" or \"full\"\n    style = \"table\",          -- \"table\", \"json\", \"raw\", \"vertical\", \"markdown\"\n  },\n  history = {\n    width = 0.2,\n    style = \"compact\",        -- \"compact\" or \"detailed\"\n    max_entries = 100,\n    on_select = \"execute\",    -- \"execute\" or \"load\"\n    persist = true,\n    filter_by_connection = true,\n    query_display = \"auto\",   -- \"short\", \"full\", or \"auto\"\n    short_hints = { \"where\", \"join\", \"order\", \"group\", \"limit\" },\n  },\n  keymaps = {\n    open = \"\u003cLeader\u003edb\",\n    execute = \"\u003cCR\u003e\",\n    close = \"q\",\n    sidebar = {\n      toggle_expand = { \"\u003cCR\u003e\", \"o\" },\n      refresh = \"R\",\n      rename = \"r\",\n      new_query = \"n\",\n      copy_name = \"y\",\n      insert_template = \"i\",\n      delete = \"d\",\n      copy_query = \"c\",\n      paste_query = \"p\",\n      to_editor = \"\u003cTab\u003e\",\n      to_history = \"\u003cS-Tab\u003e\",\n    },\n    history = {\n      select = \"\u003cCR\u003e\",\n      execute = \"R\",\n      copy = \"y\",\n      delete = \"d\",\n      clear = \"C\",\n      to_sidebar = \"\u003cTab\u003e\",\n      to_result = \"\u003cS-Tab\u003e\",\n    },\n    editor = {\n      execute_insert = \"\u003cC-CR\u003e\",\n      execute_leader = \"\u003cLeader\u003er\",\n      save = \"\u003cC-s\u003e\",\n      next_tab = \"gt\",\n      prev_tab = \"gT\",\n      close_tab = \"\u003cLeader\u003ew\",\n      to_result = \"\u003cTab\u003e\",\n      to_sidebar = \"\u003cS-Tab\u003e\",\n    },\n    result = {\n      yank_row = \"y\",\n      yank_all = \"Y\",\n      to_sidebar = \"\u003cTab\u003e\",\n      to_editor = \"\u003cS-Tab\u003e\",\n    },\n  },\n  highlights = {\n    -- Override any Dbab highlight group\n    -- DbabHeader = { bg = \"#ff6600\", fg = \"#000000\" },\n  },\n})\n```\n\n### Layout Presets\n\n| Preset | Description |\n|--------|-------------|\n| `\"classic\"` | 4-pane layout (sidebar 20%, history 20%) |\n| `\"wide\"` | 3-column top + full-width bottom (sidebar 33%, history 33%) |\n\n### Custom Layout\n\nDefine your own pane arrangement:\n\n```lua\n-- No history panel\nlayout = {\n  { \"sidebar\", \"editor\" },\n  { \"result\" },\n}\n\n-- Editor on the left\nlayout = {\n  { \"editor\", \"sidebar\" },\n  { \"result\", \"history\" },\n}\n```\n\nComponents: `\"sidebar\"`, `\"editor\"`, `\"history\"`, `\"result\"` (editor and result are required)\n\n### Result Styles\n\nConfigure with `result.style`:\n\n| Style | Description |\n|-------|-------------|\n| `\"table\"` | Table with zebra striping and type-aware highlighting (default) |\n| `\"json\"` | JSON format with Treesitter syntax highlighting |\n| `\"vertical\"` | One record per block, column names on the left (like `psql \\x`) |\n| `\"markdown\"` | Markdown table with Treesitter syntax highlighting |\n| `\"raw\"` | Unprocessed CLI output |\n\n```lua\nresult = {\n  style = \"vertical\",\n},\n```\n\n#### table\n\n![style-table](./screenshots/result.png)\n\n\n#### raw\n\n![style-raw](./screenshots/style-raw.png)\n\n#### json\n\n![style-json](./screenshots/style-json.png)\n\n#### vertical\n\n![style-vertical](./screenshots/style-vertical.png)\n\n#### markdown\n\n![style-markdown](./screenshots/style-markdown.png)\n\n### History Styles\n\nConfigure with `history.style`:\n\n| Style | Description |\n|-------|-------------|\n| `\"compact\"` | One line per entry with verb, target, hints (default) |\n| `\"detailed\"` | Multi-line: full query with syntax highlighting + metadata below |\n\n```lua\nhistory = {\n  style = \"detailed\",\n},\n```\n\n### Sidebar Display Options\n\nControl how database connections appear in the sidebar:\n\n```lua\nsidebar = {\n  use_brand_icon = false,   -- default\n  use_brand_color = false,  -- default\n  show_brand_name = false,  -- default\n},\n```\n\n| Option | `false` (default) | `true` |\n|--------|-------------------|--------|\n| `use_brand_icon` | Generic DB icon for all connections | Per-DB brand icons (PostgreSQL, MySQL, etc.) |\n| `use_brand_color` | Single color (`Number` highlight) | Per-DB brand colors (blue, red, green, etc.) |\n| `show_brand_name` | `icon my_db` | `icon [postgres] my_db` |\n\n## Highlight Groups\n\nAll highlight groups can be overridden by defining them before `setup()`.\nGroups marked with **(computed)** are always recalculated based on your colorscheme.\n\n### Result\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabRowOdd` | **(computed)** | Odd row background |\n| `DbabRowEven` | **(computed)** | Even row background |\n| `DbabHeader` | **(computed)** | Result header (from `Function` fg) |\n| `DbabSeparator` | `Comment` | Result separator lines |\n| `DbabCellActive` | `CursorLine` | Active cell |\n\n### Window\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabFloat` | `NormalFloat` | Float window background |\n| `DbabBorder` | `WinSeparator` | Window border |\n| `DbabTitle` | `Title` | Window title |\n\n### Data Types\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabNull` | `Comment` | NULL values |\n| `DbabNumber` | `Number` | Numeric values |\n| `DbabString` | `Normal` | String values |\n| `DbabBoolean` | `Boolean` | Boolean values |\n| `DbabDateTime` | `Special` | Date/time values |\n| `DbabUuid` | `Constant` | UUID values |\n| `DbabJson` | `Function` | JSON values |\n\n### Schema\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabTable` | `Type` | Table names |\n| `DbabKey` | `Keyword` | Key names |\n| `DbabPK` | `ErrorMsg` | Primary key (bold) |\n| `DbabFK` | `Function` | Foreign key (bold) |\n\n### Sidebar\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabIconDb` | `Number` | Default DB icon color (`use_brand_color = false`) |\n| `DbabIconPostgres` | `fg=#4169E1` | PostgreSQL brand color (bold) |\n| `DbabIconMysql` | `fg=#4479A1` | MySQL brand color (bold) |\n| `DbabIconMariadb` | `fg=#003545` | MariaDB brand color (bold) |\n| `DbabIconSqlite` | `fg=#003B57` | SQLite brand color (bold) |\n| `DbabIconRedis` | `fg=#FF4438` | Redis brand color (bold) |\n| `DbabIconMongodb` | `fg=#47A248` | MongoDB brand color (bold) |\n| `DbabSidebarIconConnection` | `Number` | Connection icon |\n| `DbabSidebarIconActive` | `String` | Active connection icon |\n| `DbabSidebarIconNewQuery` | `Function` | New query icon |\n| `DbabSidebarIconBuffers` | `Function` | Buffers icon |\n| `DbabSidebarIconSaved` | `Keyword` | Saved queries icon |\n| `DbabSidebarIconSchemas` | `Special` | Schemas icon |\n| `DbabSidebarIconSchema` | `Type` | Schema icon |\n| `DbabSidebarIconTable` | `Type` | Table icon |\n| `DbabSidebarIconColumn` | `Function` | Column icon |\n| `DbabSidebarIconPK` | `ErrorMsg` | Primary key icon |\n| `DbabSidebarText` | `Normal` | Default text |\n| `DbabSidebarTextActive` | `String` | Active item text (bold) |\n| `DbabSidebarType` | `Comment` | Type annotation |\n\n### History\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabHistoryHeader` | `Title` | Section header (bold) |\n| `DbabHistoryRowOdd` | **(computed)** | Odd row background |\n| `DbabHistoryRowEven` | **(computed)** | Even row background |\n| `DbabHistoryTime` | `Comment` | Timestamp |\n| `DbabHistoryVerb` | `Keyword` | SQL verb |\n| `DbabHistoryTarget` | `Type` | Target table name |\n| `DbabHistoryDuration` | `Number` | Execution duration |\n| `DbabHistoryConnName` | `Normal` | Connection name |\n| `DbabHistorySelect` | `Function` | SELECT queries |\n| `DbabHistoryInsert` | `String` | INSERT queries |\n| `DbabHistoryUpdate` | `Type` | UPDATE queries |\n| `DbabHistoryDelete` | `ErrorMsg` | DELETE queries |\n| `DbabHistoryCreate` | `String` | CREATE statements |\n| `DbabHistoryDrop` | `ErrorMsg` | DROP statements |\n| `DbabHistoryAlter` | `Special` | ALTER statements |\n| `DbabHistoryTruncate` | `WarningMsg` | TRUNCATE statements |\n\nHint badges (compact mode):\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabHistoryHintWhere` | `WarningMsg` | WHERE clause |\n| `DbabHistoryHintJoin` | `Special` | JOIN clause |\n| `DbabHistoryHintOrder` | `Keyword` | ORDER BY |\n| `DbabHistoryHintGroup` | `Type` | GROUP BY |\n| `DbabHistoryHintLimit` | `Number` | LIMIT |\n\n### Tab Bar\n\n| Group | Default | Description |\n|-------|---------|-------------|\n| `DbabTabActive` | `bg=#3a3a4a` | Active tab (bold) |\n| `DbabTabActiveIcon` | `bg=#3a3a4a fg=#a6e3a1` | Active tab icon |\n| `DbabTabInactive` | `Comment` | Inactive tab |\n| `DbabTabInactiveIcon` | `Comment` | Inactive tab icon |\n| `DbabTabModified` | `WarningMsg` | Modified indicator |\n| `DbabTabIconSaved` | `String` | Saved query icon |\n| `DbabTabIconUnsaved` | `Function` | Unsaved query icon |\n| `DbabTabbarBg` | `Normal` | Tab bar background |\n\n### Customization\n\nOverride highlights via `setup()`:\n\n```lua\nrequire(\"dbab\").setup({\n  highlights = {\n    DbabHeader = { bg = \"#ff6600\", fg = \"#000000\" },\n    DbabNull = { fg = \"#555555\", italic = true },\n  },\n})\n```\n\n## Connection URL Format\n\n```\npostgres://user:password@host:port/database\nmysql://user:password@host:port/database\nmariadb://user:password@host:port/database\nsqlite:///path/to/database.db\n```\n\nEnvironment variables are supported: `$DATABASE_URL` or `${DATABASE_URL}`\n\n## Acknowledgements\n\nThis project was inspired by excellent existing plugins:\n\n- [vim-dadbod-ui](https://github.com/kristijanhusak/vim-dadbod-ui): The classic DB UI for Vim/Neovim.\n- [nvim-dbee](https://github.com/kndndrj/nvim-dbee): A modern approach to DB client in Neovim.\n\n`dbab.nvim` aims to provide a lightweight, self-contained alternative with a modern Lua-based UI. It can optionally integrate with [vim-dadbod](https://github.com/tpope/vim-dadbod) via `executor = \"dadbod\"`.\n\n## License\n\nMIT\n","funding_links":[],"categories":["Database"],"sub_categories":["Automation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerochae%2Fdbab.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerochae%2Fdbab.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerochae%2Fdbab.nvim/lists"}