Fixed up copilot and added copilot chat
This commit is contained in:
parent
ea09729865
commit
de2044b7e8
3
init.lua
3
init.lua
|
@ -303,12 +303,14 @@ require('lazy').setup({
|
|||
['<leader>u'] = { name = 'Tro[U]ble', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
['<leader>H'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Copilot C[H]at', _ = 'which_key_ignore' },
|
||||
--['<leader>e'] = { name = '[E]xplore files', _ = 'which_key_ignore' },
|
||||
}
|
||||
-- visual mode
|
||||
require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
['<leader>R'] = { name = '[R]efactor', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Copilot C[H]at', _ = 'which_key_ignore' },
|
||||
}, { mode = 'v' })
|
||||
end,
|
||||
},
|
||||
|
@ -539,6 +541,7 @@ require('lazy').setup({
|
|||
require 'custom.plugins.lsp',
|
||||
require 'custom.plugins.barbar',
|
||||
require 'custom.plugins.copilot',
|
||||
require 'custom.plugins.copilot-chat',
|
||||
require 'custom.plugins.harpoon',
|
||||
require 'custom.plugins.toggleterm',
|
||||
require 'custom.plugins.refactoring',
|
||||
|
|
|
@ -32,6 +32,7 @@ return {
|
|||
cpp = { 'clang-format' },
|
||||
yaml = { 'yamlfmt' },
|
||||
html = { 'djlint' },
|
||||
htmldjango = { 'djlint' },
|
||||
css = { { 'prettierd', 'prettier' } },
|
||||
json = { 'deno_fmt' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
return {
|
||||
{
|
||||
'CopilotC-Nvim/CopilotChat.nvim',
|
||||
event = 'VeryLazy',
|
||||
branch = 'canary',
|
||||
dependencies = {
|
||||
{ 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim
|
||||
{ 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper
|
||||
},
|
||||
opts = {},
|
||||
keys = {
|
||||
{ '<leader>ho', '<cmd>CopilotChat<cr>', mode = { 'n', 'v' }, desc = 'CopilotChat - Open' },
|
||||
{ '<leader>he', '<cmd>CopilotChatExplain<cr>', mode = { 'n', 'v' }, desc = 'CopilotChat - Explain code' },
|
||||
{ '<leader>hr', '<cmd>CopilotChatReview<cr>', mode = { 'n', 'v' }, desc = 'CopilotChat - Review code' },
|
||||
-- { '<leader>hR', '<cmd>CopilotChatRefactor<cr>', mode = { 'n', 'v' }, desc = 'CopilotChat - Refactor code' },
|
||||
{
|
||||
'<leader>hf',
|
||||
'<cmd>CopilotChatFixDiagnostic<cr>', -- Get a fix for the diagnostic message under the cursor.
|
||||
desc = 'CopilotChat - Fix diagnostic',
|
||||
},
|
||||
{
|
||||
'<leader>hr',
|
||||
'<cmd>CopilotChatReset<cr>', -- Reset chat history and clear buffer.
|
||||
desc = 'CopilotChat - Reset chat history and clear buffer',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,13 +1,27 @@
|
|||
return {
|
||||
'github/copilot.vim',
|
||||
'zbirenbaum/copilot.lua',
|
||||
lazy = false,
|
||||
init = function()
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
map('i', '<C-o>', 'copilot#Accept("<CR>")', { expr = true, silent = true })
|
||||
|
||||
vim.g.copilot_no_tab_map = true
|
||||
vim.g.copilot_assume_mapped = true
|
||||
vim.g.copilot_tab_fallback = ''
|
||||
end,
|
||||
cmd = 'Copilot',
|
||||
event = 'InsertEnter',
|
||||
opts = {
|
||||
panel = {
|
||||
auto_refresh = true,
|
||||
layout = {
|
||||
position = 'right',
|
||||
ratio = 0.3,
|
||||
},
|
||||
keymap = {
|
||||
open = '<C-S-O>',
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
auto_trigger = false,
|
||||
keymap = {
|
||||
accept = '<C-o>',
|
||||
next = '<C-i>',
|
||||
dismiss = '<C-d>',
|
||||
prev = '<C-S-i>',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ return {
|
|||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
python = { 'ruff' },
|
||||
-- cpp = { 'cppcheck' },
|
||||
-- c = { 'cppcheck' },
|
||||
cpp = { 'cppcheck' },
|
||||
c = { 'cppcheck' },
|
||||
javascript = { 'eslint' },
|
||||
css = { 'stylelint' },
|
||||
html = { 'djlint' },
|
||||
|
|
Loading…
Reference in New Issue