You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.4 KiB

1 month ago
local django = require "django.utils"
local mappings = {
n = {
["<leader>j"] = { desc = " Django" },
["<leader>ja"] = {
function()
django.create_app()
end,
desc = "create app",
},
["<leader>jd"] = {
function()
django.dump_data()
end,
desc = "dump data",
},
["<leader>jo"] = {
function()
django.load_data()
end,
desc = "load data",
},
["<leader>jt"] = {
function()
django.reset_data()
end,
desc = "reset data",
},
1 month ago
["<leader>jp"] = {
function()
django.create_package()
end,
desc = "create python package",
},
["<leader>js"] = {
function()
django.manage_shell_plus(true)
end,
desc = "shell plus",
},
["<leader>je"] = {
function()
django.create_env_file()
end,
desc = "create env file",
},
["<leader>jr"] = {
function()
django.manage_run_server "make run"
end,
desc = "run server",
},
["<leader>jm"] = {
function()
django.manage_make_migrations()
end,
desc = "make migrations",
},
["<leader>ji"] = {
function()
django.manage_migrate()
end,
desc = "migrate",
},
["<leader>jc"] = {
function()
django.check()
end,
desc = "check",
},
["<leader>jh"] = {
function()
django.show_migrations()
end,
desc = "show migrations",
},
["<leader>jy"] = {
function()
django.run_celery()
end,
desc = "run celery",
},
["<leader>jl"] = { desc = "Language" },
["<leader>jlc"] = {
function()
django.compile_messages()
end,
desc = "Compile messages",
},
["<leader>jlm"] = {
function()
django.make_messages()
end,
desc = "Make messages",
},
1 month ago
},
}
local M = {}
local function key_map(mod, lhs, rhs, opts)
if type(lhs) == "string" then
vim.keymap.set(mod, lhs, rhs, opts)
elseif type(lhs) == "table" then
for _, key in pairs(lhs) do
vim.keymap.set(mod, key, rhs, opts)
end
end
end
function M.setup_global_mappings()
if mappings then
for k, v in pairs(mappings.n) do
if unpack(v) == nil then
key_map("n", k, "", { desc = v.desc })
else
key_map("n", k, unpack(v), { desc = v.desc })
end
end
end
end
return M