2021-11-02 12:19:04 +01:00
|
|
|
local Terminal = require("toggleterm.terminal").Terminal
|
|
|
|
local u = require("utils")
|
|
|
|
local lazygit =
|
2021-11-17 12:54:51 +01: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(term)
|
|
|
|
Terminal:close()
|
|
|
|
end
|
|
|
|
}
|
2021-11-02 12:19:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
function _lazygit_toggle()
|
2021-11-17 12:54:51 +01:00
|
|
|
lazygit:toggle()
|
2021-11-02 12:19:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true})
|
|
|
|
|
|
|
|
local pnpm =
|
2021-11-17 12:54:51 +01: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
|
|
|
)
|
|
|
|
|
|
|
|
function _pnpm_toggle()
|
2021-11-17 12:54:51 +01:00
|
|
|
pnpm:toggle()
|
2021-11-02 12:19:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _pnpm_toggle()<CR>", {noremap = true, silent = true})
|
|
|
|
|
|
|
|
local nvimConfig =
|
2021-11-17 12:54:51 +01:00
|
|
|
Terminal:new(
|
|
|
|
{
|
|
|
|
cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -",
|
|
|
|
direction = "float",
|
|
|
|
on_close = function(term)
|
|
|
|
Terminal:close()
|
|
|
|
u.ReloadConfig()
|
|
|
|
end
|
|
|
|
}
|
2021-11-02 12:19:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
function _nvimConfig_toggle()
|
2021-11-17 12:54:51 +01:00
|
|
|
nvimConfig:toggle()
|
2021-11-02 12:19:04 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap("n", "<Leader><C-i>", "<cmd>lua _nvimConfig_toggle()<CR>", {noremap = true, silent = true})
|
|
|
|
|
|
|
|
require("toggleterm").setup {
|
2021-11-17 12:54:51 +01:00
|
|
|
shade_terminals = true
|
2021-11-02 12:19:04 +01:00
|
|
|
}
|