Copilot chat
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
parent
64e073f072
commit
c4b6f4bf9e
|
|
@ -0,0 +1,47 @@
|
|||
vim.keymap.set('i', '<S-Tab>', 'copilot#Accept("\\<S-Tab>")', { expr = true, replace_keycodes = false })
|
||||
|
||||
vim.api.nvim_set_hl(0, 'CopilotChatHeader', { fg = '#7C3AED', bold = true })
|
||||
vim.api.nvim_set_hl(0, 'CopilotChatSeparator', { fg = '#374151' })
|
||||
|
||||
require("CopilotChat").setup({
|
||||
window = {
|
||||
layout = 'float',
|
||||
width = math.abs(math.floor(vim.o.columns * 0.8 + 0.5)),
|
||||
height = math.abs(math.floor(vim.o.lines * 0.8 + 0.5)),
|
||||
border = 'rounded',
|
||||
title = '🤖 AI Assistant',
|
||||
zindex = 100,
|
||||
},
|
||||
|
||||
headers = {
|
||||
user = '👤 You',
|
||||
assistant = '🤖 Copilot',
|
||||
tool = '🔧 Tool',
|
||||
},
|
||||
|
||||
separator = '━━',
|
||||
auto_fold = true,
|
||||
})
|
||||
|
||||
local chat = require("CopilotChat")
|
||||
|
||||
vim.keymap.set('n', '<leader>cc', chat.toggle, { desc = 'Toggle CopilotChat' })
|
||||
|
||||
vim.keymap.set('v', '<leader>cc', chat.open, { desc = 'Open CopilotChat with selection' })
|
||||
|
||||
vim.keymap.set('n', '<leader>cb', function()
|
||||
chat.ask("Explain this code", { selection = require("CopilotChat.select").buffer })
|
||||
end, { desc = 'Ask about current buffer' })
|
||||
|
||||
vim.keymap.set('v', '<leader>cf', function()
|
||||
chat.ask("Fix this code")
|
||||
end, { desc = 'Fix selected code' })
|
||||
|
||||
vim.keymap.set('v', '<leader>ce', function()
|
||||
chat.ask("Explain this code")
|
||||
end, { desc = 'Explain selected code' })
|
||||
|
||||
vim.keymap.set('v', '<leader>co', function()
|
||||
chat.ask("Optimize this code")
|
||||
end, { desc = 'Optimize selected code' })
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
-- alternatively you can override the default configs
|
||||
require("flutter-tools").setup {
|
||||
ui = {
|
||||
-- the border type to use for all floating windows, the same options/formats
|
||||
-- used for ":h nvim_open_win" e.g. "single" | "shadow" | {<table-of-eight-chars>}
|
||||
border = "rounded",
|
||||
-- This determines whether notifications are show with `vim.notify` or with the plugin's custom UI
|
||||
-- please note that this option is eventually going to be deprecated and users will need to
|
||||
-- depend on plugins like `nvim-notify` instead.
|
||||
notification_style = 'native'
|
||||
},
|
||||
decorations = {
|
||||
statusline = {
|
||||
-- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline
|
||||
-- this will show the current version of the flutter app from the pubspec.yaml file
|
||||
app_version = false,
|
||||
-- set to true to be able use the 'flutter_tools_decorations.device' in your statusline
|
||||
-- this will show the currently running device if an application was started with a specific
|
||||
-- device
|
||||
device = false,
|
||||
-- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline
|
||||
-- this will show the currently selected project configuration
|
||||
project_config = false,
|
||||
}
|
||||
},
|
||||
debugger = { -- integrate with nvim dap + install dart code debugger
|
||||
enabled = false,
|
||||
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
|
||||
-- see |:help dap.set_exception_breakpoints()| for more info
|
||||
exception_breakpoints = {},
|
||||
-- Whether to call toString() on objects in debug views like hovers and the
|
||||
-- variables list.
|
||||
-- Invoking toString() has a performance cost and may introduce side-effects,
|
||||
-- although users may expected this functionality. null is treated like false.
|
||||
evaluate_to_string_in_debug_views = true,
|
||||
-- You can use the `debugger.register_configurations` to register custom runner configuration (for example for different targets or flavor). Plugin automatically registers the default configuration, but you can override it or add new ones.
|
||||
-- register_configurations = function(paths)
|
||||
-- require("dap").configurations.dart = {
|
||||
-- -- your custom configuration
|
||||
-- }
|
||||
-- end,
|
||||
},
|
||||
flutter_path = "/opt/flutter/bin/flutter", -- <-- this takes priority over the lookup
|
||||
flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
|
||||
root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
|
||||
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
|
||||
widget_guides = {
|
||||
enabled = false,
|
||||
},
|
||||
closing_tags = {
|
||||
highlight = "ErrorMsg", -- highlight for the closing tag
|
||||
prefix = ">", -- character to use for close tag e.g. > Widget
|
||||
priority = 10, -- priority of virtual text in current line
|
||||
-- consider to configure this when there is a possibility of multiple virtual text items in one line
|
||||
-- see `priority` option in |:help nvim_buf_set_extmark| for more info
|
||||
enabled = true -- set to false to disable
|
||||
},
|
||||
dev_log = {
|
||||
enabled = true,
|
||||
filter = nil, -- optional callback to filter the log
|
||||
-- takes a log_line as string argument; returns a boolean or nil;
|
||||
-- the log_line is only added to the output if the function returns true
|
||||
notify_errors = false, -- if there is an error whilst running then notify the user
|
||||
open_cmd = "15split", -- command to use to open the log buffer
|
||||
focus_on_open = true, -- focus on the newly opened log window
|
||||
},
|
||||
dev_tools = {
|
||||
autostart = false, -- autostart devtools server if not detected
|
||||
auto_open_browser = false, -- Automatically opens devtools in the browser
|
||||
},
|
||||
outline = {
|
||||
open_cmd = "30vnew", -- command to use to open the outline buffer
|
||||
auto_open = false -- if true this will open the outline automatically when it is first populated
|
||||
},
|
||||
lsp = {
|
||||
color = { -- show the derived colours for dart variables
|
||||
enabled = false, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||
background = false, -- highlight the background
|
||||
background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},)
|
||||
foreground = false, -- highlight the foreground
|
||||
virtual_text = true, -- show the highlight using virtual text
|
||||
virtual_text_str = "■", -- the virtual text character to highlight
|
||||
},
|
||||
settings = {
|
||||
showTodos = true,
|
||||
completeFunctionCalls = true,
|
||||
renameFilesWithClasses = "prompt", -- "always"
|
||||
enableSnippets = true,
|
||||
updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ require("mason-lspconfig").setup {
|
|||
"docker_compose_language_service",
|
||||
"dockerls",
|
||||
"jsonls",
|
||||
"jdtls",
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"ts_ls"
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ return require('packer').startup(function(use)
|
|||
'rose-pine/neovim',
|
||||
as = 'rose-pine'
|
||||
}
|
||||
use {
|
||||
'daltonmenezes/aura-theme',
|
||||
rtp = 'packages/neovim'
|
||||
}
|
||||
|
||||
-- Essentials
|
||||
use {
|
||||
|
|
@ -92,8 +88,5 @@ return require('packer').startup(function(use)
|
|||
|
||||
-- Little friend
|
||||
use("github/copilot.vim")
|
||||
|
||||
-- Temp
|
||||
use("dylon/vim-antlr")
|
||||
use("akinsho/flutter-tools.nvim")
|
||||
use("CopilotC-Nvim/CopilotChat.nvim")
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -46,4 +46,3 @@ vim.keymap.set("n", "<leader>vpp", "<cmd>so ~/.config/nvim/lua/tiagorg/packer.lu
|
|||
|
||||
vim.keymap.set("n", "<C-q>", "<cmd>qa<CR>")
|
||||
vim.keymap.set("n", "<A-t>", "<cmd>tabnew<CR><cmd>NvimTreeFocus<CR>")
|
||||
vim.keymap.set("n", "<S-Tab>", "<C-w>w")
|
||||
|
|
|
|||
Loading…
Reference in New Issue