From c6b29713a07dba4c37683ee899f41dabbca3482c Mon Sep 17 00:00:00 2001 From: Arthur <82575487+arthur-mountain@users.noreply.github.com> Date: Wed, 26 Jun 2024 04:01:04 +0800 Subject: [PATCH] docs(extra.sql): add sql options docs (#3765) ## What is this PR for? A small contribution to enhance the documentation and make it easier to use. While vim-dadbod and vim-dadbod-ui recommend using dotenv.vim for env file injection, we aim to provide a simpler method. Instead of implementing file parsing or relying on an external plugin (dotenv.vim), just try directly using a Lua table. ## Does this PR fix an existing issue? none! ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/sql.lua | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/sql.lua b/lua/lazyvim/plugins/extras/lang/sql.lua index 6eee33a6..a4b426ba 100644 --- a/lua/lazyvim/plugins/extras/lang/sql.lua +++ b/lua/lazyvim/plugins/extras/lang/sql.lua @@ -1,3 +1,31 @@ +if lazyvim_docs then + -- The setup below will automatically configure connections without the need for manual input each time. + + -- Example configuration using dictionary with keys: + -- vim.g.dbs = { + -- dev = "Replace with your database connection URL.", + -- staging = "Replace with your database connection URL.", + -- } + -- or + -- Example configuration using a list of dictionaries: + -- vim.g.dbs = { + -- { name = "dev", url = "Replace with your database connection URL." }, + -- { name = "staging", url = "Replace with your database connection URL." }, + -- } + + -- or + -- Create a `.lazy.lua` file in your project and set your connections like this: + -- ```lua + -- vim.g.dbs = {...} + -- + -- return {} + -- ``` + + -- Alternatively, you can also use other methods to inject your environment variables. + + -- Finally, please make sure to add `.lazy.lua` to your `.gitignore` file to protect your secrets. +end + local sql_ft = { "sql", "mysql", "plsql" } return {