1
0
Fork 1
Dotfiles_nvim/lua/editor/terminal.lua

33 lines
799 B
Lua
Raw Normal View History

2024-09-07 23:50:39 +00:00
local K = require('core.keymap')
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',
},
2024-09-07 23:50:39 +00:00
cmd = { 'zsh' },
2024-07-02 21:52:43 +00:00
autoclose = true,
})
2024-09-07 23:50:39 +00:00
local project_dir = require('util.finder').project_dir
2024-07-02 21:52:43 +00:00
local term
local function toggle()
if term == nil then
term = terminal.terminal:new()
term.cwd = project_dir
end
term:toggle()
end
vim.keymap.set(
2024-09-07 23:50:39 +00:00
K.TOGGLE_TERMINAL.mode,
K.TOGGLE_TERMINAL.shortcut,
2024-07-02 21:52:43 +00:00
toggle,
2024-09-07 23:50:39 +00:00
{ desc = K.TOGGLE_TERMINAL.description }
2024-07-02 21:52:43 +00:00
)
end,
}