switch sql formatter to sql-formatter, filter obsidian workspaces by existence
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8bd885a06a
commit
62b7744614
@ -1,7 +1,7 @@
|
|||||||
local options = {
|
local options = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
sql = { "pg_format", "sqlfluff" }, -- pg_format first, fallback to sqlfluff
|
sql = { "sql-formatter" },
|
||||||
json = { "jq" },
|
json = { "jq" },
|
||||||
markdown = { "mdformat" },
|
markdown = { "mdformat" },
|
||||||
-- css = { "prettier" },
|
-- css = { "prettier" },
|
||||||
@ -9,15 +9,10 @@ local options = {
|
|||||||
},
|
},
|
||||||
-- no format_on_save (manual-only)
|
-- no format_on_save (manual-only)
|
||||||
formatters = {
|
formatters = {
|
||||||
pg_format = {
|
["sql-formatter"] = {
|
||||||
prepend_args = {
|
command = vim.fn.stdpath("data") .. "/mason/bin/sql-formatter",
|
||||||
"--keyword-case", "2", -- 1 = UPPER, 2 = lower
|
args = { "-l", "postgresql" },
|
||||||
"--function-case", "2", -- 2 = lower
|
stdin = true,
|
||||||
"--spaces", "4",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sqlfluff = {
|
|
||||||
args = { "fix", "--force", "--dialect", "postgres", "-" },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,20 @@
|
|||||||
local home = os.getenv("HOME") or "~"
|
local home = os.getenv("HOME") or "~"
|
||||||
|
|
||||||
|
local function dir_exists(path)
|
||||||
|
return vim.fn.isdirectory(vim.fn.expand(path)) == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local all_workspaces = {
|
||||||
|
{ name = "journal", path = home .. "/journal" },
|
||||||
|
{ name = "work", path = home .. "/hc_notes" },
|
||||||
|
{ name = "SQL", path = "/mnt/c/Users/ptrowbridge/SQL" },
|
||||||
|
{ name = "pl", path = "/mnt/c/Users/ptrowbridge/plbuild" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local workspaces = vim.tbl_filter(function(w)
|
||||||
|
return dir_exists(w.path)
|
||||||
|
end, all_workspaces)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"epwalsh/obsidian.nvim",
|
"epwalsh/obsidian.nvim",
|
||||||
version = "*",
|
version = "*",
|
||||||
@ -9,24 +24,7 @@ return {
|
|||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
workspaces = {
|
workspaces = workspaces,
|
||||||
{
|
|
||||||
name = "journal",
|
|
||||||
path = home .. "/journal",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "work",
|
|
||||||
path = home .. "/hc_notes",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "SQL",
|
|
||||||
path = "/mnt/c/Users/ptrowbridge/SQL",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "pl",
|
|
||||||
path = "/mnt/c/Users/ptrowbridge/plbuild",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user