Skip to content

Commit

Permalink
docs: Update readme with Neovim Lua g:dbs example
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jul 9, 2024
1 parent ab83371 commit b6f7202
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions doc/dadbod-ui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
}
Expand Down

0 comments on commit b6f7202

Please sign in to comment.