Dotfiles_nvim/lua/editor/terminal.lua

31 lines
732 B
Lua
Raw Normal View History

2024-07-02 21:52:43 +00:00
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,
}