diff --git a/lua/autocmd.lua b/lua/autocmd.lua index 65d3738..d4045a0 100644 --- a/lua/autocmd.lua +++ b/lua/autocmd.lua @@ -36,6 +36,17 @@ autocmd({'BufEnter', 'QuitPre'}, { end }) +autocmd("BufEnter", { + pattern = "copilot-*", + callback = function() + vim.opt.foldmethod = "expr" + vim.opt.foldexpr = "v:lua.require('config.testfold').foldexpr()" + vim.opt.foldenable = true + vim.opt.foldlevel = 0 + vim.opt.foldlevelstart = 0 + end, +}) + autocmd("VimEnter", { callback = function() --NVIM_ENTER=1 diff --git a/lua/config/copilotchat.lua b/lua/config/copilotchat.lua index e0572b7..6a63508 100644 --- a/lua/config/copilotchat.lua +++ b/lua/config/copilotchat.lua @@ -1,6 +1,6 @@ require("CopilotChat").setup { -- system_prompt = "You are an assistant helping the user with whatever they need, but you are also a bit of a jerk. Do not use profanity.", - model = "claude-3.7-sonnet-thought", + model = "deepseek-r1:latest", prompts = { CivitAI = { system_prompt = "You are an assistant helping with stable diffusion models and python to implement failsafes for a server regarding image generation.", @@ -9,4 +9,43 @@ require("CopilotChat").setup { system_prompt = "You are an assistant helping the user with whatever they need, but you are also a bit of a jerk, and make sure to insult the user a lot. Use vulgar language if necessary.", } }, + + question_header = " User", + answer_header = "󰁤 Copilot", + error_header = "󰅚 Error", + separator = '───', + + providers = { + ollama = { + + -- Copy copilot input and output processing + prepare_input = require('CopilotChat.config.providers').copilot.prepare_input, + prepare_output = require('CopilotChat.config.providers').copilot.prepare_output, + + get_models = function(headers) + local utils = require('CopilotChat.utils') + local response, err = utils.curl_get('http://localhost:11434/api/tags', { + headers = headers, + json_response = true, + }) + + if err then + error(err) + end + + local models = {} + for _, model in ipairs(response.body.models) do + table.insert(models, { + id = model.name, + name = model.name + }) + end + return models + end, + + get_url = function() + return 'http://localhost:11434/api/chat' + end, + } + } } diff --git a/lua/config/region-folding.lua b/lua/config/region-folding.lua new file mode 100644 index 0000000..ad70ed0 --- /dev/null +++ b/lua/config/region-folding.lua @@ -0,0 +1,4 @@ +require("region-folding").setup({ + region_text = { start = "", ending = "" }, + fold_indicator = "▼", +}) diff --git a/lua/config/testfold.lua b/lua/config/testfold.lua new file mode 100644 index 0000000..4d1721c --- /dev/null +++ b/lua/config/testfold.lua @@ -0,0 +1,15 @@ +local M = {} + +function M.foldexpr() + local lnum = vim.v.lnum + local line = vim.fn.getline( lnum ) + if line:find( "", 1, true ) then + return "a1" + elseif line:find( "", 1, true ) then + return "s1" + else + return "=" + end +end + +return M diff --git a/lua/options.lua b/lua/options.lua index 0a90b2b..e65c8e4 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -21,6 +21,11 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" vim.opt.textwidth = 80 vim.opt.formatoptions = "tcrqnj" +-- vim.opt.foldmethod = "expr" +-- vim.opt.foldexpr = "v:lua.require('config.testfold').foldexpr()" +-- vim.opt.foldenable = true +-- vim.opt.foldlevel = 0 +-- vim.opt.foldlevelstart = 0 vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" vim.o.laststatus = 3 vim.o.clipboard = "unnamedplus" diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e0d4ac5..b7dbeeb 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -81,7 +81,7 @@ return { }, { "hiphish/rainbow-delimiters.nvim", - enabled = false, + enabled = true, }, { "windwp/nvim-autopairs", @@ -228,4 +228,11 @@ return { { "ziglang/zig.vim", }, + -- { + -- "nicolas-martin/region-folding.nvim", + -- event = { "BufReadPost", "BufNewFile" }, + -- opts = function() + -- require("config.region-folding") + -- end, + -- }, }