From 02f4aab2156504e0e10ef92dab63e0f3c519d96c Mon Sep 17 00:00:00 2001 From: "asep.komarudin" Date: Sun, 30 Jun 2024 18:53:42 +0700 Subject: [PATCH] add: prisma format and key mappings --- lua/plugins/prisma.lua | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/lua/plugins/prisma.lua b/lua/plugins/prisma.lua index 67dbb24..2f43df1 100644 --- a/lua/plugins/prisma.lua +++ b/lua/plugins/prisma.lua @@ -14,9 +14,40 @@ if pcode.active_prisma_config then opts.ensure_installed = opts.ensure_installed or {} vim.list_extend(opts.ensure_installed, { "prismals" }) vim.cmd([[ - autocmd BufWritePost *.prisma silent! execute "!npx prisma format" - ]]) + autocmd BufWritePost *.prisma silent! execute "!npx prisma format" + ]]) end, + keys = { + { "p", "", desc = "  Prisma" }, + { + "pf", + function() + vim.cmd("execute '!npx prisma format'") + end, + desc = "Prisma Format", + }, + { + "pm", + function() + vim.cmd("execute '!npx prisma init --datasource-provider mysql'") + end, + desc = "init MySQL", + }, + { + "pp", + function() + vim.cmd("execute '!npx prisma init --datasource-provider postgresql'") + end, + desc = "init postgresql", + }, + { + "pe", + function() + vim.cmd("execute '!npx prisma migrate dev --name init'") + end, + desc = "Migrate", + }, + }, }, } end