black / ruff depending on project
This commit is contained in:
parent
7619e6e50f
commit
f339af2a81
@ -11,12 +11,23 @@ local function config()
|
|||||||
-- sudo pacman -S stylua
|
-- sudo pacman -S stylua
|
||||||
-- https://github.com/JohnnyMorganz/StyLua/releases
|
-- https://github.com/JohnnyMorganz/StyLua/releases
|
||||||
lua = { fmt_lua.stylua },
|
lua = { fmt_lua.stylua },
|
||||||
-- pip install isort black
|
-- pip install isort black ruff
|
||||||
-- TODO: ruff format, depending on the project
|
|
||||||
python = {
|
python = {
|
||||||
fmt_python.isort,
|
fmt_python.isort,
|
||||||
fmt_python.ruff,
|
function()
|
||||||
-- fmt_python.black,
|
-- use `black` or `ruff` based on the project dir
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
-- substr the cwd starting at the last "/" character
|
||||||
|
local cwd_name = string.sub(cwd, -cwd:reverse():find('/') + 1)
|
||||||
|
local style = {
|
||||||
|
['invsys'] = fmt_python.black,
|
||||||
|
['invsys-b'] = fmt_python.black,
|
||||||
|
['invsys-c'] = fmt_python.black,
|
||||||
|
['cubix'] = fmt_python.ruff,
|
||||||
|
['slots'] = fmt_python.ruff,
|
||||||
|
}
|
||||||
|
return style[cwd_name] or nil
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
-- sudo npm i -g fixjson
|
-- sudo npm i -g fixjson
|
||||||
json = { fmt_json.fixjson },
|
json = { fmt_json.fixjson },
|
||||||
|
Loading…
Reference in New Issue
Block a user