Dotfiles_nvim/lua/editor/terminal.lua
2024-09-08 01:50:39 +02:00

32 lines
799 B
Lua

local K = require('core.keymap')
return {
'rebelot/terminal.nvim',
config = function()
local terminal = require('terminal')
terminal.setup({
layout = {
open_cmd = 'vertical new',
},
cmd = { 'zsh' },
autoclose = true,
})
local project_dir = require('util.finder').project_dir
local term
local function toggle()
if term == nil then
term = terminal.terminal:new()
term.cwd = project_dir
end
term:toggle()
end
vim.keymap.set(
K.TOGGLE_TERMINAL.mode,
K.TOGGLE_TERMINAL.shortcut,
toggle,
{ desc = K.TOGGLE_TERMINAL.description }
)
end,
}