Adjust <Tab> for github copilot trigger

This commit is contained in:
Garrett Dawson 2023-06-27 10:45:51 -06:00
parent 1e6a8e9049
commit 4dfb1c76a2
2 changed files with 26 additions and 21 deletions

View File

@ -22,8 +22,8 @@ vim.keymap.set('n', 'L', 'gt', { desc = 'Tab Right' })
-- line bubbling
vim.keymap.set('n', '<C-j>', ':m .+1<CR>==', { noremap = true, desc = 'Bubble Down' })
vim.keymap.set('n', '<C-k>', ':m .-2<CR>==', { noremap = true, desc = 'Bubble Up' }) -- conflicts with "signature help" from LSP
vim.keymap.set('i', '<C-j>', '<ESC>:m .+1<CR>==gi', { noremap = true, desc = 'Bubble Down' })
vim.keymap.set('i', '<C-k>', '<ESC>:m .-2<CR>==gi', { noremap = true, desc = 'Bubble Up' })
-- vim.keymap.set('i', '<C-j>', '<ESC>:m .+1<CR>==gi', { noremap = true, desc = 'Bubble Down' })
-- vim.keymap.set('i', '<C-k>', '<ESC>:m .-2<CR>==gi', { noremap = true, desc = 'Bubble Up' })
vim.keymap.set('v', '<C-k>', ":m '<-2<CR>gv=gv", { noremap = true, desc = 'Bubble Down' })
vim.keymap.set('v', '<C-j>', ":m '>+1<CR>gv=gv", { noremap = true, desc = 'Bubble Up' })
@ -35,6 +35,11 @@ vim.keymap.set('n', '<leader>sj', require('telescope.builtin').jumplist, { desc
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').git_status, { desc = '[S]earch [S]tatus' })
vim.keymap.set('n', '<leader>sm', require('telescope.builtin').marks, { desc = '[S]earch [M]arks' })
-- copilot
-- vim.g.copilot_no_tab_map = "v:true"
-- vim.keymap.set('i', '<C-j>', '<silent><script><expr> <C-J> copilot#Accept("<CR>")',
-- { noremap = true, desc = 'Accept Copilot Suggestion' })
vim.diagnostic.config({
severity_sort = true,
virtual_text = {

View File

@ -438,8 +438,8 @@ end
local servers = {
clangd = {},
cssls = {},
-- eslint_d = {},
gopls = {},
html = {},
pyright = {},
rust_analyzer = {},
tsserver = {},
@ -498,24 +498,24 @@ cmp.setup {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
-- ['<Tab>'] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_next_item()
-- elseif luasnip.expand_or_locally_jumpable() then
-- luasnip.expand_or_jump()
-- else
-- fallback()
-- end
-- end, { 'i', 's' }),
-- ['<S-Tab>'] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
-- elseif luasnip.locally_jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },