update
This commit is contained in:
@@ -7,3 +7,45 @@ local map = LazyVim.safe_keymap_set
|
||||
map("n", "q", "<cmd>bd<cr>", { desc = "Quit one" })
|
||||
map("n", "Q", "<cmd>qa<cr>", { desc = "Quit All" })
|
||||
map("n", "<F2>", ":Neotree toggle<cr>", { desc = "toggle neotree" })
|
||||
|
||||
-- 自定义复制:文件名 + 行号范围 + 内容
|
||||
-- 用法:yp(当前行),2yp(当前行及以下共2行)
|
||||
_G.copy_lines_with_location = function()
|
||||
local ok, err = pcall(function()
|
||||
local count = vim.v.count1
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local filepath = vim.api.nvim_buf_get_name(bufnr)
|
||||
local relative_path = vim.fn.fnamemodify(filepath, ":.")
|
||||
if relative_path == "" then
|
||||
relative_path = "[No Name]"
|
||||
end
|
||||
|
||||
local start_line = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local end_line = start_line + count - 1
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, start_line - 1, end_line, false)
|
||||
|
||||
local range_str
|
||||
if count == 1 then
|
||||
range_str = tostring(start_line)
|
||||
else
|
||||
range_str = string.format("%d-%d", start_line, end_line)
|
||||
end
|
||||
|
||||
local parts = { string.format("%s:%s:", relative_path, range_str) }
|
||||
for i, line in ipairs(lines) do
|
||||
table.insert(parts, string.format(" %d: %s", start_line + i - 1, line))
|
||||
end
|
||||
local result = table.concat(parts, "\n")
|
||||
|
||||
vim.fn.setreg("+", result)
|
||||
vim.fn.setreg('"', result)
|
||||
vim.notify("Copied " .. #lines .. " line(s)", vim.log.levels.INFO)
|
||||
end)
|
||||
if not ok then
|
||||
vim.notify("copy_lines_with_location error: " .. tostring(err), vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
local copy_lines_with_location = _G.copy_lines_with_location
|
||||
|
||||
map("n", "<leader>yy", copy_lines_with_location, { desc = "Copy line(s) with location" })
|
||||
|
||||
|
||||
+29
-1
@@ -7,7 +7,35 @@
|
||||
--
|
||||
|
||||
return {
|
||||
{ "github/copilot.vim" },
|
||||
-- { "github/copilot.vim" },
|
||||
{
|
||||
"kkrampis/codex.nvim",
|
||||
lazy = true,
|
||||
cmd = { "Codex", "CodexToggle" }, -- Optional: Load only on command execution
|
||||
keys = {
|
||||
{
|
||||
"<leader>xc", -- Change this to your preferred keybinding
|
||||
function()
|
||||
require("codex").toggle()
|
||||
end,
|
||||
desc = "Toggle Codex popup or side-panel",
|
||||
mode = { "n", "t" },
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
cmd = { "bash", "-c", "http_proxy=http://127.0.0.1:7897 https_proxy=http://127.0.0.1:7897 codex" },
|
||||
keymaps = {
|
||||
toggle = nil, -- Keybind to toggle Codex window (Disabled by default, watch out for conflicts)
|
||||
quit = "<C-q>", -- Keybind to close the Codex window (default: Ctrl + q)
|
||||
}, -- Disable internal default keymap (<leader>cc -> :CodexToggle)
|
||||
border = "rounded", -- Options: 'single', 'double', or 'rounded'
|
||||
width = 0.8, -- Width of the floating window (0.0 to 1.0)
|
||||
height = 0.8, -- Height of the floating window (0.0 to 1.0)
|
||||
model = nil, -- Optional: pass a string to use a specific model (e.g., 'o3-mini')
|
||||
panel = false, -- Open Codex in a side-panel (vertical split) instead of floating window
|
||||
use_buffer = false, -- Capture Codex stdout into a normal buffer instead of a terminal buffer
|
||||
},
|
||||
},
|
||||
{
|
||||
"coder/claudecode.nvim",
|
||||
opts = {},
|
||||
|
||||
Reference in New Issue
Block a user