2021-11-02 12:19:04 +01:00
|
|
|
local Terminal = require("toggleterm.terminal").Terminal
|
|
|
|
local lazygit =
|
2022-05-03 19:28:52 +02:00
|
|
|
Terminal:new(
|
|
|
|
{
|
|
|
|
cmd = "lazygit",
|
|
|
|
dir = "git_dir",
|
|
|
|
direction = "float",
|
|
|
|
float_opts = {
|
|
|
|
winblend = 0,
|
|
|
|
border = "shadow"
|
|
|
|
},
|
|
|
|
on_open = function(term)
|
|
|
|
vim.cmd("startinsert!")
|
|
|
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
|
|
|
|
end,
|
|
|
|
on_close = function()
|
|
|
|
Terminal:close()
|
|
|
|
end
|
|
|
|
}
|
2021-11-02 12:19:04 +01:00
|
|
|
)
|
|
|
|
|
2022-05-03 19:28:52 +02:00
|
|
|
function _Lazygit_toggle()
|
|
|
|
lazygit:toggle()
|
2021-11-02 12:19:04 +01:00
|
|
|
end
|
|
|
|
|
2022-05-03 19:28:52 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
|
2021-11-02 12:19:04 +01:00
|
|
|
|
|
|
|
local pnpm =
|
2022-05-03 19:28:52 +02:00
|
|
|
Terminal:new(
|
|
|
|
{
|
|
|
|
cmd = "pnpm dev",
|
|
|
|
dir = "git_dir",
|
|
|
|
size = 5,
|
|
|
|
direction = "vertical",
|
|
|
|
on_close = function(term)
|
|
|
|
Terminal:close()
|
|
|
|
end
|
|
|
|
}
|
2021-11-02 12:19:04 +01:00
|
|
|
)
|
|
|
|
|
2022-05-03 19:28:52 +02:00
|
|
|
function _Pnpm_toggle()
|
|
|
|
pnpm:toggle()
|
2021-11-02 12:19:04 +01:00
|
|
|
end
|
|
|
|
|
2022-05-03 19:28:52 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
|
2021-11-02 12:19:04 +01:00
|
|
|
|
2022-01-26 20:42:58 +01:00
|
|
|
local chtConfig =
|
2022-05-03 19:28:52 +02:00
|
|
|
Terminal:new(
|
|
|
|
{
|
|
|
|
cmd = "cht",
|
|
|
|
direction = "float"
|
|
|
|
}
|
2022-01-26 20:42:58 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
function _chtConfig_toggle()
|
2022-05-03 19:28:52 +02:00
|
|
|
chtConfig:toggle()
|
2022-01-26 20:42:58 +01:00
|
|
|
end
|
|
|
|
|
2022-05-03 19:28:52 +02:00
|
|
|
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _chtConfig_toggle()<CR>", { noremap = true, silent = true })
|
2022-01-26 20:42:58 +01:00
|
|
|
|
2021-11-02 12:19:04 +01:00
|
|
|
require("toggleterm").setup {
|
2022-05-03 19:28:52 +02:00
|
|
|
shade_terminals = true
|
2021-11-02 12:19:04 +01:00
|
|
|
}
|