cybertruck
parent
659651aa54
commit
b506c9f1b0
|
@ -19,13 +19,9 @@ local cmp = require('cmp')
|
|||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{name = 'nvim_lsp'},
|
||||
{name = 'cmp-buffer'},
|
||||
{name = 'cmp-path'},
|
||||
{name = 'copilot'},
|
||||
{name = 'buffer'},
|
||||
{name = 'path'},
|
||||
{name = 'treesitter'},
|
||||
{name = 'nvim_lsp'},
|
||||
{name = 'copilot'},
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
|
@ -35,7 +31,7 @@ cmp.setup({
|
|||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
})
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -28,14 +28,17 @@ function toggleTerminal()
|
|||
-- If the terminal is open in the current window, hide it
|
||||
if vim.api.nvim_get_current_buf() == term_buf then
|
||||
vim.cmd("close")
|
||||
vim.cmd("wincmd w")
|
||||
else
|
||||
-- Otherwise, open the terminal buffer in a split at the bottom
|
||||
vim.cmd("wincmd w")
|
||||
vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.25))
|
||||
vim.api.nvim_set_current_buf(term_buf)
|
||||
vim.cmd("startinsert")
|
||||
end
|
||||
else
|
||||
-- If no terminal buffer exists, create a new one
|
||||
vim.cmd("wincmd w")
|
||||
vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.25))
|
||||
vim.cmd("terminal")
|
||||
vim.cmd("startinsert")
|
||||
|
|
Loading…
Reference in New Issue