cybertruck

main
Dominik Madarász 2024-11-14 19:14:47 +01:00
parent 659651aa54
commit b506c9f1b0
2 changed files with 6 additions and 7 deletions

View File

@ -19,13 +19,9 @@ local cmp = require('cmp')
local cmp_select = { behavior = cmp.SelectBehavior.Select } local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({ cmp.setup({
sources = { sources = {
{name = 'nvim_lsp'},
{name = 'cmp-buffer'},
{name = 'cmp-path'},
{name = 'copilot'},
{name = 'buffer'},
{name = 'path'},
{name = 'treesitter'}, {name = 'treesitter'},
{name = 'nvim_lsp'},
{name = 'copilot'},
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
@ -35,7 +31,7 @@ cmp.setup({
['<CR>'] = cmp.mapping.confirm({ ['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
}) }),
}) })
}) })

View File

@ -28,14 +28,17 @@ function toggleTerminal()
-- If the terminal is open in the current window, hide it -- If the terminal is open in the current window, hide it
if vim.api.nvim_get_current_buf() == term_buf then if vim.api.nvim_get_current_buf() == term_buf then
vim.cmd("close") vim.cmd("close")
vim.cmd("wincmd w")
else else
-- Otherwise, open the terminal buffer in a split at the bottom -- 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.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.25))
vim.api.nvim_set_current_buf(term_buf) vim.api.nvim_set_current_buf(term_buf)
vim.cmd("startinsert") vim.cmd("startinsert")
end end
else else
-- If no terminal buffer exists, create a new one -- 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("belowright split | resize " .. math.floor(vim.o.lines * 0.25))
vim.cmd("terminal") vim.cmd("terminal")
vim.cmd("startinsert") vim.cmd("startinsert")