From adce5335589f84b9b583b3199d09fd71b4b97b28 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Wed, 4 Dec 2024 19:23:14 -0500 Subject: [PATCH] Commit ai and markdown and init lua cleanup --- init.lua | 2 -- lua/plugins/gennvim.lua | 36 ++++++++++++++++++++++++++++++++++++ lua/plugins/markdownnvim.lua | 11 +++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/gennvim.lua create mode 100644 lua/plugins/markdownnvim.lua diff --git a/init.lua b/init.lua index 138c8ec2..46ae08a2 100644 --- a/init.lua +++ b/init.lua @@ -182,7 +182,6 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- vim.keymap.set('n', '', 'echo "Use k to move!!"') -- vim.keymap.set('n', '', 'echo "Use j to move!!"') --- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands @@ -242,7 +241,6 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup 'plugins' - -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et -- diff --git a/lua/plugins/gennvim.lua b/lua/plugins/gennvim.lua new file mode 100644 index 00000000..145747da --- /dev/null +++ b/lua/plugins/gennvim.lua @@ -0,0 +1,36 @@ +return { + 'David-Kunz/gen.nvim', + opts = { + model = 'llama3.2', -- The default model to use. + quit_map = 'q', -- set keymap to close the response window + retry_map = '', -- set keymap to re-send the current prompt + accept_map = '', -- set keymap to replace the previous selection with the last result + host = 'localhost', -- The host running the Ollama service. + port = '11434', -- The port on which the Ollama service is listening. + display_mode = 'split', -- The display mode. Can be "float" or "split" or "horizontal-split". + show_prompt = false, -- Shows the prompt submitted to Ollama. + show_model = false, -- Displays which model you are using at the beginning of your chat session. + no_auto_close = false, -- Never closes the window automatically. + file = false, -- Write the payload to a temporary file to keep the command short. + hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10 + init = function(options) + pcall(io.popen, 'ollama serve > /dev/null 2>&1 &') + end, + -- Function to initialize Ollama + 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, + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). + -- This can also be a command string. + -- The executed command must return a JSON object with { response, context } + -- (context property is optional). + -- list_models = '', -- Retrieves a list of model names + debug = false, -- Prints errors and the command which is run. + opts = function() + require('gen').prompts['Review_Code'] = { + prompt = 'Review the following code and make concise suggestions:\n```$filetype\n$text\n```', + } + end, + }, +} diff --git a/lua/plugins/markdownnvim.lua b/lua/plugins/markdownnvim.lua new file mode 100644 index 00000000..5c5fd8f5 --- /dev/null +++ b/lua/plugins/markdownnvim.lua @@ -0,0 +1,11 @@ +return { + { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + }, +}