From b6f72022f04f02e3d8b06d9a334fa946460315ac Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Tue, 9 Jul 2024 22:26:48 +0200 Subject: [PATCH] docs: Update readme with Neovim Lua g:dbs example --- README.md | 20 ++++++++++++++++++++ doc/dadbod-ui.txt | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d8382ff..895dc5a 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,26 @@ let g:dbs = [ \ { 'name': 'production', 'url': function('s:resolve_production_url') }, \ ] ``` + +In case you use Neovim, here's an example with Lua: + +```lua + vim.g.dbs = { + { + { name = 'dev', url = 'postgres://postgres:mypassword@localhost:5432/my-dev-db' } + { name = 'staging', url = 'postgres://postgres:mypassword@localhost:5432/my-staging-db' }, + { name = 'wp', url = 'mysql://root@localhost/wp_awesome' }, + { + name = 'production', + url = function() + return vim.fn.system('get-prod-url') + end + }, + } + } +``` + + Just make sure to **NOT COMMIT** these. I suggest using project local vim config (`:help exrc`) #### Via :DBUIAddConnection command diff --git a/doc/dadbod-ui.txt b/doc/dadbod-ui.txt index 807e8e2..218306d 100644 --- a/doc/dadbod-ui.txt +++ b/doc/dadbod-ui.txt @@ -191,10 +191,10 @@ If you use Neovim, you can also use lua to define the connections: { name = 'staging', url = 'postgres://postgres:mypassword@localhost:5432/my-staging-db' }, { name = 'wp', url = 'mysql://root@localhost/wp_awesome' }, { - name = 'production', - url = function() - return vim.fn.system('get-prod-url') - end + name = 'production', + url = function() + return vim.fn.system('get-prod-url') + end }, } }