From b8b8d6ef0989e7d0a20abdf2a4842682f123c90a Mon Sep 17 00:00:00 2001 From: kyasuda Date: Fri, 5 Sep 2025 10:32:09 -0700 Subject: [PATCH 1/2] update nvim --- .config/nvim/lua/core/keymaps.lua | 28 ++- .config/nvim/lua/plugins/bufferline.lua | 4 +- .config/nvim/lua/plugins/catppuccin.lua | 144 ++++++++----- .config/nvim/lua/plugins/codecompanion.lua | 202 ++++++++++-------- .config/nvim/lua/plugins/copilot.lua | 24 +++ .config/nvim/lua/plugins/img-clip.lua | 113 ++++++++++ .config/nvim/lua/plugins/mcphub.lua | 51 ----- .config/nvim/lua/plugins/mini.lua | 95 ++++---- .config/nvim/lua/plugins/nvim-cmp.lua | 2 +- .config/nvim/lua/plugins/nvim-lint.lua | 1 + .../nvim/lua/utils/codecompanion/extmarks.lua | 94 ++++++++ .../codecompanion/fidget-spinner-notify.lua | 0 .../codecompanion/fidget-spinner.lua | 0 .../keymaps/converters/from_table/init.lua | 2 +- .config/nvim/lua/utils/ruff.toml | 82 +++++++ .../nvim/lua/utils/telescope_extra/init.lua | 24 +++ 16 files changed, 618 insertions(+), 248 deletions(-) create mode 100644 .config/nvim/lua/plugins/img-clip.lua delete mode 100644 .config/nvim/lua/plugins/mcphub.lua create mode 100644 .config/nvim/lua/utils/codecompanion/extmarks.lua rename .config/nvim/lua/{plugins => utils}/codecompanion/fidget-spinner-notify.lua (100%) rename .config/nvim/lua/{plugins => utils}/codecompanion/fidget-spinner.lua (100%) create mode 100644 .config/nvim/lua/utils/ruff.toml diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua index c96fd71..aaa7a76 100644 --- a/.config/nvim/lua/core/keymaps.lua +++ b/.config/nvim/lua/core/keymaps.lua @@ -2,6 +2,7 @@ local map = vim.keymap.set local term = require("utils.terminal") local map_from_table = require("utils.keymaps.converters.from_table").set_keybindings local add_to_whichkey = require("utils.keymaps.converters.whichkey").addToWhichKey +local telescope_paste_img = require("utils.telescope_extra").find_and_paste_image local term_factory = term.term_factory local term_toggle = term.term_toggle @@ -34,7 +35,7 @@ local basic_mappings = { { key = "", cmd = "zz", desc = "Scroll up and center", mode = "n" }, { key = "n", cmd = "nzzzv", desc = "Next search result and center", mode = "n" }, { key = "N", cmd = "Nzzzv", desc = "Previous search result and center", mode = "n" }, - { key = "p", cmd = '"_dP', desc = "Paste without yanking", mode = "x", group = "Paste in place" }, + { key = "pp", cmd = '"_dP', desc = "Paste without yanking", mode = "x" }, { key = "<", cmd = "= 0 and n <= 2, "Must be between 0 and 2" - end, + }) + end, + -- }}} + -- {{{ LLAMA_CPP + llama_cpp = function() + return require("codecompanion.adapters").extend("openai_compatible", { + name = "llama.cpp", + formatted_name = "llama.cpp", + opts = { + stream = false, }, - }, - env = { - url = "http://localhost:8080", - chat_url = "/v1/chat/completions", - }, - }) - end, - openrouter = function() - return require("codecompanion.adapters").extend("openai_compatible", { - env = { - url = "https://openrouter.ai/api", - api_key = "cmd:cat $HOME/.openrouterapikey", - chat_url = "/v1/chat/completions", - }, - schema = { - model = { - default = "google/gemini-2.5-pro-exp-03-25:free", - -- default = "deepseek/deepseek-chat-v3-0324:free", - -- default = "google/gemini-2.0-flash-thinking-exp:free", - -- default = "deepseek/deepseek-r1-distill-qwen-32b:free", - -- default = "qwen/qwen-2.5-coder-32b-instruct:free", + schema = { + -- model = { + -- default = "qwen2.5-coder-14b-instruct", + -- choices = { + -- ["qwen2.5-coder-14b-instruct"] = { opts = { can_reason = true } }, + -- ["/models/lmstudio-community/DeepSeek-R1-Distill-Qwen-7B-GGUF/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf"] = { + -- opts = { can_reason = true }, + -- }, + -- ["/models/lmstudio-community/Qwen2.5-7B-Instruct-1M-GGUF/Qwen2.5-7B-Instruct-1M-Q4_K_M.gguf"] = { + -- opts = { can_reason = true }, + -- }, + -- }, + -- }, + temperature = { + order = 2, + mapping = "parameters", + type = "number", + optional = true, + default = 0.2, + validate = function(n) + return n >= 0 and n <= 2, "Must be between 0 and 2" + end, + }, }, - }, - }) - end, + env = { + url = "http://localhost:8080", + chat_url = "/v1/chat/completions", + }, + }) + end, + -- }}} + -- {{{ OPENROUTER + openrouter = function() + return require("codecompanion.adapters").extend("openai_compatible", { + env = { + url = "https://openrouter.ai/api", + api_key = "cmd:cat $HOME/.openrouterapikey", + chat_url = "/v1/chat/completions", + }, + schema = { + model = { + default = "google/gemini-2.5-pro-exp-03-25:free", + -- default = "deepseek/deepseek-chat-v3-0324:free", + -- default = "google/gemini-2.0-flash-thinking-exp:free", + -- default = "deepseek/deepseek-r1-distill-qwen-32b:free", + -- default = "qwen/qwen-2.5-coder-32b-instruct:free", + }, + }, + }) + end, + -- }}} + }, + -- }}} + -- {{{ ACP + acp = { + gemini_cli = function() + return require("codecompanion.adapters").extend("gemini_cli", { + defaults = { + auth_method = "oauth-personal", -- "oauth-personal"|"gemini-api-key"|"vertex-ai" + mcpServers = {}, + timeout = 20000, -- 20 seconds + }, + }) + end, + }, + -- }}} }, strategies = { chat = { @@ -212,6 +235,7 @@ return { }, }, init = function() - require("plugins.codecompanion.fidget-spinner"):init() + require("utils.codecompanion.fidget-spinner"):init() + require("utils.codecompanion.extmarks").setup() end, } diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua index 13b41aa..7d9393b 100644 --- a/.config/nvim/lua/plugins/copilot.lua +++ b/.config/nvim/lua/plugins/copilot.lua @@ -1,5 +1,7 @@ return { "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", opts = { panel = { enabled = true, @@ -49,7 +51,29 @@ return { listCount = 10, -- #completions for panel inlineSuggestCount = 5, -- #completions for getCompletions }, + telemetry = { + telemetryLevel = "all", + }, }, }, + copilot_node_command = "node", -- Node.js version must be > 20 + workspace_folders = {}, + -- copilot_model = "", + disable_limit_reached_message = false, -- Set to `true` to suppress completion limit reached popup + logger = { + file = vim.fn.stdpath("log") .. "/copilot-lua.log", + file_log_level = vim.log.levels.OFF, + print_log_level = vim.log.levels.WARN, + trace_lsp = "off", -- "off" | "messages" | "verbose" + trace_lsp_progress = false, + log_lsp_messages = false, + }, + root_dir = function() + return vim.fs.dirname(vim.fs.find(".git", { upward = true })[1]) + end, + server = { + type = "nodejs", -- "nodejs" | "binary" + custom_server_filepath = nil, + }, }, } diff --git a/.config/nvim/lua/plugins/img-clip.lua b/.config/nvim/lua/plugins/img-clip.lua new file mode 100644 index 0000000..bb94c14 --- /dev/null +++ b/.config/nvim/lua/plugins/img-clip.lua @@ -0,0 +1,113 @@ +return { + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + default = { + -- file and directory options + dir_path = function() + return vim.fn.expand("%:t:r") + end, ---@type string | fun(): string + extension = "png", ---@type string | fun(): string + file_name = "%Y-%m-%d-%H-%M-%S", ---@type string | fun(): string + use_absolute_path = false, ---@type boolean | fun(): boolean + relative_to_current_file = false, ---@type boolean | fun(): boolean + + -- logging options + verbose = true, ---@type boolean | fun(): boolean + + -- template options + template = "$FILE_PATH", ---@type string | fun(context: table): string + url_encode_path = false, ---@type boolean | fun(): boolean + relative_template_path = true, ---@type boolean | fun(): boolean + use_cursor_in_template = true, ---@type boolean | fun(): boolean + insert_mode_after_paste = true, ---@type boolean | fun(): boolean + insert_template_after_cursor = true, ---@type boolean | fun(): boolean + + -- prompt options + prompt_for_file_name = true, ---@type boolean | fun(): boolean + show_dir_path_in_prompt = false, ---@type boolean | fun(): boolean + + -- base64 options + max_base64_size = 10, ---@type number | fun(): number + embed_image_as_base64 = false, ---@type boolean | fun(): boolean + + -- image options + process_cmd = "", ---@type string | fun(): string + copy_images = false, ---@type boolean | fun(): boolean + download_images = true, ---@type boolean | fun(): boolean + + -- drag and drop options + drag_and_drop = { + enabled = true, ---@type boolean | fun(): boolean + insert_mode = false, ---@type boolean | fun(): boolean + }, + }, + + -- filetype specific options + filetypes = { + markdown = { + url_encode_path = true, ---@type boolean | fun(): boolean + template = "![$CURSOR]($FILE_PATH)", ---@type string | fun(context: table): string + download_images = false, ---@type boolean | fun(): boolean + }, + + vimwiki = { + url_encode_path = true, ---@type boolean | fun(): boolean + template = "![$CURSOR]($FILE_PATH)", ---@type string | fun(context: table): string + download_images = false, ---@type boolean | fun(): boolean + }, + + html = { + template = '$CURSOR', ---@type string | fun(context: table): string + }, + + tex = { + relative_template_path = false, ---@type boolean | fun(): boolean + template = [[ +\begin{figure}[h] + \centering + \includegraphics[width=0.8\textwidth]{$FILE_PATH} + \caption{$CURSOR} + \label{fig:$LABEL} +\end{figure} + ]], ---@type string | fun(context: table): string + }, + + typst = { + template = [[ +#figure( + image("$FILE_PATH", width: 80%), + caption: [$CURSOR], +) + ]], ---@type string | fun(context: table): string + }, + + rst = { + template = [[ +.. image:: $FILE_PATH + :alt: $CURSOR + :width: 80% + ]], ---@type string | fun(context: table): string + }, + + asciidoc = { + template = 'image::$FILE_PATH[width=80%, alt="$CURSOR"]', ---@type string | fun(context: table): string + }, + + org = { + template = [=[ +#+BEGIN_FIGURE +[[file:$FILE_PATH]] +#+CAPTION: $CURSOR +#+NAME: fig:$LABEL +#+END_FIGURE + ]=], ---@type string | fun(context: table): string + }, + }, + + -- file, directory, and custom triggered options + files = {}, ---@type table | fun(): table + dirs = {}, ---@type table | fun(): table + custom = {}, ---@type table | fun(): table + }, +} diff --git a/.config/nvim/lua/plugins/mcphub.lua b/.config/nvim/lua/plugins/mcphub.lua deleted file mode 100644 index 813e916..0000000 --- a/.config/nvim/lua/plugins/mcphub.lua +++ /dev/null @@ -1,51 +0,0 @@ -return { - "ravitemer/mcphub.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - cmd = "MCPHub", - build = "bundled_build.lua", -- Bundles mcp-hub locally - config = function() - vim.notify = require("notify") - require("mcphub").setup({ - use_bundled_binary = true, -- Use local binary - port = 37373, -- Port for MCP Hub Express API - config = vim.fn.expand("~/.config/mcphub/servers.json"), -- Config file path - native_servers = {}, -- add your native servers here - auto_approve = true, - extensions = { - avante = {}, - codecompanion = { - show_result_in_chat = true, -- Show tool results in chat - make_vars = true, -- Create chat variables from resources - make_slash_commands = true, -- make /slash_commands from MCP server prompts - }, - }, - - -- UI configuration - ui = { - window = { - width = 0.8, -- Window width (0-1 ratio) - height = 0.8, -- Window height (0-1 ratio) - border = "rounded", -- Window border style - relative = "editor", -- Window positioning - zindex = 50, -- Window stack order - }, - }, - - -- Event callbacks - on_ready = function(hub) end, -- Called when hub is ready - on_error = function(err) - vim.notify(err, "ERROR") - end, -- Called on errors - - -- Logging configuration - log = { - level = vim.log.levels.WARN, -- Minimum log level - to_file = false, -- Enable file logging - file_path = nil, -- Custom log file path - prefix = "MCPHub", -- Log message prefix - }, - }) - end, -} diff --git a/.config/nvim/lua/plugins/mini.lua b/.config/nvim/lua/plugins/mini.lua index 456b3d9..362c3ae 100644 --- a/.config/nvim/lua/plugins/mini.lua +++ b/.config/nvim/lua/plugins/mini.lua @@ -1,63 +1,66 @@ return { "echasnovski/mini.diff", depends = { "echasnovski/mini.nvim" }, - opts = { + config = function() + local diff = require("mini.diff") + diff.setup({ - -- Options for how hunks are visualized - view = { - -- Visualization style. Possible values are 'sign' and 'number'. - -- Default: 'number' if line numbers are enabled, 'sign' otherwise. - style = vim.go.number and "number" or "sign", + -- Options for how hunks are visualized + view = { + -- Visualization style. Possible values are 'sign' and 'number'. + -- Default: 'number' if line numbers are enabled, 'sign' otherwise. + style = vim.go.number and "number" or "sign", - -- Signs used for hunks with 'sign' view - signs = { add = "▒", change = "▒", delete = "▒" }, + -- Signs used for hunks with 'sign' view + signs = { add = "▒", change = "▒", delete = "▒" }, - -- Priority of used visualization extmarks - priority = 199, - }, + -- Priority of used visualization extmarks + priority = 199, + }, - -- Source for how reference text is computed/updated/etc - -- Uses content from Git index by default - source = nil, + -- Source for how reference text is computed/updated/etc + -- Uses content from Git index by default + source = diff.gen_source.none(), - -- Delays (in ms) defining asynchronous processes - delay = { - -- How much to wait before update following every text change - text_change = 200, - }, + -- Delays (in ms) defining asynchronous processes + delay = { + -- How much to wait before update following every text change + text_change = 200, + }, - -- Module mappings. Use `''` (empty string) to disable one. - mappings = { - -- Apply hunks inside a visual/operator region - apply = "gh", + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Apply hunks inside a visual/operator region + apply = "gh", - -- Reset hunks inside a visual/operator region - reset = "gH", + -- Reset hunks inside a visual/operator region + reset = "gH", - -- Hunk range textobject to be used inside operator - -- Works also in Visual mode if mapping differs from apply and reset - textobject = "gh", + -- Hunk range textobject to be used inside operator + -- Works also in Visual mode if mapping differs from apply and reset + textobject = "gh", - -- Go to hunk range in corresponding direction - goto_first = "[H", - goto_prev = "[h", - goto_next = "]h", - goto_last = "]H", - }, + -- Go to hunk range in corresponding direction + goto_first = "[H", + goto_prev = "[h", + goto_next = "]h", + goto_last = "]H", + }, - -- Various options - options = { - -- Diff algorithm. See `:h vim.diff()`. - algorithm = "histogram", + -- Various options + options = { + -- Diff algorithm. See `:h vim.diff()`. + algorithm = "histogram", - -- Whether to use "indent heuristic". See `:h vim.diff()`. - indent_heuristic = true, + -- Whether to use "indent heuristic". See `:h vim.diff()`. + indent_heuristic = true, - -- The amount of second-stage diff to align lines (in Neovim>=0.9) - linematch = 60, + -- The amount of second-stage diff to align lines (in Neovim>=0.9) + linematch = 60, - -- Whether to wrap around edges during hunk navigation - wrap_goto = false, - }, - }, + -- Whether to wrap around edges during hunk navigation + wrap_goto = false, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index df40695..5467692 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -171,8 +171,8 @@ return { sources = cmp.config.sources({ { name = "nvim_lsp_signature_help", group_index = 0 }, { name = "lazydev", group_index = 0 }, + { name = "copilot", group_index = 0 }, { name = "nvim_lsp", group_index = 1 }, - { name = "copilot", group_index = 1 }, { name = "codecompanion", group_index = 2 }, { name = "async_path", group_index = 2 }, { name = "nvim_lsp_document_symbol", group_index = 2 }, diff --git a/.config/nvim/lua/plugins/nvim-lint.lua b/.config/nvim/lua/plugins/nvim-lint.lua index b18943f..2702189 100644 --- a/.config/nvim/lua/plugins/nvim-lint.lua +++ b/.config/nvim/lua/plugins/nvim-lint.lua @@ -12,6 +12,7 @@ return { vim = { "vint" }, go = { "golangcilint" }, } + lint.linters.jsonlint.cmd = "vscode-json-language-server" lint.linters.shellcheck.args = { "-s", "bash", diff --git a/.config/nvim/lua/utils/codecompanion/extmarks.lua b/.config/nvim/lua/utils/codecompanion/extmarks.lua new file mode 100644 index 0000000..bda35bc --- /dev/null +++ b/.config/nvim/lua/utils/codecompanion/extmarks.lua @@ -0,0 +1,94 @@ +--- @class CodeCompanion.InlineExtmark +--- @field unique_line_sign_text string Text used for sign when there's only a single line +--- @field first_line_sign_text string Text used for sign on the first line of multi-line section +--- @field last_line_sign_text string Text used for sign on the last line of multi-line section +--- @field extmark vim.api.keyset.set_extmark Extmark options passed to nvim_buf_set_extmark + +local M = {} + +--- @type CodeCompanion.InlineExtmark +local default_opts = { + unique_line_sign_text = "", + first_line_sign_text = "┌", + last_line_sign_text = "└", + extmark = { + sign_hl_group = "DiagnosticWarn", + sign_text = "│", + priority = 1000, + }, +} + +--- Helper function to set a line extmark with specified sign text +--- @param bufnr number +--- @param ns_id number +--- @param line_num number Line number +--- @param opts vim.api.keyset.set_extmark Extmark options +--- @param sign_type string Key in opts for the sign text to use +local function set_line_extmark(bufnr, ns_id, line_num, opts, sign_type) + vim.api.nvim_buf_set_extmark( + bufnr, + ns_id, + line_num - 1, -- Convert to 0-based index + 0, + vim.tbl_deep_extend("force", opts.extmark or {}, { + sign_text = opts[sign_type] or opts.extmark.sign_text, + }) + ) +end + +--- Creates extmarks for inline code annotations +--- @param opts CodeCompanion.InlineExtmark Configuration options for the extmarks +--- @param data CodeCompanion.InlineArgs Data containing context information about the code block +--- @param ns_id number unique namespace id for the extmarks +local function create_extmarks(opts, data, ns_id) + --- @type {bufnr: number, start_line: number, end_line: number} + local context = data.context + + -- Handle the case where start and end lines are the same (unique line) + if context.start_line == context.end_line then + set_line_extmark(context.bufnr, ns_id, context.start_line, opts, "unique_line_sign_text") + return + end + + -- Set extmark for the first line with special options + set_line_extmark(context.bufnr, ns_id, context.start_line, opts, "first_line_sign_text") + + -- Set extmarks for the middle lines with standard options + for i = context.start_line + 1, context.end_line - 1 do + vim.api.nvim_buf_set_extmark(context.bufnr, ns_id, i - 1, 0, opts.extmark) + end + + -- Set extmark for the last line with special options + if context.end_line > context.start_line then + set_line_extmark(context.bufnr, ns_id, context.end_line, opts, "last_line_sign_text") + end +end + +--- Creates autocmds for CodeCompanionRequest events +--- @param opts CodeCompanion.InlineExtmark Configuration options passed from setup +local function create_autocmds(opts) + vim.api.nvim_create_autocmd({ "User" }, { + pattern = { "CodeCompanionRequest*" }, + callback = + --- @param args {buf: number, data : CodeCompanion.InlineArgs, match: string} + function(args) + local data = args.data or {} + local context = data and data.context or {} + if data and data.context then + local ns_id = vim.api.nvim_create_namespace("CodeCompanionInline_" .. data.id) + if args.match:find("StartedInline") then + create_extmarks(opts, data, ns_id) + elseif args.match:find("FinishedInline") then + vim.api.nvim_buf_clear_namespace(context.bufnr, ns_id, 0, -1) + end + end + end, + }) +end + +--- @param opts? CodeCompanion.InlineExtmark Optional configuration to override defaults +function M.setup(opts) + create_autocmds(vim.tbl_deep_extend("force", default_opts, opts or {})) +end + +return M diff --git a/.config/nvim/lua/plugins/codecompanion/fidget-spinner-notify.lua b/.config/nvim/lua/utils/codecompanion/fidget-spinner-notify.lua similarity index 100% rename from .config/nvim/lua/plugins/codecompanion/fidget-spinner-notify.lua rename to .config/nvim/lua/utils/codecompanion/fidget-spinner-notify.lua diff --git a/.config/nvim/lua/plugins/codecompanion/fidget-spinner.lua b/.config/nvim/lua/utils/codecompanion/fidget-spinner.lua similarity index 100% rename from .config/nvim/lua/plugins/codecompanion/fidget-spinner.lua rename to .config/nvim/lua/utils/codecompanion/fidget-spinner.lua diff --git a/.config/nvim/lua/utils/keymaps/converters/from_table/init.lua b/.config/nvim/lua/utils/keymaps/converters/from_table/init.lua index 4d756fc..d23e0df 100644 --- a/.config/nvim/lua/utils/keymaps/converters/from_table/init.lua +++ b/.config/nvim/lua/utils/keymaps/converters/from_table/init.lua @@ -1,6 +1,6 @@ local M = {} local map = vim.keymap.set -local opts = { noremap = true, silent = true } +local opts = { noremap = true, silent = false } --- Set keybindings from a table of mappings. --- @param bindings table A list of keybinding mappings. diff --git a/.config/nvim/lua/utils/ruff.toml b/.config/nvim/lua/utils/ruff.toml new file mode 100644 index 0000000..3924c9f --- /dev/null +++ b/.config/nvim/lua/utils/ruff.toml @@ -0,0 +1,82 @@ +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", + "env" +] + +# Same as Black. +line-length = 88 +indent-width = 4 + +# Assume Python 3.9 +target-version = "py39" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["D"] +ignore = ["D107", "D203", "D212", "D213", "D402", "D413", "D415", "D416", "D417"] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[lint.pydocstyle] +convention = "numpy" # Accepts: "google", "numpy", or "pep257". + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "spaces" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = true + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" + +respect-gitignore = true diff --git a/.config/nvim/lua/utils/telescope_extra/init.lua b/.config/nvim/lua/utils/telescope_extra/init.lua index a23b420..58a9203 100644 --- a/.config/nvim/lua/utils/telescope_extra/init.lua +++ b/.config/nvim/lua/utils/telescope_extra/init.lua @@ -3,6 +3,30 @@ local telescopeConfig = require("telescope.config") local M = {} +function M.find_and_paste_image() + local telescope = require("telescope.builtin") + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + telescope.find_files({ + attach_mappings = function(_, map) + local function embed_image(prompt_bufnr) + local entry = action_state.get_selected_entry() + local filepath = entry[1] + actions.close(prompt_bufnr) + + local img_clip = require("img-clip") + img_clip.paste_image(nil, filepath) + end + + map("i", "", embed_image) + map("n", "", embed_image) + + return true + end, + }) +end + function M.setup() -- Clone the default Telescope configuration local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) } From 73fed69cb78ceeb6ab1e9cb5f7524ff4691d0469 Mon Sep 17 00:00:00 2001 From: kyasuda Date: Fri, 5 Sep 2025 11:04:16 -0700 Subject: [PATCH 2/2] update nvim --- .config/nvim/lua/plugins/noice.lua | 3 ++- .config/nvim/lua/plugins/render-markdown.lua | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/plugins/noice.lua b/.config/nvim/lua/plugins/noice.lua index 30db32b..8ce04c0 100644 --- a/.config/nvim/lua/plugins/noice.lua +++ b/.config/nvim/lua/plugins/noice.lua @@ -12,7 +12,8 @@ return { --- @type NoiceFormat|string format_done = "lsp_progress_done", throttle = 1000 / 30, -- frequency to update lsp progress message - view = "mini", + -- view = "mini", + view = "notify", }, -- override markdown rendering so that **cmp** and other plugins use **Treesitter** override = { diff --git a/.config/nvim/lua/plugins/render-markdown.lua b/.config/nvim/lua/plugins/render-markdown.lua index 027c1d3..a875ed7 100644 --- a/.config/nvim/lua/plugins/render-markdown.lua +++ b/.config/nvim/lua/plugins/render-markdown.lua @@ -7,6 +7,11 @@ return { ---@module 'render-markdown' ---@type render.md.UserConfig opts = { + completions = { + lsp = { + enabled = true, + }, + }, injections = { gitcommit = { enabled = true,