Skip to content

Commit

Permalink
autocmd trick
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Orfo committed Oct 30, 2024
1 parent 7719c47 commit 426cc4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ mycollection.find({ "field1": "value1" }).sort({"info": -1})
---

## Tricks
As **nvim-dbeer** resets the default database connection everytime Neovim is close. There is a chance to set N scripts to X database everytime threy are opened. Using **Neovim autocmd**:
As **nvim-dbeer** resets the default database connection everytime Neovim is close. There is a chance to set N scripts to X database everytime threy are opened. Using **Neovim autocmd** in **init.lua**:
```lua
-- Everytime test.sql, other.sql, update.sql the default database is set to '2'
-- Everytime test.sql, other.sql, update.sql are opened the default database is set to '2'
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = { "test.sql", "other.sql", "update.sql" },
callback = function()
Expand Down

0 comments on commit 426cc4a

Please sign in to comment.