mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
Compare commits
2 Commits
22b43c6ddf
...
73fed69cb7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73fed69cb7 | ||
|
|
b8b8d6ef09 |
@@ -2,6 +2,7 @@ local map = vim.keymap.set
|
|||||||
local term = require("utils.terminal")
|
local term = require("utils.terminal")
|
||||||
local map_from_table = require("utils.keymaps.converters.from_table").set_keybindings
|
local map_from_table = require("utils.keymaps.converters.from_table").set_keybindings
|
||||||
local add_to_whichkey = require("utils.keymaps.converters.whichkey").addToWhichKey
|
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_factory = term.term_factory
|
||||||
local term_toggle = term.term_toggle
|
local term_toggle = term.term_toggle
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ local basic_mappings = {
|
|||||||
{ key = "<C-u>", cmd = "<C-u>zz", desc = "Scroll up and center", mode = "n" },
|
{ key = "<C-u>", cmd = "<C-u>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 = "Next search result and center", mode = "n" },
|
||||||
{ key = "N", cmd = "Nzzzv", desc = "Previous search result and center", mode = "n" },
|
{ key = "N", cmd = "Nzzzv", desc = "Previous search result and center", mode = "n" },
|
||||||
{ key = "<leader>p", cmd = '"_dP', desc = "Paste without yanking", mode = "x", group = "Paste in place" },
|
{ key = "<leader>pp", cmd = '"_dP', desc = "Paste without yanking", mode = "x" },
|
||||||
{ key = "<", cmd = "<gv", desc = "Reselect after indent", mode = "v" },
|
{ key = "<", cmd = "<gv", desc = "Reselect after indent", mode = "v" },
|
||||||
{ key = ">", cmd = ">gv", desc = "Reselect after indent", mode = "v" },
|
{ key = ">", cmd = ">gv", desc = "Reselect after indent", mode = "v" },
|
||||||
{ key = "J", cmd = ":m '>+1<CR>gv=gv", desc = "Move line down", mode = "v" },
|
{ key = "J", cmd = ":m '>+1<CR>gv=gv", desc = "Move line down", mode = "v" },
|
||||||
@@ -200,6 +201,7 @@ local lsp_mappings = {
|
|||||||
group = "Goto Previous Preview",
|
group = "Goto Previous Preview",
|
||||||
},
|
},
|
||||||
{ mode = "n", key = "<leader>cl", cmd = ":lua vim.diagnostic.setloclist()<CR>", group = "Set Loclist" },
|
{ mode = "n", key = "<leader>cl", cmd = ":lua vim.diagnostic.setloclist()<CR>", group = "Set Loclist" },
|
||||||
|
{ mode = "n", key = "<leader>Clr", cmd = ":LspRestart<CR>", group = "Restart LSP" },
|
||||||
{
|
{
|
||||||
mode = "n",
|
mode = "n",
|
||||||
key = "<leader>cPs",
|
key = "<leader>cPs",
|
||||||
@@ -230,7 +232,7 @@ local code_companion_mappings = {
|
|||||||
mode = "v",
|
mode = "v",
|
||||||
key = "<leader>Ci",
|
key = "<leader>Ci",
|
||||||
cmd = ":CodeCompanion #{buffer} ",
|
cmd = ":CodeCompanion #{buffer} ",
|
||||||
group = "CodeCompanion #{buffer}",
|
group = "CodeCompanion Inline",
|
||||||
opts = nosilent,
|
opts = nosilent,
|
||||||
},
|
},
|
||||||
{ mode = "v", key = "<leader>Ce", cmd = ":CodeCompanion /explain<CR>", group = "CodeCompanion /explain" },
|
{ mode = "v", key = "<leader>Ce", cmd = ":CodeCompanion /explain<CR>", group = "CodeCompanion /explain" },
|
||||||
@@ -284,6 +286,14 @@ local telescope_mappings = {
|
|||||||
cmd = ":Telescope noice theme=dropdown layout_config={width=0.75}<CR>",
|
cmd = ":Telescope noice theme=dropdown layout_config={width=0.75}<CR>",
|
||||||
group = "Telescope Noice",
|
group = "Telescope Noice",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
mode = "n",
|
||||||
|
key = "<leader>Ti",
|
||||||
|
cmd = function()
|
||||||
|
telescope_paste_img()
|
||||||
|
end,
|
||||||
|
desc = "Find and Paste Image",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
mode = "n",
|
mode = "n",
|
||||||
key = "<leader>ff",
|
key = "<leader>ff",
|
||||||
@@ -528,7 +538,7 @@ end
|
|||||||
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
||||||
--}}}
|
--}}}
|
||||||
|
|
||||||
-- {{{ NVIM-IMAGE
|
-- {{{ IMAGE
|
||||||
local image_mappings = {
|
local image_mappings = {
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -544,6 +554,14 @@ local image_mappings = {
|
|||||||
cmd = ":lua require('image').enable()<CR>",
|
cmd = ":lua require('image').enable()<CR>",
|
||||||
desc = "Enable image rendering",
|
desc = "Enable image rendering",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
mode = "n",
|
||||||
|
key = "<leader>pi",
|
||||||
|
cmd = function()
|
||||||
|
telescope_paste_img()
|
||||||
|
end,
|
||||||
|
desc = "Find and Paste Image",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
@@ -554,6 +572,7 @@ add_to_whichkey(nil, { key = "<leader>c", group = "Code" })
|
|||||||
add_to_whichkey(nil, { key = "<leader>ca", group = "Code Actions" })
|
add_to_whichkey(nil, { key = "<leader>ca", group = "Code Actions" })
|
||||||
add_to_whichkey(nil, { key = "<leader>cc", group = "Calls" })
|
add_to_whichkey(nil, { key = "<leader>cc", group = "Calls" })
|
||||||
add_to_whichkey(nil, { key = "<leader>C", group = "CodeCompanion" })
|
add_to_whichkey(nil, { key = "<leader>C", group = "CodeCompanion" })
|
||||||
|
add_to_whichkey(nil, { key = "<leader>cL", group = "LSP" })
|
||||||
add_to_whichkey(nil, { key = "<leader>d", group = "ODIS" })
|
add_to_whichkey(nil, { key = "<leader>d", group = "ODIS" })
|
||||||
add_to_whichkey(nil, { key = "<leader>f", group = "Find" })
|
add_to_whichkey(nil, { key = "<leader>f", group = "Find" })
|
||||||
add_to_whichkey(nil, { key = "<leader>g", group = "Git" })
|
add_to_whichkey(nil, { key = "<leader>g", group = "Git" })
|
||||||
@@ -563,7 +582,8 @@ add_to_whichkey(nil, { key = "<leader>i", group = "Image" })
|
|||||||
add_to_whichkey(nil, { key = "<leader>j", group = "AnyJump" })
|
add_to_whichkey(nil, { key = "<leader>j", group = "AnyJump" })
|
||||||
add_to_whichkey(nil, { key = "<leader>N", group = "Noice" })
|
add_to_whichkey(nil, { key = "<leader>N", group = "Noice" })
|
||||||
-- add_to_whichkey(nil, { key = "<leader>o", group = "Open" })
|
-- add_to_whichkey(nil, { key = "<leader>o", group = "Open" })
|
||||||
add_to_whichkey(nil, { key = "<leader>p", group = "Paste in Place" })
|
add_to_whichkey(nil, { key = "<leader>p", group = "Paste" })
|
||||||
|
add_to_whichkey(nil, { key = "<leader>pg", group = "Paste Git Raw" })
|
||||||
add_to_whichkey(nil, { key = "<leader>s", group = "Search" })
|
add_to_whichkey(nil, { key = "<leader>s", group = "Search" })
|
||||||
add_to_whichkey(nil, { key = "<leader>t", group = "Terminal" })
|
add_to_whichkey(nil, { key = "<leader>t", group = "Terminal" })
|
||||||
add_to_whichkey(nil, { key = "<leader>T", group = "Telescope" })
|
add_to_whichkey(nil, { key = "<leader>T", group = "Telescope" })
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ return {
|
|||||||
local s = " "
|
local s = " "
|
||||||
for e, n in pairs(diagnostics_dict) do
|
for e, n in pairs(diagnostics_dict) do
|
||||||
local sym = e == "error" and " "
|
local sym = e == "error" and " "
|
||||||
or e == "hint" and " "
|
or e == "hint" and " "
|
||||||
or (e == "warning" and " " or "")
|
or (e == "warning" and " " or "")
|
||||||
s = s .. n .. sym
|
s = s .. n .. sym
|
||||||
end
|
end
|
||||||
return s
|
return s
|
||||||
|
|||||||
@@ -1,56 +1,92 @@
|
|||||||
return {
|
return {
|
||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
name = "catppuccin",
|
name = "catppuccin",
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {
|
opts = {
|
||||||
flavour = "macchiato", -- latte, frappe, macchiato, mocha
|
flavour = "macchiato", -- latte, frappe, macchiato, mocha
|
||||||
term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`)
|
transparent_background = false, -- disables setting the background color.
|
||||||
integrations = {
|
float = {
|
||||||
cmp = true,
|
transparent = false, -- enable transparent floating windows
|
||||||
gitsigns = true,
|
solid = false, -- use solid styling for floating windows, see |winborder|
|
||||||
nvimtree = true,
|
},
|
||||||
mini = {
|
show_end_of_buffer = false, -- shows the '~' characters after the end of buffers
|
||||||
enabled = true,
|
term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`)
|
||||||
indentscope_color = "",
|
dim_inactive = {
|
||||||
},
|
enabled = false, -- dims the background color of inactive window
|
||||||
bufferline = true,
|
shade = "dark",
|
||||||
dashboard = true,
|
percentage = 0.15, -- percentage of the shade to apply to the inactive window
|
||||||
fidget = true,
|
},
|
||||||
indent_blankline = {
|
no_italic = false, -- Force no italic
|
||||||
enabled = true,
|
no_bold = false, -- Force no bold
|
||||||
scope_color = "lavendar", -- catppuccin color (eg. `lavender`) Default: text
|
no_underline = false, -- Force no underline
|
||||||
colored_indent_levels = true,
|
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
|
||||||
},
|
comments = { "italic" }, -- Change the style of comments
|
||||||
copilot_vim = true,
|
conditionals = { "italic" },
|
||||||
native_lsp = {
|
loops = { "bold" },
|
||||||
enabled = true,
|
functions = { "bold", "italic" },
|
||||||
virtual_text = {
|
keywords = { "bold" },
|
||||||
errors = { "italic" },
|
strings = {},
|
||||||
hints = { "italic" },
|
variables = { "bold" },
|
||||||
warnings = { "italic" },
|
numbers = { "bold" },
|
||||||
information = { "italic" },
|
booleans = { "bold" },
|
||||||
ok = { "italic" },
|
properties = { "bold" },
|
||||||
},
|
types = { "bold" },
|
||||||
underlines = {
|
operators = { "bold" },
|
||||||
errors = { "underline" },
|
-- miscs = {}, -- Uncomment to turn off hard-coded styles
|
||||||
hints = { "underline" },
|
},
|
||||||
warnings = { "underline" },
|
color_overrides = {},
|
||||||
information = { "underline" },
|
custom_highlights = {},
|
||||||
ok = { "underline" },
|
default_integrations = true,
|
||||||
},
|
auto_integrations = false,
|
||||||
inlay_hints = {
|
integrations = {
|
||||||
background = true,
|
cmp = true,
|
||||||
},
|
gitsigns = true,
|
||||||
},
|
nvimtree = true,
|
||||||
notify = true,
|
mini = {
|
||||||
treesitter = true,
|
enabled = true,
|
||||||
rainbow_delimiters = true,
|
indentscope_color = "",
|
||||||
telescope = {
|
},
|
||||||
enabled = true,
|
bufferline = true,
|
||||||
-- style = "nvchad"
|
dashboard = true,
|
||||||
},
|
diffview = true,
|
||||||
which_key = true
|
fidget = true,
|
||||||
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
noice = true,
|
||||||
}
|
indent_blankline = {
|
||||||
}
|
enabled = true,
|
||||||
|
scope_color = "lavendar", -- catppuccin color (eg. `lavender`) Default: text
|
||||||
|
colored_indent_levels = true,
|
||||||
|
},
|
||||||
|
copilot_vim = true,
|
||||||
|
native_lsp = {
|
||||||
|
enabled = true,
|
||||||
|
virtual_text = {
|
||||||
|
errors = { "italic" },
|
||||||
|
hints = { "italic" },
|
||||||
|
warnings = { "italic" },
|
||||||
|
information = { "italic" },
|
||||||
|
ok = { "italic" },
|
||||||
|
},
|
||||||
|
underlines = {
|
||||||
|
errors = { "underline" },
|
||||||
|
hints = { "underline" },
|
||||||
|
warnings = { "underline" },
|
||||||
|
information = { "underline" },
|
||||||
|
ok = { "underline" },
|
||||||
|
},
|
||||||
|
inlay_hints = {
|
||||||
|
background = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notify = true,
|
||||||
|
treesitter = true,
|
||||||
|
rainbow_delimiters = true,
|
||||||
|
render_markdown = true,
|
||||||
|
telescope = {
|
||||||
|
enabled = true,
|
||||||
|
-- style = "nvchad"
|
||||||
|
},
|
||||||
|
which_key = true,
|
||||||
|
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,98 +8,121 @@ return {
|
|||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
adapters = {
|
adapters = {
|
||||||
copilot = function()
|
-- {{{ HTTP
|
||||||
return require("codecompanion.adapters").extend("copilot", {
|
http = {
|
||||||
schema = {
|
-- {{{ COPILOT
|
||||||
name = "copilot",
|
copilot = function()
|
||||||
opts = {
|
return require("codecompanion.adapters").extend("copilot", {
|
||||||
stream = true,
|
schema = {
|
||||||
tools = true,
|
name = "copilot",
|
||||||
vision = true,
|
opts = {
|
||||||
},
|
stream = true,
|
||||||
features = {
|
tools = true,
|
||||||
text = true,
|
vision = true,
|
||||||
tokens = true,
|
},
|
||||||
},
|
features = {
|
||||||
model = {
|
text = true,
|
||||||
-- default = "claude-3.7-sonnet-thought",
|
tokens = true,
|
||||||
-- default = "o3-mini",
|
},
|
||||||
-- default = "gemini-2.0-flash-001",
|
model = {
|
||||||
default = "gpt-4.1",
|
-- default = "claude-3.7-sonnet-thought",
|
||||||
-- default = "gpt-4o",
|
-- default = "o3-mini",
|
||||||
-- default = "o3-mini-2025-01-31",
|
-- default = "gemini-2.0-flash-001",
|
||||||
-- choices = {
|
default = "gpt-4.1",
|
||||||
-- ["o3-mini-2025-01-31"] = { opts = { can_reason = true } },
|
-- default = "gpt-4o",
|
||||||
-- ["o1-2024-12-17"] = { opts = { can_reason = true } },
|
-- default = "o3-mini-2025-01-31",
|
||||||
-- ["o1-mini-2024-09-12"] = { opts = { can_reason = true } },
|
-- choices = {
|
||||||
-- "gpt-4o-2024-08-06",
|
-- ["o3-mini-2025-01-31"] = { opts = { can_reason = true } },
|
||||||
-- "claude-3.7-sonnet-thought",
|
-- ["o1-2024-12-17"] = { opts = { can_reason = true } },
|
||||||
-- "claude-3.7-sonnet",
|
-- ["o1-mini-2024-09-12"] = { opts = { can_reason = true } },
|
||||||
-- "claude-3.5-sonnet",
|
-- "gpt-4o-2024-08-06",
|
||||||
-- "gemini-2.0-flash-001",
|
-- "claude-3.7-sonnet-thought",
|
||||||
|
-- "claude-3.7-sonnet",
|
||||||
|
-- "claude-3.5-sonnet",
|
||||||
|
-- "gemini-2.0-flash-001",
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
-- max_tokens = {
|
||||||
|
-- default = 65536,
|
||||||
-- },
|
-- },
|
||||||
},
|
},
|
||||||
-- max_tokens = {
|
})
|
||||||
-- default = 65536,
|
end,
|
||||||
-- },
|
-- }}}
|
||||||
},
|
-- {{{ LLAMA_CPP
|
||||||
})
|
llama_cpp = function()
|
||||||
end,
|
return require("codecompanion.adapters").extend("openai_compatible", {
|
||||||
llama_cpp = function()
|
name = "llama.cpp",
|
||||||
return require("codecompanion.adapters").extend("openai_compatible", {
|
formatted_name = "llama.cpp",
|
||||||
name = "llama.cpp",
|
opts = {
|
||||||
formatted_name = "llama.cpp",
|
stream = false,
|
||||||
opts = {
|
|
||||||
stream = false,
|
|
||||||
},
|
|
||||||
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,
|
|
||||||
},
|
},
|
||||||
},
|
schema = {
|
||||||
env = {
|
-- model = {
|
||||||
url = "http://localhost:8080",
|
-- default = "qwen2.5-coder-14b-instruct",
|
||||||
chat_url = "/v1/chat/completions",
|
-- 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"] = {
|
||||||
end,
|
-- opts = { can_reason = true },
|
||||||
openrouter = function()
|
-- },
|
||||||
return require("codecompanion.adapters").extend("openai_compatible", {
|
-- ["/models/lmstudio-community/Qwen2.5-7B-Instruct-1M-GGUF/Qwen2.5-7B-Instruct-1M-Q4_K_M.gguf"] = {
|
||||||
env = {
|
-- opts = { can_reason = true },
|
||||||
url = "https://openrouter.ai/api",
|
-- },
|
||||||
api_key = "cmd:cat $HOME/.openrouterapikey",
|
-- },
|
||||||
chat_url = "/v1/chat/completions",
|
-- },
|
||||||
},
|
temperature = {
|
||||||
schema = {
|
order = 2,
|
||||||
model = {
|
mapping = "parameters",
|
||||||
default = "google/gemini-2.5-pro-exp-03-25:free",
|
type = "number",
|
||||||
-- default = "deepseek/deepseek-chat-v3-0324:free",
|
optional = true,
|
||||||
-- default = "google/gemini-2.0-flash-thinking-exp:free",
|
default = 0.2,
|
||||||
-- default = "deepseek/deepseek-r1-distill-qwen-32b:free",
|
validate = function(n)
|
||||||
-- default = "qwen/qwen-2.5-coder-32b-instruct:free",
|
return n >= 0 and n <= 2, "Must be between 0 and 2"
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
env = {
|
||||||
})
|
url = "http://localhost:8080",
|
||||||
end,
|
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 = {
|
strategies = {
|
||||||
chat = {
|
chat = {
|
||||||
@@ -212,6 +235,7 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
require("plugins.codecompanion.fidget-spinner"):init()
|
require("utils.codecompanion.fidget-spinner"):init()
|
||||||
|
require("utils.codecompanion.extmarks").setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
|
cmd = "Copilot",
|
||||||
|
event = "InsertEnter",
|
||||||
opts = {
|
opts = {
|
||||||
panel = {
|
panel = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -49,7 +51,29 @@ return {
|
|||||||
listCount = 10, -- #completions for panel
|
listCount = 10, -- #completions for panel
|
||||||
inlineSuggestCount = 5, -- #completions for getCompletions
|
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,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
113
.config/nvim/lua/plugins/img-clip.lua
Normal file
113
.config/nvim/lua/plugins/img-clip.lua
Normal file
@@ -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 = "", ---@type string | fun(context: table): string
|
||||||
|
download_images = false, ---@type boolean | fun(): boolean
|
||||||
|
},
|
||||||
|
|
||||||
|
vimwiki = {
|
||||||
|
url_encode_path = true, ---@type boolean | fun(): boolean
|
||||||
|
template = "", ---@type string | fun(context: table): string
|
||||||
|
download_images = false, ---@type boolean | fun(): boolean
|
||||||
|
},
|
||||||
|
|
||||||
|
html = {
|
||||||
|
template = '<img src="$FILE_PATH" alt="$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],
|
||||||
|
) <fig-$LABEL>
|
||||||
|
]], ---@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
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -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,
|
|
||||||
}
|
|
||||||
@@ -1,63 +1,66 @@
|
|||||||
return {
|
return {
|
||||||
"echasnovski/mini.diff",
|
"echasnovski/mini.diff",
|
||||||
depends = { "echasnovski/mini.nvim" },
|
depends = { "echasnovski/mini.nvim" },
|
||||||
opts = {
|
config = function()
|
||||||
|
local diff = require("mini.diff")
|
||||||
|
diff.setup({
|
||||||
|
|
||||||
-- Options for how hunks are visualized
|
-- Options for how hunks are visualized
|
||||||
view = {
|
view = {
|
||||||
-- Visualization style. Possible values are 'sign' and 'number'.
|
-- Visualization style. Possible values are 'sign' and 'number'.
|
||||||
-- Default: 'number' if line numbers are enabled, 'sign' otherwise.
|
-- Default: 'number' if line numbers are enabled, 'sign' otherwise.
|
||||||
style = vim.go.number and "number" or "sign",
|
style = vim.go.number and "number" or "sign",
|
||||||
|
|
||||||
-- Signs used for hunks with 'sign' view
|
-- Signs used for hunks with 'sign' view
|
||||||
signs = { add = "▒", change = "▒", delete = "▒" },
|
signs = { add = "▒", change = "▒", delete = "▒" },
|
||||||
|
|
||||||
-- Priority of used visualization extmarks
|
-- Priority of used visualization extmarks
|
||||||
priority = 199,
|
priority = 199,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Source for how reference text is computed/updated/etc
|
-- Source for how reference text is computed/updated/etc
|
||||||
-- Uses content from Git index by default
|
-- Uses content from Git index by default
|
||||||
source = nil,
|
source = diff.gen_source.none(),
|
||||||
|
|
||||||
-- Delays (in ms) defining asynchronous processes
|
-- Delays (in ms) defining asynchronous processes
|
||||||
delay = {
|
delay = {
|
||||||
-- How much to wait before update following every text change
|
-- How much to wait before update following every text change
|
||||||
text_change = 200,
|
text_change = 200,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Module mappings. Use `''` (empty string) to disable one.
|
-- Module mappings. Use `''` (empty string) to disable one.
|
||||||
mappings = {
|
mappings = {
|
||||||
-- Apply hunks inside a visual/operator region
|
-- Apply hunks inside a visual/operator region
|
||||||
apply = "gh",
|
apply = "gh",
|
||||||
|
|
||||||
-- Reset hunks inside a visual/operator region
|
-- Reset hunks inside a visual/operator region
|
||||||
reset = "gH",
|
reset = "gH",
|
||||||
|
|
||||||
-- Hunk range textobject to be used inside operator
|
-- Hunk range textobject to be used inside operator
|
||||||
-- Works also in Visual mode if mapping differs from apply and reset
|
-- Works also in Visual mode if mapping differs from apply and reset
|
||||||
textobject = "gh",
|
textobject = "gh",
|
||||||
|
|
||||||
-- Go to hunk range in corresponding direction
|
-- Go to hunk range in corresponding direction
|
||||||
goto_first = "[H",
|
goto_first = "[H",
|
||||||
goto_prev = "[h",
|
goto_prev = "[h",
|
||||||
goto_next = "]h",
|
goto_next = "]h",
|
||||||
goto_last = "]H",
|
goto_last = "]H",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Various options
|
-- Various options
|
||||||
options = {
|
options = {
|
||||||
-- Diff algorithm. See `:h vim.diff()`.
|
-- Diff algorithm. See `:h vim.diff()`.
|
||||||
algorithm = "histogram",
|
algorithm = "histogram",
|
||||||
|
|
||||||
-- Whether to use "indent heuristic". See `:h vim.diff()`.
|
-- Whether to use "indent heuristic". See `:h vim.diff()`.
|
||||||
indent_heuristic = true,
|
indent_heuristic = true,
|
||||||
|
|
||||||
-- The amount of second-stage diff to align lines (in Neovim>=0.9)
|
-- The amount of second-stage diff to align lines (in Neovim>=0.9)
|
||||||
linematch = 60,
|
linematch = 60,
|
||||||
|
|
||||||
-- Whether to wrap around edges during hunk navigation
|
-- Whether to wrap around edges during hunk navigation
|
||||||
wrap_goto = false,
|
wrap_goto = false,
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ return {
|
|||||||
--- @type NoiceFormat|string
|
--- @type NoiceFormat|string
|
||||||
format_done = "lsp_progress_done",
|
format_done = "lsp_progress_done",
|
||||||
throttle = 1000 / 30, -- frequency to update lsp progress message
|
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 markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
override = {
|
override = {
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ return {
|
|||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp_signature_help", group_index = 0 },
|
{ name = "nvim_lsp_signature_help", group_index = 0 },
|
||||||
{ name = "lazydev", group_index = 0 },
|
{ name = "lazydev", group_index = 0 },
|
||||||
|
{ name = "copilot", group_index = 0 },
|
||||||
{ name = "nvim_lsp", group_index = 1 },
|
{ name = "nvim_lsp", group_index = 1 },
|
||||||
{ name = "copilot", group_index = 1 },
|
|
||||||
{ name = "codecompanion", group_index = 2 },
|
{ name = "codecompanion", group_index = 2 },
|
||||||
{ name = "async_path", group_index = 2 },
|
{ name = "async_path", group_index = 2 },
|
||||||
{ name = "nvim_lsp_document_symbol", group_index = 2 },
|
{ name = "nvim_lsp_document_symbol", group_index = 2 },
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ return {
|
|||||||
vim = { "vint" },
|
vim = { "vint" },
|
||||||
go = { "golangcilint" },
|
go = { "golangcilint" },
|
||||||
}
|
}
|
||||||
|
lint.linters.jsonlint.cmd = "vscode-json-language-server"
|
||||||
lint.linters.shellcheck.args = {
|
lint.linters.shellcheck.args = {
|
||||||
"-s",
|
"-s",
|
||||||
"bash",
|
"bash",
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ return {
|
|||||||
---@module 'render-markdown'
|
---@module 'render-markdown'
|
||||||
---@type render.md.UserConfig
|
---@type render.md.UserConfig
|
||||||
opts = {
|
opts = {
|
||||||
|
completions = {
|
||||||
|
lsp = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
injections = {
|
injections = {
|
||||||
gitcommit = {
|
gitcommit = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|||||||
94
.config/nvim/lua/utils/codecompanion/extmarks.lua
Normal file
94
.config/nvim/lua/utils/codecompanion/extmarks.lua
Normal file
@@ -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
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = false }
|
||||||
|
|
||||||
--- Set keybindings from a table of mappings.
|
--- Set keybindings from a table of mappings.
|
||||||
--- @param bindings table A list of keybinding mappings.
|
--- @param bindings table A list of keybinding mappings.
|
||||||
|
|||||||
82
.config/nvim/lua/utils/ruff.toml
Normal file
82
.config/nvim/lua/utils/ruff.toml
Normal file
@@ -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
|
||||||
@@ -3,6 +3,30 @@ local telescopeConfig = require("telescope.config")
|
|||||||
|
|
||||||
local M = {}
|
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", "<CR>", embed_image)
|
||||||
|
map("n", "<CR>", embed_image)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
-- Clone the default Telescope configuration
|
-- Clone the default Telescope configuration
|
||||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||||||
|
|||||||
Reference in New Issue
Block a user