From 9cca1643ac69a42869db9c9a90a62781395d97c1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 3 Sep 2025 11:47:15 +0200 Subject: [PATCH 1/7] nvim: Update codecompanion and options Needed to be changed to wrap adapter in http table after breaking config change. --- nvim/.config/nvim/lazy-lock.json | 6 +- nvim/.config/nvim/lua/plugins/llm.lua | 79 ++++++++++++++++----------- 2 files changed, 49 insertions(+), 36 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 10f302f..cf64526 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -8,9 +8,9 @@ "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, "cmp-pandoc.nvim": { "branch": "main", "commit": "30faa4456a7643c4cb02d8fa18438fd484ed7602" }, "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, - "codecompanion-gitcommit.nvim": { "branch": "main", "commit": "0ea26d93321e259dbb3766bf7f845ff02284e220" }, - "codecompanion-history.nvim": { "branch": "main", "commit": "5442513f1303884079c8f13cf8b75da44a3db679" }, - "codecompanion.nvim": { "branch": "main", "commit": "7ae585e1c868edb523cbb15c49fd15bc3def1261" }, + "codecompanion-gitcommit.nvim": { "branch": "main", "commit": "e237b9901d64074fa84f74c1b20892303e3e1830" }, + "codecompanion-history.nvim": { "branch": "main", "commit": "b9f1afb77f1a8805e686f89ac38338a9ca588579" }, + "codecompanion.nvim": { "branch": "main", "commit": "76f1c1aaedbb159256dbc64705cd34f447046d64" }, "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, "copilot-lualine": { "branch": "main", "commit": "6bc29ba1fcf8f0f9ba1f0eacec2f178d9be49333" }, "copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" }, diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/plugins/llm.lua index 6fd15da..4f41c36 100644 --- a/nvim/.config/nvim/lua/plugins/llm.lua +++ b/nvim/.config/nvim/lua/plugins/llm.lua @@ -58,43 +58,56 @@ return { opts = { strategies = { chat = { adapter = "groq" }, - inline = { adapter = "groq" }, + inline = { adapter = "copilot" }, + cmd = { adapter = "groq" }, }, adapters = { - groq = function() - return require("codecompanion.adapters").extend("openai", { - env = { - api_key = "GROQ_API_KEY", - }, - name = "Groq", - url = "https://api.groq.com/openai/v1/chat/completions", - schema = { - model = { - default = "llama-3.1-8b-instant", - choices = { - -- production models - "llama-3.3-70b-versatile", - "llama-3.1-8b-instant", - "moonshotai/kimi-k2-instruct", - "meta-llama/llama-guard-4-12b", - "openai/gpt-oss-120b", - "openai/gpt-oss-20b", - -- preview models - "meta-llama/llama-4-maverick-17b-128e-instruct", - "meta-llama/llama-4-scout-17b-16e-instruct", - "deepseek-r1-distill-llama-70b", - "qwen/qwen3-32b", + http = { + opts = { + show_defaults = true, -- TODO: set to false to only enable working, but does not show copilot then + }, + groq = function() + return require("codecompanion.adapters").extend("openai", { + env = { + api_key = "GROQ_API_KEY", + }, + name = "Groq", + url = "https://api.groq.com/openai/v1/chat/completions", + schema = { + model = { + default = "llama-3.1-8b-instant", + choices = { + -- production models + "llama-3.3-70b-versatile", + "llama-3.1-8b-instant", + "moonshotai/kimi-k2-instruct", + "meta-llama/llama-guard-4-12b", + "openai/gpt-oss-120b", + "openai/gpt-oss-20b", + -- preview models + "meta-llama/llama-4-maverick-17b-128e-instruct", + "meta-llama/llama-4-scout-17b-16e-instruct", + "deepseek-r1-distill-llama-70b", + "qwen/qwen3-32b", + }, }, }, - }, - max_tokens = { - default = 4096, - }, - temperature = { - default = 1, - }, - }) - end, + max_tokens = { + default = 4096, + }, + temperature = { + default = 1, + }, + }) + end, + gemini = function() + return require("codecompanion.adapters").extend("gemini", { + env = { + api_key = "GEMINI_API_KEY", + }, + }) + end, + }, }, display = { action_palette = { From f5c9c2d0124f8b0e571d56f52fb8bf55e1792f76 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 3 Sep 2025 12:50:07 +0200 Subject: [PATCH 2/7] nvim: Add smartpaste to LLM prompts Will paste and try to integrate _anything_ into the curent buffer. Wrong programming language, no formatting, pseudo code, natural language instructions, anything. --- nvim/.config/nvim/lua/plugins/llm.lua | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/plugins/llm.lua index 4f41c36..c9e1894 100644 --- a/nvim/.config/nvim/lua/plugins/llm.lua +++ b/nvim/.config/nvim/lua/plugins/llm.lua @@ -142,6 +142,78 @@ return { }, }, }, + prompt_library = { + + ["Smart Paste"] = { + strategy = "inline", + description = "Paste code smartly", + opts = { short_name = "paste" }, + prompts = { + { + role = "user", + content = [[ +You are a smart code paste agent within Neovim. + +## **Task:** Intelligently integrate content from the user's clipboard into the current buffer. + +## **Instructions:** + +- You may receive code in various programming languages or even natural language instructions. +- If the clipboard content is in a different language than the current buffer, translate it to the appropriate language smartly. +- If the clipboard content contains pseudo code generate code accordingly. +- If the clipboard content contains natural language instructions, interpret and follow them to modify the code in the current buffer. +- **ONLY** generate the **new** lines of code required for seamless integration. +- Ensure the inserted code is syntactically correct and logically consistent with the existing code. +- Do **NOT** include surrounding code or line numbers. +- Make sure all brackets and quotes are closed properly. + +## **Output:** + +- Provide only the necessary lines of code for insertion. +- If you can't generate code just return nothing. +- Ensure the response is proper and well-formatted. + ]], + }, + { + role = "user", + content = function(context) + local lines = require("codecompanion.helpers.actions").get_code( + 1, + context.line_count, + { show_line_numbers = true } + ) + local selection_info = "" + local clipboard = vim.fn.getreg("+") + + if context.is_visual then + selection_info = string.format( + "Currently selected lines: %d-%d", + context.start_line, + context.end_line + ) + else + selection_info = string.format( + "Current cursor line: %d and Current cursor column is %d", + context.cursor_pos[1], + context.cursor_pos[2] + ) + end + + return string.format( + "I have the following code:\n\n```%s\n%s\n```\n\nClipboard content:\n\n```\n%s\n```\n\n%s", + context.filetype, + lines, + clipboard, + selection_info + ) + end, + opts = { + contains_code = true, + }, + }, + }, + }, + }, }, keys = { { "aa", "CodeCompanionActions", desc = "Actions", silent = true, mode = { "n", "v" } }, From 6578d9accea0d5f70858a599a59feff150759047 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 23 Aug 2025 12:38:45 +0200 Subject: [PATCH 3/7] nvim: Add zk mappings for link insertion and journal entries --- nvim/.config/nvim/lua/plugins/prose.lua | 13 +++++++++++++ writing/zk/config/sh/alias.d/zk.sh | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 248bbed..b6b2b5e 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -332,6 +332,18 @@ local prose_plugs = { { "nn", "ZkNew { title = vim.fn.input('Title: ') }", desc = "new note" }, { "nn", ":'<,'>ZkNewFromTitleSelection", desc = "new note from selection", mode = "v" }, { "nN", ":'<,'>ZkNewFromContentSelection", desc = "content from selection", mode = "v" }, + { "nj", "ZkNew { dir = 'journal', group = 'daily' }", desc = "daily journal note" }, + { "nJ", "ZkNew { dir = 'journal', group = 'weekly' }", desc = "weekly journal note" }, + + { "na", "ZkInsertLink", desc = "insert link" }, + { "", "ZkInsertLink", desc = "insert link", mode = "i" }, + { + "na", + ":'<,'>ZkInsertLinkAtSelection", + desc = "insert link at selection", + mode = "v", + }, + { "nl", "ZkNotes { sort = { 'modified' } }", desc = "note list" }, { "nf", @@ -343,6 +355,7 @@ local prose_plugs = { { "nt", "ZkTags", desc = "note tags" }, { "nc", "ZkCd", desc = "notedir cd" }, { "no", "ZkOrphans { sort = { 'modified' } }", desc = "orphans list" }, + { "nb", "ZkBacklinks", desc = "note backlinks" }, { "nl", "ZkLinks", desc = "note links" }, }, diff --git a/writing/zk/config/sh/alias.d/zk.sh b/writing/zk/config/sh/alias.d/zk.sh index 67132d6..2ae0812 100644 --- a/writing/zk/config/sh/alias.d/zk.sh +++ b/writing/zk/config/sh/alias.d/zk.sh @@ -29,8 +29,14 @@ if [ -n "${WIKIROOT}" ]; then nnn() { # 'new quicknote' _zk_wiki new -t "${*:-$(date)}" } - nnl() { # 'new note log' - _zk_wiki log "$@" + nnl() { # 'new daily journal note' + _zk_wiki day "$@" + } + nnw() { # 'new weekly journal note' + _zk_wiki week "$@" + } + nnW() { # 'new weekly planning note' + _zk_wiki weekplan "$@" } nnd() { # 'new note draft' _zk_wiki draft "$@" From e44baaf207f9911ac88e20b28b56682cf7fa3897 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 4 Sep 2025 22:59:39 +0200 Subject: [PATCH 4/7] terminal: Add bash shell indicator to starship prompt So we know that we are not in a zsh shell currently. --- terminal/.config/starship.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/terminal/.config/starship.toml b/terminal/.config/starship.toml index 625330c..e8031d0 100644 --- a/terminal/.config/starship.toml +++ b/terminal/.config/starship.toml @@ -3,12 +3,13 @@ format = """ $sudo\ +$custom\ $username\ $directory\ $git_state\ $git_status\ $status\ -$character +$character\ """ right_format =""" @@ -80,6 +81,10 @@ symbol = " 󱍔 " style = 'bold yellow' format = "[$symbol]($style)" +[custom.shell_bash_indicator] +command = 'echo 󱆃' +when = ''' test "$0" = "/usr/bin/bash" ''' + # TODO: Would be lovely to have jujutsu support here # An example implementation: https://github.com/jj-vcs/jj/wiki/Starship # But currently very slow. Can be added with e.g. '${custom.jj}\' in format above From 4b65069436eaebdf0ad919bdd1393a14be415cc7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 4 Sep 2025 22:59:39 +0200 Subject: [PATCH 5/7] terminal: Add carapace completions to all shells Bash, nushell and zsh all make use of carapace completions by default. --- terminal/.bashrc | 2 ++ terminal/.config/nushell/config.nu | 3 +++ terminal/.config/nushell/env.nu | 5 +++++ terminal/.config/zsh/.zshrc | 2 ++ 4 files changed, 12 insertions(+) diff --git a/terminal/.bashrc b/terminal/.bashrc index eac6a0c..cea3f14 100644 --- a/terminal/.bashrc +++ b/terminal/.bashrc @@ -28,6 +28,8 @@ alias ls='ls --color=auto' eval "$(starship init bash)" eval "$(zoxide init bash)" +export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional +source <(carapace _carapace) set -o vi stty time 0 diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index ccb2053..d7a0390 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -35,6 +35,9 @@ starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.n atuin init nu | save -f ($nu.data-dir | path join "vendor/autoload/atuin.nu") # load zoxide bookmarks zoxide init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zoxide.nu") +# load carapace completions +source ~/.cache/carapace/init.nu + # keybinds $env.config.keybindings = [ diff --git a/terminal/.config/nushell/env.nu b/terminal/.config/nushell/env.nu index aa8e2a6..0751a07 100644 --- a/terminal/.config/nushell/env.nu +++ b/terminal/.config/nushell/env.nu @@ -16,3 +16,8 @@ # # You can remove these comments if you want or leave # them for future reference. + +## create carapace completions +$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional +mkdir ~/.cache/carapace +carapace _carapace nushell | save --force ~/.cache/carapace/init.nu diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/.zshrc index 9e06438..ae3ff19 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/.zshrc @@ -126,6 +126,8 @@ setopt autocd eval "$(starship init zsh)" eval "$(zoxide init zsh)" eval "$(atuin init zsh)" +export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional +source <(carapace _carapace) # Speed up autocomplete, force prefix mapping zstyle ':completion:*' accept-exact '*(N)' From bd90df30e4ba70587aed146b1e7205962da4db78 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 5 Sep 2025 08:48:45 +0200 Subject: [PATCH 6/7] nvim: Turn off usage message for jj-diffconflicts --- nvim/.config/nvim/lazy-lock.json | 2 +- nvim/.config/nvim/lua/plugins/git.lua | 8 +++++++- vcs/jj/config/jj/config.toml | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index cf64526..2ce5101 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -29,7 +29,7 @@ "hunk.nvim": { "branch": "master", "commit": "1e0a4d719c780bb8b0690a54915601508ced321e" }, "image.nvim": { "branch": "master", "commit": "a4638ec549c6aa56264cb0371255192ff37a8a90" }, "img-clip.nvim": { "branch": "main", "commit": "0bb8b5ced45c2672c70184c87d014194b0705815" }, - "jj-diffconflicts": { "branch": "feat/remove-instruction-message", "commit": "ee3f9179b2ab94d5177d3935fbf2bc94258d3541" }, + "jj-diffconflicts": { "branch": "main", "commit": "82b4a871b43c447213243e53b6d8b3c6d5729f6e" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, "lazy-events.nvim": { "branch": "main", "commit": "63802b7ddc852bdfa29e33b158d52429276fa742" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua index 02b59c1..efde301 100644 --- a/nvim/.config/nvim/lua/plugins/git.lua +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -119,5 +119,11 @@ return { }, }, }, - { "rafikdraoui/jj-diffconflicts", lazy = false }, + { + "rafikdraoui/jj-diffconflicts", + config = function() + vim.g.jj_diffconflicts_show_usage_message = false + end, + cmd = {"JJDiffConflicts"}, + }, } diff --git a/vcs/jj/config/jj/config.toml b/vcs/jj/config/jj/config.toml index 58b5e40..a627398 100644 --- a/vcs/jj/config/jj/config.toml +++ b/vcs/jj/config/jj/config.toml @@ -20,7 +20,6 @@ merge-editor = "dc" program = "nvim" merge-args = [ "-c", "let g:jj_diffconflicts_marker_length=$marker_length", - "-c", "let g:jj_diffconflicts_turn_off_instructions=1", "-c", "JJDiffConflicts!", "$output", "$base", "$left", "$right" ] merge-tool-edits-conflict-markers = true From 7d25e371afca319fec46fcab6dadb10394e17a15 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 5 Sep 2025 08:48:45 +0200 Subject: [PATCH 7/7] nvim: Remove sqruff until it is added to mason-nvim-lint --- nvim/.config/nvim/lazy-lock.json | 4 ++-- nvim/.config/nvim/lua/core/languages.lua | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 2ce5101..7c6af64 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -67,7 +67,7 @@ "nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" }, "nvim-dap-repl-highlights": { "branch": "master", "commit": "307cff2c364d3bf02501d59c405a817967fcd5fb" }, "nvim-dap-view": { "branch": "main", "commit": "fc0315087a871f9e74ef88559760b81dae81bc6d" }, - "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, + "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, "nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" }, @@ -101,7 +101,7 @@ "vim-spellsync": { "branch": "master", "commit": "ea9f431483ceb40ede8bd5b126a03eccd49b1bc0" }, "wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" }, "which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" }, - "wrapping.nvim": { "branch": "feat/nontextual-detection-option", "commit": "f3eb5d36e518b62430fd705086bc83cf2b1e7ac2" }, + "wrapping.nvim": { "branch": "feat/nontextual-detection-option", "commit": "cf6e758c04899cbfaa4f4eadccbb91d2439a6c97" }, "zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" }, "zk-nvim": { "branch": "main", "commit": "fd1ab2239ed85ca51051c094a49a280f4ed76bb2" } } diff --git a/nvim/.config/nvim/lua/core/languages.lua b/nvim/.config/nvim/lua/core/languages.lua index abad0d8..22bc23e 100644 --- a/nvim/.config/nvim/lua/core/languages.lua +++ b/nvim/.config/nvim/lua/core/languages.lua @@ -115,7 +115,9 @@ local languages = { }, quarto = { lint = { quarto = { "markdownlint" } }, format = { quarto = { "prettier", "injected" } } }, sh = { lint = { sh = { "shellcheck" } }, format = { sh = { "shellharden", "shfmt" } } }, - sql = { format = { sql = { "sleek" } }, lint = { sql = { "sqruff" } } }, + sql = { + format = { sql = { "sleek" } }, + }, svelte = { lint = { svelte = { "eslint_d" } }, format = { svelte = { "prettier" } } }, terraform = { lsp = { tofu_ls = {} },