Merge pull request 'copilot-updates and other tweaks' (#28) from copilot-updates into main

Reviewed-on: #28
This commit is contained in:
Salar Rahmanian 2024-10-06 23:04:13 -07:00
commit fea59fd133
4 changed files with 63 additions and 52 deletions

View file

@ -48,7 +48,7 @@ else
vim.o.breakindent = true vim.o.breakindent = true
-- smart indenting -- smart indenting
vim.o.smartindent = false vim.o.smartindent = true
-- Save undo history -- Save undo history
vim.o.undofile = true vim.o.undofile = true
@ -90,7 +90,7 @@ else
-- sets the tab size for json files -- sets the tab size for json files
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "json", pattern = { "json", "lua", "nix" },
callback = function() callback = function()
vim.bo.tabstop = 2 vim.bo.tabstop = 2
vim.bo.shiftwidth = 2 vim.bo.shiftwidth = 2

48
lua/plugins/avante.lua Normal file
View file

@ -0,0 +1,48 @@
return {
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest change
opts = {
provider = "openai",
openai = {
api_key_name = "cmd:cat ~/.openai",
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = "make",
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
}

View file

@ -1,48 +0,0 @@
return {
"David-Kunz/gen.nvim",
lazy = true,
keys = {
{ "<leader>ai", ":Gen<CR>", mode = { "n", "v" }, desc = "AI tools using Ollama" },
{ "<leader>aa", ":Gen Ask<CR>", mode = { "n", "v" }, desc = "[A]I [A]sk" },
{
"<leader>am",
function()
require("gen").select_model()
end,
mode = { "n", "v" },
desc = "Select [A]I [m]odel",
},
},
config = function()
require("gen").setup({
{
model = "codellama",
host = "localhost",
port = "11434",
quit_map = "q",
retry_map = "<c-r>",
init = function(options)
pcall(io.popen, "ollama serve > /dev/null 2>&1 &")
end,
command = function(options)
local body = { model = options.model, stream = true }
return "curl --silent --no-buffer -X POST http://"
.. options.host
.. ":"
.. options.port
.. "/api/chat -d $body"
end,
display_mode = "split", -- "split" or "float"
show_prompt = true,
show_model = true,
no_auto_close = false,
debug = false,
},
})
require("gen").prompts["Fix_Code"] = {
prompt = "Fix the following code. Only ouput the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```",
replace = true,
extract = "```$filetype\n(.-)```",
}
end,
}

View file

@ -4,7 +4,12 @@ return {
-- build = function() -- build = function()
-- pcall(require("nvim-treesitter.install").update({ with_sync = true })) -- pcall(require("nvim-treesitter.install").update({ with_sync = true }))
-- end, -- end,
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/playground" }, dependencies = {
"nvim-treesitter/nvim-treesitter-context",
"nvim-treesitter/nvim-treesitter-refactor",
"nvim-treesitter/nvim-treesitter-textobjects",
"nvim-treesitter/playground",
},
config = function() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
-- Add languages to be installed here that you want installed for treesitter -- Add languages to be installed here that you want installed for treesitter
@ -58,7 +63,13 @@ return {
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = {
enable = true,
disable = {
"python",
"css",
},
},
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {