From 6033ab33fb70f6dea540757edc3747170871de93 Mon Sep 17 00:00:00 2001 From: Nicole Dresselhaus Date: Mon, 5 May 2025 12:28:48 +0200 Subject: [PATCH] added plugin-config --- nvim-config/lua/plugins/avante.lua | 62 ++++++ nvim-config/lua/plugins/blink.cmp.lua | 39 ++++ nvim-config/lua/plugins/example.lua | 197 ++++++++++++++++++++ nvim-config/lua/plugins/img-clip.lua | 14 ++ nvim-config/lua/plugins/lualine.lua | 27 +++ nvim-config/lua/plugins/minuet-ai.lua | 122 ++++++++++++ nvim-config/lua/plugins/nvim-treesitter.lua | 25 +++ nvim-config/lua/plugins/snacks.lua | 14 ++ 8 files changed, 500 insertions(+) create mode 100644 nvim-config/lua/plugins/avante.lua create mode 100644 nvim-config/lua/plugins/blink.cmp.lua create mode 100644 nvim-config/lua/plugins/example.lua create mode 100644 nvim-config/lua/plugins/img-clip.lua create mode 100644 nvim-config/lua/plugins/lualine.lua create mode 100644 nvim-config/lua/plugins/minuet-ai.lua create mode 100644 nvim-config/lua/plugins/nvim-treesitter.lua create mode 100644 nvim-config/lua/plugins/snacks.lua diff --git a/nvim-config/lua/plugins/avante.lua b/nvim-config/lua/plugins/avante.lua new file mode 100644 index 0000000..dc403c7 --- /dev/null +++ b/nvim-config/lua/plugins/avante.lua @@ -0,0 +1,62 @@ +return { + "yetone/avante.nvim", + event = "VeryLazy", + version = false, -- Never set this value to "*"! Never! + opts = { + -- add any opts here + -- for example + provider = "ollama", + ollama = { + endpoint = "http://gpu.dighist.geschichte.hu-berlin.de:11434", + model = "cogito:14b", -- your desired model (or use gpt-4o, etc.) + timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models + temperature = 0, + max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) + stream = true, + thinking = true, + system_prompt = "Enable deep thinking subroutine.", + --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models + }, + }, + -- 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, + "echasnovski/mini.pick", -- for file_selector provider mini.pick + "nvim-telescope/telescope.nvim", -- for file_selector provider telescope + "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions + "ibhagwan/fzf-lua", -- for file_selector provider fzf + "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons + "zbirenbaum/copilot.lua", -- for providers='copilot' + { + -- 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" }, + }, + }, +} diff --git a/nvim-config/lua/plugins/blink.cmp.lua b/nvim-config/lua/plugins/blink.cmp.lua new file mode 100644 index 0000000..581238c --- /dev/null +++ b/nvim-config/lua/plugins/blink.cmp.lua @@ -0,0 +1,39 @@ +return { + "saghen/blink.cmp", + dependencies = { + "Kaiser-Yang/blink-cmp-avante", + -- ... Other dependencies + }, + opts = { + signature = { enabled = true }, + keymap = { + [""] = { + function(cmp) + cmp.show({ providers = { "minuet" } }) + end, + }, + }, + sources = { + default = { "avante", "lsp", "path", "buffer", "minuet" }, + providers = { + avante = { + module = "blink-cmp-avante", + name = "Avante", + opts = { + -- options for blink-cmp-avante + }, + }, + minuet = { + name = "minuet", + module = "minuet.blink", + async = true, + -- Should match minuet.config.request_timeout * 1000, + -- since minuet.config.request_timeout is in seconds + timeout_ms = 10000, + score_offset = 50, -- Gives minuet higher priority among suggestions + }, + }, + }, + }, + build = "nix run .#build-plugin", +} diff --git a/nvim-config/lua/plugins/example.lua b/nvim-config/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/nvim-config/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/nvim-config/lua/plugins/img-clip.lua b/nvim-config/lua/plugins/img-clip.lua new file mode 100644 index 0000000..f2572a8 --- /dev/null +++ b/nvim-config/lua/plugins/img-clip.lua @@ -0,0 +1,14 @@ +return { + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- add options here + -- or leave it empty to use the default settings + extension = "avif", ---@type string + process_cmd = "convert - -quality 75 avif:-", ---@type string- + }, + keys = { + -- suggested keymap + { "ip", "PasteImage", desc = "Paste image from system clipboard" }, + }, +} diff --git a/nvim-config/lua/plugins/lualine.lua b/nvim-config/lua/plugins/lualine.lua new file mode 100644 index 0000000..3f82d9e --- /dev/null +++ b/nvim-config/lua/plugins/lualine.lua @@ -0,0 +1,27 @@ +return { + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + config = function(_, opts) + require("lualine").setup({ + sections = { + lualine_x = { + { + require("minuet.lualine"), + -- the follwing is the default configuration + -- the name displayed in the lualine. Set to "provider", "model" or "both" + -- display_name = 'both', + -- separator between provider and model name for option "both" + -- provider_model_separator = ':', + -- whether show display_name when no completion requests are active + -- display_on_idle = false, + }, + "encoding", + "fileformat", + "filetype", + }, + }, + }) + end, + }, +} diff --git a/nvim-config/lua/plugins/minuet-ai.lua b/nvim-config/lua/plugins/minuet-ai.lua new file mode 100644 index 0000000..9ee24b1 --- /dev/null +++ b/nvim-config/lua/plugins/minuet-ai.lua @@ -0,0 +1,122 @@ +local function get_text_fn(json) + return json.response +end + +return { + { + "milanglacier/minuet-ai.nvim", + config = function() + require("minuet").setup({ + virtualtext = { + auto_trigger_ft = {}, + keymap = { + -- accept whole completion + accept = "", + -- accept one line + accept_line = "", + -- accept n lines (prompts for number) + -- e.g. "A-z 2 CR" will accept 2 lines + accept_n_lines = "", + -- Cycle to prev completion item, or manually invoke completion + prev = "", + -- Cycle to next completion item, or manually invoke completion + next = "", + dismiss = "", + }, + }, + provider = "openai_fim_compatible", + -- the maximum total characters of the context before and after the cursor + -- 16000 characters typically equate to approximately 4,000 tokens for + -- LLMs. + context_window = 4000, + -- when the total characters exceed the context window, the ratio of + -- context before cursor and after cursor, the larger the ratio the more + -- context before cursor will be used. This option should be between 0 and + -- 1, context_ratio = 0.75 means the ratio will be 3:1. + context_ratio = 0.75, + throttle = 0, -- only send the request every x milliseconds, use 0 to disable throttle. + -- debounce the request in x milliseconds, set to 0 to disable debounce + debounce = 100, + -- Control notification display for request status + -- Notification options: + -- false: Disable all notifications (use boolean false, not string "false") + -- "debug": Display all notifications (comprehensive debugging) + -- "verbose": Display most notifications + -- "warn": Display warnings and errors only + -- "error": Display errors only + notify = "warn", + -- The request timeout, measured in seconds. When streaming is enabled + -- (stream = true), setting a shorter request_timeout allows for faster + -- retrieval of completion items, albeit potentially incomplete. + -- Conversely, with streaming disabled (stream = false), a timeout + -- occurring before the LLM returns results will yield no completion items. + request_timeout = 10, + -- If completion item has multiple lines, create another completion item + -- only containing its first line. This option only has impact for cmp and + -- blink. For virtualtext, no single line entry will be added. + add_single_line_entry = true, + -- The number of completion items encoded as part of the prompt for the + -- chat LLM. For FIM model, this is the number of requests to send. It's + -- important to note that when 'add_single_line_entry' is set to true, the + -- actual number of returned items may exceed this value. Additionally, the + -- LLM cannot guarantee the exact number of completion items specified, as + -- this parameter serves only as a prompt guideline. + n_completions = 3, + -- Defines the length of non-whitespace context after the cursor used to + -- filter completion text. Set to 0 to disable filtering. + -- + -- Example: With after_cursor_filter_length = 3 and context: + -- + -- "def fib(n):\n|\n\nfib(5)" (where | represents cursor position), + -- + -- if the completion text contains "fib", then "fib" and subsequent text + -- will be removed. This setting filters repeated text generated by the + -- LLM. A large value (e.g., 15) is recommended to avoid false positives. + after_cursor_filter_length = 15, + -- proxy port to use + proxy = nil, + provider_options = { + openai_compatible = { + api_key = "TERM", + name = "Ollama", + end_point = "http://gpu.dighist.geschichte.hu-berlin.de:11434/api/generate", + model = "granite3.3-fim:8b", + optional = { + max_tokens = 512, + top_p = 0.9, + }, + }, + openai_fim_compatible = { + api_key = "TERM", + name = "Ollama", + end_point = "http://gpu.dighist.geschichte.hu-berlin.de:11434/api/generate", + model = "granite3.3-fim:8b", + stream = true, + optional = { + max_tokens = 512, + top_p = 0.9, + }, + get_text_fn = { + no_stream = function(json) + return json.response + end, + stream = function(json) + return json.response + end, + }, + template = { + suffix = function(context_before_cursor, context_after_cursor) + return "" + .. context_before_cursor + .. "" + .. context_after_cursor + .. "" + end, + }, + }, + }, + }) + end, + }, + { "nvim-lua/plenary.nvim" }, +} diff --git a/nvim-config/lua/plugins/nvim-treesitter.lua b/nvim-config/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..2f4eaf1 --- /dev/null +++ b/nvim-config/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,25 @@ +local opts = { + ensure_installed = { + 'c', + 'lua', + 'vim', + 'bash', + 'regex', + 'vimdoc', + 'query', + 'markdown', + 'markdown_inline', + }, + highlight = { + enable = true + } +} + +local function config() + require('nvim-treesitter.configs').setup(opts) +end +return { + 'nvim-treesitter/nvim-treesitter', + config = config, + build = ':TSUpdate', +} diff --git a/nvim-config/lua/plugins/snacks.lua b/nvim-config/lua/plugins/snacks.lua new file mode 100644 index 0000000..9b433e2 --- /dev/null +++ b/nvim-config/lua/plugins/snacks.lua @@ -0,0 +1,14 @@ +return { +-- lazy.nvim +{ + "folke/snacks.nvim", + ---@type snacks.Config + opts = { + image = { + -- your image configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + } +} +}