From f413a68803b9d013df7a6a6c9c63dfb112771cd1 Mon Sep 17 00:00:00 2001 From: coja Date: Sat, 11 Apr 2026 01:26:24 +0200 Subject: [PATCH] [Nvim] fix render-markdown --- .config/nvim/init.lua | 16 ---------------- .config/nvim/lua/configs/render-markdown.lua | 2 +- .config/nvim/lua/mappings.lua | 16 +++++++--------- .config/nvim/lua/plugins/init.lua | 10 +++++----- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 0cbc005..af71982 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -32,22 +32,6 @@ dofile(vim.g.base46_cache .. "statusline") require "options" require "nvchad.autocmds" -require "render-markdown" - -require("gen").prompts["Markdown_links"] = { - prompt = "Make markdown links wherever you find link in the following text, and generate the namas accordingly:\n$text", - replace = true, -} - -require("gen").prompts["Optimize code"] = { - prompt = "Check if code can be optimized for speed and readability:\n$text", - replace = true, -} - -require("gen").prompts["Genetrate types "] = { - prompt = "Check if types are correct in this code, fix and optimize if something is needed:\n$text", - replace = true, -} vim.schedule(function() require "mappings" diff --git a/.config/nvim/lua/configs/render-markdown.lua b/.config/nvim/lua/configs/render-markdown.lua index ec75be3..8ee58dd 100644 --- a/.config/nvim/lua/configs/render-markdown.lua +++ b/.config/nvim/lua/configs/render-markdown.lua @@ -1,4 +1,4 @@ -require("render-markdown").setup { +return { -- Whether markdown should be rendered by default. enabled = true, -- Vim modes that will show a rendered view of the markdown file, :h mode(), for all enabled diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index d473227..286ee27 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -6,22 +6,20 @@ local map = vim.keymap.set -- map("n", ";", ":", { desc = "cmd enter command mode" }) -local builtin = require "telescope.builtin" - map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) -map("n", "gD", builtin.lsp_definitions, { desc = "Go to Definitions" }) -map("n", "grr", builtin.lsp_references, { desc = "Go to references" }) +map("n", "gD", "Telescope lsp_definitions", { desc = "Go to Definitions" }) +map("n", "grr", "Telescope lsp_references", { desc = "Go to references" }) map("n", "dh", ":lua vim.diagnostic.open_float()", { desc = "Show diagnostics" }) map("n", "dj", ":lua vim.diagnostic.goto_next()", { desc = "Go to next" }) map("n", "dk", ":lua vim.diagnostic.goto_prev()", { desc = "Go to previous" }) map("n", "da", ":lua vim.lsp.buf.code_action()", { desc = "Code actions", noremap = true, silent = true }) -- Telescope -map("n", "fr", ":Telescope resume", { desc = "Resume last search" }) -map("n", "fs", ":Telescope grep_string", { desc = "Find selected string" }) -map("n", "fk", ":Telescope keymaps", { desc = "Find keymaps" }) -map("n", "fd", ":Telescope diagnostics", { desc = "Diagnostics" }) +map("n", "fr", "Telescope resume", { desc = "Resume last search" }) +map("n", "fs", "Telescope grep_string", { desc = "Find selected string" }) +map("n", "fk", "Telescope keymaps", { desc = "Find keymaps" }) +map("n", "fd", "Telescope diagnostics", { desc = "Diagnostics" }) -map({ "n", "v" }, "ge", ":Gen", { desc = "Gen.nvim" }) +map({ "n", "v" }, "ge", "Gen", { desc = "Gen.nvim" }) -- P paste with -- global marks diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 8c0321b..8b5224a 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -15,10 +15,10 @@ return { -- Custom Parameters (with defaults) { "David-Kunz/gen.nvim", + cmd = "Gen", opts = { -- model = "llama3.2:3b", -- The default model to use. model = "qwen3-coder:30b", - -- host = "192.168.0.17", 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 @@ -31,9 +31,6 @@ return { 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() - pcall(io.popen, "ollama serve > /dev/null 2>&1 &") - end, -- Function to initialize Ollama command = function(options) local body = { model = options.model, stream = true } @@ -54,7 +51,10 @@ return { }, { "MeanderingProgrammer/render-markdown.nvim", - opts = {}, + ft = { "markdown", "gitcommit" }, + opts = function() + return require "configs.render-markdown" + end, }, -- {