From a282b02f39b6176768f585e3133421cb7d25de82 Mon Sep 17 00:00:00 2001 From: utensil Date: Tue, 5 Nov 2024 20:40:19 +0800 Subject: [PATCH] Fixes and improvements for LLM Chat --- trees/uts-002F.tree | 7 ++++-- uts-plugins.lua | 56 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/trees/uts-002F.tree b/trees/uts-002F.tree index aa6e795..0fefe83 100644 --- a/trees/uts-002F.tree +++ b/trees/uts-002F.tree @@ -329,12 +329,15 @@ It's very important to stay in the flow and Zen mode as much as possible. Split - Github Copilot - `+aa` to toggle the chat, `+al` to clear chat history - `+a` + a character - - for selected code block, **e**xplain, **r**eview, **o**ptimize, **R**factor, **t**est + - for selected code block, **e**xplain, **r**eview, **o**ptimize, **R**efactor, **t**est - **d**ebug, **f**ix, co**m**mit log, **n**aming etc. - `?` to select the model - `C-s` to send the prompt - `:help copilot` to learn more - - Avante + - Code Companion (preferred, but suddenly not working) + - `+a` to toggle the inline chat (works also for selection) + - `+z` to toggle the chat sidebar + - Avante (deprecated) - `+aa` to open the chat, use `a` to accept individual suggestions, or `A` to accept all - select code and `+ae` to modify code - it's interesting but I've disabled it for now, in favor of Github Copilot diff --git a/uts-plugins.lua b/uts-plugins.lua index 5cda65e..171c018 100644 --- a/uts-plugins.lua +++ b/uts-plugins.lua @@ -431,13 +431,13 @@ local plugins = { opts = { -- debug = true, -- Enable debugging -- See Configuration section for rest - window = { - layout = "float", - relative = "cursor", - width = 1, - height = 0.4, - row = 1, - }, + -- window = { + -- layout = "float", + -- relative = "cursor", + -- width = 1, + -- height = 0.4, + -- row = 1, + -- }, }, -- { -- "hrsh7th/nvim-cmp", @@ -587,6 +587,20 @@ local plugins = { { "af", "CopilotChatFixDiagnostic", desc = "CopilotChat - Fix Diagnostic" }, { "al", "CopilotChatReset", desc = "CopilotChat - Clear buffer and chat history" }, { "aa", "CopilotChatToggle", desc = "CopilotChat - Toggle" }, + { + "aa", + mode = "x", + function() + require("CopilotChat").ask("Let's discuss the following", { + selection = require("CopilotChat.select").visual, + }) + -- local actions = require "CopilotChat.actions" + -- actions.pick(actions.prompt_actions { + -- selection = require("CopilotChat.select").visual, + -- }) + end, + desc = "CopilotChat - for selection", + }, { "a?", "CopilotChatModels", desc = "CopilotChat - Select Models" }, { "ai", @@ -616,7 +630,7 @@ local plugins = { dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer + -- "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer "nvim-telescope/telescope.nvim", -- Optional: For using slash commands { "stevearc/dressing.nvim", opts = {} }, -- Optional: Improves `vim.ui.select` { "echasnovski/mini.diff", version = false }, @@ -628,6 +642,14 @@ local plugins = { provider = "mini_diff", }, }, + strategies = { + chat = { + adapter = "copilot", + }, + inline = { + adapter = "copilot", + }, + }, } end, keys = { @@ -1282,6 +1304,24 @@ local plugins = { }, }, }, + -- { "neoclide/coc.nvim", branch = "release" }, + { + "barreiroleo/ltex_extra.nvim", + branch = "dev", + ft = { "markdown", "tex" }, + opts = { + ---@type string[] + -- See https://valentjn.github.io/ltex/supported-languages.html#natural-languages + load_langs = { "en-US" }, + ---@type "none" | "fatal" | "error" | "warn" | "info" | "debug" | "trace" + log_level = "none", + ---@type string File's path to load. + -- The setup will normalice it running vim.fs.normalize(path). + -- e.g. subfolder in project root or cwd: ".ltex" + -- e.g. cross project settings: vim.fn.expand("~") .. "/.local/share/ltex" + path = ".ltex", + }, + }, -- { -- "nvchad/ui", -- config = function()