diff --git a/init.lua b/init.lua index ce988f7d..6f062a80 100644 --- a/init.lua +++ b/init.lua @@ -303,12 +303,14 @@ require('lazy').setup({ ['u'] = { name = 'Tro[U]ble', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, ['H'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + ['h'] = { name = 'Copilot C[H]at', _ = 'which_key_ignore' }, --['e'] = { name = '[E]xplore files', _ = 'which_key_ignore' }, } -- visual mode require('which-key').register({ ['h'] = { 'Git [H]unk' }, ['R'] = { name = '[R]efactor', _ = 'which_key_ignore' }, + ['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', diff --git a/lua/custom/plugins/autoformat.lua b/lua/custom/plugins/autoformat.lua index ef745374..e524b644 100644 --- a/lua/custom/plugins/autoformat.lua +++ b/lua/custom/plugins/autoformat.lua @@ -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 diff --git a/lua/custom/plugins/copilot-chat.lua b/lua/custom/plugins/copilot-chat.lua new file mode 100644 index 00000000..2b9d238d --- /dev/null +++ b/lua/custom/plugins/copilot-chat.lua @@ -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 = { + { 'ho', 'CopilotChat', mode = { 'n', 'v' }, desc = 'CopilotChat - Open' }, + { 'he', 'CopilotChatExplain', mode = { 'n', 'v' }, desc = 'CopilotChat - Explain code' }, + { 'hr', 'CopilotChatReview', mode = { 'n', 'v' }, desc = 'CopilotChat - Review code' }, + -- { 'hR', 'CopilotChatRefactor', mode = { 'n', 'v' }, desc = 'CopilotChat - Refactor code' }, + { + 'hf', + 'CopilotChatFixDiagnostic', -- Get a fix for the diagnostic message under the cursor. + desc = 'CopilotChat - Fix diagnostic', + }, + { + 'hr', + 'CopilotChatReset', -- Reset chat history and clear buffer. + desc = 'CopilotChat - Reset chat history and clear buffer', + }, + }, + }, +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua index 61e38ee6..384ffc74 100644 --- a/lua/custom/plugins/copilot.lua +++ b/lua/custom/plugins/copilot.lua @@ -1,13 +1,27 @@ return { - 'github/copilot.vim', + 'zbirenbaum/copilot.lua', lazy = false, - init = function() - local map = vim.api.nvim_set_keymap - - map('i', '', 'copilot#Accept("")', { 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 = '', + }, + }, + suggestion = { + auto_trigger = false, + keymap = { + accept = '', + next = '', + dismiss = '', + prev = '', + }, + }, + }, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 3f5ddb3a..28ebd255 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -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' },