Dotfiles_nvim/lua/editor/terminal.lua
2024-07-02 23:52:43 +02:00

30 lines
732 B
Lua

return {
'rebelot/terminal.nvim',
config = function()
local terminal = require('terminal')
terminal.setup({
layout = {
open_cmd = 'vertical new',
},
cmd = { 'bash' },
autoclose = true,
})
local project_dir = require('util.finder').get_opened_folder()
local term
local function toggle()
if term == nil then
term = terminal.terminal:new()
term.cwd = project_dir
end
term:toggle()
end
vim.keymap.set(
{ 'n', 't' },
'<F6>',
toggle,
{ desc = 'Toggle Terminal' }
)
end,
}