Enable toggling terminal windows

pull/413/head
Andreas Wachs 2 years ago
parent 4e1eff9b87
commit d2382b9042
No known key found for this signature in database
GPG Key ID: 46FF84123E7DCEAC

@ -1,52 +1,66 @@
return {
{
"akinsho/toggleterm.nvim",
event = "VeryLazy",
cmd = { "ToggleTerm", "TermExec" },
config = function()
local Terminal = require('toggleterm.terminal').Terminal
local defaultTerm = Terminal:new({ cmd = "zsh", hidden = true, direction = "float" })
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true, direction = "float" })
local pythonREPL = Terminal:new({ cmd = "python3", hidden = true, direction = "float" })
local haskellREPL = Terminal:new({ cmd = "ghci", hidden = true, direction = "float" })
function _defaultterm_toggle()
defaultTerm:toggle()
end
function _lazygit_toggle()
lazygit:toggle()
end
return { function _pythonREPL_toggle()
{ pythonREPL:toggle()
"akinsho/toggleterm.nvim", end
event = "VeryLazy",
cmd = { "ToggleTerm", "TermExec" },
config = function()
-- Lazygit
local Terminal = require('toggleterm.terminal').Terminal
local defaultTerm = Terminal:new({ cmd = "zsh", hidden = true, direction = "float" })
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true, direction = "float" })
local pythonREPL = Terminal:new({ cmd = "python3", hidden = true, direction = "float" })
local haskellREPL = Terminal:new({ cmd = "ghci", hidden = true, direction = "float" })
function _defaultterm_toggle() function _haskellREPL_toggle()
defaultTerm:toggle() haskellREPL:toggle()
end end
function _lazygit_toggle()
lazygit:toggle()
end
function _pythonREPL_toggle() function toggle_all()
pythonREPL:toggle() if defaultTerm:is_open() then
end defaultTerm:toggle()
end
if lazygit:is_open() then
lazygit:toggle()
end
if pythonREPL:is_open() then
pythonREPL:toggle()
end
if haskellREPL:is_open() then
haskellREPL:toggle()
end
end
function _haskellREPL_toggle() vim.keymap.set('n', '<space>tt', "<cmd>lua _defaultterm_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true })
haskellREPL:toggle() vim.keymap.set('n', '<F7>', "<cmd>lua _defaultterm_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true })
end vim.keymap.set('n', '<space>tl', "<cmd>lua _lazygit_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true })
vim.keymap.set('n', '<space>tp', "<cmd>lua _pythonREPL_toggle()<CR>", { desc = 'Toggle Python3 REPL', noremap = true, silent = true })
vim.keymap.set('n', '<space>th', "<cmd>lua _haskellREPL_toggle()<CR>", { desc = 'Toggle GHCI', noremap = true, silent = true })
vim.keymap.set('n', '<space>tt', "<cmd>lua _defaultterm_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true }) vim.keymap.set('t', '<C-l>', '<cmd>lua toggle_all()<CR>', { desc = 'Toggle all visible terminals' })
vim.keymap.set('n', '<F7>', "<cmd>lua _defaultterm_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true }) end,
vim.keymap.set('n', '<space>tl', "<cmd>lua _lazygit_toggle()<CR>", { desc = 'Toggle Lazygit', noremap = true, silent = true }) opts = {
vim.keymap.set('n', '<space>tp', "<cmd>lua _pythonREPL_toggle()<CR>", { desc = 'Toggle Python3 REPL', noremap = true, silent = true }) size = 10,
vim.keymap.set('n', '<space>th', "<cmd>lua _haskellREPL_toggle()<CR>", { desc = 'Toggle GHCI', noremap = true, silent = true }) on_create = function()
end, vim.opt.foldcolumn = "0"
opts = { vim.opt.signcolumn = "no"
size = 10, end,
on_create = function() open_mapping = [[<F7>]],
vim.opt.foldcolumn = "0" shading_factor = 2,
vim.opt.signcolumn = "no" direction = "float",
end, float_opts = {
open_mapping = [[<F7>]], border = "curved",
shading_factor = 2, highlights = { border = "Normal", background = "Dark" },
direction = "float", },
float_opts = { },
border = "curved",
highlights = { border = "Normal", background = "Dark" },
},
}, },
},
} }

Loading…
Cancel
Save