Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example configuration using lazy.nvim #25

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 58 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,76 @@ Install using your favorite plugin manager:
**Using Packer**

```lua

use {'PedramNavid/dbtpal',
use {
"PedramNavid/dbtpal",
config = function()
local dbt = require('dbtpal')
dbt.setup {
-- Path to the dbt executable
path_to_dbt = "dbt",

-- Path to the dbt project, if blank, will auto-detect
-- using currently open buffer for all sql,yml, and md files
path_to_dbt_project = "",
local dbt = require("dbtpal")
dbt.setup({
-- Path to the dbt executable
path_to_dbt = "dbt",

-- Path to dbt profiles directory
path_to_dbt_profiles_dir = vim.fn.expand "~/.dbt",
-- Path to the dbt project, if blank, will auto-detect
-- using currently open buffer for all sql,yml, and md files
path_to_dbt_project = "",

-- Search for ref/source files in macros and models folders
extended_path_search = true,
-- Path to dbt profiles directory
path_to_dbt_profiles_dir = vim.fn.expand("~/.dbt"),

-- Prevent modifying sql files in target/(compiled|run) folders
protect_compiled_files = true
-- Search for ref/source files in macros and models folders
extended_path_search = true,

}
-- Prevent modifying sql files in target/(compiled|run) folders
protect_compiled_files = true,
})

-- Setup key mappings

vim.keymap.set('n', '<leader>drf', dbt.run)
vim.keymap.set('n', '<leader>drp', dbt.run_all)
vim.keymap.set('n', '<leader>dtf', dbt.test)
vim.keymap.set('n', '<leader>dm', require('dbtpal.telescope').dbt_picker)
vim.keymap.set("n", "<leader>drf", dbt.run)
vim.keymap.set("n", "<leader>drp", dbt.run_all)
vim.keymap.set("n", "<leader>dtf", dbt.test)
vim.keymap.set("n", "<leader>dm", require("dbtpal.telescope").dbt_picker)

-- Enable Telescope Extension
require'telescope'.load_extension('dbtpal')
end,
requires = { { 'nvim-lua/plenary.nvim' }, {'nvim-telescope/telescope.nvim'} }
}
require("telescope").load_extension("dbtpal")
end,
requires = { { "nvim-lua/plenary.nvim" }, { "nvim-telescope/telescope.nvim" } },
}
```

**Using lazy.nvim**

<details>
<summary>Show configuration...</summary>

```lua
{
"PedramNavid/dbtpal",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
cmpadden marked this conversation as resolved.
Show resolved Hide resolved
config = function()
local dbt = require("dbtpal")

dbt.setup({
path_to_dbt = "dbt",
path_to_dbt_project = "",
path_to_dbt_profiles_dir = vim.fn.expand("~/.dbt"),
extended_path_search = true,
protect_compiled_files = true,
})

vim.keymap.set("n", "<leader>drf", dbt.run)
vim.keymap.set("n", "<leader>drp", dbt.run_all)
vim.keymap.set("n", "<leader>dtf", dbt.test)
vim.keymap.set("n", "<leader>dm", require("dbtpal.telescope").dbt_picker)

require("telescope").load_extension("dbtpal")
end,
}
cmpadden marked this conversation as resolved.
Show resolved Hide resolved
```
</details>

## 🙈 Commands

dbtpal has sensible defaults and can auto-detect project directories based
Expand Down